1 /* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
27 #include <sys/sysinfo.h>
30 /* Get the value of the system variable NAME. */
70 return __getdtablesize ();
80 return __tzname_max ();
83 #ifdef _POSIX_JOB_CONTROL
90 #ifdef _POSIX_SAVED_IDS
96 case _SC_REALTIME_SIGNALS
:
97 #ifdef _POSIX_REALTIME_SIGNALS
103 case _SC_PRIORITY_SCHEDULING
:
104 #ifdef _POSIX_PRIORITY_SCHEDULING
117 case _SC_ASYNCHRONOUS_IO
:
118 #ifdef _POSIX_ASYNCHRONOUS_IO
124 case _SC_PRIORITIZED_IO
:
125 #ifdef _POSIX_PRIORITIZED_IO
131 case _SC_SYNCHRONIZED_IO
:
132 #ifdef _POSIX_SYNCHRONIZED_IO
145 case _SC_MAPPED_FILES
:
146 #ifdef _POSIX_MAPPED_FILES
153 #ifdef _POSIX_MEMLOCK
159 case _SC_MEMLOCK_RANGE
:
160 #ifdef _POSIX_MEMLOCK_RANGE
166 case _SC_MEMORY_PROTECTION
:
167 #ifdef _POSIX_MEMORY_PROTECTION
173 case _SC_MESSAGE_PASSING
:
174 #ifdef _POSIX_MESSAGE_PASSING
181 #ifdef _POSIX_SEMAPHORES
187 case _SC_SHARED_MEMORY_OBJECTS
:
188 #ifdef _POSIX_SHARED_MEMORY_OBJECTS
195 return _POSIX_VERSION
;
198 return __getpagesize ();
200 case _SC_AIO_LISTIO_MAX
:
201 #ifdef AIO_LISTIO_MAX
202 return AIO_LISTIO_MAX
;
214 case _SC_AIO_PRIO_DELTA_MAX
:
215 #ifdef AIO_PRIO_DELTA_MAX
216 return AIO_PRIO_DELTA_MAX
;
221 case _SC_DELAYTIMER_MAX
:
222 #ifdef DELAYTIMER_MAX
223 return DELAYTIMER_MAX
;
228 case _SC_MQ_OPEN_MAX
:
235 case _SC_MQ_PRIO_MAX
:
249 case _SC_SEM_NSEMS_MAX
:
251 return SEM_NSEMS_MAX
;
256 case _SC_SEM_VALUE_MAX
:
258 return SEM_VALUE_MAX
;
263 case _SC_SIGQUEUE_MAX
:
277 case _SC_BC_BASE_MAX
:
291 case _SC_BC_SCALE_MAX
:
298 case _SC_BC_STRING_MAX
:
300 return BC_STRING_MAX
;
305 case _SC_COLL_WEIGHTS_MAX
:
306 #ifdef COLL_WEIGHTS_MAX
307 return COLL_WEIGHTS_MAX
;
312 case _SC_EQUIV_CLASS_MAX
:
313 #ifdef EQUIV_CLASS_MAX
314 return EQUIV_CLASS_MAX
;
319 case _SC_EXPR_NEST_MAX
:
321 return EXPR_NEST_MAX
;
340 case _SC_CHARCLASS_NAME_MAX
:
341 #ifdef CHARCLASS_NAME_MAX
342 return CHARCLASS_NAME_MAX
;
355 #ifdef _POSIX_PII_XTI
362 #ifdef _POSIX_PII_SOCKET
368 case _SC_PII_INTERNET
:
369 #ifdef _POSIX_PII_INTERNET
376 #ifdef _POSIX_PII_OSI
403 case _SC_PII_INTERNET_STREAM
:
404 #ifdef _POSIX_PII_INTERNET_STREAM
410 case _SC_PII_INTERNET_DGRAM
:
411 #ifdef _POSIX_PII_INTERNET_DGRAM
417 case _SC_PII_OSI_COTS
:
418 #ifdef _POSIX_PII_OSI_COTS
424 case _SC_PII_OSI_CLTS
:
425 #ifdef _POSIX_PII_OSI_CLTS
432 #ifdef _POSIX_PII_OSI_M
446 return _POSIX2_VERSION
;
449 #ifdef _POSIX2_C_BIND
450 return _POSIX2_C_BIND
;
457 return _POSIX2_C_DEV
;
462 case _SC_2_C_VERSION
:
463 #ifdef _POSIX2_C_VERSION
464 return _POSIX2_C_VERSION
;
470 #ifdef _POSIX2_FORT_DEV
471 return _POSIX2_FORT_DEV
;
476 case _SC_2_LOCALEDEF
:
477 #ifdef _POSIX2_LOCALEDEF
478 return _POSIX2_LOCALEDEF
;
484 #ifdef _POSIX2_SW_DEV
485 return _POSIX2_SW_DEV
;
490 case _SC_2_CHAR_TERM
:
491 #ifdef _POSIX2_CHAR_TERM
492 return _POSIX2_CHAR_TERM
;
504 /* POSIX 1003.1c (POSIX Threads). */
506 #ifdef _POSIX_THREADS
512 case _SC_THREAD_SAFE_FUNCTIONS
:
513 #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
519 case _SC_GETGR_R_SIZE_MAX
:
520 #ifdef NSS_BUFLEN_GROUP
521 return NSS_BUFLEN_GROUP
;
526 case _SC_GETPW_R_SIZE_MAX
:
527 #ifdef NSS_BUFLEN_PASSWD
528 return NSS_BUFLEN_PASSWD
;
533 case _SC_LOGIN_NAME_MAX
:
534 #ifdef _POSIX_LOGIN_NAME_MAX
535 return _POSIX_LOGIN_NAME_MAX
;
540 case _SC_TTY_NAME_MAX
:
541 #ifdef _POSIX_TTY_NAME_MAX
542 return _POSIX_TTY_NAME_MAX
;
547 case _SC_THREAD_DESTRUCTOR_ITERATIONS
:
548 #ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
549 return _POSIX_THREAD_DESTRUCTOR_ITERATIONS
;
554 case _SC_THREAD_KEYS_MAX
:
555 #ifdef PTHREAD_KEYS_MAX
556 return PTHREAD_KEYS_MAX
;
561 case _SC_THREAD_STACK_MIN
:
562 #ifdef PTHREAD_STACK_MIN
563 return PTHREAD_STACK_MIN
;
568 case _SC_THREAD_THREADS_MAX
:
569 #ifdef PTHREAD_THREADS_MAX
570 return PTHREAD_THREADS_MAX
;
575 case _SC_THREAD_ATTR_STACKADDR
:
576 #ifdef _POSIX_THREAD_ATTR_STACKADDR
582 case _SC_THREAD_ATTR_STACKSIZE
:
583 #ifdef _POSIX_THREAD_ATTR_STACKSIZE
589 case _SC_THREAD_PRIORITY_SCHEDULING
:
590 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
596 case _SC_THREAD_PRIO_INHERIT
:
597 #ifdef _POSIX_THREAD_PRIO_INHERIT
603 case _SC_THREAD_PRIO_PROTECT
:
604 #ifdef _POSIX_THREAD_PRIO_PROTECT
610 case _SC_THREAD_PROCESS_SHARED
:
611 #ifdef _POSIX_THREAD_PROCESS_SHARED
617 case _SC_NPROCESSORS_CONF
:
618 return __get_nprocs_conf ();
620 case _SC_NPROCESSORS_ONLN
:
621 return __get_nprocs ();
624 return __get_phys_pages ();
626 case _SC_AVPHYS_PAGES
:
627 return __get_avphys_pages ();
630 /* We have no limit since we use lists. */
634 /* We have no limit but since the return value might be used to
635 allocate a buffer we restrict the value. */
638 case _SC_XOPEN_VERSION
:
639 return _XOPEN_VERSION
;
641 case _SC_XOPEN_XCU_VERSION
:
642 return _XOPEN_XCU_VERSION
;
647 case _SC_XOPEN_CRYPT
:
654 case _SC_XOPEN_ENH_I18N
:
655 #ifdef _XOPEN_ENH_I18N
656 return _XOPEN_ENH_I18N
;
705 return sizeof (long int) * CHAR_BIT
;
708 return sizeof (int) * CHAR_BIT
;
717 return _POSIX_SSIZE_MAX
;
785 case _SC_XBS5_ILP32_OFF32
:
786 #ifdef _XBS5_ILP32_OFF32
787 return _XBS5_ILP32_OFF32
;
791 case _SC_XBS5_ILP32_OFFBIG
:
792 #ifdef _XBS5_ILP32_OFFBIG
793 return _XBS5_ILP32_OFFBIG
;
797 case _SC_XBS5_LP64_OFF64
:
798 #ifdef _XBS5_LP64_OFF64
799 return _XBS5_LP64_OFF64
;
803 case _SC_XBS5_LPBIG_OFFBIG
:
804 #ifdef _XBS5_LPBIG_OFFBIG
805 return _XBS5_LPBIG_OFFBIG
;
810 case _SC_XOPEN_LEGACY
:
811 return _XOPEN_LEGACY
;
813 case _SC_XOPEN_REALTIME
:
814 #ifdef _XOPEN_REALTIME
815 return _XOPEN_REALTIME
;
819 case _SC_XOPEN_REALTIME_THREADS
:
820 #ifdef _XOPEN_REALTIME_THREADS
821 return _XOPEN_REALTIME_THREADS
;
828 weak_alias (__sysconf
, sysconf
)