<limits.h>(0P) | POSIX Programmer's Manual | <limits.h>(0P) |
NAME
limits.h - implementation-defined constantsSYNOPSIS
#include <limits.h>DESCRIPTION
Some of the functionality described on this reference page extends the ISO C standard. Applications shall define the appropriate feature test macro (see the System Interfaces volume of IEEE Std 1003.1-2001, Section 2.2, The Compilation Environment) to enable the visibility of these symbols in this header.Many of the symbols listed here are not defined by the ISO/IEC 9899:1999 standard. Such symbols are not shown as CX shaded.
The <limits.h> header shall define various symbolic names. Different categories of names are described below.
The names represent various limits on resources that the implementation 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 implementation, by using the symbolic names listed below. It should be noted, however, that many of the listed limits are not invariant, and at runtime, the value of the limit may differ from those given in this header, for the following reasons:
- *
- The limit is pathname-dependent.
- *
- The limit differs between the compile and runtime machines.
For these reasons, an application may use the fpathconf(), pathconf(), and sysconf() functions to determine the actual value of a limit at runtime.
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 implementations, as indicated by the <limits.h> header on the implementation, but applications requiring such numbers are not guaranteed to be portable to all implementations. For positive constants ending in _MIN, this indicates the minimum acceptable value.
Runtime Invariant Values (Possibly Indeterminate)
A definition of one of the symbolic names in the following list shall be omitted from <limits.h> on specific implementations where the corresponding value is equal to or greater than the stated minimum, but is unspecified.This indetermination 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 shall be provided by the sysconf() function.
- {AIO_LISTIO_MAX}
-
- {AIO_MAX}
-
- {AIO_PRIO_DELTA_MAX}
-
- {ARG_MAX}
-
Maximum length of argument to the
exec functions including environment data.
- {ATEXIT_MAX}
-
- {CHILD_MAX}
-
Maximum number of simultaneous processes per real user ID.
- {DELAYTIMER_MAX}
-
- {HOST_NAME_MAX}
-
Maximum length of a host name (not including the terminating null) as returned from the
gethostname() function.
- {IOV_MAX}
-
- {LOGIN_NAME_MAX}
-
Maximum length of a login name.
- {MQ_OPEN_MAX}
-
- {MQ_PRIO_MAX}
-
- {OPEN_MAX}
-
Maximum number of files that one process can have open at any one time.
- {PAGESIZE}
-
Size in bytes of a page.
- {PAGE_SIZE}
-
- {PTHREAD_DESTRUCTOR_ITERATIONS}
-
- {PTHREAD_KEYS_MAX}
-
- {PTHREAD_STACK_MIN}
-
- {PTHREAD_THREADS_MAX}
-
- {RE_DUP_MAX}
-
The number of repeated occurrences of a BRE permitted by the
regexec() and
regcomp() functions when using the interval notation {\(
m,
n\}; see
BREs Matching Multiple Characters .
- {RTSIG_MAX}
-
- {SEM_NSEMS_MAX}
-
- {SEM_VALUE_MAX}
-
- {SIGQUEUE_MAX}
-
- {SS_REPL_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> ).
- {SYMLOOP_MAX}
-
Maximum number of symbolic links that can be reliably traversed in the resolution of a pathname in the absence of a loop.
- {TIMER_MAX}
-
- {TRACE_EVENT_NAME_MAX}
-
- {TRACE_NAME_MAX}
-
- {TRACE_SYS_MAX}
-
- {TRACE_USER_EVENT_MAX}
-
- {TTY_NAME_MAX}
-
Maximum length of terminal device name.
- {TZNAME_MAX}
-
Maximum number of bytes supported for the name of a timezone (not of the
TZ variable).
- Note:
-
The length given by {TZNAME_MAX} does not include the quoting characters mentioned in
Other Environment Variables .
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 shall 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 shall 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.
- {LINK_MAX}
-
Maximum number of links to a single file.
- {MAX_CANON}
-
Maximum number of bytes in a terminal canonical input line.
- {MAX_INPUT}
-
Minimum number of bytes for which space is available in a terminal input queue; therefore, the maximum number of bytes a conforming application may require to be typed as input before reading them.
- {NAME_MAX}
-
Maximum number of bytes in a filename (not including terminating null).
- {PATH_MAX}
-
Maximum number of bytes in a pathname, including the terminating null character.
- {PIPE_BUF}
-
Maximum number of bytes that is guaranteed to be atomic when writing to a pipe.
- {POSIX_ALLOC_SIZE_MIN}
-
- {POSIX_REC_INCR_XFER_SIZE}
-
- {POSIX_REC_MAX_XFER_SIZE}
-
- {POSIX_REC_MIN_XFER_SIZE}
-
- {POSIX_REC_XFER_ALIGN}
-
- {SYMLINK_MAX}
-
Maximum number of bytes in a symbolic link.
Runtime Increasable Values
The magnitude limitations in the following list shall 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 shall be provided by the sysconf() function.- {BC_BASE_MAX}
-
Maximum
obase values allowed by the
bc utility.
- {BC_DIM_MAX}
-
Maximum number of elements permitted in an array by the
bc utility.
- {BC_SCALE_MAX}
-
Maximum
scale value allowed by the
bc utility.
- {BC_STRING_MAX}
-
Maximum length of a string constant accepted by the
bc utility.
- {CHARCLASS_NAME_MAX}
-
Maximum number of bytes in a character class name.
- {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
Locale .
- {EXPR_NEST_MAX}
-
Maximum number of expressions that can be nested within parentheses by the
expr utility.
- {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>.
- {NGROUPS_MAX}
-
Maximum number of simultaneous supplementary group IDs per process.
- {RE_DUP_MAX}
-
Maximum number of repeated occurrences of a regular expression permitted when using the interval notation \{
m,
n\}; see
Regular Expressions .
Maximum Values
The symbolic constants in the following list shall be defined in <limits.h> with the values shown. These are symbolic names for the most restrictive value for certain features on an implementation supporting the Timers option. A conforming implementation shall provide values no larger than these values. A conforming application must not require a smaller value for correct operation.- {_POSIX_CLOCKRES_MIN}
-
If the Monotonic Clock option is supported, the resolution of the CLOCK_MONOTONIC clock, in nanoseconds, is represented by {_POSIX_CLOCKRES_MIN}.
Minimum Values
The symbolic constants in the following list shall be defined in <limits.h> with the values shown. These are symbolic names for the most restrictive value for certain features on an implementation conforming to this volume of IEEE Std 1003.1-2001. Related symbolic constants are defined elsewhere in this volume of IEEE Std 1003.1-2001 which reflect the actual implementation and which need not be as restrictive. A conforming implementation shall provide values at least this large. A strictly conforming application must not require a larger value for correct operation.- {_POSIX_AIO_LISTIO_MAX}
-
- {_POSIX_AIO_MAX}
-
- {_POSIX_ARG_MAX}
-
Maximum length of argument to the
exec functions including environment data.
- {_POSIX_CHILD_MAX}
-
Maximum number of simultaneous processes per real user ID.
- {_POSIX_DELAYTIMER_MAX}
-
- {_POSIX_HOST_NAME_MAX}
-
Maximum length of a host name (not including the terminating null) as returned from the
gethostname() function.
- {_POSIX_LINK_MAX}
-
Maximum number of links to a single file.
- {_POSIX_LOGIN_NAME_MAX}
-
The size of the storage required for a login name, in bytes, including the terminating null.
- {_POSIX_MAX_CANON}
-
Maximum number of bytes in a terminal canonical input queue.
- {_POSIX_MAX_INPUT}
-
Maximum number of bytes allowed in a terminal input queue.
- {_POSIX_MQ_OPEN_MAX}
-
- {_POSIX_MQ_PRIO_MAX}
-
- {_POSIX_NAME_MAX}
-
Maximum number of bytes in a filename (not including terminating null).
- {_POSIX_NGROUPS_MAX}
-
Maximum number of simultaneous supplementary group IDs per process.
- {_POSIX_OPEN_MAX}
-
Maximum number of files that one process can have open at any one time.
- {_POSIX_PATH_MAX}
-
Maximum number of bytes in a pathname.
- {_POSIX_PIPE_BUF}
-
Maximum number of bytes that is guaranteed to be atomic when writing to a pipe.
- {_POSIX_RE_DUP_MAX}
-
The number of repeated occurrences of a BRE permitted by the
regexec() and
regcomp() functions when using the interval notation {\(
m,
n\}; see
BREs Matching Multiple Characters .
- {_POSIX_RTSIG_MAX}
-
- {_POSIX_SEM_NSEMS_MAX}
-
- {_POSIX_SEM_VALUE_MAX}
-
- {_POSIX_SIGQUEUE_MAX}
-
- {_POSIX_SSIZE_MAX}
-
The value that can be stored in an object of type
ssize_t.
- {_POSIX_STREAM_MAX}
-
The number of streams that one process can have open at one time.
- {_POSIX_SS_REPL_MAX}
-
- {_POSIX_SYMLINK_MAX}
-
The number of bytes in a symbolic link.
- {_POSIX_SYMLOOP_MAX}
-
The number of symbolic links that can be traversed in the resolution of a pathname in the absence of a loop.
- {_POSIX_THREAD_DESTRUCTOR_ITERATIONS}
-
- {_POSIX_THREAD_KEYS_MAX}
-
- {_POSIX_THREAD_THREADS_MAX}
-
- {_POSIX_TIMER_MAX}
-
- {_POSIX_TRACE_EVENT_NAME_MAX}
-
- {_POSIX_TRACE_NAME_MAX}
-
- {_POSIX_TRACE_SYS_MAX}
-
- {_POSIX_TRACE_USER_EVENT_MAX}
-
- {_POSIX_TTY_NAME_MAX}
-
The size of the storage required for a terminal device name, in bytes, including the terminating null.
- {_POSIX_TZNAME_MAX}
-
Maximum number of bytes supported for the name of a timezone (not of the
TZ variable).
- Note:
- {_POSIX2_BC_BASE_MAX}
-
Maximum
obase values allowed by the
bc utility.
- {_POSIX2_BC_DIM_MAX}
-
Maximum number of elements permitted in an array by the
bc utility.
- {_POSIX2_BC_SCALE_MAX}
-
Maximum
scale value allowed by the
bc utility.
- {_POSIX2_BC_STRING_MAX}
-
Maximum length of a string constant accepted by the
bc utility.
- {_POSIX2_CHARCLASS_NAME_MAX}
-
Maximum number of bytes in a character class name.
- {_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
Locale .
- {_POSIX2_EXPR_NEST_MAX}
-
Maximum number of expressions that can be nested within parentheses by the
expr utility.
- {_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>.
- {_POSIX2_RE_DUP_MAX
-
Maximum number of repeated occurrences of a regular expression permitted when using the interval notation \{
m,
n\}; see
Regular Expressions .
- {_XOPEN_IOV_MAX}
-
- {_XOPEN_NAME_MAX}
-
- {_XOPEN_PATH_MAX}
-
Numerical Limits
The values in the following lists shall be defined in <limits.h> and are 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 are 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.
- {CHAR_MAX}
-
Maximum value of type
char.
- {CHAR_MIN}
-
Minimum value of type
char.
- {INT_MAX}
-
Maximum value of an
int.
- {LONG_BIT}
-
- {LONG_MAX}
-
Maximum value of a
long.
- {MB_LEN_MAX}
-
Maximum number of bytes in a character, for any supported locale.
- {SCHAR_MAX}
-
Maximum value of type
signed char.
- {SHRT_MAX}
-
Maximum value of type
short.
- {SSIZE_MAX}
-
Maximum value of an object of type
ssize_t.
- {UCHAR_MAX}
-
Maximum value of type
unsigned char.
- {UINT_MAX}
-
Maximum value of type
unsigned.
- {ULONG_MAX}
-
Maximum value of type
unsigned long.
- {USHRT_MAX}
-
Maximum value for a type
unsigned short.
- {WORD_BIT}
-
- {INT_MIN}
-
Minimum value of type
int.
- {LONG_MIN}
-
Minimum value of type
long.
- {SCHAR_MIN}
-
Minimum value of type
signed char.
- {SHRT_MIN}
-
Minimum value of type
short.
- {LLONG_MIN}
-
Minimum value of type
long long.
- {LLONG_MAX}
-
Maximum value of type
long long.
- {ULLONG_MAX}
-
Maximum value of type
unsigned long long.
Other Invariant Values
The following constants shall be defined on all implementations in <limits.h>:- {CHARCLASS_NAME_MAX}
-
- {NL_ARGMAX}
-
- {NL_LANGMAX}
-
- {NL_MSGMAX}
-
- {NL_NMAX}
-
- {NL_SETMAX}
-
- {NL_TEXTMAX}
-
- {NZERO}
-
The following sections are informative.
APPLICATION USAGE
None.RATIONALE
A request was made to reduce the value of {_POSIX_LINK_MAX} from the value of 8 specified for it in the POSIX.1-1990 standard to 2. The standard developers decided to deny this request for several reasons:- *
- They wanted to avoid making any changes to the standard that could break conforming applications, and the requested change could have that effect.
- *
- The use of multiple hard links to a file cannot always be replaced with use of symbolic links. Symbolic links are semantically different from hard links in that they associate a pathname with another pathname rather than a pathname with a file. This has implications for access control, file permanence, and transparency.
- *
- The original standard developers had considered the issue of allowing for implementations that did not in general support hard links, and decided that this would reduce consensus on the standard.
Systems that support historical versions of the development option of the ISO POSIX-2 standard retain the name {_POSIX2_RE_DUP_MAX} as an alias for {_POSIX_RE_DUP_MAX}.
- {PATH_MAX}
- IEEE PASC Interpretation 1003.1 #15 addressed the inconsistency in the standard with the definition of pathname and the description of {PATH_MAX}, allowing application writers to allocate either {PATH_MAX} or {PATH_MAX}+1 bytes. The inconsistency has been removed by correction to the {PATH_MAX} definition to include the null character. With this change, applications that previously allocated {PATH_MAX} bytes will continue to succeed.
- {SYMLINK_MAX}
-
This symbol refers to space for data that is stored in the file system, as opposed to {PATH_MAX} which is the length of a name that can be passed to a function. In some existing implementations, the filenames pointed to by symbolic links are stored in the inodes of the links, so it is important that {SYMLINK_MAX} not be constrained to be as large as {PATH_MAX}.
FUTURE DIRECTIONS
None.SEE ALSO
The System Interfaces volume of IEEE Std 1003.1-2001, fpathconf(), pathconf(), sysconf()COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .2003 | IEEE/The Open Group |