diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/iostat.c | 2 | ||||
-rw-r--r-- | procps/mpstat.c | 2 | ||||
-rw-r--r-- | procps/ps.c | 16 | ||||
-rw-r--r-- | procps/smemcap.c | 1 |
4 files changed, 19 insertions, 2 deletions
diff --git a/procps/iostat.c b/procps/iostat.c index 608d41364..6a39c324f 100644 --- a/procps/iostat.c +++ b/procps/iostat.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #if 1 | 29 | #if 1 |
30 | typedef unsigned long long cputime_t; | 30 | typedef unsigned long long cputime_t; |
31 | typedef long long icputime_t; | 31 | typedef long long icputime_t; |
32 | # define FMT_DATA "ll" | 32 | # define FMT_DATA LL_FMT |
33 | # define CPUTIME_MAX (~0ULL) | 33 | # define CPUTIME_MAX (~0ULL) |
34 | #else | 34 | #else |
35 | typedef unsigned long cputime_t; | 35 | typedef unsigned long cputime_t; |
diff --git a/procps/mpstat.c b/procps/mpstat.c index 1eabd8e38..05a3f3ff3 100644 --- a/procps/mpstat.c +++ b/procps/mpstat.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #if 1 | 49 | #if 1 |
50 | typedef unsigned long long data_t; | 50 | typedef unsigned long long data_t; |
51 | typedef long long idata_t; | 51 | typedef long long idata_t; |
52 | #define FMT_DATA "ll" | 52 | #define FMT_DATA LL_FMT |
53 | #define DATA_MAX ULLONG_MAX | 53 | #define DATA_MAX ULLONG_MAX |
54 | #else | 54 | #else |
55 | typedef unsigned long data_t; | 55 | typedef unsigned long data_t; |
diff --git a/procps/ps.c b/procps/ps.c index eb1946d27..3e83a3e03 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -286,6 +286,7 @@ static unsigned get_kernel_HZ(void) | |||
286 | 286 | ||
287 | /* Print value to buf, max size+1 chars (including trailing '\0') */ | 287 | /* Print value to buf, max size+1 chars (including trailing '\0') */ |
288 | 288 | ||
289 | #if !ENABLE_PLATFORM_MINGW32 | ||
289 | static void func_user(char *buf, int size, const procps_status_t *ps) | 290 | static void func_user(char *buf, int size, const procps_status_t *ps) |
290 | { | 291 | { |
291 | #if 1 | 292 | #if 1 |
@@ -309,12 +310,14 @@ static void func_group(char *buf, int size, const procps_status_t *ps) | |||
309 | { | 310 | { |
310 | safe_strncpy(buf, get_cached_groupname(ps->gid), size+1); | 311 | safe_strncpy(buf, get_cached_groupname(ps->gid), size+1); |
311 | } | 312 | } |
313 | #endif | ||
312 | 314 | ||
313 | static void func_comm(char *buf, int size, const procps_status_t *ps) | 315 | static void func_comm(char *buf, int size, const procps_status_t *ps) |
314 | { | 316 | { |
315 | safe_strncpy(buf, ps->comm, size+1); | 317 | safe_strncpy(buf, ps->comm, size+1); |
316 | } | 318 | } |
317 | 319 | ||
320 | #if !ENABLE_PLATFORM_MINGW32 | ||
318 | static void func_state(char *buf, int size, const procps_status_t *ps) | 321 | static void func_state(char *buf, int size, const procps_status_t *ps) |
319 | { | 322 | { |
320 | safe_strncpy(buf, ps->state, size+1); | 323 | safe_strncpy(buf, ps->state, size+1); |
@@ -324,12 +327,14 @@ static void func_args(char *buf, int size, const procps_status_t *ps) | |||
324 | { | 327 | { |
325 | read_cmdline(buf, size+1, ps->pid, ps->comm); | 328 | read_cmdline(buf, size+1, ps->pid, ps->comm); |
326 | } | 329 | } |
330 | #endif | ||
327 | 331 | ||
328 | static void func_pid(char *buf, int size, const procps_status_t *ps) | 332 | static void func_pid(char *buf, int size, const procps_status_t *ps) |
329 | { | 333 | { |
330 | sprintf(buf, "%*u", size, ps->pid); | 334 | sprintf(buf, "%*u", size, ps->pid); |
331 | } | 335 | } |
332 | 336 | ||
337 | #if !ENABLE_PLATFORM_MINGW32 | ||
333 | static void func_ppid(char *buf, int size, const procps_status_t *ps) | 338 | static void func_ppid(char *buf, int size, const procps_status_t *ps) |
334 | { | 339 | { |
335 | sprintf(buf, "%*u", size, ps->ppid); | 340 | sprintf(buf, "%*u", size, ps->ppid); |
@@ -371,6 +376,7 @@ static void func_tty(char *buf, int size, const procps_status_t *ps) | |||
371 | if (ps->tty_major) /* tty field of "0" means "no tty" */ | 376 | if (ps->tty_major) /* tty field of "0" means "no tty" */ |
372 | snprintf(buf, size+1, "%u,%u", ps->tty_major, ps->tty_minor); | 377 | snprintf(buf, size+1, "%u,%u", ps->tty_major, ps->tty_minor); |
373 | } | 378 | } |
379 | #endif | ||
374 | 380 | ||
375 | #if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS | 381 | #if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS |
376 | 382 | ||
@@ -436,13 +442,19 @@ static void func_pcpu(char *buf, int size, const procps_status_t *ps) | |||
436 | 442 | ||
437 | static const ps_out_t out_spec[] = { | 443 | static const ps_out_t out_spec[] = { |
438 | /* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */ | 444 | /* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */ |
445 | #if !ENABLE_PLATFORM_MINGW32 | ||
439 | { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, | 446 | { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, |
440 | { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, | 447 | { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, |
448 | #endif | ||
441 | { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM }, | 449 | { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM }, |
450 | #if !ENABLE_PLATFORM_MINGW32 | ||
442 | { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, | 451 | { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, |
452 | #endif | ||
443 | { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, | 453 | { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, |
454 | #if !ENABLE_PLATFORM_MINGW32 | ||
444 | { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, | 455 | { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, |
445 | { 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID }, | 456 | { 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID }, |
457 | #endif | ||
446 | #if ENABLE_FEATURE_PS_TIME | 458 | #if ENABLE_FEATURE_PS_TIME |
447 | { sizeof("ELAPSED")-1, "etime" ,"ELAPSED",func_etime ,PSSCAN_START_TIME }, | 459 | { sizeof("ELAPSED")-1, "etime" ,"ELAPSED",func_etime ,PSSCAN_START_TIME }, |
448 | #endif | 460 | #endif |
@@ -455,12 +467,14 @@ static const ps_out_t out_spec[] = { | |||
455 | #if ENABLE_FEATURE_PS_TIME | 467 | #if ENABLE_FEATURE_PS_TIME |
456 | { 6 , "time" ,"TIME" ,func_time ,PSSCAN_STIME | PSSCAN_UTIME }, | 468 | { 6 , "time" ,"TIME" ,func_time ,PSSCAN_STIME | PSSCAN_UTIME }, |
457 | #endif | 469 | #endif |
470 | #if !ENABLE_PLATFORM_MINGW32 | ||
458 | { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY }, | 471 | { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY }, |
459 | { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ }, | 472 | { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ }, |
460 | /* Not mandated, but useful: */ | 473 | /* Not mandated, but useful: */ |
461 | { 5 , "sid" ,"SID" ,func_sid ,PSSCAN_SID }, | 474 | { 5 , "sid" ,"SID" ,func_sid ,PSSCAN_SID }, |
462 | { 4 , "stat" ,"STAT" ,func_state ,PSSCAN_STATE }, | 475 | { 4 , "stat" ,"STAT" ,func_state ,PSSCAN_STATE }, |
463 | { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS }, | 476 | { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS }, |
477 | #endif | ||
464 | #if ENABLE_SELINUX | 478 | #if ENABLE_SELINUX |
465 | { 35 , "label" ,"LABEL" ,func_label ,PSSCAN_CONTEXT }, | 479 | { 35 , "label" ,"LABEL" ,func_label ,PSSCAN_CONTEXT }, |
466 | #endif | 480 | #endif |
@@ -599,6 +613,8 @@ static void format_process(const procps_status_t *ps) | |||
599 | #if ENABLE_SELINUX | 613 | #if ENABLE_SELINUX |
600 | # define SELINUX_O_PREFIX "label," | 614 | # define SELINUX_O_PREFIX "label," |
601 | # define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") | 615 | # define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") |
616 | #elif ENABLE_PLATFORM_MINGW32 | ||
617 | # define DEFAULT_O_STR ("pid,comm") | ||
602 | #else | 618 | #else |
603 | # define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") | 619 | # define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") |
604 | #endif | 620 | #endif |
diff --git a/procps/smemcap.c b/procps/smemcap.c index c15fef1c3..17aeccd53 100644 --- a/procps/smemcap.c +++ b/procps/smemcap.c | |||
@@ -20,6 +20,7 @@ | |||
20 | //config: a memory usage statistic tool. | 20 | //config: a memory usage statistic tool. |
21 | 21 | ||
22 | #include "libbb.h" | 22 | #include "libbb.h" |
23 | #define BB_ARCHIVE_PUBLIC | ||
23 | #include "bb_archive.h" | 24 | #include "bb_archive.h" |
24 | 25 | ||
25 | struct fileblock { | 26 | struct fileblock { |