summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
Diffstat (limited to 'procps')
-rw-r--r--procps/fuser.c10
-rw-r--r--procps/top.c7
2 files changed, 10 insertions, 7 deletions
diff --git a/procps/fuser.c b/procps/fuser.c
index 48c9bdc..fd876d5 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -57,11 +57,11 @@ static int file_to_dev_inode(const char *filename, dev_t *dev, ino_t *inode)
static char *parse_net_arg(const char *arg, unsigned *port)
{
- char path[12], tproto[5];
+ char path[20], tproto[5];
if (sscanf(arg, "%u/%4s", port, tproto) != 2)
return NULL;
- sprintf(path, "net/%s", tproto);
+ sprintf(path, "/proc/net/%s", tproto);
if (access(path, R_OK) != 0)
return NULL;
return xstrdup(tproto);
@@ -99,7 +99,7 @@ static inode_list *add_inode(inode_list *ilist, dev_t dev, ino_t inode)
static inode_list *scan_proc_net(const char *proto,
unsigned port, inode_list *ilist)
{
- char path[12], line[MAX_LINE + 1];
+ char path[20], line[MAX_LINE + 1];
char addr[128];
ino_t tmp_inode;
dev_t tmp_dev;
@@ -109,7 +109,7 @@ static inode_list *scan_proc_net(const char *proto,
tmp_dev = find_socket_dev();
- sprintf(path, "net/%s", proto);
+ sprintf(path, "/proc/net/%s", proto);
f = fopen(path, "r");
if (!f)
return ilist;
@@ -314,8 +314,6 @@ Find processes which use FILEs or PORTs
opt = getopt32(argv, OPTION_STRING);
argv += optind;
- xchdir("/proc");
-
ilist = NULL;
pp = argv;
while (*pp) {
diff --git a/procps/top.c b/procps/top.c
index e3f91c8..206f9e8 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -861,17 +861,22 @@ int top_main(int argc ATTRIBUTE_UNUSED, char **argv)
#else
qsort(top, ntop, sizeof(top_status_t), (void*)(sort_function[0]));
#endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */
- } else { /* TOPMEM */
+ }
+#if ENABLE_FEATURE_TOPMEM
+ else { /* TOPMEM */
qsort(topmem, ntop, sizeof(topmem_status_t), (void*)topmem_sort);
}
+#endif
count = lines;
if (OPT_BATCH_MODE || count > ntop) {
count = ntop;
}
if (scan_mask == TOP_MASK)
display_process_list(count, col);
+#if ENABLE_FEATURE_TOPMEM
else
display_topmem_process_list(count, col);
+#endif
clearmems();
if (iterations >= 0 && !--iterations)
break;