Return the value of a configurable system limit
#include <unistd.h>
#include <limits.h>
long sysconf( int name );
libc
The sysconf() function returns the value of a configurable
system limit indicated by name.
Configurable limits are defined in <confname.h>, and contain at
least the following values:
- _SC_ARG_MAX
- Maximum length of arguments for the exec*() functions,
in bytes, including environment data.
- _SC_CHILD_MAX
- Maximum number of simultaneous processes per real user ID.
- _SC_CLK_TCK
- The number of intervals per second used to express the value in type
clock_t.
- _SC_NGROUPS_MAX
- The maximum number of simultaneous supplementary group IDs per
process.
- _SC_OPEN_MAX
- Maximum number of files that one process can have open at any given
time.
- _SC_JOB_CONTROL
- If this variable is defined, then job control is supported.
- _SC_SAVED_IDS
- If this variable is defined, then each process has a saved set-user-ID
and a saved set-group-ID.
- _SC_VERSION
- The current POSIX version that is currently supported. A value of
198808L indicates the August (08) 1988 standard, as approved by the
IEEE Standards Board.
The sysconf() function returns the requested configurable
system limit. If name isn't defined for the system, -1 is
returned, but errno isn't set. If an error occurs, -1 is
returned and errno is set.
- EINVAL
- The name argument is invalid.
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
int main( void )
{
printf( "_SC_ARG_MAX = %ld\n",
sysconf( _SC_ARG_MAX ) );
return EXIT_SUCCESS;
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
confstr(),
errno,
pathconf()