From 85eba58158a8a1278007bccb5d4895b811350db2 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Wed, 26 Jul 2023 15:30:59 +0900 Subject: [PATCH] shared: Remove unused get_command() and unnecessary include Change-Id: I6e81fb4a969793c87c71f45dab42fea9caecfc90 Signed-off-by: Youngjae Cho --- src/shared/common.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/shared/common.c b/src/shared/common.c index d8cac72..3b49bd8 100644 --- a/src/shared/common.c +++ b/src/shared/common.c @@ -18,26 +18,17 @@ #include #include -#include #include #include #include -#include #include -#include #include -#include #include -#include #include -#include #include -#include #include "log.h" #include "common.h" -#define BUFF_MAX 255 - int get_systemd_reboot_param(char *buf, unsigned bufsize) { int r = sys_read_buf("/run/systemd/reboot-param", buf, bufsize); @@ -81,38 +72,3 @@ int do_mkdir(const char *path, mode_t mode) return 0; } -int get_command(pid_t pid, char *comm, size_t len) -{ - FILE *fp; - char path[PATH_MAX]; - char name[NAME_MAX]; - char *tmp; - int ret; - - snprintf(path, sizeof(path), "/proc/%d/comm", pid); - - fp = fopen(path, "r"); - if (!fp) { - _E("Failed to open file %s, errno:%d", path, errno); - return -errno; - } - - ret = fread(name, 1, sizeof(name) - 1, fp); - name[ret] = '\0'; - fclose(fp); - - tmp = name; - while (*tmp != '\0') { - if (*tmp == '\n' || - *tmp == '\r') { - *tmp = '\0'; - break; - } - tmp++; - } - - snprintf(comm, len, "%s", name); - - return 0; -} - -- 2.7.4