Magellan Linux

Contents of /trunk/busybox/patches/busybox-1.19.0-top.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1519 - (show annotations) (download)
Mon Sep 5 21:52:12 2011 UTC (12 years, 8 months ago) by niro
File size: 2093 byte(s)
-added upstream patches
1 --- busybox-1.19.0/libbb/procps.c
2 +++ busybox-1.19.0-top/libbb/procps.c
3 @@ -284,27 +284,25 @@ int FAST_FUNC procps_read_smaps(pid_t pi
4 void BUG_comm_size(void);
5 procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
6 {
7 - struct dirent *entry;
8 - char buf[PROCPS_BUFSIZE];
9 - char filename[sizeof("/proc//cmdline") + sizeof(int)*3];
10 - char *filename_tail;
11 - long tasknice;
12 - unsigned pid;
13 - int n;
14 - struct stat sb;
15 -
16 if (!sp)
17 sp = alloc_procps_scan();
18
19 for (;;) {
20 + struct dirent *entry;
21 + char buf[PROCPS_BUFSIZE];
22 + long tasknice;
23 + unsigned pid;
24 + int n;
25 + char filename[sizeof("/proc/%u/task/%u/cmdline") + sizeof(int)*3 * 2];
26 + char *filename_tail;
27 +
28 #if ENABLE_FEATURE_SHOW_THREADS
29 - if ((flags & PSSCAN_TASKS) && sp->task_dir) {
30 + if (sp->task_dir) {
31 entry = readdir(sp->task_dir);
32 if (entry)
33 goto got_entry;
34 closedir(sp->task_dir);
35 sp->task_dir = NULL;
36 - sp->main_thread_pid = 0;
37 }
38 #endif
39 entry = readdir(sp->dir);
40 @@ -321,9 +319,9 @@ procps_status_t* FAST_FUNC procps_scan(p
41 /* We found another /proc/PID. Do not use it,
42 * there will be /proc/PID/task/PID (same PID!),
43 * so just go ahead and dive into /proc/PID/task. */
44 - char task_dir[sizeof("/proc/%u/task") + sizeof(int)*3];
45 - sprintf(task_dir, "/proc/%u/task", pid);
46 - sp->task_dir = xopendir(task_dir);
47 + sprintf(filename, "/proc/%u/task", pid);
48 + /* Note: if opendir fails, we just go to next /proc/XXX */
49 + sp->task_dir = opendir(filename);
50 sp->main_thread_pid = pid;
51 continue;
52 }
53 @@ -347,9 +345,15 @@ procps_status_t* FAST_FUNC procps_scan(p
54 }
55 #endif
56
57 - filename_tail = filename + sprintf(filename, "/proc/%u/", pid);
58 +#if ENABLE_FEATURE_SHOW_THREADS
59 + if (sp->task_dir)
60 + filename_tail = filename + sprintf(filename, "/proc/%u/task/%u/", sp->main_thread_pid, pid);
61 + else
62 +#endif
63 + filename_tail = filename + sprintf(filename, "/proc/%u/", pid);
64
65 if (flags & PSSCAN_UIDGID) {
66 + struct stat sb;
67 if (stat(filename, &sb))
68 continue; /* process probably exited */
69 /* Effective UID/GID, not real */