NAME

limits.h - implementation-dependent constants

SYNOPSIS

#include <limits.h>

DESCRIPTION

The <limits.h> header defines various symbolic names. Different categories of names are described below.

The names represent various limits on resources that the system imposes on applications.

Implementations may choose any appropriate value for each limit, provided it is not more restrictive than the Minimum Acceptable Values listed below. Symbolic constant names beginning with _POSIX may be found in <unistd.h>.

Applications should not assume any particular value for a limit. To achieve maximum portability, an application should not require more resource than the Minimum Acceptable Value quantity. However, an application wishing to avail itself of the full amount of a resource available on an implementation may make use of the value given in <limits.h> on that particular system, by using the symbolic names listed below. It should be noted, however, that many of the listed limits are not invariant, and at run time, the value of the limit may differ from those given in this header, for the following reasons:

For these reasons, an application may use the fpathconf(), pathconf() and sysconf() functions to determine the actual value of a limit at run time.

The items in the list ending in _MIN give the most negative values that the mathematical types are guaranteed to be capable of representing. Numbers of a more negative value may be supported on some systems, as indicated by the <limits.h> header on the system, but applications requiring such numbers are not guaranteed to be portable to all systems.

The Minimum Acceptable Value symbol * indicates that there is no guaranteed value across all XSI-conformant systems.

Run-time Invariant Values (Possibly Indeterminate)

A definition of one of the symbolic names in the following list will be omitted from <limits.h> on specific implementations where the corresponding value is equal to or greater than the stated minimum, but is indeterminate.

This might depend on the amount of available memory space on a specific instance of a specific implementation. The actual value supported by a specific instance will be provided by the sysconf() function.

AIO_LISTIO_MAX
Maximum number of I/O operations in a single list I/O call supported by the implementation.
Minimum Acceptable Value: _POSIX_AIO_LISTIO_MAX

AIO_MAX
Maximum number of outstanding asynchronous I/O operations supported by the implementation.
Minimum Acceptable Value: _POSIX_AIO_MAX

AIO_PRIO_DELTA_MAX
The maximum amount by which a process can decrease its asynchronous I/O priority level from its own scheduling priority.
Minimum Acceptable Value: 0

ARG_MAX
Maximum length of argument to the exec functions including environment data.
Minimum Acceptable Value: _POSIX_ARG_MAX

ATEXIT_MAX
Maximum number of functions that may be registered with atexit().
Minimum Acceptable Value: 32

CHILD_MAX
Maximum number of simultaneous processes per real user ID.
Minimum Acceptable Value: 25

DELAYTIMER_MAX
Maximum number of timer expiration overruns.
Minimum Acceptable Value: _POSIX_DELAYTIMER_MAX

IOV_MAX
Maximum number of iovec structures that one process has available for use with readv() or writev().
Minimum Acceptable Value: _XOPEN_IOV_MAX

LOGIN_NAME_MAX
Maximum length of a login name.
Minimum Acceptable Value: _POSIX_LOGIN_NAME_MAX

MQ_OPEN_MAX
The maximum number of open message queue descriptors a process may hold.
Minimum Acceptable Value: _POSIX_MQ_OPEN_MAX

MQ_PRIO_MAX
The maximum number of message priorities supported by the implementation.
Minimum Acceptable Value: _POSIX_MQ_PRIO_MAX

OPEN_MAX
Maximum number of files that one process can have open at any one time.
Minimum Acceptable Value: 20

PAGESIZE
Size in bytes of a page.
Minimum Acceptable Value: 1

PAGE_SIZE
Same as PAGESIZE. If either PAGESIZE or PAGE_SIZE is defined, the other will be defined with the same value.

PASS_MAX
Maximum number of significant bytes in a password (not including terminating null). (LEGACY)
Minimum Acceptable Value: 8

PTHREAD_DESTRUCTOR_ITERATIONS
Maximum number of attempts made to destroy a thread's thread-specific data values on thread exit.
Minimum Acceptable Value: _POSIX_THREAD_DESTRUCTOR_ITERATIONS

PTHREAD_KEYS_MAX
Maximum number of data keys that can be created by a process.
Minimum Acceptable Value: _POSIX_THREAD_KEYS_MAX

PTHREAD_STACK_MIN
Minimum size in bytes of thread stack storage.
Minimum Acceptable Value: 0

PTHREAD_THREADS_MAX
Maximum number of threads that that can be created per process.
Minimum Acceptable Value: _POSIX_THREAD_THREADS_MAX

RTSIG_MAX
Maximum number of realtime signals reserved for application use in this implementation.
Minimum Acceptable Value: _POSIX_RTSIG_MAX

SEM_NSEMS_MAX
Maximum number of semaphores that a process may have.
Minimum Acceptable Value: _POSIX_SEM_NSEMS_MAX

SEM_VALUE_MAX
The maximum value a semaphore may have.
Minimum Acceptable Value: _POSIX_SEM_VALUE_MAX

SIGQUEUE_MAX
Maximum number of queued signals that a process may send and have pending at the receiver(s) at any time.
Minimum Acceptable Value: _POSIX_SIGQUEUE_MAX

STREAM_MAX
The number of streams that one process can have open at one time. If defined, it has the same value as {FOPEN_MAX} (see <stdio.h>).
Minimum Acceptable Value: _POSIX_STREAM_MAX

TIMER_MAX
Maximum number of timers per-process supported by the implementation.
Minimum Acceptable Value: _POSIX_TIMER_MAX

TTY_NAME_MAX
Maximum length of terminal device name.
Minimum Acceptable Value: _POSIX_TTY_NAME_MAX

TZNAME_MAX
Maximum number of bytes supported for the name of a time zone (not of the TZ variable).
Minimum Acceptable Value: _POSIX_TZNAME_MAX
Pathname Variable Values

The values in the following list may be constants within an implementation or may vary from one pathname to another. For example, file systems or directories may have different characteristics.

A definition of one of the values will be omitted from the <limits.h> header on specific implementations where the corresponding value is equal to or greater than the stated minimum, but where the value can vary depending on the file to which it is applied. The actual value supported for a specific pathname will be provided by the pathconf() function.

FILESIZEBITS
Minimum number of bits needed to represent, as a signed integer value, the maximum size of a regular file allowed in the specified directory.
Minimum Acceptable Value: 32

LINK_MAX
Maximum number of links to a single file.
Minimum Acceptable Value: _POSIX_LINK_MAX

MAX_CANON
Maximum number of bytes in a terminal canonical input line.
Minimum Acceptable Value: _POSIX_MAX_CANON

MAX_INPUT
Minimum number of bytes for which space will be available in a terminal input queue; therefore, the maximum number of bytes a portable application may require to be typed as input before reading them.
Minimum Acceptable Value: _POSIX_MAX_INPUT

NAME_MAX
Maximum number of bytes in a filename (not including terminating null).
Minimum Acceptable Value: _POSIX_NAME_MAX

PATH_MAX
Maximum number of bytes in a pathname, including the terminating null character.
Minimum Acceptable Value: _POSIX_PATH_MAX

PIPE_BUF
Maximum number of bytes that is guaranteed to be atomic when writing to a pipe.
Minimum Acceptable Value: _POSIX_PIPE_BUF
Run-time Increasable Values

The magnitude limitations in the following list will be fixed by specific implementations. An application should assume that the value supplied by <limits.h> in a specific implementation is the minimum that pertains whenever the application is run under that implementation. A specific instance of a specific implementation may increase the value relative to that supplied by <limits.h> for that implementation. The actual value supported by a specific instance will be provided by the sysconf() function.

BC_BASE_MAX
Maximum obase values allowed by the bc utility.
Minimum Acceptable Value: _POSIX2_BC_BASE_MAX

BC_DIM_MAX
Maximum number of elements permitted in an array by the bc utility.
Minimum Acceptable Value: _POSIX2_BC_DIM_MAX

BC_SCALE_MAX
Maximum scale value allowed by the bc utility.
Minimum Acceptable Value: _POSIX2_BC_SCALE_MAX

BC_STRING_MAX
Maximum length of a string constant accepted by the bc utility.
Minimum Acceptable Value: _POSIX2_BC_STRING_MAX

COLL_WEIGHTS_MAX
Maximum number of weights that can be assigned to an entry of the LC_COLLATE order keyword in the locale definition file; see the POSIX specification, Locale.
Minimum Acceptable Value: _POSIX2_COLL_WEIGHTS_MAX

EXPR_NEST_MAX
Maximum number of expressions that can be nested within parentheses by the expr utility.
Minimum Acceptable Value: _POSIX2_EXPR_NEST_MAX

LINE_MAX
Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing newline.
Minimum Acceptable Value: _POSIX2_LINE_MAX

NGROUPS_MAX
Maximum number of simultaneous supplementary group IDs per process.
Minimum Acceptable Value: 8

RE_DUP_MAX
Maximum number of repeated occurrences of a regular expression permitted when using the interval notation \{m,n\}; see the Regular Expressions specification.
Minimum Acceptable Value: _POSIX2_RE_DUP_MAX
Maximum Values

The symbolic constants in the following list are defined in <limits.h> with the values shown. These are symbolic names for the most restrictive value for certain features on a system supporting the Realtime Feature Group. A conforming implementation will provide values no larger than these values. A portable application will not require a smaller value for correct operation.

_POSIX_CLOCKRES_MIN
The CLOCK_REALTIME clock resolution, in nanoseconds
Value: 20 000 000
Minimum Values

The symbolic constants in the following list are defined in <limits.h> with the values shown. These are symbolic names for the most restrictive value for certain features on a system conforming to this specification. Related symbolic constants are defined elsewhere in this specification which reflect the actual implementation and which need not be as restrictive. A conforming implementation will provide values at least this large. A portable application must not require a larger value for correct operation.

_POSIX_AIO_LISTIO_MAX
The number of I/O operations that can be specified in a list I/O call.
Value: 2

_POSIX_AIO_MAX
The number of outstanding asynchronous I/O operations.
Value: 1

_POSIX_ARG_MAX
Maximum length of argument to the exec functions including environment data.
Value: 4 096

_POSIX_CHILD_MAX
Maximum number of simultaneous processes per real user ID.
Value: 6

_POSIX_DELAYTIMER_MAX
The number of timer expiration overruns.
Value: 32

_POSIX_LINK_MAX
Maximum number of links to a single file.
Value: 8

_POSIX_LOGIN_NAME_MAX
The size of the storage required for a login name, in bytes, including the terminating null.
Value: 9

_POSIX_MAX_CANON
Maximum number of bytes in a terminal canonical input queue.
Value: 255

_POSIX_MAX_INPUT
Maximum number of bytes allowed in a terminal input queue.
Value: 255

_POSIX_MQ_OPEN_MAX
The number of message queues that can be open for a single process.
Value: 8

_POSIX_MQ_PRIO_MAX
The maximum number of message priorities supported by the implementation.
Value: 32

_POSIX_NAME_MAX
Maximum number of bytes in a filename (not including terminating null).
Value: 14

_POSIX_NGROUPS_MAX
Maximum number of simultaneous supplementary group IDs per process.
Value: 0

_POSIX_OPEN_MAX
Maximum number of files that one process can have open at any one time.
Value: 16

_POSIX_PATH_MAX
Maximum number of bytes in a pathname.
Value: 255

_POSIX_PIPE_BUF
Maximum number of bytes that is guaranteed to be atomic when writing to a pipe.
Value: 512

_POSIX_RTSIG_MAX
The number of realtime signal numbers reserved for application use.
Value: 8

_POSIX_SEM_NSEMS_MAX
The number of semaphores that a process may have.
Value: 256

_POSIX_SEM_VALUE_MAX
The maximum value a semaphore may have.
Value: 32 767

_POSIX_SIGQUEUE_MAX
The number of queued signals that a process may send and have pending at the receiver(s) at any time.
Value: 32

_POSIX_SSIZE_MAX
The value that can be stored in an object of type ssize_t.
Value: 32 767

_POSIX_STREAM_MAX
The number of streams that one process can have open at one time.
Value: 8

_POSIX_THREAD_DESTRUCTOR_ITERATIONS
The number of attempts made to destroy a thread's thread-specific data values on thread exit.
Value: 4

_POSIX_THREAD_KEYS_MAX
The number of data keys per process.
Value: 128

_POSIX_THREAD_THREADS_MAX
The number of threads per process.
Value: 64

_POSIX_TIMER_MAX
The per process number of timers.
Value: 32

_POSIX_TTY_NAME_MAX
The size of the storage required for a terminal device name, in bytes, including the terminating null.
Value: 9

_POSIX_TZNAME_MAX
Maximum number of bytes supported for the name of a time zone (not of TZ variable).
Value: 3

_POSIX2_BC_BASE_MAX
Maximum obase values allowed by the bc utility.
Value: 99

_POSIX2_BC_DIM_MAX
Maximum number of elements permitted in an array by the bc utility.
Value: 2 048

_POSIX2_BC_SCALE_MAX
Maximum scale value allowed by the bc utility.
Value: 99

_POSIX2_BC_STRING_MAX
Maximum length of a string constant accepted by the bc utility.
Value: 1 000

_POSIX2_COLL_WEIGHTS_MAX
Maximum number of weights that can be assigned to an entry of the LC_COLLATE order keyword in the locale definition file; see the  Locale specification.
Value: 2

_POSIX2_EXPR_NEST_MAX
Maximum number of expressions that can be nested within parentheses by the expr utility.
Value: 32

_POSIX2_LINE_MAX
Unless otherwise noted, the maximum length, in bytes, of a utility's input line (either standard input or another file), when the utility is described as processing text files. The length includes room for the trailing newline.
Value: 2 048

_POSIX2_RE_DUP_MAX
Maximum number of repeated occurrences of a regular expression permitted when using the interval notation \{m,n\}; see the POSIX specification, Regular Expressions.
Value: 255

_XOPEN_IOV_MAX
Maximum number of iovec structures that one process has available for use with readv() or writev().
Value: 16
Numerical Limits

The values in the following lists are defined in <limits.h> and will be constant expressions suitable for use in #if preprocessing directives. Moreover, except for CHAR_BIT, DBL_DIG, DBL_MAX, FLT_DIG, FLT_MAX, LONG_BIT, WORD_BIT and MB_LEN_MAX, the symbolic names will be defined as expressions of the correct type.

If the value of an object of type char is treated as a signed integer when used in an expression, the value of CHAR_MIN is the same as that of SCHAR_MIN and the value of CHAR_MAX is the same as that of SCHAR_MAX. Otherwise, the value of CHAR_MIN is 0 and the value of CHAR_MAX is the same as that of UCHAR_MAX.

CHAR_BIT
Number of bits in a type char.
Minimum Acceptable Value: 8

CHAR_MAX
Maximum value of a type char.
Minimum Acceptable Value: UCHAR_MAX or SCHAR_MAX

DBL_DIG
Digits of precision of a type double. (LEGACY)
Minimum Acceptable Value: 10

DBL_MAX
Maximum value of a type double. (LEGACY)
Minimum Acceptable Value: 1E +37

FLT_DIG
Digits of precision of a type float. (LEGACY)
Minimum Acceptable Value: 6

FLT_MAX
Maximum value of a float. (LEGACY)
Minimum Acceptable Value: 1E+37

INT_MAX
Maximum value of an int.
Minimum Acceptable Value: 2 147 483 647

LONG_BIT
Number of bits in a long int.
Minimum Acceptable Value: 32

LONG_MAX
Maximum value of a long int.
Minimum Acceptable Value: +2 147 483 647

MB_LEN_MAX
Maximum number of bytes in a character, for any supported locale.
Minimum Acceptable Value: 1

SCHAR_MAX
Maximum value of a type signed char.
Minimum Acceptable Value: +127

SHRT_MAX
Maximum value of a type short.
Minimum Acceptable Value: +32 767

SSIZE_MAX
Maximum value of an object of type ssize_t.
Minimum Acceptable Value: _POSIX_SSIZE_MAX

UCHAR_MAX
Maximum value of a type unsigned char.
Minimum Acceptable Value: 255

UINT_MAX
Maximum value of a type unsigned int.
Minimum Acceptable Value: 4 294 967 295

ULONG_MAX
Maximum value of a type unsigned long int.
Minimum Acceptable Value: 4 294 967 295

USHRT_MAX
Maximum value for a type unsigned short int.
Minimum Acceptable Value: 65 535

WORD_BIT
Number of bits in a word or type int.
Minimum Acceptable Value: 16

CHAR_MIN
Minimum value of a type char.
Maximum Acceptable Value: SCHAR_MIN or 0

INT_MIN
Minimum value of a type int.
Maximum Acceptable Value: -2 147 483 647

LONG_MIN
Minimum value of a type long int.
Maximum Acceptable Value: -2 147 483 647

SCHAR_MIN
Minimum value of a type signed char.
Maximum Acceptable Value: -127

SHRT_MIN
Minimum value of a type short.
Maximum Acceptable Value: -32 767
Other Invariant Values

The following constants are defined on all systems in <limits.h>.

CHARCLASS_NAME_MAX
Maximum number of bytes in a character class name.
Minimum Acceptable Value: 14

NL_ARGMAX
Maximum value of digit in calls to the printf() and scanf() functions.
Minimum Acceptable Value: 9

NL_LANGMAX
Maximum number of bytes in a LANG name.
Minimum Acceptable Value: 14

NL_MSGMAX
Maximum message number.
Minimum Acceptable Value: 32 767

NL_NMAX
Maximum number of bytes in an N-to-1 collation mapping.
Minimum Acceptable Value: *

NL_SETMAX
Maximum set number.
Minimum Acceptable Value: 255

NL_TEXTMAX
Maximum number of bytes in a message string.
Minimum Acceptable Value: _POSIX2_LINE_MAX

NZERO
Default process priority.
Minimum Acceptable Value: 20

TMP_MAX
Minimum number of unique pathnames generated by tmpnam(). Maximum number of times an application can call tmpnam() reliably. (LEGACY)
Minimum Acceptable Value: 10 000

APPLICATION USAGE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

fpathconf(), pathconf(), sysconf().