Permalink
Browse files

sunos: use pset_getloadavg instead of getloadavg

If used in a non-global zone, getloadavg() always returns [0, 0, 0]. If
pset_getloadavg is used instead, the current processor set is analyzed, which
should work in both global and non-global zones.
  • Loading branch information...
1 parent b271b06 commit 8664590008a305d5f8010ef2eed8d179fd39ca8e @AvianFlu committed Feb 2, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/unix/sunos.c
View
@@ -34,6 +34,7 @@
#include <net/if.h>
#include <sys/loadavg.h>
+#include <sys/pset.h>
#include <sys/time.h>
#include <unistd.h>
#include <kstat.h>
@@ -269,7 +270,7 @@ uint64_t uv_get_total_memory(void) {
void uv_loadavg(double avg[3]) {
- (void) getloadavg(avg, 3);
+ (void) pset_getloadavg(PS_MYID, avg, 3);
}

0 comments on commit 8664590

Please sign in to comment.