* sysdeps/mach/hurd/i386/tls.h (THREAD_DTV): Changed type of _DTV
[glibc.git] / sysdeps / posix / sysconf.c
blobd1286a06fe12ecb8635fc637eaf27163877fb034
1 /* Copyright (C) 1991,1993,1995-1997,1999-2003,2004
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. */
20 #include <errno.h>
21 #include <limits.h>
22 #include <grp.h>
23 #include <pwd.h>
24 #include <stddef.h>
25 #include <stdio.h>
26 #include <time.h>
27 #include <unistd.h>
28 #include <sys/param.h>
29 #include <sys/sysinfo.h>
30 #include <sys/types.h>
31 #include <regex.h>
34 /* Get the value of the system variable NAME. */
35 long int
36 __sysconf (name)
37 int name;
39 switch (name)
41 /* Also add obsolete or unnecessarily added constants here. */
42 case _SC_EQUIV_CLASS_MAX:
43 default:
44 __set_errno (EINVAL);
45 return -1;
47 case _SC_ARG_MAX:
48 #ifdef ARG_MAX
49 return ARG_MAX;
50 #else
51 return -1;
52 #endif
54 case _SC_CHILD_MAX:
55 #ifdef CHILD_MAX
56 return CHILD_MAX;
57 #else
58 return -1;
59 #endif
61 case _SC_CLK_TCK:
62 return __getclktck ();
64 case _SC_NGROUPS_MAX:
65 #ifdef NGROUPS_MAX
66 return NGROUPS_MAX;
67 #else
68 return -1;
69 #endif
71 case _SC_OPEN_MAX:
72 return __getdtablesize ();
74 case _SC_STREAM_MAX:
75 #ifdef STREAM_MAX
76 return STREAM_MAX;
77 #else
78 return FOPEN_MAX;
79 #endif
81 case _SC_TZNAME_MAX:
82 return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
84 case _SC_JOB_CONTROL:
85 #ifdef _POSIX_JOB_CONTROL
86 return 1;
87 #else
88 return -1;
89 #endif
91 case _SC_SAVED_IDS:
92 #ifdef _POSIX_SAVED_IDS
93 return 1;
94 #else
95 return -1;
96 #endif
98 case _SC_REALTIME_SIGNALS:
99 #ifdef _POSIX_REALTIME_SIGNALS
100 return _POSIX_REALTIME_SIGNALS;
101 #else
102 return -1;
103 #endif
105 case _SC_PRIORITY_SCHEDULING:
106 #ifdef _POSIX_PRIORITY_SCHEDULING
107 return _POSIX_PRIORITY_SCHEDULING;
108 #else
109 return -1;
110 #endif
112 case _SC_TIMERS:
113 #ifdef _POSIX_TIMERS
114 return _POSIX_TIMERS;
115 #else
116 return -1;
117 #endif
119 case _SC_ASYNCHRONOUS_IO:
120 #ifdef _POSIX_ASYNCHRONOUS_IO
121 return _POSIX_ASYNCHRONOUS_IO;
122 #else
123 return -1;
124 #endif
126 case _SC_PRIORITIZED_IO:
127 #ifdef _POSIX_PRIORITIZED_IO
128 return _POSIX_PRIORITIZED_IO;
129 #else
130 return -1;
131 #endif
133 case _SC_SYNCHRONIZED_IO:
134 #ifdef _POSIX_SYNCHRONIZED_IO
135 return _POSIX_SYNCHRONIZED_IO;
136 #else
137 return -1;
138 #endif
140 case _SC_FSYNC:
141 #ifdef _POSIX_FSYNC
142 return _POSIX_FSYNC;
143 #else
144 return -1;
145 #endif
147 case _SC_MAPPED_FILES:
148 #ifdef _POSIX_MAPPED_FILES
149 return _POSIX_MAPPED_FILES;
150 #else
151 return -1;
152 #endif
154 case _SC_MEMLOCK:
155 #ifdef _POSIX_MEMLOCK
156 return _POSIX_MEMLOCK;
157 #else
158 return -1;
159 #endif
161 case _SC_MEMLOCK_RANGE:
162 #ifdef _POSIX_MEMLOCK_RANGE
163 return _POSIX_MEMLOCK_RANGE;
164 #else
165 return -1;
166 #endif
168 case _SC_MEMORY_PROTECTION:
169 #ifdef _POSIX_MEMORY_PROTECTION
170 return _POSIX_MEMORY_PROTECTION;
171 #else
172 return -1;
173 #endif
175 case _SC_MESSAGE_PASSING:
176 #ifdef _POSIX_MESSAGE_PASSING
177 return _POSIX_MESSAGE_PASSING;
178 #else
179 return -1;
180 #endif
182 case _SC_SEMAPHORES:
183 #ifdef _POSIX_SEMAPHORES
184 return _POSIX_SEMAPHORES;
185 #else
186 return -1;
187 #endif
189 case _SC_SHARED_MEMORY_OBJECTS:
190 #ifdef _POSIX_SHARED_MEMORY_OBJECTS
191 return _POSIX_SHARED_MEMORY_OBJECTS;
192 #else
193 return -1;
194 #endif
196 case _SC_VERSION:
197 return _POSIX_VERSION;
199 case _SC_PAGESIZE:
200 return __getpagesize ();
202 case _SC_AIO_LISTIO_MAX:
203 #ifdef AIO_LISTIO_MAX
204 return AIO_LISTIO_MAX;
205 #else
206 return -1;
207 #endif
209 case _SC_AIO_MAX:
210 #ifdef AIO_MAX
211 return AIO_MAX;
212 #else
213 return -1;
214 #endif
216 case _SC_AIO_PRIO_DELTA_MAX:
217 #ifdef AIO_PRIO_DELTA_MAX
218 return AIO_PRIO_DELTA_MAX;
219 #else
220 return -1;
221 #endif
223 case _SC_DELAYTIMER_MAX:
224 #ifdef DELAYTIMER_MAX
225 return DELAYTIMER_MAX;
226 #else
227 return -1;
228 #endif
230 case _SC_MQ_OPEN_MAX:
231 #ifdef MQ_OPEN_MAX
232 return MQ_OPEN_MAX;
233 #else
234 return -1;
235 #endif
237 case _SC_MQ_PRIO_MAX:
238 #ifdef MQ_PRIO_MAX
239 return MQ_PRIO_MAX;
240 #else
241 return -1;
242 #endif
244 case _SC_RTSIG_MAX:
245 #ifdef RTSIG_MAX
246 return RTSIG_MAX;
247 #else
248 return -1;
249 #endif
251 case _SC_SEM_NSEMS_MAX:
252 #ifdef SEM_NSEMS_MAX
253 return SEM_NSEMS_MAX;
254 #else
255 return -1;
256 #endif
258 case _SC_SEM_VALUE_MAX:
259 #ifdef SEM_VALUE_MAX
260 return SEM_VALUE_MAX;
261 #else
262 return -1;
263 #endif
265 case _SC_SIGQUEUE_MAX:
266 #ifdef SIGQUEUE_MAX
267 return SIGQUEUE_MAX;
268 #else
269 return -1;
270 #endif
272 case _SC_TIMER_MAX:
273 #ifdef TIMER_MAX
274 return TIMER_MAX;
275 #else
276 return -1;
277 #endif
279 case _SC_BC_BASE_MAX:
280 #ifdef BC_BASE_MAX
281 return BC_BASE_MAX;
282 #else
283 return -1;
284 #endif
286 case _SC_BC_DIM_MAX:
287 #ifdef BC_DIM_MAX
288 return BC_DIM_MAX;
289 #else
290 return -1;
291 #endif
293 case _SC_BC_SCALE_MAX:
294 #ifdef BC_SCALE_MAX
295 return BC_SCALE_MAX;
296 #else
297 return -1;
298 #endif
300 case _SC_BC_STRING_MAX:
301 #ifdef BC_STRING_MAX
302 return BC_STRING_MAX;
303 #else
304 return -1;
305 #endif
307 case _SC_COLL_WEIGHTS_MAX:
308 #ifdef COLL_WEIGHTS_MAX
309 return COLL_WEIGHTS_MAX;
310 #else
311 return -1;
312 #endif
314 case _SC_EXPR_NEST_MAX:
315 #ifdef EXPR_NEST_MAX
316 return EXPR_NEST_MAX;
317 #else
318 return -1;
319 #endif
321 case _SC_LINE_MAX:
322 #ifdef LINE_MAX
323 return LINE_MAX;
324 #else
325 return -1;
326 #endif
328 case _SC_RE_DUP_MAX:
329 #ifdef RE_DUP_MAX
330 return RE_DUP_MAX;
331 #else
332 return -1;
333 #endif
335 case _SC_CHARCLASS_NAME_MAX:
336 #ifdef CHARCLASS_NAME_MAX
337 return CHARCLASS_NAME_MAX;
338 #else
339 return -1;
340 #endif
342 case _SC_PII:
343 #ifdef _POSIX_PII
344 return 1;
345 #else
346 return -1;
347 #endif
349 case _SC_PII_XTI:
350 #ifdef _POSIX_PII_XTI
351 return 1;
352 #else
353 return -1;
354 #endif
356 case _SC_PII_SOCKET:
357 #ifdef _POSIX_PII_SOCKET
358 return 1;
359 #else
360 return -1;
361 #endif
363 case _SC_PII_INTERNET:
364 #ifdef _POSIX_PII_INTERNET
365 return 1;
366 #else
367 return -1;
368 #endif
370 case _SC_PII_OSI:
371 #ifdef _POSIX_PII_OSI
372 return 1;
373 #else
374 return -1;
375 #endif
377 case _SC_POLL:
378 #ifdef _POSIX_POLL
379 return 1;
380 #else
381 return -1;
382 #endif
384 case _SC_SELECT:
385 #ifdef _POSIX_SELECT
386 return 1;
387 #else
388 return -1;
389 #endif
391 /* The same as _SC_IOV_MAX. */
392 case _SC_UIO_MAXIOV:
393 #ifdef UIO_MAXIOV
394 return UIO_MAXIOV;
395 #else
396 return -1;
397 #endif
399 case _SC_PII_INTERNET_STREAM:
400 #ifdef _POSIX_PII_INTERNET_STREAM
401 return 1;
402 #else
403 return -1;
404 #endif
406 case _SC_PII_INTERNET_DGRAM:
407 #ifdef _POSIX_PII_INTERNET_DGRAM
408 return 1;
409 #else
410 return -1;
411 #endif
413 case _SC_PII_OSI_COTS:
414 #ifdef _POSIX_PII_OSI_COTS
415 return 1;
416 #else
417 return -1;
418 #endif
420 case _SC_PII_OSI_CLTS:
421 #ifdef _POSIX_PII_OSI_CLTS
422 return 1;
423 #else
424 return -1;
425 #endif
427 case _SC_PII_OSI_M:
428 #ifdef _POSIX_PII_OSI_M
429 return 1;
430 #else
431 return -1;
432 #endif
434 case _SC_T_IOV_MAX:
435 #ifdef _T_IOV_MAX
436 return _T_IOV_MAX;
437 #else
438 return -1;
439 #endif
441 case _SC_2_VERSION:
442 return _POSIX2_VERSION;
444 case _SC_2_C_BIND:
445 #ifdef _POSIX2_C_BIND
446 return _POSIX2_C_BIND;
447 #else
448 return -1;
449 #endif
451 case _SC_2_C_DEV:
452 #ifdef _POSIX2_C_DEV
453 return _POSIX2_C_DEV;
454 #else
455 return -1;
456 #endif
458 case _SC_2_C_VERSION:
459 #ifdef _POSIX2_C_VERSION
460 return _POSIX2_C_VERSION;
461 #else
462 return -1;
463 #endif
465 case _SC_2_FORT_DEV:
466 #ifdef _POSIX2_FORT_DEV
467 return _POSIX2_FORT_DEV;
468 #else
469 return -1;
470 #endif
472 case _SC_2_FORT_RUN:
473 #ifdef _POSIX2_FORT_RUN
474 return _POSIX2_FORT_RUN;
475 #else
476 return -1;
477 #endif
479 case _SC_2_LOCALEDEF:
480 #ifdef _POSIX2_LOCALEDEF
481 return _POSIX2_LOCALEDEF;
482 #else
483 return -1;
484 #endif
486 case _SC_2_SW_DEV:
487 #ifdef _POSIX2_SW_DEV
488 return _POSIX2_SW_DEV;
489 #else
490 return -1;
491 #endif
493 case _SC_2_CHAR_TERM:
494 #ifdef _POSIX2_CHAR_TERM
495 return _POSIX2_CHAR_TERM;
496 #else
497 return -1;
498 #endif
500 case _SC_2_UPE:
501 #ifdef _POSIX2_UPE
502 return _POSIX2_UPE;
503 #else
504 return -1;
505 #endif
507 /* POSIX 1003.1c (POSIX Threads). */
508 case _SC_THREADS:
509 #ifdef _POSIX_THREADS
510 return _POSIX_THREADS;
511 #else
512 return -1;
513 #endif
515 case _SC_THREAD_SAFE_FUNCTIONS:
516 #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
517 return _POSIX_THREAD_SAFE_FUNCTIONS;
518 #else
519 return -1;
520 #endif
522 case _SC_GETGR_R_SIZE_MAX:
523 return NSS_BUFLEN_GROUP;
525 case _SC_GETPW_R_SIZE_MAX:
526 return NSS_BUFLEN_PASSWD;
528 case _SC_LOGIN_NAME_MAX:
529 #ifdef LOGIN_NAME_MAX
530 return LOGIN_NAME_MAX;
531 #else
532 return -1;
533 #endif
535 case _SC_TTY_NAME_MAX:
536 #ifdef TTY_NAME_MAX
537 return TTY_NAME_MAX;
538 #else
539 return -1;
540 #endif
542 case _SC_THREAD_DESTRUCTOR_ITERATIONS:
543 #ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
544 return _POSIX_THREAD_DESTRUCTOR_ITERATIONS;
545 #else
546 return -1;
547 #endif
549 case _SC_THREAD_KEYS_MAX:
550 #ifdef PTHREAD_KEYS_MAX
551 return PTHREAD_KEYS_MAX;
552 #else
553 return -1;
554 #endif
556 case _SC_THREAD_STACK_MIN:
557 #ifdef PTHREAD_STACK_MIN
558 return PTHREAD_STACK_MIN;
559 #else
560 return -1;
561 #endif
563 case _SC_THREAD_THREADS_MAX:
564 #ifdef PTHREAD_THREADS_MAX
565 return PTHREAD_THREADS_MAX;
566 #else
567 return -1;
568 #endif
570 case _SC_THREAD_ATTR_STACKADDR:
571 #ifdef _POSIX_THREAD_ATTR_STACKADDR
572 return _POSIX_THREAD_ATTR_STACKADDR;
573 #else
574 return -1;
575 #endif
577 case _SC_THREAD_ATTR_STACKSIZE:
578 #ifdef _POSIX_THREAD_ATTR_STACKSIZE
579 return _POSIX_THREAD_ATTR_STACKSIZE;
580 #else
581 return -1;
582 #endif
584 case _SC_THREAD_PRIORITY_SCHEDULING:
585 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
586 return _POSIX_THREAD_PRIORITY_SCHEDULING;
587 #else
588 return -1;
589 #endif
591 case _SC_THREAD_PRIO_INHERIT:
592 #ifdef _POSIX_THREAD_PRIO_INHERIT
593 return _POSIX_THREAD_PRIO_INHERIT;
594 #else
595 return -1;
596 #endif
598 case _SC_THREAD_PRIO_PROTECT:
599 #ifdef _POSIX_THREAD_PRIO_PROTECT
600 return _POSIX_THREAD_PRIO_PROTECT;
601 #else
602 return -1;
603 #endif
605 case _SC_THREAD_PROCESS_SHARED:
606 #ifdef _POSIX_THREAD_PROCESS_SHARED
607 return _POSIX_THREAD_PROCESS_SHARED;
608 #else
609 return -1;
610 #endif
612 case _SC_NPROCESSORS_CONF:
613 return __get_nprocs_conf ();
615 case _SC_NPROCESSORS_ONLN:
616 return __get_nprocs ();
618 case _SC_PHYS_PAGES:
619 return __get_phys_pages ();
621 case _SC_AVPHYS_PAGES:
622 return __get_avphys_pages ();
624 case _SC_ATEXIT_MAX:
625 /* We have no limit since we use lists. */
626 return INT_MAX;
628 case _SC_PASS_MAX:
629 /* We have no limit but since the return value might be used to
630 allocate a buffer we restrict the value. */
631 return BUFSIZ;
633 case _SC_XOPEN_VERSION:
634 return _XOPEN_VERSION;
636 case _SC_XOPEN_XCU_VERSION:
637 return _XOPEN_XCU_VERSION;
639 case _SC_XOPEN_UNIX:
640 return _XOPEN_UNIX;
642 case _SC_XOPEN_CRYPT:
643 #ifdef _XOPEN_CRYPT
644 return _XOPEN_CRYPT;
645 #else
646 return -1;
647 #endif
649 case _SC_XOPEN_ENH_I18N:
650 #ifdef _XOPEN_ENH_I18N
651 return _XOPEN_ENH_I18N;
652 #else
653 return -1;
654 #endif
656 case _SC_XOPEN_SHM:
657 #ifdef _XOPEN_SHM
658 return _XOPEN_SHM;
659 #else
660 return -1;
661 #endif
663 case _SC_XOPEN_XPG2:
664 #ifdef _XOPEN_XPG2
665 return _XOPEN_XPG2;
666 #else
667 return -1;
668 #endif
670 case _SC_XOPEN_XPG3:
671 #ifdef _XOPEN_XPG3
672 return _XOPEN_XPG3;
673 #else
674 return -1;
675 #endif
677 case _SC_XOPEN_XPG4:
678 #ifdef _XOPEN_XPG4
679 return _XOPEN_XPG4;
680 #else
681 return -1;
682 #endif
684 case _SC_CHAR_BIT:
685 return CHAR_BIT;
687 case _SC_CHAR_MAX:
688 return CHAR_MAX;
690 case _SC_CHAR_MIN:
691 return CHAR_MIN;
693 case _SC_INT_MAX:
694 return INT_MAX;
696 case _SC_INT_MIN:
697 return INT_MIN;
699 case _SC_LONG_BIT:
700 return sizeof (long int) * CHAR_BIT;
702 case _SC_WORD_BIT:
703 return sizeof (int) * CHAR_BIT;
705 case _SC_MB_LEN_MAX:
706 return MB_LEN_MAX;
708 case _SC_NZERO:
709 return NZERO;
711 case _SC_SSIZE_MAX:
712 return _POSIX_SSIZE_MAX;
714 case _SC_SCHAR_MAX:
715 return SCHAR_MAX;
717 case _SC_SCHAR_MIN:
718 return SCHAR_MIN;
720 case _SC_SHRT_MAX:
721 return SHRT_MAX;
723 case _SC_SHRT_MIN:
724 return SHRT_MIN;
726 case _SC_UCHAR_MAX:
727 return UCHAR_MAX;
729 case _SC_UINT_MAX:
730 return UINT_MAX;
732 case _SC_ULONG_MAX:
733 return ULONG_MAX;
735 case _SC_USHRT_MAX:
736 return USHRT_MAX;
738 case _SC_NL_ARGMAX:
739 #ifdef NL_ARGMAX
740 return NL_ARGMAX;
741 #else
742 return -1;
743 #endif
745 case _SC_NL_LANGMAX:
746 #ifdef NL_LANGMAX
747 return NL_LANGMAX;
748 #else
749 return -1;
750 #endif
752 case _SC_NL_MSGMAX:
753 #ifdef NL_MSGMAX
754 return NL_MSGMAX;
755 #else
756 return -1;
757 #endif
759 case _SC_NL_NMAX:
760 #ifdef NL_NMAX
761 return NL_NMAX;
762 #else
763 return -1;
764 #endif
766 case _SC_NL_SETMAX:
767 #ifdef NL_SETMAX
768 return NL_SETMAX;
769 #else
770 return -1;
771 #endif
773 case _SC_NL_TEXTMAX:
774 #ifdef NL_TEXTMAX
775 return NL_TEXTMAX;
776 #else
777 return -1;
778 #endif
780 case _SC_XBS5_ILP32_OFF32:
781 #ifdef _XBS5_ILP32_OFF32
782 return _XBS5_ILP32_OFF32;
783 #else
784 return -1;
785 #endif
786 case _SC_XBS5_ILP32_OFFBIG:
787 #ifdef _XBS5_ILP32_OFFBIG
788 return _XBS5_ILP32_OFFBIG;
789 #else
790 return -1;
791 #endif
792 case _SC_XBS5_LP64_OFF64:
793 #ifdef _XBS5_LP64_OFF64
794 return _XBS5_LP64_OFF64;
795 #else
796 return -1;
797 #endif
798 case _SC_XBS5_LPBIG_OFFBIG:
799 #ifdef _XBS5_LPBIG_OFFBIG
800 return _XBS5_LPBIG_OFFBIG;
801 #else
802 return -1;
803 #endif
805 case _SC_V6_ILP32_OFF32:
806 #ifdef _POSIX_V6_ILP32_OFF32
807 return _POSIX_V6_ILP32_OFF32;
808 #else
809 return -1;
810 #endif
811 case _SC_V6_ILP32_OFFBIG:
812 #ifdef _POSIX_V6_ILP32_OFFBIG
813 return _POSIX_V6_ILP32_OFFBIG;
814 #else
815 return -1;
816 #endif
817 case _SC_V6_LP64_OFF64:
818 #ifdef _POSIX_V6_LP64_OFF64
819 return _POSIX_V6_LP64_OFF64;
820 #else
821 return -1;
822 #endif
823 case _SC_V6_LPBIG_OFFBIG:
824 #ifdef _POSIX_V6_LPBIG_OFFBIG
825 return _POSIX_V6_LPBIG_OFFBIG;
826 #else
827 return -1;
828 #endif
830 case _SC_XOPEN_LEGACY:
831 return _XOPEN_LEGACY;
833 case _SC_XOPEN_REALTIME:
834 #ifdef _XOPEN_REALTIME
835 return _XOPEN_REALTIME;
836 #else
837 return -1;
838 #endif
839 case _SC_XOPEN_REALTIME_THREADS:
840 #ifdef _XOPEN_REALTIME_THREADS
841 return _XOPEN_REALTIME_THREADS;
842 #else
843 return -1;
844 #endif
846 case _SC_ADVISORY_INFO:
847 #ifdef _POSIX_ADVISORY_INFO
848 return _POSIX_ADVISORY_INFO;
849 #else
850 return -1;
851 #endif
853 case _SC_BARRIERS:
854 #ifdef _POSIX_BARRIERS
855 return _POSIX_BARRIERS;
856 #else
857 return -1;
858 #endif
860 case _SC_BASE:
861 #ifdef _POSIX_BASE
862 return _POSIX_BASE;
863 #else
864 return -1;
865 #endif
866 case _SC_C_LANG_SUPPORT:
867 #ifdef _POSIX_C_LANG_SUPPORT
868 return _POSIX_C_LANG_SUPPORT;
869 #else
870 return -1;
871 #endif
872 case _SC_C_LANG_SUPPORT_R:
873 #ifdef _POSIX_C_LANG_SUPPORT_R
874 return _POSIX_C_LANG_SUPPORT_R;
875 #else
876 return -1;
877 #endif
879 case _SC_CLOCK_SELECTION:
880 #ifdef _POSIX_CLOCK_SELECTION
881 return _POSIX_CLOCK_SELECTION;
882 #else
883 return -1;
884 #endif
886 case _SC_CPUTIME:
887 #ifdef _POSIX_CPUTIME
888 return _POSIX_CPUTIME;
889 #else
890 return -1;
891 #endif
893 case _SC_DEVICE_IO:
894 #ifdef _POSIX_DEVICE_IO
895 return _POSIX_DEVICE_IO;
896 #else
897 return -1;
898 #endif
899 case _SC_DEVICE_SPECIFIC:
900 #ifdef _POSIX_DEVICE_SPCIFIC
901 return _POSIX_DEVICE_SPECIFIC;
902 #else
903 return -1;
904 #endif
905 case _SC_DEVICE_SPECIFIC_R:
906 #ifdef _POSIX_DEVICE_SPCIFIC_R
907 return _POSIX_DEVICE_SPECIFIC_R;
908 #else
909 return -1;
910 #endif
912 case _SC_FD_MGMT:
913 #ifdef _POSIX_FD_MGMT
914 return _POSIX_FD_MGMT;
915 #else
916 return -1;
917 #endif
919 case _SC_FIFO:
920 #ifdef _POSIX_FIFO
921 return _POSIX_FIFO;
922 #else
923 return -1;
924 #endif
925 case _SC_PIPE:
926 #ifdef _POSIX_PIPE
927 return _POSIX_PIPE;
928 #else
929 return -1;
930 #endif
932 case _SC_FILE_ATTRIBUTES:
933 #ifdef _POSIX_FILE_ATTRIBUTES
934 return _POSIX_FILE_ATTRIBUTES;
935 #else
936 return -1;
937 #endif
938 case _SC_FILE_LOCKING:
939 #ifdef _POSIX_FILE_LOCKING
940 return _POSIX_FILE_LOCKING;
941 #else
942 return -1;
943 #endif
944 case _SC_FILE_SYSTEM:
945 #ifdef _POSIX_FILE_SYSTEM
946 return _POSIX_FILE_SYSTEM;
947 #else
948 return -1;
949 #endif
951 case _SC_MONOTONIC_CLOCK:
952 #if _POSIX_MONOTONIC_CLOCK
953 return _POSIX_MONOTONIC_CLOCK;
954 #else
955 return -1;
956 #endif
958 case _SC_MULTI_PROCESS:
959 #ifdef _POSIX_MULTI_PROCESS
960 return _POSIX_MULTI_PROCESS;
961 #else
962 return -1;
963 #endif
964 case _SC_SINGLE_PROCESS:
965 #ifdef _POSIX_SINGLE_PROCESS
966 return _POSIX_SINGLE_PROCESS;
967 #else
968 return -1;
969 #endif
971 case _SC_NETWORKING:
972 #ifdef _POSIX_NETWORKING
973 return _POSIX_NETWORKING;
974 #else
975 return -1;
976 #endif
978 case _SC_READER_WRITER_LOCKS:
979 #ifdef _POSIX_READER_WRITER_LOCKS
980 return _POSIX_READER_WRITER_LOCKS;
981 #else
982 return -1;
983 #endif
984 case _SC_SPIN_LOCKS:
985 #ifdef _POSIX_SPIN_LOCKS
986 return _POSIX_SPIN_LOCKS;
987 #else
988 return -1;
989 #endif
991 case _SC_REGEXP:
992 #ifdef _POSIX_REGEXP
993 return _POSIX_REGEXP;
994 #else
995 return -1;
996 #endif
997 case _SC_REGEX_VERSION:
998 #ifdef _POSIX_REGEX_VERSION
999 return _POSIX_REGEX_VERSION;
1000 #else
1001 return -1;
1002 #endif
1004 case _SC_SHELL:
1005 #ifdef _POSIX_SHELL
1006 return _POSIX_SHELL;
1007 #else
1008 return -1;
1009 #endif
1011 case _SC_SIGNALS:
1012 #ifdef _POSUX_SIGNALS
1013 return _POSIX_SIGNALS;
1014 #else
1015 return -1;
1016 #endif
1018 case _SC_SPAWN:
1019 #ifdef _POSIX_SPAWN
1020 return _POSIX_SPAWN;
1021 #else
1022 return -1;
1023 #endif
1025 case _SC_SPORADIC_SERVER:
1026 #ifdef _POSIX_SPORADIC_SERVER
1027 return _POSIX_SPORADIC_SERVER;
1028 #else
1029 return -1;
1030 #endif
1031 case _SC_THREAD_SPORADIC_SERVER:
1032 #ifdef _POSIX_THREAD_SPORADIC_SERVER
1033 return _POSIX_THREAD_SPORADIC_SERVER;
1034 #else
1035 return -1;
1036 #endif
1038 case _SC_SYSTEM_DATABASE:
1039 #ifdef _POSIX_SYSTEM_DATABASE
1040 return _POSIX_SYSTEM_DATABASE;
1041 #else
1042 return -1;
1043 #endif
1044 case _SC_SYSTEM_DATABASE_R:
1045 #ifdef _POSIX_SYSTEM_DATABASE_R
1046 return _POSIX_SYSTEM_DATABASE_R;
1047 #else
1048 return -1;
1049 #endif
1051 case _SC_THREAD_CPUTIME:
1052 #ifdef _POSIX_THREAD_CPUTIME
1053 return _POSIX_THREAD_CPUTIME;
1054 #else
1055 return -1;
1056 #endif
1058 case _SC_TIMEOUTS:
1059 #ifdef _POSIX_TIMEOUTS
1060 return _POSIX_TIMEOUTS;
1061 #else
1062 return -1;
1063 #endif
1065 case _SC_TYPED_MEMORY_OBJECTS:
1066 #ifdef _POSIX_TYPED_MEMORY_OBJECTS
1067 return _POSIX_TYPED_MEMORY_OBJECTS;
1068 #else
1069 return -1;
1070 #endif
1072 case _SC_USER_GROUPS:
1073 #ifdef _POSIX_USER_GROUPS
1074 return _POSIX_USER_GROUPS;
1075 #else
1076 return -1;
1077 #endif
1078 case _SC_USER_GROUPS_R:
1079 #ifdef _POSIX_USER_GROUPS_R
1080 return _POSIX_USER_GROUPS_R;
1081 #else
1082 return -1;
1083 #endif
1085 case _SC_2_PBS:
1086 #ifdef _POSIX2_PBS
1087 return _POSIX2_PBS;
1088 #else
1089 return -1;
1090 #endif
1091 case _SC_2_PBS_ACCOUNTING:
1092 #ifdef _POSIX2_PBS_ACCOUNTING
1093 return _POSIX2_PBS_ACCOUNTING;
1094 #else
1095 return -1;
1096 #endif
1097 case _SC_2_PBS_CHECKPOINT:
1098 #ifdef _POSIX2_PBS_CHECKPOINT
1099 return _POSIX2_PBS_CHECKPOINT;
1100 #else
1101 return -1;
1102 #endif
1103 case _SC_2_PBS_LOCATE:
1104 #ifdef _POSIX2_PBS_LOCATE
1105 return _POSIX2_PBS_LOCATE;
1106 #else
1107 return -1;
1108 #endif
1109 case _SC_2_PBS_MESSAGE:
1110 #ifdef _POSIX2_PBS_MESSAGE
1111 return _POSIX2_PBS_MESSAGE;
1112 #else
1113 return -1;
1114 #endif
1115 case _SC_2_PBS_TRACK:
1116 #ifdef _POSIX2_PBS_TRACK
1117 return _POSIX2_PBS_TRACK;
1118 #else
1119 return -1;
1120 #endif
1122 case _SC_SYMLOOP_MAX:
1123 #ifdef SYMLOOP_MAX
1124 return SYMLOOP_MAX;
1125 #else
1126 return -1;
1127 #endif
1129 case _SC_STREAMS:
1130 #ifdef _XOPEN_STREAMS
1131 return _XOPEN_STREAMS;
1132 #else
1133 return -1;
1134 #endif
1136 case _SC_HOST_NAME_MAX:
1137 #ifdef HOST_NAME_MAX
1138 return HOST_NAME_MAX;
1139 #else
1140 return -1;
1141 #endif
1143 case _SC_TRACE:
1144 #ifdef _POSIX_TRACE
1145 return _POSIX_TRACE;
1146 #else
1147 return -1;
1148 #endif
1149 case _SC_TRACE_EVENT_FILTER:
1150 #ifdef _POSIX_TRACE_EVENT_FILTER
1151 return _POSIX_TRACE_EVENT_FILTER;
1152 #else
1153 return -1;
1154 #endif
1155 case _SC_TRACE_INHERIT:
1156 #ifdef _POSIX_TRACE_INHERIT
1157 return _POSIX_TRACE_INHERIT;
1158 #else
1159 return -1;
1160 #endif
1161 case _SC_TRACE_LOG:
1162 #ifdef _POSIX_TRACE_LOG
1163 return _POSIX_TRACE_LOG;
1164 #else
1165 return -1;
1166 #endif
1168 case _SC_LEVEL1_ICACHE_SIZE:
1169 case _SC_LEVEL1_ICACHE_ASSOC:
1170 case _SC_LEVEL1_ICACHE_LINESIZE:
1171 case _SC_LEVEL1_DCACHE_SIZE:
1172 case _SC_LEVEL1_DCACHE_ASSOC:
1173 case _SC_LEVEL1_DCACHE_LINESIZE:
1174 case _SC_LEVEL2_CACHE_SIZE:
1175 case _SC_LEVEL2_CACHE_ASSOC:
1176 case _SC_LEVEL2_CACHE_LINESIZE:
1177 case _SC_LEVEL3_CACHE_SIZE:
1178 case _SC_LEVEL3_CACHE_ASSOC:
1179 case _SC_LEVEL3_CACHE_LINESIZE:
1180 case _SC_LEVEL4_CACHE_SIZE:
1181 case _SC_LEVEL4_CACHE_ASSOC:
1182 /* In general we cannot determine these values. Therefore we
1183 return zero which indicates that no information is
1184 available. */
1185 return 0;
1189 #undef __sysconf
1190 weak_alias (__sysconf, sysconf)
1191 libc_hidden_def (__sysconf)