aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-05-15 21:30:45 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-05-15 21:30:45 +0000
commit6b06cb80be64fcf207bee734cc678c25434ed1a4 (patch)
treeaebc37ae3a2658fba3f57003102fa0dfb1a10ac8 /procps
parent43d5d429fd7a80ca02eb8388f058fd9654cc118d (diff)
downloadbusybox-w32-6b06cb80be64fcf207bee734cc678c25434ed1a4.tar.gz
busybox-w32-6b06cb80be64fcf207bee734cc678c25434ed1a4.tar.bz2
busybox-w32-6b06cb80be64fcf207bee734cc678c25434ed1a4.zip
more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs. function old new delta syslogd_main 938 958 +20 get_signum 136 143 +7 obj_load 777 782 +5 recv_from_to 210 214 +4 get_next_block 1795 1799 +4 display_topmem_process_list 1117 1121 +4 logread_main 484 487 +3 buffer_fill_and_print 73 76 +3 kill_main 687 689 +2 ll_remember_index 240 241 +1 do_stats 452 453 +1 if_readconf 166 165 -1 display_process_list 1192 1191 -1 run_applet_and_exit 507 505 -2 print_signames 33 31 -2 parse_one_line 1092 1090 -2 find_out_spec 57 55 -2 add_ksymoops_symbols 421 419 -2 ash_main 1407 1402 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes
Diffstat (limited to 'procps')
-rw-r--r--procps/kill.c9
-rw-r--r--procps/pgrep.c2
-rw-r--r--procps/pidof.c2
-rw-r--r--procps/ps.c2
-rw-r--r--procps/top.c10
5 files changed, 12 insertions, 13 deletions
diff --git a/procps/kill.c b/procps/kill.c
index b839b3819..ed659afdc 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -106,19 +106,19 @@ int kill_main(int argc, char **argv)
106 argc--; 106 argc--;
107 107
108do_it_now: 108do_it_now:
109 pid = getpid();
109 110
110 if (killall5) { 111 if (killall5) {
111 pid_t sid; 112 pid_t sid;
112 procps_status_t* p = NULL; 113 procps_status_t* p = NULL;
113 114
114 /* Now stop all processes */
115 kill(-1, SIGSTOP);
116 /* Find out our own session id */ 115 /* Find out our own session id */
117 pid = getpid();
118 sid = getsid(pid); 116 sid = getsid(pid);
117 /* Now stop all processes */
118 kill(-1, SIGSTOP);
119 /* Now kill all processes except our session */ 119 /* Now kill all processes except our session */
120 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) { 120 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) {
121 if (p->sid != sid && p->pid != pid && p->pid != 1) 121 if (p->sid != (unsigned)sid && p->pid != (unsigned)pid && p->pid != 1)
122 kill(p->pid, signo); 122 kill(p->pid, signo);
123 } 123 }
124 /* And let them continue */ 124 /* And let them continue */
@@ -134,7 +134,6 @@ do_it_now:
134 134
135 if (killall) { 135 if (killall) {
136 /* Looks like they want to do a killall. Do that */ 136 /* Looks like they want to do a killall. Do that */
137 pid = getpid();
138 while (arg) { 137 while (arg) {
139 pid_t* pidList; 138 pid_t* pidList;
140 139
diff --git a/procps/pgrep.c b/procps/pgrep.c
index f20789c81..336fa84ba 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -115,7 +115,7 @@ int pgrep_main(int argc ATTRIBUTE_UNUSED, char **argv)
115 cmd = proc->comm; 115 cmd = proc->comm;
116 /* NB: OPT_INVERT is always 0 or 1 */ 116 /* NB: OPT_INVERT is always 0 or 1 */
117 if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */ 117 if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */
118 && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == strlen(cmd)))) ^ OPT_INVERT 118 && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))) ^ OPT_INVERT
119 ) { 119 ) {
120 matched_pid = proc->pid; 120 matched_pid = proc->pid;
121 if (OPT_LAST) { 121 if (OPT_LAST) {
diff --git a/procps/pidof.c b/procps/pidof.c
index 46e646d6e..8ed5a2155 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -59,7 +59,7 @@ int pidof_main(int argc ATTRIBUTE_UNUSED, char **argv)
59 if (opt & OPT_OMIT) { 59 if (opt & OPT_OMIT) {
60 llist_t *omits_p = omits; 60 llist_t *omits_p = omits;
61 while (omits_p) { 61 while (omits_p) {
62 if (xatoul(omits_p->data) == *pl) { 62 if (xatoul(omits_p->data) == (unsigned long)(*pl)) {
63 goto omitting; 63 goto omitting;
64 } 64 }
65 omits_p = omits_p->link; 65 omits_p = omits_p->link;
diff --git a/procps/ps.c b/procps/ps.c
index aeb8cecb4..cf939bbb8 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -310,7 +310,7 @@ static ps_out_t* new_out_t(void)
310 310
311static const ps_out_t* find_out_spec(const char *name) 311static const ps_out_t* find_out_spec(const char *name)
312{ 312{
313 int i; 313 unsigned i;
314 for (i = 0; i < ARRAY_SIZE(out_spec); i++) { 314 for (i = 0; i < ARRAY_SIZE(out_spec); i++) {
315 if (!strcmp(name, out_spec[i].name)) 315 if (!strcmp(name, out_spec[i].name))
316 return &out_spec[i]; 316 return &out_spec[i];
diff --git a/procps/top.c b/procps/top.c
index 206f9e8be..ca43376ac 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -53,7 +53,7 @@ typedef struct jiffy_counts_t {
53 the next. Used for finding deltas. */ 53 the next. Used for finding deltas. */
54typedef struct save_hist { 54typedef struct save_hist {
55 unsigned long ticks; 55 unsigned long ticks;
56 unsigned pid; 56 pid_t pid;
57} save_hist; 57} save_hist;
58 58
59typedef int (*cmp_funcp)(top_status_t *P, top_status_t *Q); 59typedef int (*cmp_funcp)(top_status_t *P, top_status_t *Q);
@@ -317,7 +317,7 @@ static unsigned long display_header(int scr_width)
317 fclose(fp); 317 fclose(fp);
318 318
319 /* output memory info */ 319 /* output memory info */
320 if (scr_width > sizeof(scrbuf)) 320 if (scr_width > (int)sizeof(scrbuf))
321 scr_width = sizeof(scrbuf); 321 scr_width = sizeof(scrbuf);
322 snprintf(scrbuf, scr_width, 322 snprintf(scrbuf, scr_width,
323 "Mem: %luK used, %luK free, %luK shrd, %luK buff, %luK cached", 323 "Mem: %luK used, %luK free, %luK shrd, %luK buff, %luK cached",
@@ -481,7 +481,7 @@ static NOINLINE void display_process_list(int count, int scr_width)
481 , SHOW_STAT(pcpu) 481 , SHOW_STAT(pcpu)
482#endif 482#endif
483 ); 483 );
484 if (col + 1 < scr_width) 484 if ((int)(col + 1) < scr_width)
485 read_cmdline(line_buf + col, scr_width - col - 1, s->pid, s->comm); 485 read_cmdline(line_buf + col, scr_width - col - 1, s->pid, s->comm);
486 fputs(line_buf, stdout); 486 fputs(line_buf, stdout);
487 /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu, 487 /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
@@ -584,7 +584,7 @@ static char *grab_number(char *str, const char *match, unsigned sz)
584static void display_topmem_header(int scr_width) 584static void display_topmem_header(int scr_width)
585{ 585{
586 char linebuf[128]; 586 char linebuf[128];
587 int i; 587 unsigned i;
588 FILE *fp; 588 FILE *fp;
589 union { 589 union {
590 struct { 590 struct {
@@ -703,7 +703,7 @@ static NOINLINE void display_topmem_process_list(int count, int scr_width)
703 ulltoa6_and_space(s->dirty_sh, &line_buf[6*6]); 703 ulltoa6_and_space(s->dirty_sh, &line_buf[6*6]);
704 ulltoa6_and_space(s->stack , &line_buf[7*6]); 704 ulltoa6_and_space(s->stack , &line_buf[7*6]);
705 line_buf[8*6] = '\0'; 705 line_buf[8*6] = '\0';
706 if (scr_width > MIN_WIDTH) { 706 if (scr_width > (int)MIN_WIDTH) {
707 read_cmdline(&line_buf[8*6], scr_width - MIN_WIDTH, s->pid, s->comm); 707 read_cmdline(&line_buf[8*6], scr_width - MIN_WIDTH, s->pid, s->comm);
708 } 708 }
709 printf("\n""%.*s", scr_width, line_buf); 709 printf("\n""%.*s", scr_width, line_buf);