(ELF_MACHINE_NO_RELA): Define unconditionally to defined RTLD_BOOTSTRAP.
[glibc-ports.git] / sysdeps / unix / sysv / sysv4 / sysconf.c
blobbfe7823c4c3bd1361182532e07fa52a7543b5dc9
1 /* Copyright (C) 1993,1995,1996,1997,2002,2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Brendan Kehoe (brendan@zen.org).
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. */
20 #include <errno.h>
21 #include <limits.h>
22 #include <unistd.h>
23 #include <stdio.h>
24 #include <time.h>
25 #include <sysconfig.h>
27 extern int __sysconfig (int);
29 /* Get the value of the system variable NAME. */
30 long int
31 __sysconf (name)
32 int name;
34 switch (name)
36 default:
37 __set_errno (EINVAL);
38 return -1;
40 case _SC_ARG_MAX:
41 #ifdef ARG_MAX
42 return ARG_MAX;
43 #else
44 return -1;
45 #endif
47 case _SC_CHILD_MAX:
48 #ifdef CHILD_MAX
49 return CHILD_MAX;
50 #else
51 return -1;
52 #endif
54 case _SC_CLK_TCK:
55 return __sysconfig (_CONFIG_CLK_TCK);
57 case _SC_NGROUPS_MAX:
58 #ifdef NGROUPS_MAX
59 return NGROUPS_MAX;
60 #else
61 return -1;
62 #endif
64 /* Both of these are looking for _CONFIG_OPEN_FILES. */
65 case _SC_OPEN_MAX:
66 case _SC_STREAM_MAX:
67 return __sysconfig (_CONFIG_OPEN_FILES);
69 case _SC_TZNAME_MAX:
70 return __tzname_max ();
72 case _SC_JOB_CONTROL:
73 #ifdef _POSIX_JOB_CONTROL
74 return 1;
75 #else
76 return -1;
77 #endif
79 case _SC_SAVED_IDS:
80 #ifdef _POSIX_SAVED_IDS
81 return 1;
82 #else
83 return -1;
84 #endif
86 case _SC_REALTIME_SIGNALS:
87 #ifdef _POSIX_REALTIME_SIGNALS
88 return 1;
89 #else
90 return -1;
91 #endif
93 case _SC_PRIORITY_SCHEDULING:
94 #ifdef _POSIX_PRIORITY_SCHEDULING
95 return 1;
96 #else
97 return -1;
98 #endif
100 case _SC_TIMERS:
101 #ifdef _POSIX_TIMERS
102 return 1;
103 #else
104 return -1;
105 #endif
107 case _SC_ASYNCHRONOUS_IO:
108 #ifdef _POSIX_ASYNCHRONOUS_IO
109 return 1;
110 #else
111 return -1;
112 #endif
114 case _SC_PRIORITIZED_IO:
115 #ifdef _POSIX_PRIORITIZED_IO
116 return 1;
117 #else
118 return -1;
119 #endif
121 case _SC_SYNCHRONIZED_IO:
122 #ifdef _POSIX_SYNCHRONIZED_IO
123 return 1;
124 #else
125 return -1;
126 #endif
128 case _SC_FSYNC:
129 #ifdef _POSIX_FSYNC
130 return 1;
131 #else
132 return -1;
133 #endif
135 case _SC_MAPPED_FILES:
136 #ifdef _POSIX_MAPPED_FILES
137 return 1;
138 #else
139 return -1;
140 #endif
142 case _SC_MEMLOCK:
143 #ifdef _POSIX_MEMLOCK
144 return 1;
145 #else
146 return -1;
147 #endif
149 case _SC_MEMLOCK_RANGE:
150 #ifdef _POSIX_MEMLOCK_RANGE
151 return 1;
152 #else
153 return -1;
154 #endif
156 case _SC_MEMORY_PROTECTION:
157 #ifdef _POSIX_MEMORY_PROTECTION
158 return 1;
159 #else
160 return -1;
161 #endif
163 case _SC_MESSAGE_PASSING:
164 #ifdef _POSIX_MESSAGE_PASSING
165 return 1;
166 #else
167 return -1;
168 #endif
170 case _SC_SEMAPHORES:
171 #ifdef _POSIX_SEMAPHORES
172 return 1;
173 #else
174 return -1;
175 #endif
177 case _SC_SHARED_MEMORY_OBJECTS:
178 #ifdef _POSIX_SHARED_MEMORY_OBJECTS
179 return 1;
180 #else
181 return -1;
182 #endif
184 case _SC_VERSION:
185 return _POSIX_VERSION;
187 case _SC_PAGESIZE:
188 return __sysconfig (_CONFIG_PAGESIZE);
190 case _SC_AIO_LISTIO_MAX:
191 #ifdef AIO_LISTIO_MAX
192 return AIO_LISTIO_MAX;
193 #else
194 return -1;
195 #endif
197 case _SC_AIO_MAX:
198 #ifdef AIO_MAX
199 return AIO_MAX;
200 #else
201 return -1;
202 #endif
204 case _SC_AIO_PRIO_DELTA_MAX:
205 #ifdef AIO_PRIO_DELTA_MAX
206 return AIO_PRIO_DELTA_MAX;
207 #else
208 return -1;
209 #endif
211 case _SC_DELAYTIMER_MAX:
212 #ifdef DELAYTIMER_MAX
213 return DELAYTIMER_MAX;
214 #else
215 return -1;
216 #endif
218 case _SC_MQ_OPEN_MAX:
219 #ifdef MQ_OPEN_MAX
220 return MQ_OPEN_MAX;
221 #else
222 return -1;
223 #endif
225 case _SC_MQ_PRIO_MAX:
226 #ifdef MQ_PRIO_MAX
227 return MQ_PRIO_MAX;
228 #else
229 return -1;
230 #endif
232 case _SC_RTSIG_MAX:
233 #ifdef RTSIG_MAX
234 return RTSIG_MAX;
235 #else
236 return -1;
237 #endif
239 case _SC_SEM_NSEMS_MAX:
240 #ifdef SEM_NSEMS_MAX
241 return SEM_NSEMS_MAX;
242 #else
243 return -1;
244 #endif
246 case _SC_SEM_VALUE_MAX:
247 #ifdef SEM_VALUE_MAX
248 return SEM_VALUE_MAX;
249 #else
250 return -1;
251 #endif
253 case _SC_SIGQUEUE_MAX:
254 #ifdef SIGQUEUE_MAX
255 return SIGQUEUE_MAX;
256 #else
257 return -1;
258 #endif
260 case _SC_TIMER_MAX:
261 #ifdef TIMER_MAX
262 return TIMER_MAX;
263 #else
264 return -1;
265 #endif
267 case _SC_BC_BASE_MAX:
268 #ifdef BC_BASE_MAX
269 return BC_BASE_MAX;
270 #else
271 return -1;
272 #endif
274 case _SC_BC_DIM_MAX:
275 #ifdef BC_DIM_MAX
276 return BC_DIM_MAX;
277 #else
278 return -1;
279 #endif
281 case _SC_BC_SCALE_MAX:
282 #ifdef BC_SCALE_MAX
283 return BC_SCALE_MAX;
284 #else
285 return -1;
286 #endif
288 case _SC_BC_STRING_MAX:
289 #ifdef BC_STRING_MAX
290 return BC_STRING_MAX;
291 #else
292 return -1;
293 #endif
295 case _SC_EQUIV_CLASS_MAX:
296 #ifdef EQUIV_CLASS_MAX
297 return EQUIV_CLASS_MAX;
298 #else
299 return -1;
300 #endif
302 case _SC_EXPR_NEST_MAX:
303 #ifdef EXPR_NEST_MAX
304 return EXPR_NEST_MAX;
305 #else
306 return -1;
307 #endif
309 case _SC_LINE_MAX:
310 #ifdef LINE_MAX
311 return LINE_MAX;
312 #else
313 return -1;
314 #endif
316 case _SC_RE_DUP_MAX:
317 #ifdef RE_DUP_MAX
318 return RE_DUP_MAX;
319 #else
320 return -1;
321 #endif
323 case _SC_CHARCLASS_NAME_MAX:
324 #ifdef CHARCLASS_NAME_MAX
325 return CHARCLASS_NAME_MAX;
326 #else
327 return -1;
328 #endif
330 case _SC_2_VERSION:
331 /* This is actually supposed to return the version
332 of the 1003.2 utilities on the system {POSIX2_VERSION}. */
333 return _POSIX2_C_VERSION;
335 case _SC_2_C_BIND:
336 #ifdef _POSIX2_C_BIND
337 return _POSIX2_C_BIND;
338 #else
339 return -1;
340 #endif
342 case _SC_2_C_DEV:
343 #ifdef _POSIX2_C_DEV
344 return _POSIX2_C_DEV;
345 #else
346 return -1;
347 #endif
349 case _SC_2_FORT_DEV:
350 #ifdef _POSIX2_FORT_DEV
351 return _POSIX2_FORT_DEV;
352 #else
353 return -1;
354 #endif
356 case _SC_2_SW_DEV:
357 #ifdef _POSIX2_SW_DEV
358 return _POSIX2_SW_DEV;
359 #else
360 return -1;
361 #endif
365 weak_alias (__sysconf, sysconf)
366 libc_hidden_def (__sysconf)