Manual browser: limits(3)
|LIMITS(3)||Library Functions Manual||LIMITS(3)|
NAMElimits — standard limits
DESCRIPTIONThe <limits.h> header defines various compile-time and runtime limits. These can be grouped into three categories:
- Compile-time limits defined in a header file.
- Runtime system limits that are not associated with a file or directory; see sysconf(3).
- Runtime limits that are associated with a file or directory; see pathconf(2).
The <limits.h> header has been standardized by at least three entities.
ISO LimitsThe limits defined by the ISO/IEC 9899:1999 (“ISO C99”) standard are all compile-time limits. The numerical (integer) limits are:
|ULONG_MAX||unsigned long int||
|LLONG_MAX||long long int||9223372036854775807|
|LLONG_MIN||long long int||-9223372036854775807|
|ULLONG_MAX||unsigned long long int||
All listed limits may vary across machines and operating systems. The standard guarantees only that the implementation-defined values are equal or greater in absolute value to those shown. The values permit a system with 16-bit integers using one's complement arithmetic.
Depending whether the system defines char as signed or unsigned, the maximum and minimum values are:
|CHAR_MAX||char||either SCHAR_MAX or UCHAR_MAX|
|CHAR_MIN||char||either SCHAR_MIN or 0|
The two special cases, CHAR_BIT and MB_LEN_MAX, define the number of bits in char and the maximum number of bytes in a multibyte character constant, respectively.
POSIX LimitsThe POSIX.1 standard specifies numerous limits related to the operating system. For each limit, a separate constant prefixed with “_POSIX_” defines the lowest value that the limit is allowed to have on any POSIX compliant system. For instance, _POSIX_OPEN_MAX defines the minimum upper bound permitted by POSIX for the number of files that a single process may have open at any time. This ensures that a portable program can safely reach these limits without prior knowledge about the actual limits used in a particular system.
As the limits are not necessary invariant, pathconf(2) and sysconf(3) should be used to determine the actual value of a limit at runtime. The manual pages of these two functions also contain a more detailed description of the limits available in NetBSD.
XSI LimitsAlso the X/Open System Interface Extension (XSI) specifies few limits. In NetBSD these are limited to LONG_BIT (the number of bits in long), WORD_BIT (the number of bits in a “word”), and few limits related to float and double.
SEE ALSOgetconf(1), pathconf(2), sysconf(3), types(3), unistd(3)
Richard W. Stevens and Stephen A. Rago, Advanced Programming in the UNIX Environment, Addison-Wesley, Second Edition, 2005.
|August 9, 2011||NetBSD 7.0|