Return the value of a configurable system limit


#include <unistd.h>
#include <limits.h>

long sysconf( int name );


The name of the limit that you want to get; see below.



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:

The maximum amount by which a process can decrease its asynchronous I/O priority level from its own scheduling priority.
Maximum length of arguments for the exec*() functions, in bytes, including environment data.
Maximum number of simultaneous processes per real user ID.
The number of intervals per second used to express the value in type clock_t.
The maximum number of times a timer can overrun and you can still detect it.
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.
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.
If this variable is defined, then job control is supported.
The maximum number of simultaneous supplementary group IDs per process.
Maximum number of files that one process can have open at any given time.
The default size of a thread's guard area.
If this variable is defined, then each process has a saved set-user ID and a saved set-group ID.
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).
The maximum number of outstanding realtime signals sent per process.
The minimum stack size for a thread.
The maximum length of the names for time zones. The value is the same as TZNAME_MAX.
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

Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

confstr(), errno, pathconf()

getconf in the Utilities Reference

Understanding System Limits chapter of the Neutrino User's Guide