From: Lennart Weller Date: Wed, 8 Feb 2017 16:25:47 +0000 (+0100) Subject: Replace OS conditional prctl.h include with file presence X-Git-Tag: ab-debian_0.20170213.01-0ab1~1^2~21^2 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=559231383489be9111e3f24800709f529d4cc6a6;hp=-c;p=netdata.git Replace OS conditional prctl.h include with file presence --- 559231383489be9111e3f24800709f529d4cc6a6 diff --git a/configure.ac b/configure.ac index fd9b0cd1..ecf2352c 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,7 @@ AC_CHECK_SIZEOF([void *]) AC_CANONICAL_HOST AC_HEADER_MAJOR AC_HEADER_RESOLV +AC_CHECK_HEADERS_ONCE([sys/prctl.h]) AC_CHECK_LIB([cap], [cap_get_proc, cap_set_proc], [AC_CHECK_HEADER( diff --git a/src/apps_plugin.c b/src/apps_plugin.c index 128b1985..6996b380 100644 --- a/src/apps_plugin.c +++ b/src/apps_plugin.c @@ -3109,7 +3109,9 @@ int main(int argc, char **argv) { struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY }; if(setrlimit(RLIMIT_CORE, &rl) != 0) info("Cannot request unlimited core dumps for debugging... Proceeding anyway..."); +#ifdef HAVE_SYS_PRCTL_H prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); +#endif } #endif /* NETDATA_INTERNAL_CHECKS */ diff --git a/src/common.h b/src/common.h index ea129550..778bacd3 100644 --- a/src/common.h +++ b/src/common.h @@ -67,9 +67,9 @@ #include #include -#if !(defined(__FreeBSD__) || defined(__APPLE__)) +#ifdef HAVE_SYS_PRCTL_H #include -#endif /* __FreeBSD__ || __APPLE__*/ +#endif #include #include diff --git a/src/main.c b/src/main.c index fb547e44..d73c15a8 100644 --- a/src/main.c +++ b/src/main.c @@ -571,9 +571,9 @@ int main(int argc, char **argv) if(setrlimit(RLIMIT_CORE, &rl) != 0) error("Cannot request unlimited core dumps for debugging... Proceeding anyway..."); -#if !(defined(__FreeBSD__) || defined(__APPLE__)) +#ifdef HAVE_SYS_PRCTL_H prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); -#endif /* __FreeBSD__ || __APPLE__*/ +#endif } // -------------------------------------------------------------------- @@ -748,9 +748,9 @@ int main(int argc, char **argv) struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY }; if(setrlimit(RLIMIT_CORE, &rl) != 0) error("Cannot request unlimited core dumps for debugging... Proceeding anyway..."); -#if !(defined(__FreeBSD__) || defined(__APPLE__)) +#ifdef HAVE_SYS_PRCTL_H prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); -#endif /* __FreeBSD__ || __APPLE__*/ +#endif } #endif /* NETDATA_INTERNAL_CHECKS */