summaryrefslogtreecommitdiff
path: root/package/busybox/patches/008-ps.patch
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-11-28 17:25:50 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2010-11-28 17:25:50 +0100
commita2cb1b3951d0e9b5e2c16ce6e871e7ef7056c951 (patch)
treec84b35bb1a5ad70cf82053143776e5dc47860a2d /package/busybox/patches/008-ps.patch
parent834241eb737720ba7ec1a15f81bc29ace5fdb12c (diff)
parent10a4e449eebc151f3bc7774433a53ee1a44c9919 (diff)
Merge branch 'master' of git+ssh://openadk.org/git/openadk
Diffstat (limited to 'package/busybox/patches/008-ps.patch')
-rw-r--r--package/busybox/patches/008-ps.patch110
1 files changed, 110 insertions, 0 deletions
diff --git a/package/busybox/patches/008-ps.patch b/package/busybox/patches/008-ps.patch
new file mode 100644
index 000000000..7e9e2dd70
--- /dev/null
+++ b/package/busybox/patches/008-ps.patch
@@ -0,0 +1,110 @@
+--- busybox-1.17.2.orig/procps/ps.c 2010-08-23 02:44:35.000000000 +0200
++++ busybox-1.17.2/procps/ps.c 2010-11-27 23:47:59.000000000 +0100
+@@ -14,8 +14,6 @@
+ /* Absolute maximum on output line length */
+ enum { MAX_WIDTH = 2*1024 };
+
+-#if ENABLE_DESKTOP
+-
+ #include <sys/times.h> /* for times() */
+ #ifndef AT_CLKTCK
+ #define AT_CLKTCK 17
+@@ -544,98 +542,3 @@ int ps_main(int argc UNUSED_PARAM, char
+
+ return EXIT_SUCCESS;
+ }
+-
+-
+-#else /* !ENABLE_DESKTOP */
+-
+-
+-int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+-int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
+-{
+- procps_status_t *p;
+- int psscan_flags = PSSCAN_PID | PSSCAN_UIDGID
+- | PSSCAN_STATE | PSSCAN_VSZ | PSSCAN_COMM;
+- unsigned terminal_width IF_NOT_FEATURE_PS_WIDE(= 79);
+- enum {
+- OPT_Z = (1 << 0) * ENABLE_SELINUX,
+- OPT_T = (1 << ENABLE_SELINUX) * ENABLE_FEATURE_SHOW_THREADS,
+- };
+- int opts = 0;
+- /* If we support any options, parse argv */
+-#if ENABLE_SELINUX || ENABLE_FEATURE_SHOW_THREADS || ENABLE_FEATURE_PS_WIDE
+-# if ENABLE_FEATURE_PS_WIDE
+- /* -w is a bit complicated */
+- int w_count = 0;
+- opt_complementary = "-:ww";
+- opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")"w", &w_count);
+- /* if w is given once, GNU ps sets the width to 132,
+- * if w is given more than once, it is "unlimited"
+- */
+- if (w_count) {
+- terminal_width = (w_count == 1) ? 132 : MAX_WIDTH;
+- } else {
+- get_terminal_width_height(0, &terminal_width, NULL);
+- /* Go one less... */
+- if (--terminal_width > MAX_WIDTH)
+- terminal_width = MAX_WIDTH;
+- }
+-# else
+- /* -w is not supported, only -Z and/or -T */
+- opt_complementary = "-";
+- opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T"));
+-# endif
+-#endif
+-
+-#if ENABLE_SELINUX
+- if ((opts & OPT_Z) && is_selinux_enabled()) {
+- psscan_flags = PSSCAN_PID | PSSCAN_CONTEXT
+- | PSSCAN_STATE | PSSCAN_COMM;
+- puts(" PID CONTEXT STAT COMMAND");
+- } else
+-#endif
+- {
+- puts(" PID USER VSZ STAT COMMAND");
+- }
+- if (opts & OPT_T) {
+- psscan_flags |= PSSCAN_TASKS;
+- }
+-
+- p = NULL;
+- while ((p = procps_scan(p, psscan_flags)) != NULL) {
+- int len;
+-#if ENABLE_SELINUX
+- if (psscan_flags & PSSCAN_CONTEXT) {
+- len = printf("%5u %-32.32s %s ",
+- p->pid,
+- p->context ? p->context : "unknown",
+- p->state);
+- } else
+-#endif
+- {
+- const char *user = get_cached_username(p->uid);
+- //if (p->vsz == 0)
+- // len = printf("%5u %-8.8s %s ",
+- // p->pid, user, p->state);
+- //else
+- {
+- char buf6[6];
+- smart_ulltoa5(p->vsz, buf6, " mgtpezy");
+- buf6[5] = '\0';
+- len = printf("%5u %-8.8s %s %s ",
+- p->pid, user, buf6, p->state);
+- }
+- }
+-
+- {
+- int sz = terminal_width - len;
+- char buf[sz + 1];
+- read_cmdline(buf, sz, p->pid, p->comm);
+- puts(buf);
+- }
+- }
+- if (ENABLE_FEATURE_CLEAN_UP)
+- clear_username_cache();
+- return EXIT_SUCCESS;
+-}
+-
+-#endif /* !ENABLE_DESKTOP */