From: Youngjae Cho Date: Wed, 26 Jul 2023 06:30:59 +0000 (+0900) Subject: shared: Remove unused get_command() and unnecessary include X-Git-Tag: accepted/tizen/unified/20230731.175310~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F296362%2F2;p=platform%2Fcore%2Fsystem%2Fdeviced.git shared: Remove unused get_command() and unnecessary include Change-Id: I6e81fb4a969793c87c71f45dab42fea9caecfc90 Signed-off-by: Youngjae Cho --- 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; -} -