diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-07-18 08:40:35 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2019-07-18 08:40:35 +0200 |
commit | 34cc70c3c6428ba0d1f42994f5f0d6b4b8fc8711 (patch) | |
tree | c434bba834da4b42c85d00a2083c205307c8d55a /plugins/utils.c | |
parent | 2f4d6764d78cf085601b34ac92486405bd11095d (diff) | |
parent | e8325b39c47e6fbf7c8c1e31f9026870d9520af5 (diff) | |
download | monitoring-plugins-34cc70c3c6428ba0d1f42994f5f0d6b4b8fc8711.tar.gz |
Merge branch 'master' into feature_check_curl
Diffstat (limited to 'plugins/utils.c')
-rw-r--r-- | plugins/utils.c | 16 |
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); +} |