]> arthur.barton.de Git - netdata.git/commitdiff
Replace OS conditional prctl.h include with file presence
authorLennart Weller <lhw@ring0.de>
Wed, 8 Feb 2017 16:25:47 +0000 (17:25 +0100)
committerLennart Weller <lhw@ring0.de>
Wed, 8 Feb 2017 16:25:47 +0000 (17:25 +0100)
configure.ac
src/apps_plugin.c
src/common.h
src/main.c

index fd9b0cd1c001f032f0788892b8ff2eb9f8f02e36..ecf2352c22a78415dd1eca80b9921293167c40fe 100644 (file)
@@ -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(
index 128b198561d551622f97ead759d6a3b8459e4ea2..6996b38069a52a32cbd4a672792ef887df169e1f 100644 (file)
@@ -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 */
 
index ea129550fa3c95afc96a18e2688722b237503f5e..778bacd3c4cd213a92db38d0ee8dd010b2f4ae07 100644 (file)
@@ -67,9 +67,9 @@
 #include <syslog.h>
 #include <sys/mman.h>
 
-#if !(defined(__FreeBSD__) || defined(__APPLE__))
+#ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
-#endif /* __FreeBSD__ || __APPLE__*/
+#endif
 
 #include <sys/resource.h>
 #include <sys/socket.h>
index fb547e440526a1489b60365203416323c134ccb0..d73c15a86c6eda3b2035a289e0a74b97ff626a59 100644 (file)
@@ -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 */