xref: /minix3/include/limits.h (revision 68db8ed0b9600e11489ca631e7ea24a6f5adb15f)
1 /* The <limits.h> header defines some basic sizes, both of the language types
2  * (e.g., the number of bits in an integer), and of the operating system (e.g.
3  * the number of characters in a file name.
4  */
5 
6 #ifndef _LIMITS_H
7 #define _LIMITS_H
8 
9 #include <minix/limits.h>
10 
11 /* Definitions about chars (8 bits in MINIX, and signed). */
12 #define CHAR_BIT           8	/* # bits in a char */
13 #define CHAR_MIN        -128	/* minimum value of a char */
14 #define CHAR_MAX         127	/* maximum value of a char */
15 #define SCHAR_MIN       -128	/* minimum value of a signed char */
16 #define SCHAR_MAX        127	/* maximum value of a signed char */
17 #define UCHAR_MAX        255	/* maximum value of an unsigned char */
18 #define MB_LEN_MAX         1	/* maximum length of a multibyte char */
19 
20 /* Definitions about shorts (16 bits in MINIX). */
21 #define SHRT_MIN  (-32767-1)	/* minimum value of a short */
22 #define SHRT_MAX       32767	/* maximum value of a short */
23 #define USHRT_MAX     0xFFFF	/* maximum value of unsigned short */
24 
25 /* _EM_WSIZE is a compiler-generated symbol giving the word size in bytes. */
26 #if _EM_WSIZE == 2
27 #define INT_MIN   (-32767-1)	/* minimum value of a 16-bit int */
28 #define INT_MAX        32767	/* maximum value of a 16-bit int */
29 #define UINT_MAX      0xFFFF	/* maximum value of an unsigned 16-bit int */
30 #endif
31 
32 #if _EM_WSIZE == 4
33 #define INT_MIN (-2147483647-1)	/* minimum value of a 32-bit int */
34 #define INT_MAX   2147483647	/* maximum value of a 32-bit int */
35 #define UINT_MAX  0xFFFFFFFF	/* maximum value of an unsigned 32-bit int */
36 #endif
37 
38 /*Definitions about longs (32 bits in MINIX). */
39 #define LONG_MIN (-2147483647L-1)/* minimum value of a long */
40 #define LONG_MAX  2147483647L	/* maximum value of a long */
41 #define ULONG_MAX 0xFFFFFFFFL	/* maximum value of an unsigned long */
42 
43 /*Definitions about long longs (64 bits, may not be supported). */
44 #ifdef __LONG_LONG_SUPPORTED
45 #define LLONG_MIN  (-0x7FFFFFFFFFFFFFFFLL-1)	/* minimum value of a
46 						 * long long
47 						 */
48 #define LLONG_MAX  0x7FFFFFFFFFFFFFFFLL		/* maximum value of a
49 						 * long long
50 						 */
51 #define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL	/* maximum value of an
52 						 * unsigned long long
53 						 */
54 #endif
55 
56 #include <minix/dir.h>
57 
58 /* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */
59 #ifdef _POSIX_SOURCE		/* these are only visible for POSIX */
60 #define _POSIX_ARG_MAX    4096	/* exec() may have 4K worth of args */
61 #define _POSIX_CHILD_MAX     6	/* a process may have 6 children */
62 #define _POSIX_LINK_MAX      8	/* a file may have 8 links */
63 #define _POSIX_MAX_CANON   255	/* size of the canonical input queue */
64 #define _POSIX_MAX_INPUT   255	/* you can type 255 chars ahead */
65 #define _POSIX_NAME_MAX DIRSIZ	/* max. file name length */
66 #define _POSIX_NGROUPS_MAX   8	/* max. number of supplemental groups */
67 
68 /* a process may have this many files open */
69 #define _POSIX_OPEN_MAX  __MINIX_OPEN_MAX
70 
71 /* a pathname may contain at most this many chars */
72 #define _POSIX_PATH_MAX    __MINIX_PATH_MAX
73 
74 #define _POSIX_PIPE_BUF    512	/* pipes writes of 512 bytes must be atomic */
75 #define _POSIX_STREAM_MAX    8	/* at least 8 FILEs can be open at once */
76 #define _POSIX_TZNAME_MAX    3	/* time zone names can be at least 3 chars */
77 #define _POSIX_SSIZE_MAX 32767	/* read() must support 32767 byte reads */
78 #define _POSIX_SYMLOOP_MAX   8	/* The number of symbolic links that can be
79 				 * traversed in the resolution of a pathname
80 				 * in the absence of a loop.
81 				 */
82 #define _POSIX_SYMLINK_MAX 255	/* The number of bytes in a symbolic link */
83 
84 /* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */
85 /* Some of these old names had better be defined when not POSIX. */
86 #define _NO_LIMIT          100	/* arbitrary number; limit not enforced */
87 
88 #define NGROUPS_MAX          8	/* max. number of supplemental groups */
89 #if _EM_WSIZE > 2
90 #define ARG_MAX          262144 /* # bytes of args + environ for exec() */
91 #else
92 #define ARG_MAX           4096	/* args + environ on small machines */
93 #endif
94 #define CHILD_MAX    _NO_LIMIT	/* MINIX does not limit children */
95 #define OPEN_MAX  __MINIX_OPEN_MAX	/* # open files a process may have */
96 #if 0			/* V1 file system */
97 #define LINK_MAX      CHAR_MAX	/* # links a file may have */
98 #else			/* V2 or better file system */
99 #define LINK_MAX      SHRT_MAX	/* # links a file may have */
100 #endif
101 #define MAX_CANON          255	/* size of the canonical input queue */
102 #define MAX_INPUT          255	/* size of the type-ahead buffer */
103 #define NAME_MAX        DIRSIZ	/* # chars in a file name */
104 #define PATH_MAX  __MINIX_PATH_MAX	/* # chars in a path name */
105 #define PIPE_BUF          7168	/* # bytes in atomic write to a pipe */
106 #define STREAM_MAX          20	/* must be the same as FOPEN_MAX in stdio.h */
107 #define TZNAME_MAX           3	/* maximum bytes in a time zone name is 3 */
108 #define SSIZE_MAX        32767	/* max defined byte count for read() */
109 #define SIZE_MAX      UINT_MAX
110 #define SYMLINK_MAX       1024 	/* # bytes in a symbolic link */
111 #define SYMLOOP_MAX	    16	/* maximum number of symbolic links that can
112 				 * be reliably traversed in the resolution of
113 				 * a pathname in the absence of a loop.
114 				 */
115 #define IOV_MAX        INT_MAX  /* maximum number of buffers for readv/writev */
116 #endif /* _POSIX_SOURCE */
117 
118 #endif /* _LIMITS_H */
119