From c0b357aaa9c76cac72dfe34ad83992632d6666d7 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 10 Jan 2007 19:27:56 +0000 Subject: [PATCH] The new method doesn't need to be a spectator, and /proc/virtual isn't available there by default. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2450 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- src/vserver-stat.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/vserver-stat.c b/src/vserver-stat.c index efb8706..9a9e7ee 100644 --- a/src/vserver-stat.c +++ b/src/vserver-stat.c @@ -613,19 +613,6 @@ int main(int argc, char **argv) if (hertz==0x42) initHertz(); if (pagesize==0x42) initPageSize(); - my_pid = getpid(); - - if (!switchToWatchXid(&errptr)) { - perror(errptr); - exit(1); - } - - if (access("/proc/uptime",R_OK)==-1 && errno==ENOENT) - WRITE_MSG(2, - "WARNING: can not access /proc/uptime. Usually, this is caused by\n" - " procfs-security. Please read the FAQ for more details\n" - " http://linux-vserver.org/Proc-Security\n"); - Vector_init(&xid_data, sizeof(struct XidData)); if (vc_isSupported(vcFEATURE_VSTAT)) { @@ -641,6 +628,19 @@ int main(int argc, char **argv) closedir(proc_dir); } else { + my_pid = getpid(); + + if (!switchToWatchXid(&errptr)) { + perror(errptr); + exit(1); + } + + if (access("/proc/uptime",R_OK)==-1 && errno==ENOENT) + WRITE_MSG(2, + "WARNING: can not access /proc/uptime. Usually, this is caused by\n" + " procfs-security. Please read the FAQ for more details\n" + " http://linux-vserver.org/Proc-Security\n"); + Echdir(PROC_DIR_NAME); proc_dir = Eopendir("."); while ((dir_entry = readdir(proc_dir)) != NULL) -- 1.8.1.5