sysconf.c 16 KB

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