From c141bd0521aca697e167b15a9b90f93b43da806a Mon Sep 17 00:00:00 2001 From: Simon Cornish Date: Mon, 2 Sep 2013 23:25:07 -0700 Subject: Remove object files when cleaning Otherwise something like this will fail: ./otp_build setup --enable-m32-build make clean ./otp_build setup --enable-m64-build --- lib/os_mon/c_src/Makefile.in | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/os_mon/c_src/Makefile.in b/lib/os_mon/c_src/Makefile.in index 51569f6ec9..f84ccf7c87 100644 --- a/lib/os_mon/c_src/Makefile.in +++ b/lib/os_mon/c_src/Makefile.in @@ -84,6 +84,7 @@ debug opt: $(TARGET_FILES) clean: rm -f $(TARGET_FILES) + rm -rf $(OBJDIR) rm -f core *~ docs: -- cgit v1.2.3 From 8be8c20d33d67acb205a51897ea5284bc81605e7 Mon Sep 17 00:00:00 2001 From: Simon Cornish Date: Mon, 2 Sep 2013 23:25:36 -0700 Subject: Fix some compiler warnings --- lib/os_mon/c_src/cpu_sup.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/os_mon/c_src/cpu_sup.c b/lib/os_mon/c_src/cpu_sup.c index 7372d5b0e8..22946eca0e 100644 --- a/lib/os_mon/c_src/cpu_sup.c +++ b/lib/os_mon/c_src/cpu_sup.c @@ -29,6 +29,7 @@ #include #include #include +#include #if defined(__sun__) #include @@ -120,7 +121,9 @@ typedef struct { static void util_measure(unsigned int **result_vec, int *result_sz); +#if defined(__sun__) static unsigned int misc_measure(char* name); +#endif static void send(unsigned int data); static void sendv(unsigned int data[], int ints); static void error(char* err_msg); @@ -140,7 +143,9 @@ int main(int argc, char** argv) { int rc; int sz; unsigned int *rv; +#if defined(__linux__) unsigned int no_of_cpus = 0; +#endif #if defined(__sun__) kstat_ctl = kstat_open(); -- cgit v1.2.3 From efbd406f1b8f148569a40a090c38929a7661d2aa Mon Sep 17 00:00:00 2001 From: Simon Cornish Date: Mon, 2 Sep 2013 23:31:52 -0700 Subject: Fix broken cpu_sup:nprocs and others on Solaris 64-bit The correct kstat datatype for nproc & avenrun_* is ui32, not ulong. Under 64-bit OTP builds garbage was returned because the wrong datatype was used. This patch correcs the datatype. It also adds an additional check in the test case for a slightly less insane return value. --- lib/os_mon/c_src/cpu_sup.c | 4 ++-- lib/os_mon/test/cpu_sup_SUITE.erl | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/os_mon/c_src/cpu_sup.c b/lib/os_mon/c_src/cpu_sup.c index 22946eca0e..e9fd75a32c 100644 --- a/lib/os_mon/c_src/cpu_sup.c +++ b/lib/os_mon/c_src/cpu_sup.c @@ -293,10 +293,10 @@ static unsigned int misc_measure(char* name) { if(!entry) return -1; - if(entry->data_type != KSTAT_DATA_ULONG) + if(entry->data_type != KSTAT_DATA_UINT32) return -1; - return entry->value.ul; + return entry->value.ui32; } diff --git a/lib/os_mon/test/cpu_sup_SUITE.erl b/lib/os_mon/test/cpu_sup_SUITE.erl index d04adbb6d3..e0382cb0c7 100644 --- a/lib/os_mon/test/cpu_sup_SUITE.erl +++ b/lib/os_mon/test/cpu_sup_SUITE.erl @@ -88,6 +88,7 @@ load_api(Config) when is_list(Config) -> ?line N = cpu_sup:nprocs(), ?line true = is_integer(N), ?line true = N>0, + ?line true = N<1000000, %% avg1() ?line Load1 = cpu_sup:avg1(), -- cgit v1.2.3