Global replace of Nicira Networks.
[sliver-openvswitch.git] / vswitchd / system-stats.c
index 11b2fbe..cecd8f4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010 Nicira Networks
+/* Copyright (c) 2010 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
 #if HAVE_MNTENT_H
 #include <mntent.h>
 #endif
-#include <signal.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -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;
         }