diff options
| author | Alex Richardson <arichardson@FreeBSD.org> | 2018-10-29 21:08:34 +0000 |
|---|---|---|
| committer | Alex Richardson <arichardson@FreeBSD.org> | 2018-10-29 21:08:34 +0000 |
| commit | 2fa224b17de008093f790d00a401a8db1e1c5feb (patch) | |
| tree | e0fa359f21eae714ed2a1b512df55baf5012f5f5 /lib/libpmc | |
| parent | 3ab5b6bd979c53e17056ed91f6fe6f0358ed72c9 (diff) | |
Notes
Diffstat (limited to 'lib/libpmc')
| -rw-r--r-- | lib/libpmc/pmu-events/jevents.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libpmc/pmu-events/jevents.c b/lib/libpmc/pmu-events/jevents.c index 4f135772787a1..c92616b716d97 100644 --- a/lib/libpmc/pmu-events/jevents.c +++ b/lib/libpmc/pmu-events/jevents.c @@ -34,7 +34,7 @@ */ -#include <sys/stddef.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> @@ -54,8 +54,6 @@ #include "json.h" #include "jevents.h" -int snprintf(char * __restrict, size_t, const char * __restrict, - ...) __printflike(3, 4); _Noreturn void _Exit(int); int verbose; @@ -859,8 +857,11 @@ static int get_maxfds(void) { struct rlimit rlim; - if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) - return min((int)rlim.rlim_max / 2, 512); + if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { + if (rlim.rlim_max == RLIM_INFINITY) + return 512; + return min((unsigned)rlim.rlim_max / 2, 512); + } return 512; } @@ -1121,8 +1122,8 @@ int main(int argc, char *argv[]) mapfile = NULL; rc = nftw(ldirname, preprocess_arch_std_files, maxfds, 0); if (rc && verbose) { - pr_info("%s: Error preprocessing arch standard files %s\n", - prog, ldirname); + pr_info("%s: Error preprocessing arch standard files %s: %s\n", + prog, ldirname, strerror(errno)); goto empty_map; } else if (rc < 0) { /* Make build fail */ |
