aboutsummaryrefslogtreecommitdiff
path: root/plugins/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/utils.c')
-rw-r--r--plugins/utils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/utils.c b/plugins/utils.c
index ee620133..348ec022 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -678,3 +678,19 @@ char *sperfdata_int (const char *label,
return data;
}
+
+int
+open_max (void)
+{
+ errno = 0;
+ if (maxfd > 0)
+ return(maxfd);
+
+ if ((maxfd = sysconf (_SC_OPEN_MAX)) < 0) {
+ if (errno == 0)
+ maxfd = DEFAULT_MAXFD; /* it's indeterminate */
+ else
+ die (STATE_UNKNOWN, _("sysconf error for _SC_OPEN_MAX\n"));
+ }
+ return(maxfd);
+}