aboutsummaryrefslogtreecommitdiff
path: root/lib/libpmc/pmu-events
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2019-04-14 00:06:49 +0000
committerEnji Cooper <ngie@FreeBSD.org>2019-04-14 00:06:49 +0000
commitb3d01a2ad7f16bb20f6fb58bb34f9339396c0075 (patch)
tree67f251a3b4d3109079559fb716c8b51aad8f51fd /lib/libpmc/pmu-events
parentf0dfbcccf45f88185edf08c8ab71386f23f2f678 (diff)
Notes
Diffstat (limited to 'lib/libpmc/pmu-events')
-rw-r--r--lib/libpmc/pmu-events/jevents.c26
-rw-r--r--lib/libpmc/pmu-events/jevents.h8
2 files changed, 12 insertions, 22 deletions
diff --git a/lib/libpmc/pmu-events/jevents.c b/lib/libpmc/pmu-events/jevents.c
index c59780e3d59e6..e5e81d208857a 100644
--- a/lib/libpmc/pmu-events/jevents.c
+++ b/lib/libpmc/pmu-events/jevents.c
@@ -1,5 +1,3 @@
-#define _XOPEN_SOURCE 500 /* needed for nftw() */
-#define __BSD_VISIBLE 1 /* needed for asprintf() */
/* Parse event JSON files */
/*
@@ -33,22 +31,22 @@
*
*/
-
+#include <sys/param.h>
+#include <sys/resource.h> /* getrlimit */
+#include <sys/stat.h>
+#include <sys/time.h> /* getrlimit */
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include <string.h>
-#include <ctype.h>
#include <unistd.h>
-#include <stdarg.h>
-#include <libgen.h>
-#include <limits.h>
-#include <dirent.h>
-#include <sys/time.h> /* getrlimit */
-#include <sys/resource.h> /* getrlimit */
#include <ftw.h>
-#include <sys/stat.h>
#include "list.h"
#include "jsmn.h"
#include "json.h"
@@ -641,7 +639,7 @@ int json_events(const char *fn,
addfield(map, &extra_desc, " ",
"(Precise event)", NULL);
}
- snprintf(buf, sizeof buf, "event=%#llx", eventcode);
+ snprintf(buf, sizeof(buf), "event=%#llx", eventcode);
addfield(map, &event, ",", buf, NULL);
if (desc && extra_desc)
addfield(map, &desc, " ", extra_desc, NULL);
@@ -866,7 +864,7 @@ static int get_maxfds(void)
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
if (rlim.rlim_max == RLIM_INFINITY)
return 512;
- return min((unsigned)rlim.rlim_max / 2, 512);
+ return MIN(rlim.rlim_max / 2, 512);
}
return 512;
diff --git a/lib/libpmc/pmu-events/jevents.h b/lib/libpmc/pmu-events/jevents.h
index cd3d1c19021bd..637d3c36128cc 100644
--- a/lib/libpmc/pmu-events/jevents.h
+++ b/lib/libpmc/pmu-events/jevents.h
@@ -11,12 +11,4 @@ int json_events(const char *fn,
void *data);
char *get_cpu_str(void);
-#ifndef min
-#define min(x, y) ({ \
- typeof(x) _min1 = (x); \
- typeof(y) _min2 = (y); \
- (void) (&_min1 == &_min2); \
- _min1 < _min2 ? _min1 : _min2; })
-#endif
-
#endif