diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-27 14:17:31 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-27 14:17:31 +0000 |
commit | be905d550c96da8c75d697842ba4169a62d05190 (patch) | |
tree | 10dd9d6a9ef0bab7345b7696f66fcf9339e6cce6 /procps | |
parent | 2f4399c6cc966d39ba74fc4727a0493b3b52ffd8 (diff) | |
download | busybox-w32-be905d550c96da8c75d697842ba4169a62d05190.tar.gz busybox-w32-be905d550c96da8c75d697842ba4169a62d05190.tar.bz2 busybox-w32-be905d550c96da8c75d697842ba4169a62d05190.zip |
process utilities related style cleanup
Diffstat (limited to 'procps')
-rw-r--r-- | procps/ps.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/procps/ps.c b/procps/ps.c index 62571493d..d88fe4af1 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -57,41 +57,40 @@ int ps_main(int argc, char **argv) | |||
57 | 57 | ||
58 | #if ENABLE_SELINUX | 58 | #if ENABLE_SELINUX |
59 | if (use_selinux) | 59 | if (use_selinux) |
60 | printf(" PID Context Stat Command\n"); | 60 | puts(" PID Context Stat Command"); |
61 | else | 61 | else |
62 | #endif | 62 | #endif |
63 | printf(" PID Uid VmSize Stat Command\n"); | 63 | puts(" PID Uid VmSize Stat Command"); |
64 | 64 | ||
65 | while ((p = procps_scan(1)) != 0) { | 65 | while ((p = procps_scan(1)) != 0) { |
66 | char *namecmd = p->cmd; | 66 | char *namecmd = p->cmd; |
67 | #if ENABLE_SELINUX | 67 | #if ENABLE_SELINUX |
68 | if (use_selinux) | 68 | if (use_selinux) { |
69 | { | ||
70 | char sbuf[128]; | 69 | char sbuf[128]; |
71 | len = sizeof(sbuf); | 70 | len = sizeof(sbuf); |
72 | 71 | ||
73 | if (is_selinux_enabled()) { | 72 | if (is_selinux_enabled()) { |
74 | if (getpidcon(p->pid,&sid)<0) | 73 | if (getpidcon(p->pid,&sid) < 0) |
75 | sid=NULL; | 74 | sid = NULL; |
76 | } | 75 | } |
77 | 76 | ||
78 | if (sid) { | 77 | if (sid) { |
79 | /* I assume sid initilized with NULL */ | 78 | /* I assume sid initilized with NULL */ |
80 | len = strlen(sid)+1; | 79 | len = strlen(sid)+1; |
81 | safe_strncpy(sbuf, sid, len); | 80 | safe_strncpy(sbuf, sid, len); |
82 | freecon(sid); | 81 | freecon(sid); |
83 | sid=NULL; | 82 | sid = NULL; |
84 | }else { | 83 | } else { |
85 | safe_strncpy(sbuf, "unknown",7); | 84 | safe_strncpy(sbuf, "unknown", 7); |
86 | } | 85 | } |
87 | len = printf("%5d %-32s %s ", p->pid, sbuf, p->state); | 86 | len = printf("%5d %-32s %s ", p->pid, sbuf, p->state); |
88 | } | 87 | } |
89 | else | 88 | else |
90 | #endif | 89 | #endif |
91 | if(p->rss == 0) | 90 | if(p->rss == 0) |
92 | len = printf("%5d %-8s %s ", p->pid, p->user, p->state); | 91 | len = printf("%5d %-8s %s ", p->pid, p->user, p->state); |
93 | else | 92 | else |
94 | len = printf("%5d %-8s %6ld %s ", p->pid, p->user, p->rss, p->state); | 93 | len = printf("%5d %-8s %6ld %s ", p->pid, p->user, p->rss, p->state); |
95 | 94 | ||
96 | i = terminal_width-len; | 95 | i = terminal_width-len; |
97 | 96 | ||