]> arthur.barton.de Git - netdata.git/blobdiff - src/common.c
build: migrate to autotools
[netdata.git] / src / common.c
index 9240e3c9768d7ca6a50a77a4180042f8cf06a1e1..2df676f90216253f4e7584e242ba697d6e354d1f 100755 (executable)
@@ -1,6 +1,7 @@
-// enable O_NOATIME
-#define _GNU_SOURCE
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <sys/syscall.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
@@ -170,3 +171,26 @@ int fd_is_valid(int fd) {
     return fcntl(fd, F_GETFD) != -1 || errno != EBADF;
 }
 
+/*
+ ***************************************************************************
+ * Get number of clock ticks per second.
+ ***************************************************************************
+ */
+unsigned int hz;
+
+void get_HZ(void)
+{
+       long ticks;
+
+       if ((ticks = sysconf(_SC_CLK_TCK)) == -1) {
+               perror("sysconf");
+       }
+
+       hz = (unsigned int) ticks;
+}
+
+pid_t gettid(void)
+{
+       return syscall(SYS_gettid);
+}
+