Fixes so "make allnoconfig" works again.
[oweals/busybox.git] / libbb / procps.c
index 44103fae8992d9b877967e3c577914c2b07d8708..72f627f15e3f22ad870291e38cc562be186ffed5 100644 (file)
 
 #include "libbb.h"
 
-extern procps_status_t * procps_scan(int save_user_arg0
-#ifdef CONFIG_SELINUX
-       , int use_selinux , security_id_t *sid
-#endif
-       )
+extern procps_status_t * procps_scan(int save_user_arg0)
 {
        static DIR *dir;
        struct dirent *entry;
@@ -54,20 +50,15 @@ extern procps_status_t * procps_scan(int save_user_arg0
                pid = atoi(name);
                curstatus.pid = pid;
 
+               sprintf(status, "/proc/%d", pid);
+               if(stat(status, &sb))
+                       continue;
+               my_getpwuid(curstatus.user, sb.st_uid, sizeof(curstatus.user));
+
                sprintf(status, "/proc/%d/stat", pid);
+
                if((fp = fopen(status, "r")) == NULL)
                        continue;
-#ifdef CONFIG_SELINUX
-               if(use_selinux)
-               {
-                       if(fstat_secure(fileno(fp), &sb, sid))
-                               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)
@@ -115,7 +106,11 @@ extern procps_status_t * procps_scan(int save_user_arg0
                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);