sysconf.c 16 KB

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