+static int proc_get_data(char *path, char *buf, int len)
+{
+ _cleanup_close_ int fd = -1;
+ int ret;
+
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ return STC_ERROR_FAIL;
+
+ ret = read(fd, buf, len-1);
+ if (ret < 0) {
+ buf[0] = '\0';
+ return STC_ERROR_FAIL;
+ }
+ buf[ret] = '\0';
+ return STC_ERROR_NONE;
+}
+
+int proc_get_raw_cmdline(pid_t pid, char *buf, int len)
+{
+ char path[PROC_BUF_MAX];
+ snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
+ return proc_get_data(path, buf, len);
+}
+