shared: Remove unused get_command() and unnecessary include 62/296362/2
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 26 Jul 2023 06:30:59 +0000 (15:30 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Fri, 28 Jul 2023 00:12:52 +0000 (09:12 +0900)
Change-Id: I6e81fb4a969793c87c71f45dab42fea9caecfc90
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/shared/common.c

index d8cac72..3b49bd8 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdbool.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <time.h>
 #include <assert.h>
-#include <sys/time.h>
 #include <fcntl.h>
-#include <signal.h>
 #include <dirent.h>
-#include <ctype.h>
 #include <string.h>
-#include <stdarg.h>
 #include <errno.h>
-#include <poll.h>
 #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;
-}
-