logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

getconf.1p (10972B)


  1. '\" et
  2. .TH GETCONF "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. getconf
  12. \(em get configuration values
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. getconf \fB[\fR-v specification\fB] \fIsystem_var\fR
  17. .P
  18. getconf \fB[\fR-v specification\fB] \fIpath_var pathname\fR
  19. .fi
  20. .SH DESCRIPTION
  21. In the first synopsis form, the
  22. .IR getconf
  23. utility shall write to the standard output the value of the variable
  24. specified by the
  25. .IR system_var
  26. operand.
  27. .P
  28. In the second synopsis form, the
  29. .IR getconf
  30. utility shall write to the standard output the value of the variable
  31. specified by the
  32. .IR path_var
  33. operand for the path specified by the
  34. .IR pathname
  35. operand.
  36. .P
  37. The value of each configuration variable shall be determined as if it
  38. were obtained by calling the function from which it is defined to be
  39. available by this volume of POSIX.1\(hy2017 or by the System Interfaces volume of POSIX.1\(hy2017 (see the OPERANDS section). The
  40. value shall reflect conditions in the current operating environment.
  41. .SH OPTIONS
  42. The
  43. .IR getconf
  44. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  45. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  46. .P
  47. The following option shall be supported:
  48. .IP "\fB\-v\ \fIspecification\fR" 10
  49. .br
  50. Indicate a specific specification and version for which configuration
  51. variables shall be determined. If this option is not specified, the
  52. values returned correspond to an implementation default conforming
  53. compilation environment.
  54. .RS 10
  55. .P
  56. If the command:
  57. .sp
  58. .RS 4
  59. .nf
  60. getconf _POSIX_V7_ILP32_OFF32
  61. .fi
  62. .P
  63. .RE
  64. .P
  65. does not write
  66. .BR \(dq-1\en\(dq
  67. or
  68. .BR \(dqundefined\en\(dq
  69. to standard output, then commands of the form:
  70. .sp
  71. .RS 4
  72. .nf
  73. getconf -v POSIX_V7_ILP32_OFF32 ...
  74. .fi
  75. .P
  76. .RE
  77. .P
  78. determine values for configuration variables corresponding to the
  79. POSIX_V7_ILP32_OFF32 compilation environment specified in
  80. .IR "\fIc99\fR\^",
  81. the EXTENDED DESCRIPTION.
  82. .P
  83. If the command:
  84. .sp
  85. .RS 4
  86. .nf
  87. getconf _POSIX_V7_ILP32_OFFBIG
  88. .fi
  89. .P
  90. .RE
  91. .P
  92. does not write
  93. .BR \(dq-1\en\(dq
  94. or
  95. .BR \(dqundefined\en\(dq
  96. to standard output, then commands of the form:
  97. .sp
  98. .RS 4
  99. .nf
  100. getconf -v POSIX_V7_ILP32_OFFBIG ...
  101. .fi
  102. .P
  103. .RE
  104. .P
  105. determine values for configuration variables corresponding to the
  106. POSIX_V7_ILP32_OFFBIG compilation environment specified in
  107. .IR "\fIc99\fR\^",
  108. the EXTENDED DESCRIPTION.
  109. .P
  110. If the command:
  111. .sp
  112. .RS 4
  113. .nf
  114. getconf _POSIX_V7_LP64_OFF64
  115. .fi
  116. .P
  117. .RE
  118. .P
  119. does not write
  120. .BR \(dq-1\en\(dq
  121. or
  122. .BR \(dqundefined\en\(dq
  123. to standard output, then commands of the form:
  124. .sp
  125. .RS 4
  126. .nf
  127. getconf -v POSIX_V7_LP64_OFF64 ...
  128. .fi
  129. .P
  130. .RE
  131. .P
  132. determine values for configuration variables corresponding to the
  133. POSIX_V7_LP64_OFF64 compilation environment specified in
  134. .IR "\fIc99\fR\^",
  135. the EXTENDED DESCRIPTION.
  136. .P
  137. If the command:
  138. .sp
  139. .RS 4
  140. .nf
  141. getconf _POSIX_V7_LPBIG_OFFBIG
  142. .fi
  143. .P
  144. .RE
  145. .P
  146. does not write
  147. .BR \(dq-1\en\(dq
  148. or
  149. .BR \(dqundefined\en\(dq
  150. to standard output, then commands of the form:
  151. .sp
  152. .RS 4
  153. .nf
  154. getconf -v POSIX_V7_LPBIG_OFFBIG ...
  155. .fi
  156. .P
  157. .RE
  158. .P
  159. determine values for configuration variables corresponding to the
  160. POSIX_V7_LPBIG_OFFBIG compilation environment specified in
  161. .IR "\fIc99\fR\^",
  162. the EXTENDED DESCRIPTION.
  163. .RE
  164. .SH OPERANDS
  165. The following operands shall be supported:
  166. .IP "\fIpath_var\fR" 10
  167. A name of a configuration variable. All of the variables in the
  168. Variable column of the table in the DESCRIPTION of the
  169. \fIfpathconf\fR()
  170. function defined in the System Interfaces volume of POSIX.1\(hy2017, without the enclosing braces, shall be
  171. supported. The implementation may add other local variables.
  172. .IP "\fIpathname\fR" 10
  173. A pathname for which the variable specified by
  174. .IR path_var
  175. is to be determined.
  176. .IP "\fIsystem_var\fR" 10
  177. A name of a configuration variable. All of the following variables
  178. shall be supported:
  179. .RS 10
  180. .IP " *" 4
  181. The names in the Variable column of the table in the DESCRIPTION of the
  182. \fIsysconf\fR()
  183. function in the System Interfaces volume of POSIX.1\(hy2017, except for the entries corresponding to
  184. _SC_CLK_TCK, _SC_GETGR_R_SIZE_MAX, and _SC_GETPW_R_SIZE_MAX, without
  185. the enclosing braces.
  186. .RS 4
  187. .P
  188. For compatibility with earlier versions, the following variable names
  189. shall also be supported:
  190. POSIX2_C_BIND
  191. POSIX2_C_DEV
  192. POSIX2_CHAR_TERM
  193. POSIX2_FORT_DEV
  194. POSIX2_FORT_RUN
  195. POSIX2_LOCALEDEF
  196. POSIX2_SW_DEV
  197. POSIX2_UPE
  198. POSIX2_VERSION
  199. .P
  200. and shall be equivalent to the same name prefixed with an
  201. <underscore>.
  202. This requirement may be removed in a future version.
  203. .RE
  204. .IP " *" 4
  205. The names of the symbolic constants used as the
  206. .IR name
  207. argument of the
  208. \fIconfstr\fR()
  209. function in the System Interfaces volume of POSIX.1\(hy2017, without the _CS_ prefix.
  210. .IP " *" 4
  211. The names of the symbolic constants listed under the headings ``Maximum
  212. Values'' and ``Minimum Values'' in the description of the
  213. .IR <limits.h>
  214. header in the Base Definitions volume of POSIX.1\(hy2017, without the enclosing braces.
  215. .RS 4
  216. .P
  217. For compatibility with earlier versions, the following variable names
  218. shall also be supported:
  219. POSIX2_BC_BASE_MAX
  220. POSIX2_BC_DIM_MAX
  221. POSIX2_BC_SCALE_MAX
  222. POSIX2_BC_STRING_MAX
  223. POSIX2_COLL_WEIGHTS_MAX
  224. POSIX2_EXPR_NEST_MAX
  225. POSIX2_LINE_MAX
  226. POSIX2_RE_DUP_MAX
  227. .P
  228. and shall be equivalent to the same name prefixed with an
  229. <underscore>.
  230. This requirement may be removed in a future version.
  231. .RE
  232. .P
  233. The implementation may add other local values.
  234. .RE
  235. .SH STDIN
  236. Not used.
  237. .SH "INPUT FILES"
  238. None.
  239. .SH "ENVIRONMENT VARIABLES"
  240. The following environment variables shall affect the execution of
  241. .IR getconf :
  242. .IP "\fILANG\fP" 10
  243. Provide a default value for the internationalization variables that are
  244. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  245. .IR "Section 8.2" ", " "Internationalization Variables"
  246. for the precedence of internationalization variables used to determine
  247. the values of locale categories.)
  248. .IP "\fILC_ALL\fP" 10
  249. If set to a non-empty string value, override the values of all the
  250. other internationalization variables.
  251. .IP "\fILC_CTYPE\fP" 10
  252. Determine the locale for the interpretation of sequences of bytes of
  253. text data as characters (for example, single-byte as opposed to
  254. multi-byte characters in arguments).
  255. .IP "\fILC_MESSAGES\fP" 10
  256. .br
  257. Determine the locale that should be used to affect the format and
  258. contents of diagnostic messages written to standard error.
  259. .IP "\fINLSPATH\fP" 10
  260. Determine the location of message catalogs for the processing of
  261. .IR LC_MESSAGES .
  262. .SH "ASYNCHRONOUS EVENTS"
  263. Default.
  264. .SH STDOUT
  265. If the specified variable is defined on the system and its value is
  266. described to be available from the
  267. \fIconfstr\fR()
  268. function defined in the System Interfaces volume of POSIX.1\(hy2017, its value shall be written in the
  269. following format:
  270. .sp
  271. .RS 4
  272. .nf
  273. "%s\en", <\fIvalue\fR>
  274. .fi
  275. .P
  276. .RE
  277. .P
  278. Otherwise, if the specified variable is defined on the system, its
  279. value shall be written in the following format:
  280. .sp
  281. .RS 4
  282. .nf
  283. "%d\en", <\fIvalue\fR>
  284. .fi
  285. .P
  286. .RE
  287. .P
  288. If the specified variable is valid, but is undefined on the system,
  289. .IR getconf
  290. shall write using the following format:
  291. .sp
  292. .RS 4
  293. .nf
  294. "undefined\en"
  295. .fi
  296. .P
  297. .RE
  298. .P
  299. If the variable name is invalid or an error occurs, nothing shall be
  300. written to standard output.
  301. .SH STDERR
  302. The standard error shall be used only for diagnostic messages.
  303. .SH "OUTPUT FILES"
  304. None.
  305. .SH "EXTENDED DESCRIPTION"
  306. None.
  307. .SH "EXIT STATUS"
  308. The following exit values shall be returned:
  309. .IP "\00" 6
  310. The specified variable is valid and information about its current state
  311. was written successfully.
  312. .IP >0 6
  313. An error occurred.
  314. .SH "CONSEQUENCES OF ERRORS"
  315. Default.
  316. .LP
  317. .IR "The following sections are informative."
  318. .SH "APPLICATION USAGE"
  319. None.
  320. .SH EXAMPLES
  321. The following example illustrates the value of
  322. {NGROUPS_MAX}:
  323. .sp
  324. .RS 4
  325. .nf
  326. getconf NGROUPS_MAX
  327. .fi
  328. .P
  329. .RE
  330. .P
  331. The following example illustrates the value of
  332. {NAME_MAX}
  333. for a specific directory:
  334. .sp
  335. .RS 4
  336. .nf
  337. getconf NAME_MAX /usr
  338. .fi
  339. .P
  340. .RE
  341. .P
  342. The following example shows how to deal more carefully with results
  343. that might be unspecified:
  344. .sp
  345. .RS 4
  346. .nf
  347. if value=$(getconf PATH_MAX /usr); then
  348. if [ "$value" = "undefined" ]; then
  349. echo PATH_MAX in /usr is indeterminate.
  350. else
  351. echo PATH_MAX in /usr is $value.
  352. fi
  353. else
  354. echo Error in getconf.
  355. fi
  356. .fi
  357. .P
  358. .RE
  359. .SH RATIONALE
  360. The original need for this utility, and for the
  361. \fIconfstr\fR()
  362. function, was to provide a way of finding the configuration-defined
  363. default value for the
  364. .IR PATH
  365. environment variable. Since
  366. .IR PATH
  367. can be modified by the user to include directories that could contain
  368. utilities replacing the standard utilities, shell scripts need
  369. a way to determine the system-supplied
  370. .IR PATH
  371. environment variable value that contains the correct search path for
  372. the standard utilities. It was later suggested that access to the other
  373. variables described in this volume of POSIX.1\(hy2017 could also be useful to applications.
  374. .P
  375. This functionality of
  376. .IR getconf
  377. would not be adequately subsumed by another command such as:
  378. .sp
  379. .RS 4
  380. .nf
  381. grep \fIvar\fP /etc/conf
  382. .fi
  383. .P
  384. .RE
  385. .P
  386. because such a strategy would provide correct values for neither those
  387. variables that can vary at runtime, nor those that can vary depending
  388. on the path.
  389. .P
  390. Early proposal versions of
  391. .IR getconf
  392. specified exit status 1 when the specified variable was valid, but not
  393. defined on the system. The output string
  394. .BR \(dqundefined\(dq
  395. is now used to specify this case with exit code 0 because so many
  396. things depend on an exit code of zero when an invoked utility is
  397. successful.
  398. .SH "FUTURE DIRECTIONS"
  399. None.
  400. .SH "SEE ALSO"
  401. .IR "\fIc99\fR\^"
  402. .P
  403. The Base Definitions volume of POSIX.1\(hy2017,
  404. .IR "Chapter 8" ", " "Environment Variables",
  405. .IR "Section 12.2" ", " "Utility Syntax Guidelines",
  406. .IR "\fB<limits.h>\fP"
  407. .P
  408. The System Interfaces volume of POSIX.1\(hy2017,
  409. .IR "\fIconfstr\fR\^(\|)",
  410. .IR "\fIfpathconf\fR\^(\|)",
  411. .IR "\fIsysconf\fR\^(\|)",
  412. .IR "\fIsystem\fR\^(\|)"
  413. .\"
  414. .SH COPYRIGHT
  415. Portions of this text are reprinted and reproduced in electronic form
  416. from IEEE Std 1003.1-2017, Standard for Information Technology
  417. -- Portable Operating System Interface (POSIX), The Open Group Base
  418. Specifications Issue 7, 2018 Edition,
  419. Copyright (C) 2018 by the Institute of
  420. Electrical and Electronics Engineers, Inc and The Open Group.
  421. In the event of any discrepancy between this version and the original IEEE and
  422. The Open Group Standard, the original IEEE and The Open Group Standard
  423. is the referee document. The original Standard can be obtained online at
  424. http://www.opengroup.org/unix/online.html .
  425. .PP
  426. Any typographical or formatting errors that appear
  427. in this page are most likely
  428. to have been introduced during the conversion of the source files to
  429. man page format. To report such errors, see
  430. https://www.kernel.org/doc/man-pages/reporting_bugs.html .