sysconf.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. /* Copyright (C) 1991, 93, 95, 96, 97, 2000 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. #define getpagesize __getpagesize_internal
  16. #define getdtablesize __getdtablesize
  17. #define _XOPEN_SOURCE 500
  18. #include <features.h>
  19. #include <errno.h>
  20. #include <limits.h>
  21. #include <grp.h>
  22. #include <pwd.h>
  23. #include <stddef.h>
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <time.h>
  27. #include <unistd.h>
  28. #include <sys/sysinfo.h>
  29. #include <sys/types.h>
  30. #ifdef __UCLIBC_HAS_REGEX__
  31. #include <regex.h>
  32. #endif
  33. #ifndef __UCLIBC_CLK_TCK_CONST
  34. #error __UCLIBC_CLK_TCK_CONST not defined!
  35. #endif
  36. /***********************************************************************/
  37. /*
  38. * Manuel Novoa III Jan 2001
  39. *
  40. * On i386, the switch-based implementation generates 796 bytes of code.
  41. * However, many of the return values are repeats. By collecting these
  42. * repeats and moving to a table-based implementation, we generate 283
  43. * bytes on i386 (-Os -fomit-frame-pointer).
  44. */
  45. #ifdef _UCLIBC_GENERATE_SYSCONF_ARCH
  46. /*
  47. * Set some errno's so the auto-gen code knows what it is dealing with.
  48. * 1) ENOSYS signifies that we're returning a default value.
  49. * This is just extra info for development.
  50. * 2) EISNAM signifies that the value returned varies at runtime.
  51. *
  52. * Option: GETPAGESIZE_IS_DYNAMIC
  53. * The current implementation of getpagesize in uClibc returns
  54. * a constant. The pagesize on the target arch should not vary,
  55. * so it should be safe to set this as 0.
  56. */
  57. #define RETURN_NEG_1 __set_errno(ENOSYS); return -1
  58. #define RETURN_FUNCTION(f) __set_errno(EISNAM); return (long int) #f
  59. #define GETPAGESIZE_IS_DYNAMIC 0
  60. #else
  61. #define RETURN_NEG_1 return -1
  62. #define RETURN_FUNCTION(f) return f;
  63. #endif /* _UCLIBC_GENERATE_SYSCONF_ARCH */
  64. /* Get the value of the system variable NAME. */
  65. long int attribute_hidden __sysconf(int name)
  66. {
  67. switch (name)
  68. {
  69. default:
  70. __set_errno(EINVAL);
  71. return -1;
  72. case _SC_ARG_MAX:
  73. #ifdef ARG_MAX
  74. return ARG_MAX;
  75. #else
  76. RETURN_NEG_1;
  77. #endif
  78. case _SC_CHILD_MAX:
  79. #ifdef CHILD_MAX
  80. return CHILD_MAX;
  81. #else
  82. RETURN_NEG_1;
  83. #endif
  84. case _SC_CLK_TCK:
  85. /* Can't use CLK_TCK here since that calls __sysconf(_SC_CLK_TCK) */
  86. return __UCLIBC_CLK_TCK_CONST;
  87. case _SC_NGROUPS_MAX:
  88. #ifdef NGROUPS_MAX
  89. return NGROUPS_MAX;
  90. #else
  91. RETURN_NEG_1;
  92. #endif
  93. case _SC_OPEN_MAX:
  94. RETURN_FUNCTION(getdtablesize());
  95. case _SC_STREAM_MAX:
  96. #ifdef STREAM_MAX
  97. return STREAM_MAX;
  98. #else
  99. return FOPEN_MAX;
  100. #endif
  101. case _SC_TZNAME_MAX:
  102. return _POSIX_TZNAME_MAX;
  103. case _SC_JOB_CONTROL:
  104. #ifdef _POSIX_JOB_CONTROL
  105. return 1;
  106. #else
  107. RETURN_NEG_1;
  108. #endif
  109. case _SC_SAVED_IDS:
  110. #ifdef _POSIX_SAVED_IDS
  111. return 1;
  112. #else
  113. RETURN_NEG_1;
  114. #endif
  115. case _SC_REALTIME_SIGNALS:
  116. #ifdef _POSIX_REALTIME_SIGNALS
  117. return 1;
  118. #else
  119. RETURN_NEG_1;
  120. #endif
  121. case _SC_PRIORITY_SCHEDULING:
  122. #ifdef _POSIX_PRIORITY_SCHEDULING
  123. return 1;
  124. #else
  125. RETURN_NEG_1;
  126. #endif
  127. case _SC_TIMERS:
  128. #ifdef _POSIX_TIMERS
  129. return 1;
  130. #else
  131. RETURN_NEG_1;
  132. #endif
  133. case _SC_ASYNCHRONOUS_IO:
  134. #ifdef _POSIX_ASYNCHRONOUS_IO
  135. return 1;
  136. #else
  137. RETURN_NEG_1;
  138. #endif
  139. case _SC_PRIORITIZED_IO:
  140. #ifdef _POSIX_PRIORITIZED_IO
  141. return 1;
  142. #else
  143. RETURN_NEG_1;
  144. #endif
  145. case _SC_SYNCHRONIZED_IO:
  146. #ifdef _POSIX_SYNCHRONIZED_IO
  147. return 1;
  148. #else
  149. RETURN_NEG_1;
  150. #endif
  151. case _SC_FSYNC:
  152. #ifdef _POSIX_FSYNC
  153. return 1;
  154. #else
  155. RETURN_NEG_1;
  156. #endif
  157. case _SC_MAPPED_FILES:
  158. #ifdef _POSIX_MAPPED_FILES
  159. return 1;
  160. #else
  161. RETURN_NEG_1;
  162. #endif
  163. case _SC_MEMLOCK:
  164. #ifdef _POSIX_MEMLOCK
  165. return 1;
  166. #else
  167. RETURN_NEG_1;
  168. #endif
  169. case _SC_MEMLOCK_RANGE:
  170. #ifdef _POSIX_MEMLOCK_RANGE
  171. return 1;
  172. #else
  173. RETURN_NEG_1;
  174. #endif
  175. case _SC_MEMORY_PROTECTION:
  176. #ifdef _POSIX_MEMORY_PROTECTION
  177. return 1;
  178. #else
  179. RETURN_NEG_1;
  180. #endif
  181. case _SC_MESSAGE_PASSING:
  182. #ifdef _POSIX_MESSAGE_PASSING
  183. return 1;
  184. #else
  185. RETURN_NEG_1;
  186. #endif
  187. case _SC_SEMAPHORES:
  188. #ifdef _POSIX_SEMAPHORES
  189. return 1;
  190. #else
  191. RETURN_NEG_1;
  192. #endif
  193. case _SC_SHARED_MEMORY_OBJECTS:
  194. #ifdef _POSIX_SHARED_MEMORY_OBJECTS
  195. return 1;
  196. #else
  197. RETURN_NEG_1;
  198. #endif
  199. case _SC_VERSION:
  200. return _POSIX_VERSION;
  201. case _SC_PAGESIZE:
  202. #if defined(GETPAGESIZE_IS_DYNAMIC) && (GETPAGESIZE_IS_DYNAMIC == 1)
  203. RETURN_FUNCTION(getpagesize());
  204. #else
  205. return getpagesize(); /* note: currently this is not dynamic */
  206. #endif
  207. case _SC_AIO_LISTIO_MAX:
  208. #ifdef AIO_LISTIO_MAX
  209. return AIO_LISTIO_MAX;
  210. #else
  211. RETURN_NEG_1;
  212. #endif
  213. case _SC_AIO_MAX:
  214. #ifdef AIO_MAX
  215. return AIO_MAX;
  216. #else
  217. RETURN_NEG_1;
  218. #endif
  219. case _SC_AIO_PRIO_DELTA_MAX:
  220. #ifdef AIO_PRIO_DELTA_MAX
  221. return AIO_PRIO_DELTA_MAX;
  222. #else
  223. RETURN_NEG_1;
  224. #endif
  225. case _SC_DELAYTIMER_MAX:
  226. #ifdef DELAYTIMER_MAX
  227. return DELAYTIMER_MAX;
  228. #else
  229. RETURN_NEG_1;
  230. #endif
  231. case _SC_MQ_OPEN_MAX:
  232. #ifdef MQ_OPEN_MAX
  233. return MQ_OPEN_MAX;
  234. #else
  235. RETURN_NEG_1;
  236. #endif
  237. case _SC_MQ_PRIO_MAX:
  238. #ifdef MQ_PRIO_MAX
  239. return MQ_PRIO_MAX;
  240. #else
  241. RETURN_NEG_1;
  242. #endif
  243. case _SC_RTSIG_MAX:
  244. #ifdef RTSIG_MAX
  245. return RTSIG_MAX;
  246. #else
  247. RETURN_NEG_1;
  248. #endif
  249. case _SC_SEM_NSEMS_MAX:
  250. #ifdef SEM_NSEMS_MAX
  251. return SEM_NSEMS_MAX;
  252. #else
  253. RETURN_NEG_1;
  254. #endif
  255. case _SC_SEM_VALUE_MAX:
  256. #ifdef SEM_VALUE_MAX
  257. return SEM_VALUE_MAX;
  258. #else
  259. RETURN_NEG_1;
  260. #endif
  261. case _SC_SIGQUEUE_MAX:
  262. #ifdef SIGQUEUE_MAX
  263. return SIGQUEUE_MAX;
  264. #else
  265. RETURN_NEG_1;
  266. #endif
  267. case _SC_TIMER_MAX:
  268. #ifdef TIMER_MAX
  269. return TIMER_MAX;
  270. #else
  271. RETURN_NEG_1;
  272. #endif
  273. case _SC_BC_BASE_MAX:
  274. #ifdef BC_BASE_MAX
  275. return BC_BASE_MAX;
  276. #else
  277. RETURN_NEG_1;
  278. #endif
  279. case _SC_BC_DIM_MAX:
  280. #ifdef BC_DIM_MAX
  281. return BC_DIM_MAX;
  282. #else
  283. RETURN_NEG_1;
  284. #endif
  285. case _SC_BC_SCALE_MAX:
  286. #ifdef BC_SCALE_MAX
  287. return BC_SCALE_MAX;
  288. #else
  289. RETURN_NEG_1;
  290. #endif
  291. case _SC_BC_STRING_MAX:
  292. #ifdef BC_STRING_MAX
  293. return BC_STRING_MAX;
  294. #else
  295. RETURN_NEG_1;
  296. #endif
  297. case _SC_COLL_WEIGHTS_MAX:
  298. #ifdef COLL_WEIGHTS_MAX
  299. return COLL_WEIGHTS_MAX;
  300. #else
  301. RETURN_NEG_1;
  302. #endif
  303. case _SC_EQUIV_CLASS_MAX:
  304. #ifdef EQUIV_CLASS_MAX
  305. return EQUIV_CLASS_MAX;
  306. #else
  307. RETURN_NEG_1;
  308. #endif
  309. case _SC_EXPR_NEST_MAX:
  310. #ifdef EXPR_NEST_MAX
  311. return EXPR_NEST_MAX;
  312. #else
  313. RETURN_NEG_1;
  314. #endif
  315. case _SC_LINE_MAX:
  316. #ifdef LINE_MAX
  317. return LINE_MAX;
  318. #else
  319. RETURN_NEG_1;
  320. #endif
  321. case _SC_RE_DUP_MAX:
  322. #ifdef RE_DUP_MAX
  323. return RE_DUP_MAX;
  324. #else
  325. RETURN_NEG_1;
  326. #endif
  327. case _SC_CHARCLASS_NAME_MAX:
  328. #ifdef CHARCLASS_NAME_MAX
  329. return CHARCLASS_NAME_MAX;
  330. #else
  331. RETURN_NEG_1;
  332. #endif
  333. case _SC_PII:
  334. #ifdef _POSIX_PII
  335. return 1;
  336. #else
  337. RETURN_NEG_1;
  338. #endif
  339. case _SC_PII_XTI:
  340. #ifdef _POSIX_PII_XTI
  341. return 1;
  342. #else
  343. RETURN_NEG_1;
  344. #endif
  345. case _SC_PII_SOCKET:
  346. #ifdef _POSIX_PII_SOCKET
  347. return 1;
  348. #else
  349. RETURN_NEG_1;
  350. #endif
  351. case _SC_PII_INTERNET:
  352. #ifdef _POSIX_PII_INTERNET
  353. return 1;
  354. #else
  355. RETURN_NEG_1;
  356. #endif
  357. case _SC_PII_OSI:
  358. #ifdef _POSIX_PII_OSI
  359. return 1;
  360. #else
  361. RETURN_NEG_1;
  362. #endif
  363. case _SC_POLL:
  364. #ifdef _POSIX_POLL
  365. return 1;
  366. #else
  367. RETURN_NEG_1;
  368. #endif
  369. case _SC_SELECT:
  370. #ifdef _POSIX_SELECT
  371. return 1;
  372. #else
  373. RETURN_NEG_1;
  374. #endif
  375. case _SC_UIO_MAXIOV:
  376. #ifdef UIO_MAXIOV
  377. return UIO_MAXIOV;
  378. #else
  379. RETURN_NEG_1;
  380. #endif
  381. case _SC_PII_INTERNET_STREAM:
  382. #ifdef _POSIX_PII_INTERNET_STREAM
  383. return 1;
  384. #else
  385. RETURN_NEG_1;
  386. #endif
  387. case _SC_PII_INTERNET_DGRAM:
  388. #ifdef _POSIX_PII_INTERNET_DGRAM
  389. return 1;
  390. #else
  391. RETURN_NEG_1;
  392. #endif
  393. case _SC_PII_OSI_COTS:
  394. #ifdef _POSIX_PII_OSI_COTS
  395. return 1;
  396. #else
  397. RETURN_NEG_1;
  398. #endif
  399. case _SC_PII_OSI_CLTS:
  400. #ifdef _POSIX_PII_OSI_CLTS
  401. return 1;
  402. #else
  403. RETURN_NEG_1;
  404. #endif
  405. case _SC_PII_OSI_M:
  406. #ifdef _POSIX_PII_OSI_M
  407. return 1;
  408. #else
  409. RETURN_NEG_1;
  410. #endif
  411. case _SC_T_IOV_MAX:
  412. #ifdef _T_IOV_MAX
  413. return _T_IOV_MAX;
  414. #else
  415. RETURN_NEG_1;
  416. #endif
  417. case _SC_2_VERSION:
  418. return _POSIX2_VERSION;
  419. case _SC_2_C_BIND:
  420. #ifdef _POSIX2_C_BIND
  421. return _POSIX2_C_BIND;
  422. #else
  423. RETURN_NEG_1;
  424. #endif
  425. case _SC_2_C_DEV:
  426. #ifdef _POSIX2_C_DEV
  427. return _POSIX2_C_DEV;
  428. #else
  429. RETURN_NEG_1;
  430. #endif
  431. case _SC_2_C_VERSION:
  432. #ifdef _POSIX2_C_VERSION
  433. return _POSIX2_C_VERSION;
  434. #else
  435. RETURN_NEG_1;
  436. #endif
  437. case _SC_2_FORT_DEV:
  438. #ifdef _POSIX2_FORT_DEV
  439. return _POSIX2_FORT_DEV;
  440. #else
  441. RETURN_NEG_1;
  442. #endif
  443. case _SC_2_FORT_RUN:
  444. #ifdef _POSIX2_FORT_RUN
  445. return _POSIX2_FORT_RUN;
  446. #else
  447. RETURN_NEG_1;
  448. #endif
  449. case _SC_2_LOCALEDEF:
  450. #ifdef _POSIX2_LOCALEDEF
  451. return _POSIX2_LOCALEDEF;
  452. #else
  453. RETURN_NEG_1;
  454. #endif
  455. case _SC_2_SW_DEV:
  456. #ifdef _POSIX2_SW_DEV
  457. return _POSIX2_SW_DEV;
  458. #else
  459. RETURN_NEG_1;
  460. #endif
  461. case _SC_2_CHAR_TERM:
  462. #ifdef _POSIX2_CHAR_TERM
  463. return _POSIX2_CHAR_TERM;
  464. #else
  465. RETURN_NEG_1;
  466. #endif
  467. case _SC_2_UPE:
  468. #ifdef _POSIX2_UPE
  469. return _POSIX2_UPE;
  470. #else
  471. RETURN_NEG_1;
  472. #endif
  473. /* POSIX 1003.1c (POSIX Threads). */
  474. case _SC_THREADS:
  475. #ifdef __UCLIBC_HAS_THREADS__
  476. return 1;
  477. #else
  478. RETURN_NEG_1;
  479. #endif
  480. case _SC_THREAD_SAFE_FUNCTIONS:
  481. #ifdef __UCLIBC_HAS_THREADS__
  482. return 1;
  483. #else
  484. RETURN_NEG_1;
  485. #endif
  486. /* If you change these, also change libc/pwd_grp/pwd_grp.c to match */
  487. #define PWD_BUFFER_SIZE 256
  488. #define GRP_BUFFER_SIZE 256
  489. case _SC_GETGR_R_SIZE_MAX:
  490. return GRP_BUFFER_SIZE;
  491. case _SC_GETPW_R_SIZE_MAX:
  492. return PWD_BUFFER_SIZE;
  493. /* getlogin() is a worthless interface. In uClibc we let the user specify
  494. * whatever they want via the LOGNAME environment variable, or we return NULL
  495. * if getenv() fails to find anything. So this is merely how large a env
  496. * variable can be. Lets use 256 */
  497. case _SC_LOGIN_NAME_MAX:
  498. return 256;
  499. /* If you change this, also change _SC_TTY_NAME_MAX in libc/unistd/sysconf.c */
  500. #define TTYNAME_BUFLEN 32
  501. case _SC_TTY_NAME_MAX:
  502. return TTYNAME_BUFLEN;
  503. case _SC_THREAD_DESTRUCTOR_ITERATIONS:
  504. #ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
  505. return _POSIX_THREAD_DESTRUCTOR_ITERATIONS;
  506. #else
  507. RETURN_NEG_1;
  508. #endif
  509. case _SC_THREAD_KEYS_MAX:
  510. #ifdef PTHREAD_KEYS_MAX
  511. return PTHREAD_KEYS_MAX;
  512. #else
  513. RETURN_NEG_1;
  514. #endif
  515. case _SC_THREAD_STACK_MIN:
  516. #ifdef PTHREAD_STACK_MIN
  517. return PTHREAD_STACK_MIN;
  518. #else
  519. RETURN_NEG_1;
  520. #endif
  521. case _SC_THREAD_THREADS_MAX:
  522. #ifdef PTHREAD_THREADS_MAX
  523. return PTHREAD_THREADS_MAX;
  524. #else
  525. RETURN_NEG_1;
  526. #endif
  527. case _SC_THREAD_ATTR_STACKADDR:
  528. #ifdef _POSIX_THREAD_ATTR_STACKADDR
  529. return 1;
  530. #else
  531. RETURN_NEG_1;
  532. #endif
  533. case _SC_THREAD_ATTR_STACKSIZE:
  534. #ifdef _POSIX_THREAD_ATTR_STACKSIZE
  535. return 1;
  536. #else
  537. RETURN_NEG_1;
  538. #endif
  539. case _SC_THREAD_PRIORITY_SCHEDULING:
  540. #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
  541. return 1;
  542. #else
  543. RETURN_NEG_1;
  544. #endif
  545. case _SC_THREAD_PRIO_INHERIT:
  546. #ifdef _POSIX_THREAD_PRIO_INHERIT
  547. return 1;
  548. #else
  549. RETURN_NEG_1;
  550. #endif
  551. case _SC_THREAD_PRIO_PROTECT:
  552. #ifdef _POSIX_THREAD_PRIO_PROTECT
  553. return 1;
  554. #else
  555. RETURN_NEG_1;
  556. #endif
  557. case _SC_THREAD_PROCESS_SHARED:
  558. #ifdef _POSIX_THREAD_PROCESS_SHARED
  559. return 1;
  560. #else
  561. RETURN_NEG_1;
  562. #endif
  563. case _SC_NPROCESSORS_CONF:
  564. #if 0
  565. RETURN_FUNCTION(get_nprocs_conf());
  566. #else
  567. /* this is a hack. for now always claim we have exactly one cpu */
  568. return 1;
  569. #endif
  570. case _SC_NPROCESSORS_ONLN:
  571. #if 0
  572. RETURN_FUNCTION(get_nprocs());
  573. #else
  574. /* this is a hack. for now always claim we have exactly one cpu */
  575. return 1;
  576. #endif
  577. case _SC_PHYS_PAGES:
  578. #if 0
  579. RETURN_FUNCTION(get_phys_pages());
  580. #else
  581. RETURN_NEG_1;
  582. #endif
  583. case _SC_AVPHYS_PAGES:
  584. #if 0
  585. RETURN_FUNCTION(get_avphys_pages());
  586. #else
  587. RETURN_NEG_1;
  588. #endif
  589. case _SC_ATEXIT_MAX:
  590. return __UCLIBC_MAX_ATEXIT;
  591. case _SC_PASS_MAX:
  592. /* We have no limit but since the return value might be used to
  593. allocate a buffer we restrict the value. */
  594. return BUFSIZ;
  595. case _SC_XOPEN_VERSION:
  596. return _XOPEN_VERSION;
  597. case _SC_XOPEN_XCU_VERSION:
  598. return _XOPEN_XCU_VERSION;
  599. case _SC_XOPEN_UNIX:
  600. return _XOPEN_UNIX;
  601. case _SC_XOPEN_CRYPT:
  602. #ifdef _XOPEN_CRYPT
  603. return _XOPEN_CRYPT;
  604. #else
  605. RETURN_NEG_1;
  606. #endif
  607. case _SC_XOPEN_ENH_I18N:
  608. #ifdef _XOPEN_ENH_I18N
  609. return _XOPEN_ENH_I18N;
  610. #else
  611. RETURN_NEG_1;
  612. #endif
  613. case _SC_XOPEN_SHM:
  614. #ifdef _XOPEN_SHM
  615. return _XOPEN_SHM;
  616. #else
  617. RETURN_NEG_1;
  618. #endif
  619. case _SC_XOPEN_XPG2:
  620. #ifdef _XOPEN_XPG2
  621. return _XOPEN_XPG2;
  622. #else
  623. RETURN_NEG_1;
  624. #endif
  625. case _SC_XOPEN_XPG3:
  626. #ifdef _XOPEN_XPG3
  627. return _XOPEN_XPG3;
  628. #else
  629. RETURN_NEG_1;
  630. #endif
  631. case _SC_XOPEN_XPG4:
  632. #ifdef _XOPEN_XPG4
  633. return _XOPEN_XPG4;
  634. #else
  635. RETURN_NEG_1;
  636. #endif
  637. case _SC_CHAR_BIT:
  638. return CHAR_BIT;
  639. case _SC_CHAR_MAX:
  640. return CHAR_MAX;
  641. case _SC_CHAR_MIN:
  642. return CHAR_MIN;
  643. case _SC_INT_MAX:
  644. return INT_MAX;
  645. case _SC_INT_MIN:
  646. return INT_MIN;
  647. case _SC_LONG_BIT:
  648. return sizeof (long int) * CHAR_BIT;
  649. case _SC_WORD_BIT:
  650. return sizeof (int) * CHAR_BIT;
  651. case _SC_MB_LEN_MAX:
  652. return MB_LEN_MAX;
  653. case _SC_NZERO:
  654. return NZERO;
  655. case _SC_SSIZE_MAX:
  656. return _POSIX_SSIZE_MAX;
  657. case _SC_SCHAR_MAX:
  658. return SCHAR_MAX;
  659. case _SC_SCHAR_MIN:
  660. return SCHAR_MIN;
  661. case _SC_SHRT_MAX:
  662. return SHRT_MAX;
  663. case _SC_SHRT_MIN:
  664. return SHRT_MIN;
  665. case _SC_UCHAR_MAX:
  666. return UCHAR_MAX;
  667. case _SC_UINT_MAX:
  668. return UINT_MAX;
  669. case _SC_ULONG_MAX:
  670. return ULONG_MAX;
  671. case _SC_USHRT_MAX:
  672. return USHRT_MAX;
  673. case _SC_NL_ARGMAX:
  674. #ifdef NL_ARGMAX
  675. return NL_ARGMAX;
  676. #else
  677. RETURN_NEG_1;
  678. #endif
  679. case _SC_NL_LANGMAX:
  680. #ifdef NL_LANGMAX
  681. return NL_LANGMAX;
  682. #else
  683. RETURN_NEG_1;
  684. #endif
  685. case _SC_NL_MSGMAX:
  686. #ifdef NL_MSGMAX
  687. return NL_MSGMAX;
  688. #else
  689. RETURN_NEG_1;
  690. #endif
  691. case _SC_NL_NMAX:
  692. #ifdef NL_NMAX
  693. return NL_NMAX;
  694. #else
  695. RETURN_NEG_1;
  696. #endif
  697. case _SC_NL_SETMAX:
  698. #ifdef NL_SETMAX
  699. return NL_SETMAX;
  700. #else
  701. RETURN_NEG_1;
  702. #endif
  703. case _SC_NL_TEXTMAX:
  704. #ifdef NL_TEXTMAX
  705. return NL_TEXTMAX;
  706. #else
  707. RETURN_NEG_1;
  708. #endif
  709. case _SC_XBS5_ILP32_OFF32:
  710. #ifdef _XBS5_ILP32_OFF32
  711. return _XBS5_ILP32_OFF32;
  712. #else
  713. RETURN_NEG_1;
  714. #endif
  715. case _SC_XBS5_ILP32_OFFBIG:
  716. #ifdef _XBS5_ILP32_OFFBIG
  717. return _XBS5_ILP32_OFFBIG;
  718. #else
  719. RETURN_NEG_1;
  720. #endif
  721. case _SC_XBS5_LP64_OFF64:
  722. #ifdef _XBS5_LP64_OFF64
  723. return _XBS5_LP64_OFF64;
  724. #else
  725. RETURN_NEG_1;
  726. #endif
  727. case _SC_XBS5_LPBIG_OFFBIG:
  728. #ifdef _XBS5_LPBIG_OFFBIG
  729. return _XBS5_LPBIG_OFFBIG;
  730. #else
  731. RETURN_NEG_1;
  732. #endif
  733. case _SC_XOPEN_LEGACY:
  734. return _XOPEN_LEGACY;
  735. case _SC_XOPEN_REALTIME:
  736. #ifdef _XOPEN_REALTIME
  737. return _XOPEN_REALTIME;
  738. #else
  739. RETURN_NEG_1;
  740. #endif
  741. case _SC_XOPEN_REALTIME_THREADS:
  742. #ifdef _XOPEN_REALTIME_THREADS
  743. return _XOPEN_REALTIME_THREADS;
  744. #else
  745. RETURN_NEG_1;
  746. #endif
  747. }
  748. }
  749. strong_alias(__sysconf,sysconf)