(open_socket): Use SOCK_CLOEXEC and SOCK_NONBLOCK if possible.
[glibc/history.git] / include / limits.h
blob3e9a5df88a54412c2d09eab895493b06b9b762fe
1 /* Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2005
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
21 * ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h>
24 #ifndef _LIBC_LIMITS_H_
25 #define _LIBC_LIMITS_H_ 1
27 #include <features.h>
30 /* Maximum length of any multibyte character in any locale.
31 We define this value here since the gcc header does not define
32 the correct value. */
33 #define MB_LEN_MAX 16
36 /* If we are not using GNU CC we have to define all the symbols ourself.
37 Otherwise use gcc's definitions (see below). */
38 #if !defined __GNUC__ || __GNUC__ < 2
40 /* We only protect from multiple inclusion here, because all the other
41 #include's protect themselves, and in GCC 2 we may #include_next through
42 multiple copies of this file before we get to GCC's. */
43 # ifndef _LIMITS_H
44 # define _LIMITS_H 1
46 #include <bits/wordsize.h>
48 /* We don't have #include_next.
49 Define ANSI <limits.h> for standard 32-bit words. */
51 /* These assume 8-bit `char's, 16-bit `short int's,
52 and 32-bit `int's and `long int's. */
54 /* Number of bits in a `char'. */
55 # define CHAR_BIT 8
57 /* Minimum and maximum values a `signed char' can hold. */
58 # define SCHAR_MIN (-128)
59 # define SCHAR_MAX 127
61 /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
62 # define UCHAR_MAX 255
64 /* Minimum and maximum values a `char' can hold. */
65 # ifdef __CHAR_UNSIGNED__
66 # define CHAR_MIN 0
67 # define CHAR_MAX UCHAR_MAX
68 # else
69 # define CHAR_MIN SCHAR_MIN
70 # define CHAR_MAX SCHAR_MAX
71 # endif
73 /* Minimum and maximum values a `signed short int' can hold. */
74 # define SHRT_MIN (-32768)
75 # define SHRT_MAX 32767
77 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
78 # define USHRT_MAX 65535
80 /* Minimum and maximum values a `signed int' can hold. */
81 # define INT_MIN (-INT_MAX - 1)
82 # define INT_MAX 2147483647
84 /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
85 # define UINT_MAX 4294967295U
87 /* Minimum and maximum values a `signed long int' can hold. */
88 # if __WORDSIZE == 64
89 # define LONG_MAX 9223372036854775807L
90 # else
91 # define LONG_MAX 2147483647L
92 # endif
93 # define LONG_MIN (-LONG_MAX - 1L)
95 /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
96 # if __WORDSIZE == 64
97 # define ULONG_MAX 18446744073709551615UL
98 # else
99 # define ULONG_MAX 4294967295UL
100 # endif
102 # ifdef __USE_ISOC99
104 /* Minimum and maximum values a `signed long long int' can hold. */
105 # define LLONG_MAX 9223372036854775807LL
106 # define LLONG_MIN (-LLONG_MAX - 1LL)
108 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */
109 # define ULLONG_MAX 18446744073709551615ULL
111 # endif /* ISO C99 */
113 # endif /* limits.h */
114 #endif /* GCC 2. */
116 #endif /* !_LIBC_LIMITS_H_ */
118 /* Get the compiler's limits.h, which defines almost all the ISO constants.
120 We put this #include_next outside the double inclusion check because
121 it should be possible to include this file more than once and still get
122 the definitions from gcc's header. */
123 #if defined __GNUC__ && !defined _GCC_LIMITS_H_
124 /* `_GCC_LIMITS_H_' is what GCC's file defines. */
125 # include_next <limits.h>
126 #endif
128 /* The <limits.h> files in some gcc versions don't define LLONG_MIN,
129 LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for
130 ages are available. */
131 #if defined __USE_ISOC99 && defined __GNUC__
132 # ifndef LLONG_MIN
133 # define LLONG_MIN (-LLONG_MAX-1)
134 # endif
135 # ifndef LLONG_MAX
136 # define LLONG_MAX __LONG_LONG_MAX__
137 # endif
138 # ifndef ULLONG_MAX
139 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
140 # endif
141 #endif
143 #ifdef __USE_POSIX
144 /* POSIX adds things to <limits.h>. */
145 # include <bits/posix1_lim.h>
146 #endif
148 #ifdef __USE_POSIX2
149 # include <bits/posix2_lim.h>
150 #endif
152 #ifdef __USE_XOPEN
153 # include <bits/xopen_lim.h>
154 #endif