diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-01-07 16:13:14 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-01-07 16:13:14 +0000 |
| commit | 6b404431aa7adea24120894d59daeebc5cbe9727 (patch) | |
| tree | f3ccda749daf6fe9f80f4ee99fbb5d1b0ed4cbb7 /procps | |
| parent | 4e9ca75281a25dcdbb3e2d2fa79108b02afa43db (diff) | |
| download | busybox-w32-6b404431aa7adea24120894d59daeebc5cbe9727.tar.gz busybox-w32-6b404431aa7adea24120894d59daeebc5cbe9727.tar.bz2 busybox-w32-6b404431aa7adea24120894d59daeebc5cbe9727.zip | |
ps: fix build breakage from vda's recent commit
*: whitespace fixes
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 f5d4cfcc1..2ebcca1c0 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c | |||
| @@ -116,7 +116,7 @@ int pgrep_main(int argc, char **argv) | |||
| 116 | cmd = proc->comm; | 116 | cmd = proc->comm; |
| 117 | /* NB: OPT_INVERT is always 0 or 1 */ | 117 | /* NB: OPT_INVERT is always 0 or 1 */ |
| 118 | if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */ | 118 | if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */ |
| 119 | && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == strlen(cmd)))) ^ OPT_INVERT | 119 | && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == strlen(cmd)))) ^ OPT_INVERT |
| 120 | ) { | 120 | ) { |
| 121 | matched_pid = proc->pid; | 121 | matched_pid = proc->pid; |
| 122 | if (OPT_LAST) { | 122 | if (OPT_LAST) { |
diff --git a/procps/ps.c b/procps/ps.c index 6a6a9e6d6..a46e92a8b 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
| @@ -66,60 +66,60 @@ struct globals { | |||
| 66 | /* for ELF executables, notes are pushed before environment and args */ | 66 | /* for ELF executables, notes are pushed before environment and args */ |
| 67 | static ptrdiff_t find_elf_note(ptrdiff_t findme) | 67 | static ptrdiff_t find_elf_note(ptrdiff_t findme) |
| 68 | { | 68 | { |
| 69 | ptrdiff_t *ep = (ptrdiff_t *) environ; | 69 | ptrdiff_t *ep = (ptrdiff_t *) environ; |
| 70 | 70 | ||
| 71 | while (*ep++); | 71 | while (*ep++); |
| 72 | while (*ep) { | 72 | while (*ep) { |
| 73 | if (ep[0] == findme) { | 73 | if (ep[0] == findme) { |
| 74 | return ep[1]; | 74 | return ep[1]; |
| 75 | } | 75 | } |
| 76 | ep += 2; | 76 | ep += 2; |
| 77 | } | 77 | } |
| 78 | return -1; | 78 | return -1; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | #if ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS | 81 | #if ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS |
| 82 | static unsigned get_HZ_by_waiting(void) | 82 | static unsigned get_HZ_by_waiting(void) |
| 83 | { | 83 | { |
| 84 | struct timeval tv1, tv2; | 84 | struct timeval tv1, tv2; |
| 85 | unsigned t1, t2, r, hz; | 85 | unsigned t1, t2, r, hz; |
| 86 | unsigned cnt = cnt; /* for compiler */ | 86 | unsigned cnt = cnt; /* for compiler */ |
| 87 | int diff; | 87 | int diff; |
| 88 | 88 | ||
| 89 | r = 0; | 89 | r = 0; |
| 90 | 90 | ||
| 91 | /* Wait for times() to reach new tick */ | 91 | /* Wait for times() to reach new tick */ |
| 92 | t1 = times(NULL); | 92 | t1 = times(NULL); |
| 93 | do { | 93 | do { |
| 94 | t2 = times(NULL); | 94 | t2 = times(NULL); |
| 95 | } while (t2 == t1); | 95 | } while (t2 == t1); |
| 96 | gettimeofday(&tv2, NULL); | 96 | gettimeofday(&tv2, NULL); |
| 97 | 97 | ||
| 98 | do { | 98 | do { |
| 99 | t1 = t2; | 99 | t1 = t2; |
| 100 | tv1.tv_usec = tv2.tv_usec; | 100 | tv1.tv_usec = tv2.tv_usec; |
| 101 | 101 | ||
| 102 | /* Wait exactly one times() tick */ | 102 | /* Wait exactly one times() tick */ |
| 103 | do { | 103 | do { |
| 104 | t2 = times(NULL); | 104 | t2 = times(NULL); |
| 105 | } while (t2 == t1); | 105 | } while (t2 == t1); |
| 106 | gettimeofday(&tv2, NULL); | 106 | gettimeofday(&tv2, NULL); |
| 107 | 107 | ||
| 108 | /* Calculate ticks per sec, rounding up to even */ | 108 | /* Calculate ticks per sec, rounding up to even */ |
| 109 | diff = tv2.tv_usec - tv1.tv_usec; | 109 | diff = tv2.tv_usec - tv1.tv_usec; |
| 110 | if (diff <= 0) diff += 1000000; | 110 | if (diff <= 0) diff += 1000000; |
| 111 | hz = 1000000u / (unsigned)diff; | 111 | hz = 1000000u / (unsigned)diff; |
| 112 | hz = (hz+1) & ~1; | 112 | hz = (hz+1) & ~1; |
| 113 | 113 | ||
| 114 | /* Count how many same hz values we saw */ | 114 | /* Count how many same hz values we saw */ |
| 115 | if (r != hz) { | 115 | if (r != hz) { |
| 116 | r = hz; | 116 | r = hz; |
| 117 | cnt = 0; | 117 | cnt = 0; |
| 118 | } | 118 | } |
| 119 | cnt++; | 119 | cnt++; |
| 120 | } while (cnt < 3); /* exit if saw 3 same values */ | 120 | } while (cnt < 3); /* exit if saw 3 same values */ |
| 121 | 121 | ||
| 122 | return r; | 122 | return r; |
| 123 | } | 123 | } |
| 124 | #else | 124 | #else |
| 125 | static inline unsigned get_HZ_by_waiting(void) | 125 | static inline unsigned get_HZ_by_waiting(void) |
| @@ -190,7 +190,7 @@ static void put_lu(char *buf, int size, unsigned long u) | |||
| 190 | char buf5[5]; | 190 | char buf5[5]; |
| 191 | 191 | ||
| 192 | /* see http://en.wikipedia.org/wiki/Tera */ | 192 | /* see http://en.wikipedia.org/wiki/Tera */ |
| 193 | smart_ulltoa4( (u, buf5, " mgtpezy"); | 193 | smart_ulltoa4(u, buf5, " mgtpezy"); |
| 194 | buf5[5] = '\0'; | 194 | buf5[5] = '\0'; |
| 195 | sprintf(buf, "%.*s", size, buf5); | 195 | sprintf(buf, "%.*s", size, buf5); |
| 196 | } | 196 | } |
