aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-20 18:32:27 +0200
committerSverker Eriksson <[email protected]>2016-05-20 18:32:27 +0200
commitd20068c72361eac577d919514da0de9a34f07745 (patch)
tree568c51798a133e5726c9f202f9f70249bf2a3d07
parentc5a18407907b316117c285046c53fb0a1795602e (diff)
parent86477f342663bfcc3e87a7746d405f5c079b6d86 (diff)
downloadotp-d20068c72361eac577d919514da0de9a34f07745.tar.gz
otp-d20068c72361eac577d919514da0de9a34f07745.tar.bz2
otp-d20068c72361eac577d919514da0de9a34f07745.zip
Merge branch 'sverker/os_mon/FreeBSD-EXIT_WITH'
-rw-r--r--lib/os_mon/c_src/cpu_sup.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/lib/os_mon/c_src/cpu_sup.c b/lib/os_mon/c_src/cpu_sup.c
index 353c7e674e..17ef48c26e 100644
--- a/lib/os_mon/c_src/cpu_sup.c
+++ b/lib/os_mon/c_src/cpu_sup.c
@@ -603,6 +603,35 @@ static void util_measure(unsigned int **result_vec, int *result_sz) {
#endif
/* ---------------------------- *
+ * Utils for OSX and FreeBSD *
+ * ---------------------------- */
+
+#if (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
+
+#define EXIT_WITH(msg) (rich_error(msg, __FILE__, __LINE__))
+#define RICH_BUFLEN (213) /* left in error(char*) */
+
+void rich_error(const char *reason, const char *file, const int line) {
+ char buf[RICH_BUFLEN];
+ snprintf(buf, RICH_BUFLEN, "%s (%s:%i)", reason, file, line);
+ error(buf);
+}
+#undef RICH_BUFLEN
+
+void getsysctl(const char *name, void *ptr, size_t len)
+{
+ size_t gotlen = len;
+ if (sysctlbyname(name, ptr, &gotlen, NULL, 0) != 0) {
+ EXIT_WITH("sysctlbyname failed");
+ }
+ if (gotlen != len) {
+ EXIT_WITH("sysctlbyname: unexpected length");
+ }
+}
+#endif
+
+
+/* ---------------------------- *
* FreeBSD stat functions *
* ---------------------------- */
@@ -645,34 +674,6 @@ static void util_measure(unsigned int **result_vec, int *result_sz) {
}
#endif
-/* ---------------------------- *
- * Utils for OSX and FreeBSD *
- * ---------------------------- */
-
-#if (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
-
-#define EXIT_WITH(msg) (rich_error(msg, __FILE__, __LINE__))
-#define RICH_BUFLEN (213) /* left in error(char*) */
-
-void rich_error(const char *reason, const char *file, const int line) {
- char buf[RICH_BUFLEN];
- snprintf(buf, RICH_BUFLEN, "%s (%s:%i)", reason, file, line);
- error(buf);
-}
-#undef RICH_BUFLEN
-
-void getsysctl(const char *name, void *ptr, size_t len)
-{
- size_t gotlen = len;
- if (sysctlbyname(name, ptr, &gotlen, NULL, 0) != 0) {
- EXIT_WITH("sysctlbyname failed");
- }
- if (gotlen != len) {
- EXIT_WITH("sysctlbyname: unexpected length");
- }
-}
-#endif
-
/* ---------------------------- *
* Generic functions *