getconf.c 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336
  1. /* Copyright (C) 1991, 92, 1995-2008, 2009 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; version 2 of the License, or
  6. (at your option) any later version.
  7. This program 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
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #define _GNU_SOURCE 1
  15. #include <unistd.h>
  16. #include <errno.h>
  17. #include <string.h>
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #define PACKAGE "getconf regression test"
  21. #define VERSION ""
  22. #define _(x) x
  23. #define error(status, errnum, fmt, ...) \
  24. {fprintf(stderr, fmt "\n", ## __VA_ARGS__); exit(status);}
  25. struct conf
  26. {
  27. const char *name;
  28. const int call_name;
  29. const enum { SYSCONF, CONFSTR, PATHCONF } call;
  30. };
  31. static const struct conf vars[] =
  32. {
  33. #ifdef _PC_LINK_MAX
  34. { "LINK_MAX", _PC_LINK_MAX, PATHCONF },
  35. #endif
  36. #ifdef _PC_LINK_MAX
  37. { "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
  38. #endif
  39. #ifdef _PC_MAX_CANON
  40. { "MAX_CANON", _PC_MAX_CANON, PATHCONF },
  41. #endif
  42. #ifdef _PC_MAX_CANON
  43. { "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
  44. #endif
  45. #ifdef _PC_MAX_INPUT
  46. { "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
  47. #endif
  48. #ifdef _PC_MAX_INPUT
  49. { "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
  50. #endif
  51. #ifdef _PC_NAME_MAX
  52. { "NAME_MAX", _PC_NAME_MAX, PATHCONF },
  53. #endif
  54. #ifdef _PC_NAME_MAX
  55. { "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
  56. #endif
  57. #ifdef _PC_PATH_MAX
  58. { "PATH_MAX", _PC_PATH_MAX, PATHCONF },
  59. #endif
  60. #ifdef _PC_PATH_MAX
  61. { "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
  62. #endif
  63. #ifdef _PC_PIPE_BUF
  64. { "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
  65. #endif
  66. #ifdef _PC_PIPE_BUF
  67. { "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
  68. #endif
  69. #ifdef _PC_SOCK_MAXBUF
  70. { "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
  71. #endif
  72. #ifdef _PC_ASYNC_IO
  73. { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
  74. #endif
  75. #ifdef _PC_CHOWN_RESTRICTED
  76. { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
  77. #endif
  78. #ifdef _PC_NO_TRUNC
  79. { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
  80. #endif
  81. #ifdef _PC_PRIO_IO
  82. { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
  83. #endif
  84. #ifdef _PC_SYNC_IO
  85. { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
  86. #endif
  87. #ifdef _PC_VDISABLE
  88. { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
  89. #endif
  90. #ifdef _SC_ARG_MAX
  91. { "ARG_MAX", _SC_ARG_MAX, SYSCONF },
  92. #endif
  93. #ifdef _SC_ATEXIT_MAX
  94. { "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
  95. #endif
  96. #ifdef _SC_CHAR_BIT
  97. { "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
  98. #endif
  99. #ifdef _SC_CHAR_MAX
  100. { "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
  101. #endif
  102. #ifdef _SC_CHAR_MIN
  103. { "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
  104. #endif
  105. #ifdef _SC_CHILD_MAX
  106. { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
  107. #endif
  108. #ifdef _SC_CLK_TCK
  109. { "CLK_TCK", _SC_CLK_TCK, SYSCONF },
  110. #endif
  111. #ifdef _SC_INT_MAX
  112. { "INT_MAX", _SC_INT_MAX, SYSCONF },
  113. #endif
  114. #ifdef _SC_INT_MIN
  115. { "INT_MIN", _SC_INT_MIN, SYSCONF },
  116. #endif
  117. #ifdef _SC_UIO_MAXIOV
  118. { "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
  119. #endif
  120. #ifdef _SC_LOGIN_NAME_MAX
  121. { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
  122. #endif
  123. #ifdef _SC_LONG_BIT
  124. { "LONG_BIT", _SC_LONG_BIT, SYSCONF },
  125. #endif
  126. #ifdef _SC_MB_LEN_MAX
  127. { "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
  128. #endif
  129. #ifdef _SC_NGROUPS_MAX
  130. { "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
  131. #endif
  132. #ifdef _SC_NL_ARGMAX
  133. { "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
  134. #endif
  135. #ifdef _SC_NL_LANGMAX
  136. { "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
  137. #endif
  138. #ifdef _SC_NL_MSGMAX
  139. { "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
  140. #endif
  141. #ifdef _SC_NL_NMAX
  142. { "NL_NMAX", _SC_NL_NMAX, SYSCONF },
  143. #endif
  144. #ifdef _SC_NL_SETMAX
  145. { "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
  146. #endif
  147. #ifdef _SC_NL_TEXTMAX
  148. { "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
  149. #endif
  150. #ifdef _SC_GETGR_R_SIZE_MAX
  151. { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
  152. #endif
  153. #ifdef _SC_GETPW_R_SIZE_MAX
  154. { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
  155. #endif
  156. #ifdef _SC_NZERO
  157. { "NZERO", _SC_NZERO, SYSCONF },
  158. #endif
  159. #ifdef _SC_OPEN_MAX
  160. { "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
  161. #endif
  162. #ifdef _SC_PAGESIZE
  163. { "PAGESIZE", _SC_PAGESIZE, SYSCONF },
  164. #endif
  165. #ifdef _SC_PAGESIZE
  166. { "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
  167. #endif
  168. #ifdef _SC_PASS_MAX
  169. { "PASS_MAX", _SC_PASS_MAX, SYSCONF },
  170. #endif
  171. #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
  172. { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
  173. #endif
  174. #ifdef _SC_THREAD_KEYS_MAX
  175. { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
  176. #endif
  177. #ifdef _SC_THREAD_STACK_MIN
  178. { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
  179. #endif
  180. #ifdef _SC_THREAD_THREADS_MAX
  181. { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
  182. #endif
  183. #ifdef _SC_SCHAR_MAX
  184. { "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
  185. #endif
  186. #ifdef _SC_SCHAR_MIN
  187. { "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
  188. #endif
  189. #ifdef _SC_SHRT_MAX
  190. { "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
  191. #endif
  192. #ifdef _SC_SHRT_MIN
  193. { "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
  194. #endif
  195. #ifdef _SC_SSIZE_MAX
  196. { "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
  197. #endif
  198. #ifdef _SC_TTY_NAME_MAX
  199. { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
  200. #endif
  201. #ifdef _SC_TZNAME_MAX
  202. { "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
  203. #endif
  204. #ifdef _SC_UCHAR_MAX
  205. { "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
  206. #endif
  207. #ifdef _SC_UINT_MAX
  208. { "UINT_MAX", _SC_UINT_MAX, SYSCONF },
  209. #endif
  210. #ifdef _SC_UIO_MAXIOV
  211. { "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
  212. #endif
  213. #ifdef _SC_ULONG_MAX
  214. { "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
  215. #endif
  216. #ifdef _SC_USHRT_MAX
  217. { "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
  218. #endif
  219. #ifdef _SC_WORD_BIT
  220. { "WORD_BIT", _SC_WORD_BIT, SYSCONF },
  221. #endif
  222. #ifdef _SC_AVPHYS_PAGES
  223. { "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
  224. #endif
  225. #ifdef _SC_NPROCESSORS_CONF
  226. { "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
  227. #endif
  228. #ifdef _SC_NPROCESSORS_ONLN
  229. { "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
  230. #endif
  231. #ifdef _SC_PHYS_PAGES
  232. { "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
  233. #endif
  234. #ifdef _SC_ARG_MAX
  235. { "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
  236. #endif
  237. #ifdef _SC_ASYNCHRONOUS_IO
  238. { "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
  239. #endif
  240. #ifdef _SC_CHILD_MAX
  241. { "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
  242. #endif
  243. #ifdef _SC_FSYNC
  244. { "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
  245. #endif
  246. #ifdef _SC_JOB_CONTROL
  247. { "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
  248. #endif
  249. #ifdef _SC_MAPPED_FILES
  250. { "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
  251. #endif
  252. #ifdef _SC_MEMLOCK
  253. { "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
  254. #endif
  255. #ifdef _SC_MEMLOCK_RANGE
  256. { "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
  257. #endif
  258. #ifdef _SC_MEMORY_PROTECTION
  259. { "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
  260. #endif
  261. #ifdef _SC_MESSAGE_PASSING
  262. { "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
  263. #endif
  264. #ifdef _SC_NGROUPS_MAX
  265. { "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
  266. #endif
  267. #ifdef _SC_OPEN_MAX
  268. { "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
  269. #endif
  270. #ifdef _SC_PII
  271. { "_POSIX_PII", _SC_PII, SYSCONF },
  272. #endif
  273. #ifdef _SC_PII_INTERNET
  274. { "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
  275. #endif
  276. #ifdef _SC_PII_INTERNET_DGRAM
  277. { "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
  278. #endif
  279. #ifdef _SC_PII_INTERNET_STREAM
  280. { "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
  281. #endif
  282. #ifdef _SC_PII_OSI
  283. { "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
  284. #endif
  285. #ifdef _SC_PII_OSI_CLTS
  286. { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
  287. #endif
  288. #ifdef _SC_PII_OSI_COTS
  289. { "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
  290. #endif
  291. #ifdef _SC_PII_OSI_M
  292. { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
  293. #endif
  294. #ifdef _SC_PII_SOCKET
  295. { "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
  296. #endif
  297. #ifdef _SC_PII_XTI
  298. { "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
  299. #endif
  300. #ifdef _SC_POLL
  301. { "_POSIX_POLL", _SC_POLL, SYSCONF },
  302. #endif
  303. #ifdef _SC_PRIORITIZED_IO
  304. { "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
  305. #endif
  306. #ifdef _SC_PRIORITY_SCHEDULING
  307. { "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
  308. #endif
  309. #ifdef _SC_REALTIME_SIGNALS
  310. { "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
  311. #endif
  312. #ifdef _SC_SAVED_IDS
  313. { "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
  314. #endif
  315. #ifdef _SC_SELECT
  316. { "_POSIX_SELECT", _SC_SELECT, SYSCONF },
  317. #endif
  318. #ifdef _SC_SEMAPHORES
  319. { "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
  320. #endif
  321. #ifdef _SC_SHARED_MEMORY_OBJECTS
  322. { "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
  323. #endif
  324. #ifdef _SC_SSIZE_MAX
  325. { "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
  326. #endif
  327. #ifdef _SC_STREAM_MAX
  328. { "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
  329. #endif
  330. #ifdef _SC_SYNCHRONIZED_IO
  331. { "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
  332. #endif
  333. #ifdef _SC_THREADS
  334. { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
  335. #endif
  336. #ifdef _SC_THREAD_ATTR_STACKADDR
  337. { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
  338. #endif
  339. #ifdef _SC_THREAD_ATTR_STACKSIZE
  340. { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
  341. #endif
  342. #ifdef _SC_THREAD_PRIORITY_SCHEDULING
  343. { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
  344. #endif
  345. #ifdef _SC_THREAD_PRIO_INHERIT
  346. { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
  347. #endif
  348. #ifdef _SC_THREAD_PRIO_PROTECT
  349. { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
  350. #endif
  351. #ifdef _SC_THREAD_ROBUST_PRIO_INHERIT
  352. { "_POSIX_THREAD_ROBUST_PRIO_INHERIT", _SC_THREAD_ROBUST_PRIO_INHERIT,
  353. SYSCONF },
  354. #endif
  355. #ifdef _SC_THREAD_ROBUST_PRIO_PROTECT
  356. { "_POSIX_THREAD_ROBUST_PRIO_PROTECT", _SC_THREAD_ROBUST_PRIO_PROTECT,
  357. SYSCONF },
  358. #endif
  359. #ifdef _SC_THREAD_PROCESS_SHARED
  360. { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
  361. #endif
  362. #ifdef _SC_THREAD_SAFE_FUNCTIONS
  363. { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
  364. #endif
  365. #ifdef _SC_TIMERS
  366. { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
  367. #endif
  368. #ifdef _SC_TIMER_MAX
  369. { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
  370. #endif
  371. #ifdef _SC_TZNAME_MAX
  372. { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
  373. #endif
  374. #ifdef _SC_VERSION
  375. { "_POSIX_VERSION", _SC_VERSION, SYSCONF },
  376. #endif
  377. #ifdef _SC_T_IOV_MAX
  378. { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
  379. #endif
  380. #ifdef _SC_XOPEN_CRYPT
  381. { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
  382. #endif
  383. #ifdef _SC_XOPEN_ENH_I18N
  384. { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
  385. #endif
  386. #ifdef _SC_XOPEN_LEGACY
  387. { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
  388. #endif
  389. #ifdef _SC_XOPEN_REALTIME
  390. { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
  391. #endif
  392. #ifdef _SC_XOPEN_REALTIME_THREADS
  393. { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
  394. #endif
  395. #ifdef _SC_XOPEN_SHM
  396. { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
  397. #endif
  398. #ifdef _SC_XOPEN_UNIX
  399. { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
  400. #endif
  401. #ifdef _SC_XOPEN_VERSION
  402. { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
  403. #endif
  404. #ifdef _SC_XOPEN_XCU_VERSION
  405. { "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
  406. #endif
  407. #ifdef _SC_XOPEN_XPG2
  408. { "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
  409. #endif
  410. #ifdef _SC_XOPEN_XPG3
  411. { "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
  412. #endif
  413. #ifdef _SC_XOPEN_XPG4
  414. { "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
  415. #endif
  416. /* POSIX.2 */
  417. #ifdef _SC_BC_BASE_MAX
  418. { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
  419. #endif
  420. #ifdef _SC_BC_DIM_MAX
  421. { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
  422. #endif
  423. #ifdef _SC_BC_SCALE_MAX
  424. { "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
  425. #endif
  426. #ifdef _SC_BC_STRING_MAX
  427. { "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
  428. #endif
  429. { "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
  430. #ifdef _SC_COLL_WEIGHTS_MAX
  431. { "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
  432. #endif
  433. #ifdef _SC_EQUIV_CLASS_MAX
  434. { "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
  435. #endif
  436. #ifdef _SC_EXPR_NEST_MAX
  437. { "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
  438. #endif
  439. #ifdef _SC_LINE_MAX
  440. { "LINE_MAX", _SC_LINE_MAX, SYSCONF },
  441. #endif
  442. #ifdef _SC_BC_BASE_MAX
  443. { "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
  444. #endif
  445. #ifdef _SC_BC_DIM_MAX
  446. { "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
  447. #endif
  448. #ifdef _SC_BC_SCALE_MAX
  449. { "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
  450. #endif
  451. #ifdef _SC_BC_STRING_MAX
  452. { "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
  453. #endif
  454. #ifdef _SC_2_CHAR_TERM
  455. { "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
  456. #endif
  457. #ifdef _SC_COLL_WEIGHTS_MAX
  458. { "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
  459. #endif
  460. #ifdef _SC_2_C_BIND
  461. { "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
  462. #endif
  463. #ifdef _SC_2_C_DEV
  464. { "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
  465. #endif
  466. #ifdef _SC_2_C_VERSION
  467. { "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
  468. #endif
  469. #ifdef _SC_EXPR_NEST_MAX
  470. { "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
  471. #endif
  472. #ifdef _SC_2_FORT_DEV
  473. { "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
  474. #endif
  475. #ifdef _SC_2_FORT_RUN
  476. { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
  477. #endif
  478. #ifdef _SC_LINE_MAX
  479. { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
  480. { "POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
  481. #endif
  482. #ifdef _SC_2_LOCALEDEF
  483. { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
  484. #endif
  485. #ifdef _SC_RE_DUP_MAX
  486. { "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
  487. #endif
  488. #ifdef _SC_2_SW_DEV
  489. { "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
  490. #endif
  491. #ifdef _SC_2_UPE
  492. { "POSIX2_UPE", _SC_2_UPE, SYSCONF },
  493. #endif
  494. #ifdef _SC_2_VERSION
  495. { "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
  496. #endif
  497. #ifdef _SC_RE_DUP_MAX
  498. { "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
  499. #endif
  500. #ifdef _CS_PATH
  501. { "PATH", _CS_PATH, CONFSTR },
  502. { "CS_PATH", _CS_PATH, CONFSTR },
  503. #endif
  504. /* LFS */
  505. #ifdef _CS_LFS_CFLAGS
  506. { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
  507. #endif
  508. #ifdef _CS_LFS_LDFLAGS
  509. { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
  510. #endif
  511. #ifdef _CS_LFS_LIBS
  512. { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
  513. #endif
  514. #ifdef _CS_LFS_LINTFLAGS
  515. { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
  516. #endif
  517. #ifdef _CS_LFS64_CFLAGS
  518. { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
  519. #endif
  520. #ifdef _CS_LFS64_LDFLAGS
  521. { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
  522. #endif
  523. #ifdef _CS_LFS64_LIBS
  524. { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
  525. #endif
  526. #ifdef _CS_LFS64_LINTFLAGS
  527. { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
  528. #endif
  529. /* Programming environments. */
  530. #ifdef _CS_V5_WIDTH_RESTRICTED_ENVS
  531. { "_XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
  532. { "XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
  533. #endif
  534. #ifdef _SC_XBS5_ILP32_OFF32
  535. { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
  536. #endif
  537. #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
  538. { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
  539. #endif
  540. #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
  541. { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
  542. #endif
  543. #ifdef _CS_XBS5_ILP32_OFF32_LIBS
  544. { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
  545. #endif
  546. #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
  547. { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
  548. #endif
  549. #ifdef _SC_XBS5_ILP32_OFFBIG
  550. { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
  551. #endif
  552. #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
  553. { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
  554. #endif
  555. #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
  556. { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
  557. #endif
  558. #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
  559. { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
  560. #endif
  561. #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
  562. { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
  563. #endif
  564. #ifdef _SC_XBS5_LP64_OFF64
  565. { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
  566. #endif
  567. #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
  568. { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
  569. #endif
  570. #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
  571. { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
  572. #endif
  573. #ifdef _CS_XBS5_LP64_OFF64_LIBS
  574. { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
  575. #endif
  576. #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
  577. { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
  578. #endif
  579. #ifdef _SC_XBS5_LPBIG_OFFBIG
  580. { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
  581. #endif
  582. #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
  583. { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
  584. #endif
  585. #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
  586. { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
  587. #endif
  588. #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
  589. { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
  590. #endif
  591. #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
  592. { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
  593. #endif
  594. #ifdef _SC_V6_ILP32_OFF32
  595. { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
  596. #endif
  597. #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
  598. { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
  599. #endif
  600. #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
  601. { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
  602. #endif
  603. #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
  604. { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
  605. #endif
  606. #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
  607. { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
  608. #endif
  609. #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
  610. { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
  611. { "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
  612. #endif
  613. #ifdef _SC_V6_ILP32_OFFBIG
  614. { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
  615. #endif
  616. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
  617. { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
  618. #endif
  619. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
  620. { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
  621. #endif
  622. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
  623. { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
  624. #endif
  625. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
  626. { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
  627. #endif
  628. #ifdef _SC_V6_LP64_OFF64
  629. { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
  630. #endif
  631. #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
  632. { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
  633. #endif
  634. #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
  635. { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
  636. #endif
  637. #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
  638. { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
  639. #endif
  640. #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
  641. { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
  642. #endif
  643. #ifdef _SC_V6_LPBIG_OFFBIG
  644. { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
  645. #endif
  646. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
  647. { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
  648. #endif
  649. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
  650. { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
  651. #endif
  652. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
  653. { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
  654. #endif
  655. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
  656. { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
  657. #endif
  658. #ifdef _SC_V7_ILP32_OFF32
  659. { "_POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32, SYSCONF },
  660. #endif
  661. #ifdef _CS_POSIX_V7_ILP32_OFF32_CFLAGS
  662. { "POSIX_V7_ILP32_OFF32_CFLAGS", _CS_POSIX_V7_ILP32_OFF32_CFLAGS, CONFSTR },
  663. #endif
  664. #ifdef _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
  665. { "POSIX_V7_ILP32_OFF32_LDFLAGS", _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, CONFSTR },
  666. #endif
  667. #ifdef _CS_POSIX_V7_ILP32_OFF32_LIBS
  668. { "POSIX_V7_ILP32_OFF32_LIBS", _CS_POSIX_V7_ILP32_OFF32_LIBS, CONFSTR },
  669. #endif
  670. #ifdef _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
  671. { "POSIX_V7_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, CONFSTR },
  672. #endif
  673. #ifdef _CS_V7_WIDTH_RESTRICTED_ENVS
  674. { "_POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
  675. { "POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
  676. #endif
  677. #ifdef _SC_V7_ILP32_OFFBIG
  678. { "_POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG, SYSCONF },
  679. #endif
  680. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
  681. { "POSIX_V7_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, CONFSTR },
  682. #endif
  683. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
  684. { "POSIX_V7_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, CONFSTR },
  685. #endif
  686. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LIBS
  687. { "POSIX_V7_ILP32_OFFBIG_LIBS", _CS_POSIX_V7_ILP32_OFFBIG_LIBS, CONFSTR },
  688. #endif
  689. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
  690. { "POSIX_V7_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
  691. #endif
  692. #ifdef _SC_V7_LP64_OFF64
  693. { "_POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64, SYSCONF },
  694. #endif
  695. #ifdef _CS_POSIX_V7_LP64_OFF64_CFLAGS
  696. { "POSIX_V7_LP64_OFF64_CFLAGS", _CS_POSIX_V7_LP64_OFF64_CFLAGS, CONFSTR },
  697. #endif
  698. #ifdef _CS_POSIX_V7_LP64_OFF64_LDFLAGS
  699. { "POSIX_V7_LP64_OFF64_LDFLAGS", _CS_POSIX_V7_LP64_OFF64_LDFLAGS, CONFSTR },
  700. #endif
  701. #ifdef _CS_POSIX_V7_LP64_OFF64_LIBS
  702. { "POSIX_V7_LP64_OFF64_LIBS", _CS_POSIX_V7_LP64_OFF64_LIBS, CONFSTR },
  703. #endif
  704. #ifdef _CS_POSIX_V7_LP64_OFF64_LINTFLAGS
  705. { "POSIX_V7_LP64_OFF64_LINTFLAGS", _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, CONFSTR },
  706. #endif
  707. #ifdef _SC_V7_LPBIG_OFFBIG
  708. { "_POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG, SYSCONF },
  709. #endif
  710. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
  711. { "POSIX_V7_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, CONFSTR },
  712. #endif
  713. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
  714. { "POSIX_V7_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
  715. #endif
  716. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
  717. { "POSIX_V7_LPBIG_OFFBIG_LIBS", _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, CONFSTR },
  718. #endif
  719. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
  720. { "POSIX_V7_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
  721. #endif
  722. #ifdef _SC_ADVISORY_INFO
  723. { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
  724. #endif
  725. #ifdef _SC_BARRIERS
  726. { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
  727. #endif
  728. #ifdef _SC_BASE
  729. { "_POSIX_BASE", _SC_BASE, SYSCONF },
  730. #endif
  731. #ifdef _SC_C_LANG_SUPPORT
  732. { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
  733. #endif
  734. #ifdef _SC_C_LANG_SUPPORT_R
  735. { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
  736. #endif
  737. #ifdef _SC_CLOCK_SELECTION
  738. { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
  739. #endif
  740. #ifdef _SC_CPUTIME
  741. { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
  742. #endif
  743. #ifdef _SC_THREAD_CPUTIME
  744. { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
  745. #endif
  746. #ifdef _SC_DEVICE_SPECIFIC
  747. { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
  748. #endif
  749. #ifdef _SC_DEVICE_SPECIFIC_R
  750. { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
  751. #endif
  752. #ifdef _SC_FD_MGMT
  753. { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
  754. #endif
  755. #ifdef _SC_FIFO
  756. { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
  757. #endif
  758. #ifdef _SC_PIPE
  759. { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
  760. #endif
  761. #ifdef _SC_FILE_ATTRIBUTES
  762. { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
  763. #endif
  764. #ifdef _SC_FILE_LOCKING
  765. { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
  766. #endif
  767. #ifdef _SC_FILE_SYSTEM
  768. { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
  769. #endif
  770. #ifdef _SC_MONOTONIC_CLOCK
  771. { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
  772. #endif
  773. #ifdef _SC_MULTI_PROCESS
  774. { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
  775. #endif
  776. #ifdef _SC_SINGLE_PROCESS
  777. { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
  778. #endif
  779. #ifdef _SC_NETWORKING
  780. { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
  781. #endif
  782. #ifdef _SC_READER_WRITER_LOCKS
  783. { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
  784. #endif
  785. #ifdef _SC_SPIN_LOCKS
  786. { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
  787. #endif
  788. #ifdef _SC_REGEXP
  789. { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
  790. #endif
  791. #ifdef _SC_REGEX_VERSION
  792. { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
  793. #endif
  794. #ifdef _SC_SHELL
  795. { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
  796. #endif
  797. #ifdef _SC_SIGNALS
  798. { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
  799. #endif
  800. #ifdef _SC_SPAWN
  801. { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
  802. #endif
  803. #ifdef _SC_SPORADIC_SERVER
  804. { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
  805. #endif
  806. #ifdef _SC_THREAD_SPORADIC_SERVER
  807. { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
  808. #endif
  809. #ifdef _SC_SYSTEM_DATABASE
  810. { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
  811. #endif
  812. #ifdef _SC_SYSTEM_DATABASE_R
  813. { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
  814. #endif
  815. #ifdef _SC_TIMEOUTS
  816. { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
  817. #endif
  818. #ifdef _SC_TYPED_MEMORY_OBJECTS
  819. { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
  820. #endif
  821. #ifdef _SC_USER_GROUPS
  822. { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
  823. #endif
  824. #ifdef _SC_USER_GROUPS_R
  825. { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
  826. #endif
  827. #ifdef _SC_2_PBS
  828. { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
  829. #endif
  830. #ifdef _SC_2_PBS_ACCOUNTING
  831. { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
  832. #endif
  833. #ifdef _SC_2_PBS_LOCATE
  834. { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
  835. #endif
  836. #ifdef _SC_2_PBS_TRACK
  837. { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
  838. #endif
  839. #ifdef _SC_2_PBS_MESSAGE
  840. { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
  841. #endif
  842. #ifdef _SC_SYMLOOP_MAX
  843. { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
  844. #endif
  845. #ifdef _SC_STREAM_MAX
  846. { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
  847. #endif
  848. #ifdef _SC_AIO_LISTIO_MAX
  849. { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
  850. #endif
  851. #ifdef _SC_AIO_MAX
  852. { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
  853. #endif
  854. #ifdef _SC_AIO_PRIO_DELTA_MAX
  855. { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
  856. #endif
  857. #ifdef _SC_DELAYTIMER_MAX
  858. { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
  859. #endif
  860. #ifdef _SC_HOST_NAME_MAX
  861. { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
  862. #endif
  863. #ifdef _SC_LOGIN_NAME_MAX
  864. { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
  865. #endif
  866. #ifdef _SC_MQ_OPEN_MAX
  867. { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
  868. #endif
  869. #ifdef _SC_MQ_PRIO_MAX
  870. { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
  871. #endif
  872. #ifdef _SC_DEVICE_IO
  873. { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
  874. #endif
  875. #ifdef _SC_TRACE
  876. { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
  877. #endif
  878. #ifdef _SC_TRACE_EVENT_FILTER
  879. { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
  880. #endif
  881. #ifdef _SC_TRACE_INHERIT
  882. { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
  883. #endif
  884. #ifdef _SC_TRACE_LOG
  885. { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
  886. #endif
  887. #ifdef _SC_RTSIG_MAX
  888. { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
  889. #endif
  890. #ifdef _SC_SEM_NSEMS_MAX
  891. { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
  892. #endif
  893. #ifdef _SC_SEM_VALUE_MAX
  894. { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
  895. #endif
  896. #ifdef _SC_SIGQUEUE_MAX
  897. { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
  898. #endif
  899. #ifdef _PC_FILESIZEBITS
  900. { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
  901. #endif
  902. #ifdef _PC_ALLOC_SIZE_MIN
  903. { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
  904. #endif
  905. #ifdef _PC_REC_INCR_XFER_SIZE
  906. { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
  907. #endif
  908. #ifdef _PC_REC_MAX_XFER_SIZE
  909. { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
  910. #endif
  911. #ifdef _PC_REC_MIN_XFER_SIZE
  912. { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
  913. #endif
  914. #ifdef _PC_REC_XFER_ALIGN
  915. { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
  916. #endif
  917. #ifdef _PC_SYMLINK_MAX
  918. { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
  919. #endif
  920. #ifdef _CS_GNU_LIBC_VERSION
  921. { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
  922. #endif
  923. #ifdef _CS_GNU_LIBPTHREAD_VERSION
  924. { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
  925. #endif
  926. #ifdef _PC_2_SYMLINKS
  927. { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
  928. #endif
  929. #ifdef _SC_LEVEL1_ICACHE_SIZE
  930. { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
  931. #endif
  932. #ifdef _SC_LEVEL1_ICACHE_ASSOC
  933. { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
  934. #endif
  935. #ifdef _SC_LEVEL1_ICACHE_LINESIZE
  936. { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
  937. #endif
  938. #ifdef _SC_LEVEL1_DCACHE_SIZE
  939. { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
  940. #endif
  941. #ifdef _SC_LEVEL1_DCACHE_ASSOC
  942. { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
  943. #endif
  944. #ifdef _SC_LEVEL1_DCACHE_LINESIZE
  945. { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
  946. #endif
  947. #ifdef _SC_LEVEL2_CACHE_SIZE
  948. { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
  949. #endif
  950. #ifdef _SC_LEVEL2_CACHE_ASSOC
  951. { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
  952. #endif
  953. #ifdef _SC_LEVEL2_CACHE_LINESIZE
  954. { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
  955. #endif
  956. #ifdef _SC_LEVEL3_CACHE_SIZE
  957. { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
  958. #endif
  959. #ifdef _SC_LEVEL3_CACHE_ASSOC
  960. { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
  961. #endif
  962. #ifdef _SC_LEVEL3_CACHE_LINESIZE
  963. { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
  964. #endif
  965. #ifdef _SC_LEVEL4_CACHE_SIZE
  966. { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
  967. #endif
  968. #ifdef _SC_LEVEL4_CACHE_ASSOC
  969. { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
  970. #endif
  971. #ifdef _SC_LEVEL4_CACHE_LINESIZE
  972. { "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
  973. #endif
  974. #ifdef _SC_IPV6
  975. { "IPV6", _SC_IPV6, SYSCONF },
  976. #endif
  977. #ifdef _SC_RAW_SOCKETS
  978. { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
  979. #endif
  980. { NULL, 0, SYSCONF }
  981. };
  982. static const struct { const char *name; int num; } specs[] =
  983. {
  984. #ifdef _SC_XBS5_ILP32_OFF32
  985. { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
  986. #endif
  987. #ifdef _SC_XBS5_ILP32_OFFBIG
  988. { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
  989. #endif
  990. #ifdef _SC_XBS5_LP64_OFF64
  991. { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
  992. #endif
  993. #ifdef _SC_XBS5_LPBIG_OFFBIG
  994. { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
  995. #endif
  996. #ifdef _SC_V6_ILP32_OFF32
  997. { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
  998. #endif
  999. #ifdef _SC_V6_ILP32_OFFBIG
  1000. { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
  1001. #endif
  1002. #ifdef _SC_V6_LP64_OFF64
  1003. { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
  1004. #endif
  1005. #ifdef _SC_V6_LPBIG_OFFBIG
  1006. { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
  1007. #endif
  1008. #ifdef _SC_V7_ILP32_OFF32
  1009. { "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
  1010. #endif
  1011. #ifdef _SC_V7_ILP32_OFFBIG
  1012. { "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
  1013. #endif
  1014. #ifdef _SC_V7_LP64_OFF64
  1015. { "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
  1016. #endif
  1017. #ifdef _SC_V7_LPBIG_OFFBIG
  1018. { "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
  1019. #endif
  1020. };
  1021. static const int nspecs = sizeof (specs) / sizeof (specs[0]);
  1022. #ifdef __UCLIBC_HAS___PROGNAME__
  1023. extern const char *__progname;
  1024. #else
  1025. #define __progname "foo"
  1026. #endif
  1027. static void
  1028. usage (void)
  1029. {
  1030. fprintf (stderr,
  1031. _("Usage: %s [-v specification] variable_name [pathname]\n"),
  1032. __progname);
  1033. fprintf (stderr,
  1034. _(" %s -a [pathname]\n"), __progname);
  1035. exit (2);
  1036. }
  1037. static void
  1038. print_all (const char *path)
  1039. {
  1040. register const struct conf *c;
  1041. size_t clen;
  1042. long int value;
  1043. char *cvalue;
  1044. for (c = vars; c->name != NULL; ++c) {
  1045. printf("%-35s", c->name);
  1046. switch (c->call) {
  1047. case PATHCONF:
  1048. value = pathconf (path, c->call_name);
  1049. if (value != -1) {
  1050. printf("%ld", value);
  1051. }
  1052. printf("\n");
  1053. break;
  1054. case SYSCONF:
  1055. value = sysconf (c->call_name);
  1056. if (value == -1l) {
  1057. if (c->call_name == _SC_UINT_MAX
  1058. || c->call_name == _SC_ULONG_MAX)
  1059. printf ("%lu", value);
  1060. }
  1061. else {
  1062. printf ("%ld", value);
  1063. }
  1064. printf ("\n");
  1065. break;
  1066. case CONFSTR:
  1067. clen = confstr (c->call_name, (char *) NULL, 0);
  1068. cvalue = (char *) malloc (clen);
  1069. if (cvalue == NULL)
  1070. error (3, 0, _("memory exhausted"));
  1071. if (confstr (c->call_name, cvalue, clen) != clen)
  1072. error (3, errno, "confstr");
  1073. printf ("%.*s\n", (int) clen, cvalue);
  1074. free (cvalue);
  1075. break;
  1076. }
  1077. }
  1078. exit (0);
  1079. }
  1080. int
  1081. main (int argc, char *argv[])
  1082. {
  1083. register const struct conf *c;
  1084. /* Set locale. Do not set LC_ALL because the other categories must
  1085. not be affected (according to POSIX.2). */
  1086. /* Initialize the message catalog. */
  1087. if (argc > 1 && strcmp (argv[1], "--version") == 0)
  1088. {
  1089. printf ("getconf (GNU %s) %s\n", PACKAGE, VERSION);
  1090. printf ("\
  1091. Copyright (C) %s Free Software Foundation, Inc.\n\
  1092. This is free software; see the source for copying conditions. There is NO\n\
  1093. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
  1094. ", "2009");
  1095. printf ("Written by %s.\n", "Roland McGrath");
  1096. return 0;
  1097. }
  1098. if (argc > 1 && strcmp (argv[1], "--help") == 0)
  1099. {
  1100. printf ("\
  1101. Usage: getconf [-v SPEC] VAR\n\
  1102. or: getconf [-v SPEC] PATH_VAR PATH\n\
  1103. \n\
  1104. Get the configuration value for variable VAR, or for variable PATH_VAR\n\
  1105. for path PATH. If SPEC is given, give values for compilation\n\
  1106. environment SPEC.\n\n");
  1107. fputs ("For bug reporting instructions, please see:\n\
  1108. <http://www.gnu.org/software/libc/bugs.html>.\n", stdout);
  1109. return 0;
  1110. }
  1111. const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
  1112. size_t getconf_dirlen = strlen (getconf_dir);
  1113. const char *spec = NULL;
  1114. char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
  1115. char *argv0 = argv[0];
  1116. if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
  1117. {
  1118. if (argv[1][2] == '\0')
  1119. {
  1120. if (argc < 3)
  1121. usage ();
  1122. spec = argv[2];
  1123. argv += 2;
  1124. argc -= 2;
  1125. }
  1126. else
  1127. {
  1128. spec = &argv[1][2];
  1129. argv += 1;
  1130. argc += 1;
  1131. }
  1132. }
  1133. else
  1134. {
  1135. char default_name[getconf_dirlen + sizeof "/default"];
  1136. memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
  1137. "/default", sizeof "/default");
  1138. int len = readlink (default_name, buf, sizeof buf - 1);
  1139. if (len > 0)
  1140. {
  1141. buf[len] = '\0';
  1142. spec = buf;
  1143. }
  1144. }
  1145. /* Check for the specifications we know. */
  1146. if (spec != NULL)
  1147. {
  1148. int i;
  1149. for (i = 0; i < nspecs; ++i)
  1150. if (strcmp (spec, specs[i].name) == 0)
  1151. break;
  1152. if (i == nspecs)
  1153. error (2, 0, _("unknown specification \"%s\""), spec);
  1154. switch (specs[i].num)
  1155. {
  1156. #if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32)
  1157. case _SC_XBS5_ILP32_OFF32:
  1158. #endif
  1159. #if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG)
  1160. case _SC_XBS5_ILP32_OFFBIG:
  1161. #endif
  1162. #if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64)
  1163. case _SC_XBS5_LP64_OFF64:
  1164. #endif
  1165. #if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG)
  1166. case _SC_XBS5_LPBIG_OFFBIG:
  1167. #endif
  1168. #if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32)
  1169. case _SC_V6_ILP32_OFF32:
  1170. #endif
  1171. #if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG)
  1172. case _SC_V6_ILP32_OFFBIG:
  1173. #endif
  1174. #if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64)
  1175. case _SC_V6_LP64_OFF64:
  1176. #endif
  1177. #if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG)
  1178. case _SC_V6_LPBIG_OFFBIG:
  1179. #endif
  1180. #if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32)
  1181. case _SC_V7_ILP32_OFF32:
  1182. #endif
  1183. #if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG)
  1184. case _SC_V7_ILP32_OFFBIG:
  1185. #endif
  1186. #if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64)
  1187. case _SC_V7_LP64_OFF64:
  1188. #endif
  1189. #if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG)
  1190. case _SC_V7_LPBIG_OFFBIG:
  1191. #endif
  1192. {
  1193. const char *args[argc + 3];
  1194. size_t spec_len = strlen (spec);
  1195. char getconf_name[getconf_dirlen + 1 + spec_len + 1];
  1196. memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
  1197. getconf_dirlen),
  1198. "/", 1), spec, spec_len + 1);
  1199. args[0] = argv0;
  1200. args[1] = "-v";
  1201. args[2] = spec;
  1202. memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
  1203. execv (getconf_name, (char * const *) args);
  1204. error (4, errno, _("Couldn't execute %s"), getconf_name);
  1205. }
  1206. default:
  1207. break;
  1208. }
  1209. }
  1210. if (argc > 1 && strcmp (argv[1], "-a") == 0)
  1211. {
  1212. if (argc == 2)
  1213. print_all ("/");
  1214. else if (argc == 3)
  1215. print_all (argv[2]);
  1216. else
  1217. usage ();
  1218. }
  1219. int ai = 1;
  1220. if (argc > ai && strcmp (argv[ai], "--") == 0)
  1221. ++ai;
  1222. if (argc - ai < 1 || argc - ai > 2)
  1223. usage ();
  1224. for (c = vars; c->name != NULL; ++c)
  1225. if (strcmp (c->name, argv[ai]) == 0
  1226. || (strncmp (c->name, "_POSIX_", 7) == 0
  1227. && strcmp (c->name + 7, argv[ai]) == 0))
  1228. {
  1229. long int value;
  1230. size_t clen;
  1231. char *cvalue;
  1232. switch (c->call)
  1233. {
  1234. case PATHCONF:
  1235. if (argc - ai < 2)
  1236. usage ();
  1237. errno = 0;
  1238. value = pathconf (argv[ai + 1], c->call_name);
  1239. if (value == -1)
  1240. {
  1241. if (errno) {
  1242. error (3, errno, "pathconf: %s", argv[ai + 1]);
  1243. } else
  1244. puts (_("undefined"));
  1245. }
  1246. else
  1247. printf ("%ld\n", value);
  1248. exit (0);
  1249. case SYSCONF:
  1250. if (argc - ai > 1)
  1251. usage ();
  1252. value = sysconf (c->call_name);
  1253. if (value == -1l)
  1254. {
  1255. if (c->call_name == _SC_UINT_MAX
  1256. || c->call_name == _SC_ULONG_MAX)
  1257. printf ("%lu\n", value);
  1258. else
  1259. puts (_("undefined"));
  1260. }
  1261. else
  1262. printf ("%ld\n", value);
  1263. exit (0);
  1264. case CONFSTR:
  1265. if (argc - ai > 1)
  1266. usage ();
  1267. clen = confstr (c->call_name, (char *) NULL, 0);
  1268. cvalue = (char *) malloc (clen);
  1269. if (cvalue == NULL)
  1270. error (3, 0, _("memory exhausted"));
  1271. if (confstr (c->call_name, cvalue, clen) != clen)
  1272. error (3, errno, "confstr");
  1273. printf ("%.*s\n", (int) clen, cvalue);
  1274. exit (0);
  1275. }
  1276. }
  1277. error (2, 0, _("Unrecognized variable `%s'"), argv[ai]);
  1278. /* NOTREACHED */
  1279. return 2;
  1280. }