1 --- busybox-1.15.3-org/include/libbb.h 2010-04-23 16:11:13.000000000 +0200
2 +++ busybox-1.15.3/include/libbb.h 2010-04-23 15:07:04.000000000 +0200
5 uint8_t shift_pages_to_bytes;
6 uint8_t shift_pages_to_kb;
9 /* Fields are set to 0/NULL if failed to determine (or not requested) */
12 --- busybox-1.15.3-org/libbb/procps.c 2010-04-23 16:11:13.000000000 +0200
13 +++ busybox-1.15.3/libbb/procps.c 2010-04-23 16:06:55.000000000 +0200
17 char buf[PROCPS_BUFSIZE];
18 - char filename[sizeof("/proc//cmdline") + sizeof(int)*3];
19 + char filename[sizeof("/proc//task//cmdline//") + sizeof(int)*6];
25 sp = alloc_procps_scan();
28 - entry = readdir(sp->dir);
29 - if (entry == NULL) {
30 - free_procps_scan(sp);
35 + entry = readdir(sp->taskdir);
37 + closedir(sp->taskdir);
41 pid = bb_strtou(entry->d_name, NULL, 10);
47 - filename_tail = filename + sprintf(filename, "/proc/%u/", pid);
48 + filename_tail = filename + sprintf(filename, "/proc/%u/task/%u/", sp->parentpid, pid);
50 if (flags & PSSCAN_UIDGID) {
51 if (stat(filename, &sb))
60 + entry = readdir(sp->dir);
61 + if (entry == NULL) {
62 + free_procps_scan(sp);
65 + pid = bb_strtou(entry->d_name, NULL, 10);
69 + filename_tail = filename + sprintf(filename, "/proc/%u/", pid);
72 + strcpy(filename_tail, "task");
73 + sp->taskdir = opendir(filename);
75 + // ignore processes without taskdir
78 + sp->parentpid = pid;
79 + return procps_scan(sp, flags);