From 43a312877afecc793dc1f517cbc234ca9f8beeac Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 14 Mar 2016 14:12:47 +0000 Subject: [PATCH 1/3] add support for libtirc musl libc does not ship rpc functions and rpc is marked as absolete in glibc too. So add support for libtircp. --- src/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eff9972c2..8bd9038ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,6 +26,10 @@ int main() ENDMACRO (CHECK_STRUCT_MEMBER) +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(TIRPC libtirpc) +INCLUDE_DIRECTORIES(${TIRPC_INCLUDE_DIRS}) + ## linux IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") @@ -104,6 +108,7 @@ ENDIF(WIN32) IF(SIGAR_LINK_FLAGS) SET_TARGET_PROPERTIES(sigar PROPERTIES LINK_FLAGS "${SIGAR_LINK_FLAGS}") ENDIF(SIGAR_LINK_FLAGS) +TARGET_LINK_LIBRARIES(sigar ${TIRPC_LIBRARIES}) INSTALL(TARGETS sigar RUNTIME DESTINATION bin From 5e09cdb086a77314dfbff5dc0a18359bac965111 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 14 Mar 2016 14:14:30 +0000 Subject: [PATCH 2/3] fix compilation with musl libc the HZ define is not exposed by musl libc. --- src/os/linux/linux_sigar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c index a3fd23010..7f38497df 100644 --- a/src/os/linux/linux_sigar.c +++ b/src/os/linux/linux_sigar.c @@ -46,6 +46,10 @@ #define PROC_PARTITIONS PROC_FS_ROOT "partitions" #define PROC_DISKSTATS PROC_FS_ROOT "diskstats" +#ifndef HZ +#define HZ 100 +#endif + /* * /proc/self/stat fields: * 1 - pid From e78f794c22e7825374d1d9bda37f649ed2f725d3 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 14 Mar 2016 14:17:29 +0000 Subject: [PATCH 3/3] only enable the GNU libc strerror_r on GNU libc We don't want use the non-standard GNU libc variant of strerror_r on musl libc, or any libc other than GNU. --- src/os/linux/sigar_os.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/linux/sigar_os.h b/src/os/linux/sigar_os.h index 29a2ba323..7e1ead7d8 100644 --- a/src/os/linux/sigar_os.h +++ b/src/os/linux/sigar_os.h @@ -70,7 +70,7 @@ struct sigar_t { }; #define HAVE_STRERROR_R -#ifndef __USE_XOPEN2K +#if !defined(__USE_XOPEN2K) && defined(__GLIBC__) /* use gnu version of strerror_r */ #define HAVE_STRERROR_R_GLIBC #endif