X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fsystem-stats.c;h=a3b4db44341c337cb94e2b65f83ed9726f1b4d79;hb=b23cdad927a3b7f282e30d358be2c93597f8b9a3;hp=11b2fbedbeb700af8d83588628942a4ba1ffdac1;hpb=ce8876775477a359f3ae14b8cae0ef2212f1681b;p=openvswitch diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c index 11b2fbed..a3b4db44 100644 --- a/vswitchd/system-stats.c +++ b/vswitchd/system-stats.c @@ -22,7 +22,6 @@ #if HAVE_MNTENT_H #include #endif -#include #include #include #include @@ -39,7 +38,7 @@ #include "timeval.h" #include "vlog.h" -VLOG_DEFINE_THIS_MODULE(system_stats) +VLOG_DEFINE_THIS_MODULE(system_stats); /* #ifdefs make it a pain to maintain code: you have to try to build both ways. * Thus, this file tries to compile as much of the code as possible regardless @@ -96,7 +95,11 @@ get_memory_stats(struct shash *stats) if (!LINUX) { unsigned int pagesize = get_page_size(); long int phys_pages = sysconf(_SC_PHYS_PAGES); +#ifdef _SC_AVPHYS_PAGES long int avphys_pages = sysconf(_SC_AVPHYS_PAGES); +#else + long int avphys_pages = 0; +#endif int mem_total, mem_used; if (pagesize <= 0 || phys_pages <= 0 || avphys_pages <= 0) { @@ -387,9 +390,9 @@ get_process_stats(struct shash *stats) struct dirent *de; DIR *dir; - dir = opendir(ovs_rundir); + dir = opendir(ovs_rundir()); if (!dir) { - VLOG_ERR_ONCE("%s: open failed (%s)", ovs_rundir, strerror(errno)); + VLOG_ERR_ONCE("%s: open failed (%s)", ovs_rundir(), strerror(errno)); return; } @@ -411,10 +414,10 @@ get_process_stats(struct shash *stats) continue; } - file_name = xasprintf("%s/%s", ovs_rundir, de->d_name); + file_name = xasprintf("%s/%s", ovs_rundir(), de->d_name); pid = read_pidfile(file_name); free(file_name); - if (pid < 0 || kill(pid, 0)) { + if (pid < 0) { continue; }