fixed
This commit is contained in:
parent
1b9dc6d7dc
commit
0737916f1a
11 changed files with 71 additions and 35 deletions
|
@ -44,10 +44,7 @@ int mu_proc_status(const char *prog_name, const pid_t pid, struct mu_proc *proc_
|
|||
val++;
|
||||
|
||||
/* Write values */
|
||||
if (!strncmp(token, "Name", 4))
|
||||
strcpy(proc_s->prog, val);
|
||||
|
||||
else if (!strncmp(token, "Uid", 3))
|
||||
if (!strncmp(token, "Uid", 3))
|
||||
proc_s->uid = strtoul(val, 0L, 10);
|
||||
|
||||
else if (!strncmp(token, "Gid", 3))
|
||||
|
@ -78,6 +75,11 @@ int mu_proc_stat(const char *prog_name, const pid_t pid, struct mu_proc *proc_s)
|
|||
fscanf(fp, "%ld %ld %ld %ld %ld %ld %llu %lu %ld", &proc_s->cutime, &proc_s->cstime, &proc_s->priority, &proc_s->nice, &proc_s->num_threads, &proc_s->itrealvalue, &proc_s->starttime, &proc_s->vsize, &proc_s->rss);
|
||||
fclose(fp);
|
||||
|
||||
/* Remove ( and ) from string */
|
||||
size_t len = strlen(proc_s->cmdline) - 1;
|
||||
proc_s->cmdline[len] = '\0';
|
||||
|
||||
memmove(proc_s->cmdline, proc_s->cmdline + 1, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue