summaryrefslogtreecommitdiff
path: root/procps/top.c
diff options
context:
space:
mode:
authorRob Landley2006-08-03 15:41:12 +0000
committerRob Landley2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /procps/top.c
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.zip
busybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'procps/top.c')
-rw-r--r--procps/top.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/procps/top.c b/procps/top.c
index bf30c23..1b6f707 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -29,22 +29,9 @@
*/
#include "busybox.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
//#define CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE /* + 2k */
-#ifdef CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE
-#include <time.h>
-#include <fcntl.h>
-#include <netinet/in.h> /* htons */
-#endif
-
-
typedef int (*cmp_t)(procps_status_t *P, procps_status_t *Q);
static procps_status_t *top; /* Hehe */
@@ -116,7 +103,7 @@ static struct jiffy_counts jif, prev_jif;
static void get_jiffy_counts(void)
{
- FILE* fp = bb_xfopen("stat", "r");
+ FILE* fp = xfopen("stat", "r");
prev_jif = jif;
if (fscanf(fp, "cpu %lld %lld %lld %lld %lld %lld %lld %lld",
&jif.usr,&jif.nic,&jif.sys,&jif.idle,
@@ -196,7 +183,7 @@ static unsigned long display_generic(int scr_width)
unsigned int needs_conversion = 1;
/* read memory info */
- fp = bb_xfopen("meminfo", "r");
+ fp = xfopen("meminfo", "r");
/*
* Old kernels (such as 2.4.x) had a nice summary of memory info that
@@ -238,7 +225,7 @@ static unsigned long display_generic(int scr_width)
fclose(fp);
/* read load average as a string */
- fp = bb_xfopen("loadavg", "r");
+ fp = xfopen("loadavg", "r");
buf[0] = '\0';
fgets(buf, sizeof(buf), fp);
end = strchr(buf, ' ');
@@ -414,7 +401,7 @@ int top_main(int argc, char **argv)
}
/* change to /proc */
- bb_xchdir("/proc");
+ xchdir("/proc");
#ifdef CONFIG_FEATURE_USE_TERMIOS
tcgetattr(0, (void *) &initial_settings);
memcpy(&new_settings, &initial_settings, sizeof(struct termios));