diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/pgrep.c | 2 | ||||
-rw-r--r-- | procps/ps.c | 96 |
2 files changed, 49 insertions, 49 deletions
diff --git a/procps/pgrep.c b/procps/pgrep.c index f5d4cfc..2ebcca1 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -116,7 +116,7 @@ int pgrep_main(int argc, 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 == strlen(cmd)))) ^ OPT_INVERT ) { matched_pid = proc->pid; if (OPT_LAST) { diff --git a/procps/ps.c b/procps/ps.c index 6a6a9e6..a46e92a 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -66,60 +66,60 @@ struct globals { /* for ELF executables, notes are pushed before environment and args */ static ptrdiff_t find_elf_note(ptrdiff_t findme) { - ptrdiff_t *ep = (ptrdiff_t *) environ; - - while (*ep++); - while (*ep) { - if (ep[0] == findme) { - return ep[1]; - } - ep += 2; - } - return -1; + ptrdiff_t *ep = (ptrdiff_t *) environ; + + while (*ep++); + while (*ep) { + if (ep[0] == findme) { + return ep[1]; + } + ep += 2; + } + return -1; } #if ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS static unsigned get_HZ_by_waiting(void) { - struct timeval tv1, tv2; - unsigned t1, t2, r, hz; - unsigned cnt = cnt; /* for compiler */ - int diff; - - r = 0; - - /* Wait for times() to reach new tick */ - t1 = times(NULL); - do { - t2 = times(NULL); - } while (t2 == t1); - gettimeofday(&tv2, NULL); - - do { - t1 = t2; - tv1.tv_usec = tv2.tv_usec; - - /* Wait exactly one times() tick */ - do { - t2 = times(NULL); - } while (t2 == t1); - gettimeofday(&tv2, NULL); - - /* Calculate ticks per sec, rounding up to even */ - diff = tv2.tv_usec - tv1.tv_usec; - if (diff <= 0) diff += 1000000; - hz = 1000000u / (unsigned)diff; - hz = (hz+1) & ~1; + struct timeval tv1, tv2; + unsigned t1, t2, r, hz; + unsigned cnt = cnt; /* for compiler */ + int diff; + + r = 0; + + /* Wait for times() to reach new tick */ + t1 = times(NULL); + do { + t2 = times(NULL); + } while (t2 == t1); + gettimeofday(&tv2, NULL); + + do { + t1 = t2; + tv1.tv_usec = tv2.tv_usec; + + /* Wait exactly one times() tick */ + do { + t2 = times(NULL); + } while (t2 == t1); + gettimeofday(&tv2, NULL); + + /* Calculate ticks per sec, rounding up to even */ + diff = tv2.tv_usec - tv1.tv_usec; + if (diff <= 0) diff += 1000000; + hz = 1000000u / (unsigned)diff; + hz = (hz+1) & ~1; /* Count how many same hz values we saw */ - if (r != hz) { - r = hz; - cnt = 0; - } - cnt++; - } while (cnt < 3); /* exit if saw 3 same values */ - - return r; + if (r != hz) { + r = hz; + cnt = 0; + } + cnt++; + } while (cnt < 3); /* exit if saw 3 same values */ + + return r; } #else static inline unsigned get_HZ_by_waiting(void) @@ -190,7 +190,7 @@ static void put_lu(char *buf, int size, unsigned long u) char buf5[5]; /* see http://en.wikipedia.org/wiki/Tera */ - smart_ulltoa4( (u, buf5, " mgtpezy"); + smart_ulltoa4(u, buf5, " mgtpezy"); buf5[5] = '\0'; sprintf(buf, "%.*s", size, buf5); } |