Defines implementation limits identified by IEEE POSIX 1003.
The limits.h file contains definitions required by the ANSI X3.159-198x Programming Language C Standard and the Institute of Electrical and Electronics Engineers (IEEE) P1003.1 Portable Operating System Interface for Computer Environments (POSIX) standard.
The constants required by the ANSI C Standard describe the sizes of basic data types, as follows:
| Symbol | Value | Explanation |
|---|---|---|
| CHAR_BIT | 8 | Number of bits in a variable of type char |
| CHAR_MAX | 255 | Maximum value of a variable of type char |
| CHAR_MIN | 0 | Minimum value of a variable of type char |
| INT_MAX | 2,147,483,647 | Maximum value of a variable of type int |
| INT_MIN | -2,147,483,648 | Minimum value of a variable of type int |
| LONG_MAX | 2,147,483,647 | Maximum value of a variable of type long |
| LONG_MIN | -2,147,483,648 | Maximum value of a variable of type long |
| SCHAR_MAX | 127 | Maximum value of a variable of type signed char |
| SCHAR_MIN | -128 | Minimum value of a variable of type signed char |
| SHRT_MAX | 32,767 | Maximum value of a variable of type short |
| SHRT_MIN | -32,768 | Maximum value of a variable of type short |
| UCHAR_MAX | 255 | Maximum value of a variable of type unsigned char |
| UINT_MAX | 4,294,967,295 | Maximum value of a variable of type unsigned int |
| ULONG_MAX | 4,294,967,295 | Maximum value of a variable of type unsigned long |
| USHRT_MAX | 65,535 | Maximum value of a variable of type unsigned short |
Run-Time Invariant Values
The first set of values required by POSIX, run-time invariant values, are simple constants determined by basic operating system data-structure sizes.
| Symbol | Value | Explanation |
|---|---|---|
| MAX_INPUT | 512 | No fewer than the number of bytes specified by the MAX_INPUT symbol are allowed in a terminal input queue. |
| NGROUPS_MAX | 2048 | Maximum size of the concurrent group list. |
| PASS_MAX | 255 | Maximum number of bytes in a password (not including the null terminator). |
| PID_MAX | INT_MAX | Maximum value for a processID. |
| UID_MAX | ULONG_MAX | Maximum value for a user or group ID. |
Run-Time Invariant Values (Possibly Indeterminate)
The second set of run-time invariant values required by POSIX specify values that might vary, especially due to system load, but that can be attained on a lightly loaded system.
| Symbol | Value | Explanation |
|---|---|---|
| ARG_MAX | 1048576 | Maximum length (in bytes) of arguments for the exec subroutine, including the environment. This is a default value that can be configured to a different size. |
| Symbol | Value | Explanation |
|---|---|---|
| CHILD_MAX | 40 | Maximum number of simultaneous processes per user ID |
| MAX_CANON | 256 | Maximum number of bytes in a canonical input line |
| OPEN_MAX | 65534 | Maximum number of files that one process can have open at any given time |
| CHRS_OPEN_MAX | 65000 | The maximum number of file descriptors to fit in the checkpoint/restart segment. |
Path-Name Variable Values
The third set of values required by POSIX, path-name variable values, represent constraints imposed by the file system on file path names. Further constraints on these values might be imposed by the underlying file-system implementation. Use the pathconf or fpathconf subroutine to determine any file-implementation characteristics specific to the underlying file system.
| Symbol | Value | Explanation |
|---|---|---|
| NAME_MAX | Undefined | Maximum number of bytes in a file component name (not including the null terminator) |
| PATH_MAX | 512 | Maximum number of bytes in a path name (not including the null terminator) |
Run-Time Increasable Values
The fourth set of values required by POSIX specify values that might be increased at run time. Use the pathconf or fpathconf subroutine to determine any file-implementation characteristics specific to the underlying file system.
| Item | Description | |
|---|---|---|
| Symbol | Value | Explanation |
| LINK_MAX | 32,767 | Maximum value of a file's link count (SHRT_MAX). |
| PIPE_BUF | 32,768 | Maximum number of bytes guaranteed to be written automatically to a pipe. |