Return the value of a configurable system limit
#include <unistd.h>
#include <limits.h>
long sysconf( int name );
- name
- The name of the limit that you want to get; see below.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The sysconf() function returns the value of a configurable
system limit indicated by name.
Configurable limits are defined in <confname.h>, and include at
least the following values:
- _SC_AIO_PRIO_DELTA_MAX
- The maximum amount by which a process can decrease its asynchronous I/O
priority level from its own scheduling priority.
- _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_DELAYTIMER_MAX
- The maximum number of times a timer can overrun and you can still
detect it.
- _SC_GETGR_R_SIZE_MAX
- If defined (not -1), the maximum size of buffer that you need to
supply to
getgrgid_r()
for any memory that it needs to allocate.
- _SC_GETPW_R_SIZE_MAX
- If defined (not -1), the maximum size of buffer that you need to
supply to
getpwent_r(),
getpwuid_r(),
getspent_r(),
or
getspnam_r()
for any memory that they need to allocate.
- _SC_JOB_CONTROL
- If this variable is defined, then job control is supported.
- _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_PAGESIZE
- The default size of a thread's guard area.
- _SC_SAVED_IDS
- If this variable is defined, then each process has a saved set-user ID
and a saved set-group ID.
- _SC_SEM_NSEMS_MAX
- The maximum number of semaphores that one process can have open at
a time.
The sysconf() function returns -1 to indicate that this value
is indeterminate because that limit applies to both named and unnamed
semaphores.
The kernel allows an arbitrary number of unnamed semaphores
(they're kernel synchronization objects, so the number of them is limited
only by the amount of available kernel memory).
- _SC_SIGQUEUE_MAX
- The maximum number of outstanding realtime signals sent per process.
- _SC_THREAD_STACK_MIN
- The minimum stack size for a thread.
- _SC_TZNAME_MAX
- The maximum length of the names for time zones.
The value is the same as TZNAME_MAX.
- _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 requested configurable
system limit. If name isn't defined for the system, -1 is
returned.
#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()
getconf
in the Utilities Reference
Understanding System Limits
chapter of the Neutrino User's Guide