#include "libbb.h"
-#ifndef
-#define PAGE_MASK (~((getpagesize())-1))
-#endif
-
extern procps_status_t * procps_scan(int save_user_arg0
#ifdef CONFIG_SELINUX
, int use_selinux , security_id_t *sid
pid = atoi(name);
curstatus.pid = pid;
+ sprintf(status, "/proc/%d", pid);
+ if(stat(status, &sb))
+ continue;
+ my_getpwuid(curstatus.user, sb.st_uid);
+
sprintf(status, "/proc/%d/stat", pid);
if((fp = fopen(status, "r")) == NULL)
continue;
}
else
#endif
- if(fstat(fileno(fp), &sb))
- continue;
- my_getpwuid(curstatus.user, sb.st_uid);
name = fgets(buf, sizeof(buf), fp);
fclose(fp);
if(name == NULL)
else
curstatus.state[2] = ' ';
+#ifdef PAGE_SHIFT
curstatus.rss <<= (PAGE_SHIFT - 10); /* 2**10 = 1kb */
+#else
+ curstatus.rss *= (getpagesize() >> 10); /* 2**10 = 1kb */
+#endif
if(save_user_arg0) {
sprintf(status, "/proc/%d/cmdline", pid);