1 /* Copyright (C) 1991-2021 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 Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the 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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
25 #include <sys/param.h>
26 #include <sys/sysinfo.h>
29 /* Get the value of the system variable NAME. */
42 case _SC_CHARCLASS_NAME_MAX
:
43 #ifdef CHARCLASS_NAME_MAX
44 return CHARCLASS_NAME_MAX
;
49 case _SC_COLL_WEIGHTS_MAX
:
50 #ifdef COLL_WEIGHTS_MAX
51 return COLL_WEIGHTS_MAX
;
56 case _SC_EQUIV_CLASS_MAX
:
57 #ifdef EQUIV_CLASS_MAX
58 return EQUIV_CLASS_MAX
;
64 #ifdef _POSIX2_LOCALEDEF
65 return _POSIX2_LOCALEDEF
;
70 case _SC_NPROCESSORS_CONF
:
71 return __get_nprocs_conf ();
73 case _SC_NPROCESSORS_ONLN
:
74 return __get_nprocs ();
77 return __get_phys_pages ();
79 case _SC_AVPHYS_PAGES
:
80 return __get_avphys_pages ();
83 /* We have no limit since we use lists. */
87 /* We have no limit but since the return value might be used to
88 allocate a buffer we restrict the value. */
107 return sizeof (long int) * CHAR_BIT
;
110 return sizeof (int) * CHAR_BIT
;
119 return _POSIX_SSIZE_MAX
;
145 case _SC_GETGR_R_SIZE_MAX
:
146 return NSS_BUFLEN_GROUP
;
148 case _SC_GETPW_R_SIZE_MAX
:
149 return NSS_BUFLEN_PASSWD
;
154 case _SC_NGROUPS_MAX
:
157 case _SC_JOB_CONTROL
:
159 case _SC_REALTIME_SIGNALS
:
160 case _SC_PRIORITY_SCHEDULING
:
162 case _SC_ASYNCHRONOUS_IO
:
163 case _SC_PRIORITIZED_IO
:
164 case _SC_SYNCHRONIZED_IO
:
166 case _SC_MAPPED_FILES
:
168 case _SC_MEMLOCK_RANGE
:
169 case _SC_MEMORY_PROTECTION
:
170 case _SC_MESSAGE_PASSING
:
172 case _SC_SHARED_MEMORY_OBJECTS
:
174 case _SC_AIO_LISTIO_MAX
:
176 case _SC_AIO_PRIO_DELTA_MAX
:
177 case _SC_DELAYTIMER_MAX
:
178 case _SC_MQ_OPEN_MAX
:
179 case _SC_MQ_PRIO_MAX
:
183 case _SC_SEM_NSEMS_MAX
:
184 case _SC_SEM_VALUE_MAX
:
185 case _SC_SIGQUEUE_MAX
:
195 case _SC_PII_INTERNET_STREAM
:
196 case _SC_PII_INTERNET_DGRAM
:
197 case _SC_PII_OSI_COTS
:
198 case _SC_PII_OSI_CLTS
:
202 case _SC_BC_BASE_MAX
:
204 case _SC_BC_SCALE_MAX
:
205 case _SC_BC_STRING_MAX
:
206 case _SC_EXPR_NEST_MAX
:
214 case _SC_2_CHAR_TERM
:
215 case _SC_2_C_VERSION
:
219 case _SC_THREAD_SAFE_FUNCTIONS
:
220 case _SC_LOGIN_NAME_MAX
:
221 case _SC_TTY_NAME_MAX
:
222 case _SC_THREAD_DESTRUCTOR_ITERATIONS
:
223 case _SC_THREAD_KEYS_MAX
:
224 case _SC_THREAD_STACK_MIN
:
225 case _SC_THREAD_THREADS_MAX
:
226 case _SC_THREAD_ATTR_STACKADDR
:
227 case _SC_THREAD_ATTR_STACKSIZE
:
228 case _SC_THREAD_PRIORITY_SCHEDULING
:
229 case _SC_THREAD_PRIO_INHERIT
:
230 case _SC_THREAD_PRIO_PROTECT
:
231 case _SC_THREAD_PROCESS_SHARED
:
233 case _SC_XOPEN_VERSION
:
234 case _SC_XOPEN_XCU_VERSION
:
236 case _SC_XOPEN_CRYPT
:
237 case _SC_XOPEN_ENH_I18N
:
250 case _SC_XBS5_ILP32_OFF32
:
251 case _SC_XBS5_ILP32_OFFBIG
:
252 case _SC_XBS5_LP64_OFF64
:
253 case _SC_XBS5_LPBIG_OFFBIG
:
255 case _SC_POSIX_V6_ILP32_OFF32
:
256 case _SC_POSIX_V6_ILP32_OFFBIG
:
257 case _SC_POSIX_V6_LP64_OFF64
:
258 case _SC_POSIX_V6_LPBIG_OFFBIG
:
260 case _SC_POSIX_V7_ILP32_OFF32
:
261 case _SC_POSIX_V7_ILP32_OFFBIG
:
262 case _SC_POSIX_V7_LP64_OFF64
:
263 case _SC_POSIX_V7_LPBIG_OFFBIG
:
265 case _SC_XOPEN_LEGACY
:
266 case _SC_XOPEN_REALTIME
:
267 case _SC_XOPEN_REALTIME_THREADS
:
269 case _SC_MINSIGSTKSZ
:
275 __set_errno (ENOSYS
);
279 weak_alias (__sysconf
, sysconf
)
280 libc_hidden_def (__sysconf
)
282 stub_warning (sysconf
)