Skip to content

Commit 3a4c087

Browse files
author
Vincent Landgraf
committed
#10 use native getpagesize and getloadavg on solaris/smartos
1 parent b883ac9 commit 3a4c087

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

ext/vmstat/extconf.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
# posix.h
44
have_header 'unistd.h'
5-
have_func 'getpagesize'
5+
have_func 'getpagesize', 'unistd.h'
66
have_header 'stdlib.h'
7-
have_func 'getloadavg'
7+
if have_header 'sys/loadavg.h'
8+
have_func 'getloadavg', 'sys/loadavg.h'
9+
else
10+
have_func 'getloadavg'
11+
end
812

913
# mach.h
1014
have_header 'mach/mach.h'

ext/vmstat/hw/posix.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#if defined(HAVE_UNISTD_H) && defined(HAVE_GETPAGESIZE)
1+
#if defined(HAVE_UNISTD_H)
22
#include <unistd.h>
3+
#endif
34

5+
#if defined(HAVE_GETPAGESIZE)
46
#ifndef VMSTAT_PAGESIZE
57
#define VMSTAT_PAGESIZE
68
VALUE vmstat_pagesize(VALUE self) {
@@ -9,7 +11,11 @@ VALUE vmstat_pagesize(VALUE self) {
911
#endif
1012
#endif
1113

12-
#if defined(HAVE_STDLIB_H) && defined(HAVE_GETLOADAVG)
14+
#if defined(HAVE_SYS_LOADAVG_H)
15+
#include <sys/loadavg.h>
16+
#endif
17+
18+
#if defined(HAVE_GETLOADAVG)
1319
#ifndef VMSTAT_LOAD_AVERAGE
1420
#define VMSTAT_LOAD_AVERAGE
1521
VALUE vmstat_load_average(VALUE self) {

0 commit comments

Comments
 (0)