summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
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 b839b38..ed659af 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -106,19 +106,19 @@ int kill_main(int argc, char **argv)
argc--;
do_it_now:
+ pid = getpid();
if (killall5) {
pid_t sid;
procps_status_t* p = NULL;
- /* Now stop all processes */
- kill(-1, SIGSTOP);
/* Find out our own session id */
- pid = getpid();
sid = getsid(pid);
+ /* Now stop all processes */
+ kill(-1, SIGSTOP);
/* Now kill all processes except our session */
while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) {
- if (p->sid != sid && p->pid != pid && p->pid != 1)
+ if (p->sid != (unsigned)sid && p->pid != (unsigned)pid && p->pid != 1)
kill(p->pid, signo);
}
/* And let them continue */
@@ -134,7 +134,6 @@ do_it_now:
if (killall) {
/* Looks like they want to do a killall. Do that */
- pid = getpid();
while (arg) {
pid_t* pidList;
diff --git a/procps/pgrep.c b/procps/pgrep.c
index f20789c..336fa84 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -115,7 +115,7 @@ int pgrep_main(int argc ATTRIBUTE_UNUSED, char **argv)
cmd = proc->comm;
/* NB: OPT_INVERT is always 0 or 1 */
if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */
- && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == strlen(cmd)))) ^ OPT_INVERT
+ && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))) ^ OPT_INVERT
) {
matched_pid = proc->pid;
if (OPT_LAST) {
diff --git a/procps/pidof.c b/procps/pidof.c
index 46e646d..8ed5a21 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -59,7 +59,7 @@ int pidof_main(int argc ATTRIBUTE_UNUSED, char **argv)
if (opt & OPT_OMIT) {
llist_t *omits_p = omits;
while (omits_p) {
- if (xatoul(omits_p->data) == *pl) {
+ if (xatoul(omits_p->data) == (unsigned long)(*pl)) {
goto omitting;
}
omits_p = omits_p->link;
diff --git a/procps/ps.c b/procps/ps.c
index aeb8cec..cf939bb 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -310,7 +310,7 @@ static ps_out_t* new_out_t(void)
static const ps_out_t* find_out_spec(const char *name)
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(out_spec); i++) {
if (!strcmp(name, out_spec[i].name))
return &out_spec[i];
diff --git a/procps/top.c b/procps/top.c
index 206f9e8..ca43376 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -53,7 +53,7 @@ typedef struct jiffy_counts_t {
the next. Used for finding deltas. */
typedef struct save_hist {
unsigned long ticks;
- unsigned pid;
+ pid_t pid;
} save_hist;
typedef int (*cmp_funcp)(top_status_t *P, top_status_t *Q);
@@ -317,7 +317,7 @@ static unsigned long display_header(int scr_width)
fclose(fp);
/* output memory info */
- if (scr_width > sizeof(scrbuf))
+ if (scr_width > (int)sizeof(scrbuf))
scr_width = sizeof(scrbuf);
snprintf(scrbuf, scr_width,
"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)
, SHOW_STAT(pcpu)
#endif
);
- if (col + 1 < scr_width)
+ if ((int)(col + 1) < scr_width)
read_cmdline(line_buf + col, scr_width - col - 1, s->pid, s->comm);
fputs(line_buf, stdout);
/* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
@@ -584,7 +584,7 @@ static char *grab_number(char *str, const char *match, unsigned sz)
static void display_topmem_header(int scr_width)
{
char linebuf[128];
- int i;
+ unsigned i;
FILE *fp;
union {
struct {
@@ -703,7 +703,7 @@ static NOINLINE void display_topmem_process_list(int count, int scr_width)
ulltoa6_and_space(s->dirty_sh, &line_buf[6*6]);
ulltoa6_and_space(s->stack , &line_buf[7*6]);
line_buf[8*6] = '\0';
- if (scr_width > MIN_WIDTH) {
+ if (scr_width > (int)MIN_WIDTH) {
read_cmdline(&line_buf[8*6], scr_width - MIN_WIDTH, s->pid, s->comm);
}
printf("\n""%.*s", scr_width, line_buf);