/* Copyright 07/20/98 Sun Microsystems, Inc. All Rights Reserved */ #if !defined(__STD_CLIMITS) && !defined(__STD_LIMITS_H) #define __STD_CLIMITS // C++ Standard functions and types #include #include /* * Sizes of integral types */ #define CHAR_BIT 8 /* max # of bits in a "char" */ #define SCHAR_MIN (-128) /* min value of a "signed char" */ #define SCHAR_MAX 127 /* max value of a "signed char" */ #define UCHAR_MAX 255 /* max value of an "unsigned char" */ #define MB_LEN_MAX 5 #if defined(_CHAR_IS_SIGNED) #define CHAR_MIN SCHAR_MIN /* min value of a "char" */ #define CHAR_MAX SCHAR_MAX /* max value of a "char" */ #elif defined(_CHAR_IS_UNSIGNED) #define CHAR_MIN 0 /* min value of a "char" */ #define CHAR_MAX UCHAR_MAX /* max value of a "char" */ #else #error "chars are signed or unsigned" #endif #define SHRT_MIN (-32768) /* min value of a "short int" */ #define SHRT_MAX 32767 /* max value of a "short int" */ #define USHRT_MAX 65535 /* max value of "unsigned short int" */ #define INT_MIN (-2147483647-1) /* min value of an "int" */ #define INT_MAX 2147483647 /* max value of an "int" */ #define UINT_MAX 4294967295U /* max value of an "unsigned int" */ #if defined(_LP64) #define LONG_MIN (-9223372036854775807L-1L) /* min value of a "long int" */ #define LONG_MAX 9223372036854775807L /* max value of a "long int" */ #define ULONG_MAX 18446744073709551615UL /* max value of "unsigned long int" */ #else /* _ILP32 */ #define LONG_MIN (-2147483647L-1L) /* min value of a "long int" */ #define LONG_MAX 2147483647L /* max value of a "long int" */ #define ULONG_MAX 4294967295UL /* max value of "unsigned long int" */ #endif #define ATEXIT_MAX 32 /* max # funcs may register with atexit() */ #define _XOPEN_IOV_MAX 16 /* max # iovec/process with readv()/writev() */ #define IOV_MAX _XOPEN_IOV_MAX #if defined(__EXTENSIONS__) || (__STDC__ - 0 == 0 && \ !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) #define FCHR_MAX 1048576 /* max size of a file in bytes */ #define PID_MAX 99999 /* max value for a process ID */ /* * POSIX 1003.1a, section 2.9.5, table 2-5 contains [NAME_MAX] and the * related text states: * * A definition of one of the values from Table 2-5 shall be omitted from the * 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() (5.7.1) function. * * This is clear that any machine supporting multiple file system types * and/or a network can not include this define, regardless of protection * by the _POSIX_SOURCE and _POSIX_C_SOURCE flags. * * #define NAME_MAX 14 */ #define CHILD_MAX 25 /* max # of processes per user id */ #ifndef OPEN_MAX #define OPEN_MAX 64 /* max # of files a process can have open */ #endif #define PIPE_MAX 5120 /* max # bytes written to a pipe in a write */ #define STD_BLK 1024 /* # bytes in a physical I/O block */ #define UID_MAX 2147483647 /* max value for a user or group ID */ #define USI_MAX 4294967295 /* max decimal value of an "unsigned" */ #define SYSPID_MAX 1 /* max pid of system processes */ #ifndef SYS_NMLN /* also defined in sys/utsname.h */ #define SYS_NMLN 257 /* 4.0 size of utsname elements */ #endif #ifndef CLK_TCK typedef long clock_t; /* duplicate typedefs allowed in C++ */ extern "C" long _sysconf(int); /* System Private interface to sysconf() */ #define CLK_TCK ((clock_t)_sysconf(3)) /* 3 is _SC_CLK_TCK */ #endif #define LOGNAME_MAX 8 /* max # of characters in a login name */ #define TTYNAME_MAX 128 /* max # of characters in a tty name */ /* * Size constants for long long */ #define LLONG_MIN (-9223372036854775807LL-1LL) #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL #endif /* defined(__EXTENSIONS__) || (__STDC__ - 0 == 0 && ... */ #ifdef __cplusplus } #endif #endif /* __STD_limits */