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

sysconf.3p (12564B)


  1. '\" et
  2. .TH SYSCONF "3P" 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. sysconf
  12. \(em get configurable system variables
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <unistd.h>
  17. .P
  18. long sysconf(int \fIname\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIsysconf\fR()
  23. function provides a method for the application to determine the current
  24. value of a configurable system limit or option (\c
  25. .IR variable ).
  26. The implementation shall support all of the variables listed in the
  27. following table and may support others.
  28. .P
  29. The
  30. .IR name
  31. argument represents the system variable to be queried. The following
  32. table lists the minimal set of system variables from
  33. .IR <limits.h>
  34. or
  35. .IR <unistd.h>
  36. that can be returned by
  37. \fIsysconf\fR(),
  38. and the symbolic constants defined in
  39. .IR <unistd.h>
  40. that are the corresponding values used for
  41. .IR name .
  42. .ad l
  43. .TS
  44. box center tab(@);
  45. cB | cB
  46. lw(2.7i)1e | le.
  47. Variable@Value of Name
  48. _
  49. {AIO_LISTIO_MAX}@_SC_AIO_LISTIO_MAX
  50. {AIO_MAX}@_SC_AIO_MAX
  51. {AIO_PRIO_DELTA_MAX}@_SC_AIO_PRIO_DELTA_MAX
  52. {ARG_MAX}@_SC_ARG_MAX
  53. {ATEXIT_MAX}@_SC_ATEXIT_MAX
  54. {BC_BASE_MAX}@_SC_BC_BASE_MAX
  55. {BC_DIM_MAX}@_SC_BC_DIM_MAX
  56. {BC_SCALE_MAX}@_SC_BC_SCALE_MAX
  57. {BC_STRING_MAX}@_SC_BC_STRING_MAX
  58. {CHILD_MAX}@_SC_CHILD_MAX
  59. Clock ticks/second@_SC_CLK_TCK
  60. {COLL_WEIGHTS_MAX}@_SC_COLL_WEIGHTS_MAX
  61. {DELAYTIMER_MAX}@_SC_DELAYTIMER_MAX
  62. {EXPR_NEST_MAX}@_SC_EXPR_NEST_MAX
  63. {HOST_NAME_MAX}@_SC_HOST_NAME_MAX
  64. {IOV_MAX}@_SC_IOV_MAX
  65. {LINE_MAX}@_SC_LINE_MAX
  66. {LOGIN_NAME_MAX}@_SC_LOGIN_NAME_MAX
  67. {NGROUPS_MAX}@_SC_NGROUPS_MAX
  68. Initial size of \fIgetgrgid_r\fP\^(\|) and@_SC_GETGR_R_SIZE_MAX
  69. \fIgetgrnam_r\fP\^(\|) data buffers
  70. Initial size of \fIgetpwuid_r\fP\^(\|) and@_SC_GETPW_R_SIZE_MAX
  71. \fIgetpwnam_r\fP\^(\|) data buffers
  72. {MQ_OPEN_MAX}@_SC_MQ_OPEN_MAX
  73. {MQ_PRIO_MAX}@_SC_MQ_PRIO_MAX
  74. {OPEN_MAX}@_SC_OPEN_MAX
  75. {PAGE_SIZE}@_SC_PAGE_SIZE
  76. {PAGESIZE}@_SC_PAGESIZE
  77. {PTHREAD_DESTRUCTOR_ITERATIONS}@_SC_THREAD_DESTRUCTOR_ITERATIONS
  78. {PTHREAD_KEYS_MAX}@_SC_THREAD_KEYS_MAX
  79. {PTHREAD_STACK_MIN}@_SC_THREAD_STACK_MIN
  80. {PTHREAD_THREADS_MAX}@_SC_THREAD_THREADS_MAX
  81. {RE_DUP_MAX}@_SC_RE_DUP_MAX
  82. {RTSIG_MAX}@_SC_RTSIG_MAX
  83. {SEM_NSEMS_MAX}@_SC_SEM_NSEMS_MAX
  84. {SEM_VALUE_MAX}@_SC_SEM_VALUE_MAX
  85. {SIGQUEUE_MAX}@_SC_SIGQUEUE_MAX
  86. {STREAM_MAX}@_SC_STREAM_MAX
  87. {SYMLOOP_MAX}@_SC_SYMLOOP_MAX
  88. {TIMER_MAX}@_SC_TIMER_MAX
  89. {TTY_NAME_MAX}@_SC_TTY_NAME_MAX
  90. {TZNAME_MAX}@_SC_TZNAME_MAX
  91. _POSIX_ADVISORY_INFO@_SC_ADVISORY_INFO
  92. _POSIX_BARRIERS@_SC_BARRIERS
  93. _POSIX_ASYNCHRONOUS_IO@_SC_ASYNCHRONOUS_IO
  94. _POSIX_CLOCK_SELECTION@_SC_CLOCK_SELECTION
  95. _POSIX_CPUTIME@_SC_CPUTIME
  96. _POSIX_FSYNC@_SC_FSYNC
  97. _POSIX_IPV6@_SC_IPV6
  98. _POSIX_JOB_CONTROL@_SC_JOB_CONTROL
  99. _POSIX_MAPPED_FILES@_SC_MAPPED_FILES
  100. _POSIX_MEMLOCK@_SC_MEMLOCK
  101. _POSIX_MEMLOCK_RANGE@_SC_MEMLOCK_RANGE
  102. _POSIX_MEMORY_PROTECTION@_SC_MEMORY_PROTECTION
  103. _POSIX_MESSAGE_PASSING@_SC_MESSAGE_PASSING
  104. _POSIX_MONOTONIC_CLOCK@_SC_MONOTONIC_CLOCK
  105. _POSIX_PRIORITIZED_IO@_SC_PRIORITIZED_IO
  106. _POSIX_PRIORITY_SCHEDULING@_SC_PRIORITY_SCHEDULING
  107. _POSIX_RAW_SOCKETS@_SC_RAW_SOCKETS
  108. _POSIX_READER_WRITER_LOCKS@_SC_READER_WRITER_LOCKS
  109. _POSIX_REALTIME_SIGNALS@_SC_REALTIME_SIGNALS
  110. _POSIX_REGEXP@_SC_REGEXP
  111. _POSIX_SAVED_IDS@_SC_SAVED_IDS
  112. _POSIX_SEMAPHORES@_SC_SEMAPHORES
  113. _POSIX_SHARED_MEMORY_OBJECTS@_SC_SHARED_MEMORY_OBJECTS
  114. _POSIX_SHELL@_SC_SHELL
  115. _POSIX_SPAWN@_SC_SPAWN
  116. _POSIX_SPIN_LOCKS@_SC_SPIN_LOCKS
  117. _POSIX_SPORADIC_SERVER@_SC_SPORADIC_SERVER
  118. _POSIX_SS_REPL_MAX@_SC_SS_REPL_MAX
  119. _POSIX_SYNCHRONIZED_IO@_SC_SYNCHRONIZED_IO
  120. _POSIX_THREAD_ATTR_STACKADDR@_SC_THREAD_ATTR_STACKADDR
  121. _POSIX_THREAD_ATTR_STACKSIZE@_SC_THREAD_ATTR_STACKSIZE
  122. _POSIX_THREAD_CPUTIME@_SC_THREAD_CPUTIME
  123. _POSIX_THREAD_PRIO_INHERIT@_SC_THREAD_PRIO_INHERIT
  124. _POSIX_THREAD_PRIO_PROTECT@_SC_THREAD_PRIO_PROTECT
  125. _POSIX_THREAD_PRIORITY_SCHEDULING@_SC_THREAD_PRIORITY_SCHEDULING
  126. _POSIX_THREAD_PROCESS_SHARED@_SC_THREAD_PROCESS_SHARED
  127. _POSIX_THREAD_ROBUST_PRIO_INHERIT@_SC_THREAD_ROBUST_PRIO_INHERIT
  128. _POSIX_THREAD_ROBUST_PRIO_PROTECT@_SC_THREAD_ROBUST_PRIO_PROTECT
  129. _POSIX_THREAD_SAFE_FUNCTIONS@_SC_THREAD_SAFE_FUNCTIONS
  130. _POSIX_THREAD_SPORADIC_SERVER@_SC_THREAD_SPORADIC_SERVER
  131. _POSIX_THREADS@_SC_THREADS
  132. _POSIX_TIMEOUTS@_SC_TIMEOUTS
  133. .TE
  134. .TS
  135. box center tab(@);
  136. cB | cB
  137. lw(2.85i)1e | le.
  138. Variable@Value of Name
  139. _
  140. _POSIX_TIMERS@_SC_TIMERS
  141. _POSIX_TRACE@_SC_TRACE
  142. _POSIX_TRACE_EVENT_FILTER@_SC_TRACE_EVENT_FILTER
  143. _POSIX_TRACE_EVENT_NAME_MAX@_SC_TRACE_EVENT_NAME_MAX
  144. _POSIX_TRACE_INHERIT@_SC_TRACE_INHERIT
  145. _POSIX_TRACE_LOG@_SC_TRACE_LOG
  146. _POSIX_TRACE_NAME_MAX@_SC_TRACE_NAME_MAX
  147. _POSIX_TRACE_SYS_MAX@_SC_TRACE_SYS_MAX
  148. _POSIX_TRACE_USER_EVENT_MAX@_SC_TRACE_USER_EVENT_MAX
  149. _POSIX_TYPED_MEMORY_OBJECTS@_SC_TYPED_MEMORY_OBJECTS
  150. _POSIX_VERSION@_SC_VERSION
  151. _POSIX_V7_ILP32_OFF32@_SC_V7_ILP32_OFF32
  152. _POSIX_V7_ILP32_OFFBIG@_SC_V7_ILP32_OFFBIG
  153. _POSIX_V7_LP64_OFF64@_SC_V7_LP64_OFF64
  154. _POSIX_V7_LPBIG_OFFBIG@_SC_V7_LPBIG_OFFBIG
  155. _POSIX_V6_ILP32_OFF32@_SC_V6_ILP32_OFF32
  156. _POSIX_V6_ILP32_OFFBIG@_SC_V6_ILP32_OFFBIG
  157. _POSIX_V6_LP64_OFF64@_SC_V6_LP64_OFF64
  158. _POSIX_V6_LPBIG_OFFBIG@_SC_V6_LPBIG_OFFBIG
  159. _POSIX2_C_BIND@_SC_2_C_BIND
  160. _POSIX2_C_DEV@_SC_2_C_DEV
  161. _POSIX2_CHAR_TERM@_SC_2_CHAR_TERM
  162. _POSIX2_FORT_DEV@_SC_2_FORT_DEV
  163. _POSIX2_FORT_RUN@_SC_2_FORT_RUN
  164. _POSIX2_LOCALEDEF@_SC_2_LOCALEDEF
  165. _POSIX2_PBS@_SC_2_PBS
  166. _POSIX2_PBS_ACCOUNTING@_SC_2_PBS_ACCOUNTING
  167. _POSIX2_PBS_CHECKPOINT@_SC_2_PBS_CHECKPOINT
  168. _POSIX2_PBS_LOCATE@_SC_2_PBS_LOCATE
  169. _POSIX2_PBS_MESSAGE@_SC_2_PBS_MESSAGE
  170. _POSIX2_PBS_TRACK@_SC_2_PBS_TRACK
  171. _POSIX2_SW_DEV@_SC_2_SW_DEV
  172. _POSIX2_UPE@_SC_2_UPE
  173. _POSIX2_VERSION@_SC_2_VERSION
  174. _XOPEN_CRYPT@_SC_XOPEN_CRYPT
  175. _XOPEN_ENH_I18N@_SC_XOPEN_ENH_I18N
  176. _XOPEN_REALTIME@_SC_XOPEN_REALTIME
  177. _XOPEN_REALTIME_THREADS@_SC_XOPEN_REALTIME_THREADS
  178. _XOPEN_SHM@_SC_XOPEN_SHM
  179. _XOPEN_STREAMS@_SC_XOPEN_STREAMS
  180. _XOPEN_UNIX@_SC_XOPEN_UNIX
  181. _XOPEN_UUCP@_SC_XOPEN_UUCP
  182. _XOPEN_VERSION@_SC_XOPEN_VERSION
  183. .TE
  184. .ad b
  185. .SH "RETURN VALUE"
  186. If
  187. .IR name
  188. is an invalid value,
  189. \fIsysconf\fR()
  190. shall return \-1 and set
  191. .IR errno
  192. to indicate the error. If the variable corresponding to
  193. .IR name
  194. is described in
  195. .IR <limits.h>
  196. as a maximum or minimum value and the variable has no limit,
  197. \fIsysconf\fR()
  198. shall return \-1 without changing the value of
  199. .IR errno .
  200. Note that indefinite limits do not imply infinite limits; see
  201. .IR <limits.h> .
  202. .P
  203. Otherwise,
  204. \fIsysconf\fR()
  205. shall return the current variable value on the system. The value
  206. returned shall not be more restrictive than the corresponding value
  207. described to the application when it was compiled with the
  208. implementation's
  209. .IR <limits.h>
  210. or
  211. .IR <unistd.h> .
  212. The value shall not change during the lifetime of the calling process,
  213. except that \fIsysconf\fP(_SC_OPEN_MAX) may return different values
  214. before and after a call to
  215. \fIsetrlimit\fR()
  216. which changes the RLIMIT_NOFILE soft limit.
  217. .P
  218. If the variable corresponding to
  219. .IR name
  220. is dependent on an unsupported option, the results are unspecified.
  221. .SH ERRORS
  222. The
  223. \fIsysconf\fR()
  224. function shall fail if:
  225. .TP
  226. .BR EINVAL
  227. The value of the
  228. .IR name
  229. argument is invalid.
  230. .LP
  231. .IR "The following sections are informative."
  232. .SH EXAMPLES
  233. None.
  234. .SH "APPLICATION USAGE"
  235. As \-1 is a permissible return value in a successful situation, an
  236. application wishing to check for error situations should set
  237. .IR errno
  238. to 0, then call
  239. \fIsysconf\fR(),
  240. and, if it returns \-1, check to see if
  241. .IR errno
  242. is non-zero.
  243. .P
  244. Application developers should check whether an option, such as
  245. _POSIX_TRACE, is supported prior to obtaining and using values for
  246. related variables, such as _POSIX_TRACE_NAME_MAX.
  247. .SH RATIONALE
  248. This functionality was added in response to requirements of application
  249. developers and of system vendors who deal with many international
  250. system configurations. It is closely related to
  251. \fIpathconf\fR()
  252. and
  253. \fIfpathconf\fR().
  254. .P
  255. Although a conforming application can run on all systems by never
  256. demanding more resources than the minimum values published in this volume of POSIX.1\(hy2017, it
  257. is useful for that application to be able to use the actual value for
  258. the quantity of a resource available on any given system. To do this,
  259. the application makes use of the value of a symbolic constant in
  260. .IR <limits.h>
  261. or
  262. .IR <unistd.h> .
  263. .P
  264. However, once compiled, the application must still be able to cope if
  265. the amount of resource available is increased. To that end, an
  266. application may need a means of determining the quantity of a resource,
  267. or the presence of an option, at execution time.
  268. .P
  269. Two examples are offered:
  270. .IP " 1." 4
  271. Applications may wish to act differently on systems with or without job
  272. control.
  273. Applications vendors who wish to distribute only a single binary
  274. package to all instances of a computer architecture would be forced to
  275. assume job control is never available if it were to rely solely on the
  276. .IR <unistd.h>
  277. value published in this volume of POSIX.1\(hy2017.
  278. .IP " 2." 4
  279. International applications vendors occasionally require knowledge of
  280. the number of clock ticks per second.
  281. Without these facilities, they would be required to either distribute
  282. their applications partially in source form or to have 50 Hz and 60 Hz
  283. versions for the various countries in which they operate.
  284. .P
  285. It is the knowledge that many applications are actually distributed
  286. widely in executable form that leads to this facility. If limited to
  287. the most restrictive values in the headers, such applications would
  288. have to be prepared to accept the most limited environments offered by
  289. the smallest microcomputers. Although this is entirely portable, there
  290. was a consensus that they should be able to take advantage of the
  291. facilities offered by large systems, without the restrictions
  292. associated with source and object distributions.
  293. .P
  294. During the discussions of this feature, it was pointed out that it is
  295. almost always possible for an application to discern what a value might
  296. be at runtime by suitably testing the various functions themselves.
  297. And, in any event, it could always be written to adequately deal with
  298. error returns from the various functions. In the end, it was felt that
  299. this imposed an unreasonable level of complication and sophistication
  300. on the application developer.
  301. .P
  302. This runtime facility is not meant to provide ever-changing values
  303. that applications have to check multiple times. The values are seen as
  304. changing no more frequently than once per system initialization, such
  305. as by a system administrator or operator with an automatic
  306. configuration program. This volume of POSIX.1\(hy2017 specifies that they shall not change
  307. within the lifetime of the process.
  308. .P
  309. Some values apply to the system overall and others vary at the file
  310. system or directory level. The latter are described in
  311. .IR "\fIfpathconf\fR\^(\|)".
  312. .P
  313. Note that all values returned must be expressible as integers. String
  314. values were considered, but the additional flexibility of this approach
  315. was rejected due to its added complexity of implementation and use.
  316. .P
  317. Some values, such as
  318. {PATH_MAX},
  319. are sometimes so large that they must not be used to, say, allocate
  320. arrays. The
  321. \fIsysconf\fR()
  322. function returns a negative value to show that this symbolic constant
  323. is not even defined in this case.
  324. .P
  325. Similar to
  326. \fIpathconf\fR(),
  327. this permits the implementation not to have a limit. When one resource
  328. is infinite, returning an error indicating that some other resource
  329. limit has been reached is conforming behavior.
  330. .SH "FUTURE DIRECTIONS"
  331. None.
  332. .SH "SEE ALSO"
  333. .IR "\fIconfstr\fR\^(\|)",
  334. .IR "\fIfpathconf\fR\^(\|)"
  335. .P
  336. The Base Definitions volume of POSIX.1\(hy2017,
  337. .IR "\fB<limits.h>\fP",
  338. .IR "\fB<unistd.h>\fP"
  339. .P
  340. The Shell and Utilities volume of POSIX.1\(hy2017,
  341. .IR "\fIgetconf\fR\^"
  342. .\"
  343. .SH COPYRIGHT
  344. Portions of this text are reprinted and reproduced in electronic form
  345. from IEEE Std 1003.1-2017, Standard for Information Technology
  346. -- Portable Operating System Interface (POSIX), The Open Group Base
  347. Specifications Issue 7, 2018 Edition,
  348. Copyright (C) 2018 by the Institute of
  349. Electrical and Electronics Engineers, Inc and The Open Group.
  350. In the event of any discrepancy between this version and the original IEEE and
  351. The Open Group Standard, the original IEEE and The Open Group Standard
  352. is the referee document. The original Standard can be obtained online at
  353. http://www.opengroup.org/unix/online.html .
  354. .PP
  355. Any typographical or formatting errors that appear
  356. in this page are most likely
  357. to have been introduced during the conversion of the source files to
  358. man page format. To report such errors, see
  359. https://www.kernel.org/doc/man-pages/reporting_bugs.html .