]> arthur.barton.de Git - netdata.git/blobdiff - src/common.c
Merge pull request #17 from alonbl/build
[netdata.git] / src / common.c
index eba11fa719f95ff3730e128e054868e10f901327..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>
@@ -14,6 +15,8 @@
 #include "log.h"
 #include "common.h"
 
+char *global_host_prefix = "";
+
 /*
 // http://stackoverflow.com/questions/7666509/hash-function-for-string
 uint32_t simple_hash(const char *name)
@@ -168,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);
+}
+