aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
Diffstat (limited to 'procps')
-rw-r--r--procps/sysctl.c17
-rw-r--r--procps/top.c21
2 files changed, 8 insertions, 30 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 5673d293f..03a03889e 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -15,15 +15,6 @@
*/
#include "busybox.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
/*
* Function Prototypes
@@ -202,8 +193,8 @@ int sysctl_write_setting(const char *setting, int output)
return -2;
}
- tmpname = bb_xasprintf("%s%.*s", PROC_PATH, (int)(equals - name), name);
- outname = bb_xstrdup(tmpname + strlen(PROC_PATH));
+ tmpname = xasprintf("%s%.*s", PROC_PATH, (int)(equals - name), name);
+ outname = xstrdup(tmpname + strlen(PROC_PATH));
while ((cptr = strchr(tmpname, '.')) != NULL)
*cptr = '/';
@@ -258,7 +249,7 @@ int sysctl_read_setting(const char *setting, int output)
bb_error_msg(ERR_INVALID_KEY, setting);
tmpname = concat_path_file(PROC_PATH, name);
- outname = bb_xstrdup(tmpname + strlen(PROC_PATH));
+ outname = xstrdup(tmpname + strlen(PROC_PATH));
while ((cptr = strchr(tmpname, '.')) != NULL)
*cptr = '/';
@@ -309,7 +300,7 @@ int sysctl_display_all(const char *path, int output, int show_table)
char *tmpdir;
struct stat ts;
- if (!(dp = bb_opendir(path))) {
+ if (!(dp = opendir(path))) {
retval = -1;
} else {
while ((de = readdir(dp)) != NULL) {
diff --git a/procps/top.c b/procps/top.c
index bf30c23f6..1b6f7072f 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));