aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-03-23 12:27:16 +0000
committerRon Yorston <rmy@pobox.com>2014-03-23 12:27:16 +0000
commitf29d074c6d17cddbc80bf5da924e8bbb43cfe507 (patch)
tree92fe1a01050f2a4055acfc421da95422cca4b269
parent57a39c29392cec65c963f37a159d04f90277aad7 (diff)
downloadbusybox-w32-f29d074c6d17cddbc80bf5da924e8bbb43cfe507.tar.gz
busybox-w32-f29d074c6d17cddbc80bf5da924e8bbb43cfe507.tar.bz2
busybox-w32-f29d074c6d17cddbc80bf5da924e8bbb43cfe507.zip
ps: exclude more unused code
-rw-r--r--include/libbb.h4
-rw-r--r--libbb/procps.c4
-rw-r--r--procps/ps.c6
3 files changed, 12 insertions, 2 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 1cc2a48b9..3b2bf0a0a 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1633,7 +1633,11 @@ void free_procps_scan(procps_status_t* sp) FAST_FUNC;
1633procps_status_t* procps_scan(procps_status_t* sp, int flags) FAST_FUNC; 1633procps_status_t* procps_scan(procps_status_t* sp, int flags) FAST_FUNC;
1634/* Format cmdline (up to col chars) into char buf[size] */ 1634/* Format cmdline (up to col chars) into char buf[size] */
1635/* Puts [comm] if cmdline is empty (-> process is a kernel thread) */ 1635/* Puts [comm] if cmdline is empty (-> process is a kernel thread) */
1636#if !ENABLE_PLATFORM_MINGW32
1636void read_cmdline(char *buf, int size, unsigned pid, const char *comm) FAST_FUNC; 1637void read_cmdline(char *buf, int size, unsigned pid, const char *comm) FAST_FUNC;
1638#else
1639#define read_cmdline(buf, size, pid, comm) snprintf(buf, size, "[%s]", comm)
1640#endif
1637pid_t *find_pid_by_name(const char* procName) FAST_FUNC; 1641pid_t *find_pid_by_name(const char* procName) FAST_FUNC;
1638pid_t *pidlist_reverse(pid_t *pidList) FAST_FUNC; 1642pid_t *pidlist_reverse(pid_t *pidList) FAST_FUNC;
1639int starts_with_cpu(const char *str) FAST_FUNC; 1643int starts_with_cpu(const char *str) FAST_FUNC;
diff --git a/libbb/procps.c b/libbb/procps.c
index e2f54d730..3c99ac6e7 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -570,8 +570,6 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
570 return sp; 570 return sp;
571} 571}
572 572
573#endif /* ENABLE_PLATFORM_MINGW32 */
574
575void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) 573void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
576{ 574{
577 int sz; 575 int sz;
@@ -623,6 +621,8 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
623 } 621 }
624} 622}
625 623
624#endif /* ENABLE_PLATFORM_MINGW32 */
625
626/* from kernel: 626/* from kernel:
627 // pid comm S ppid pgid sid tty_nr tty_pgrp flg 627 // pid comm S ppid pgid sid tty_nr tty_pgrp flg
628 sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ 628 sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
diff --git a/procps/ps.c b/procps/ps.c
index 32563776d..9fca3524e 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -240,6 +240,7 @@ static unsigned get_kernel_HZ(void)
240 240
241/* Print value to buf, max size+1 chars (including trailing '\0') */ 241/* Print value to buf, max size+1 chars (including trailing '\0') */
242 242
243#if !ENABLE_PLATFORM_MINGW32
243static void func_user(char *buf, int size, const procps_status_t *ps) 244static void func_user(char *buf, int size, const procps_status_t *ps)
244{ 245{
245#if 1 246#if 1
@@ -263,12 +264,14 @@ static void func_group(char *buf, int size, const procps_status_t *ps)
263{ 264{
264 safe_strncpy(buf, get_cached_groupname(ps->gid), size+1); 265 safe_strncpy(buf, get_cached_groupname(ps->gid), size+1);
265} 266}
267#endif
266 268
267static void func_comm(char *buf, int size, const procps_status_t *ps) 269static void func_comm(char *buf, int size, const procps_status_t *ps)
268{ 270{
269 safe_strncpy(buf, ps->comm, size+1); 271 safe_strncpy(buf, ps->comm, size+1);
270} 272}
271 273
274#if !ENABLE_PLATFORM_MINGW32
272static void func_state(char *buf, int size, const procps_status_t *ps) 275static void func_state(char *buf, int size, const procps_status_t *ps)
273{ 276{
274 safe_strncpy(buf, ps->state, size+1); 277 safe_strncpy(buf, ps->state, size+1);
@@ -278,12 +281,14 @@ static void func_args(char *buf, int size, const procps_status_t *ps)
278{ 281{
279 read_cmdline(buf, size+1, ps->pid, ps->comm); 282 read_cmdline(buf, size+1, ps->pid, ps->comm);
280} 283}
284#endif
281 285
282static void func_pid(char *buf, int size, const procps_status_t *ps) 286static void func_pid(char *buf, int size, const procps_status_t *ps)
283{ 287{
284 sprintf(buf, "%*u", size, ps->pid); 288 sprintf(buf, "%*u", size, ps->pid);
285} 289}
286 290
291#if !ENABLE_PLATFORM_MINGW32
287static void func_ppid(char *buf, int size, const procps_status_t *ps) 292static void func_ppid(char *buf, int size, const procps_status_t *ps)
288{ 293{
289 sprintf(buf, "%*u", size, ps->ppid); 294 sprintf(buf, "%*u", size, ps->ppid);
@@ -320,6 +325,7 @@ static void func_tty(char *buf, int size, const procps_status_t *ps)
320 if (ps->tty_major) /* tty field of "0" means "no tty" */ 325 if (ps->tty_major) /* tty field of "0" means "no tty" */
321 snprintf(buf, size+1, "%u,%u", ps->tty_major, ps->tty_minor); 326 snprintf(buf, size+1, "%u,%u", ps->tty_major, ps->tty_minor);
322} 327}
328#endif
323 329
324#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS 330#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS
325 331