limits.odin 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. #+build linux, darwin, netbsd, openbsd, freebsd
  2. package posix
  3. // limits.h - implementation-defined constants
  4. // NOTE: numerical limits are left out because Odin provides `min(T)` and `max(T)`.
  5. // The <limits.h> header shall define the following symbolic constants with the values shown.
  6. // These are the most restrictive values for certain features on an implementation.
  7. // A conforming implementation shall provide values no larger than these values.
  8. // A conforming application must not require a smaller value for correct operation.
  9. _POSIX_CLOCKRES_MIN :: 20000000
  10. // The <limits.h> header shall define the following symbolic constants with the values shown.
  11. // These are the most restrictive values for certain features on an implementation conforming to
  12. // this volume of POSIX.1-2017.
  13. // Related symbolic constants are defined elsewhere in this volume of POSIX.1-2017 which reflect
  14. // the actual implementation and which need not be as restrictive. For each of these limits,
  15. // a conforming implementation shall provide a value at least this large or shall have no limit.
  16. // A strictly conforming application must not require a larger value for correct operation.
  17. _POSIX_AIO_LISTIO_MAX :: 2
  18. _POSIX_AIO_MAX :: 1
  19. _POSIX_ARG_MAX :: 4096
  20. _POSIX_CHILD_MAX :: 25
  21. _POSIX_DELAYTIMER_MAX :: 32
  22. _POSIX_HOST_NAME_MAX :: 255
  23. _POSIX_LINK_MAX :: 8
  24. _POSIX_MAX_CANON :: 255
  25. _POSIX_MAX_INPUT :: 255
  26. _POSIX_MQ_OPEN_MAX :: 8
  27. _POSIX_MQ_PRIO_MAX :: 32
  28. _POSIX_NAME_MAX :: 14
  29. _POSIX_NGROUPS_MAX :: 8
  30. _POSIX_OPEN_MAX :: 20
  31. _POSIX_PATH_MAX :: 256
  32. _POSIX_PIPE_BUF :: 512
  33. _POSIX_RE_DUP_MAX :: 255
  34. _POSIX_RTSIG_MAX :: 8
  35. _POSIX_SEM_NSEMS_MAX :: 256
  36. _POSIX_SEM_VALUE_MAX :: 32767
  37. _POSIX_SS_REPL_MAX :: 4
  38. _POSIX_STREAM_MAX :: 8
  39. _POSIX_SYMLINK_MAX :: 255
  40. _POSIX_SYMLOOP_MAX :: 8
  41. _POSIX_THREAD_DESTRUCTION_ITERATIONS :: 4
  42. _POSIX_THREAD_KEYS_MAX :: 128
  43. _POSIX_THREADS_THREADS_MAX :: 64
  44. _POSIX_TIMER_MAX :: 32
  45. _POSIX_TRAXE_EVENT_NAME_MAX :: 30
  46. _POSIX_TRACE_NAME_MAX :: 8
  47. _POSIX_TRACE_SYS_MAX :: 8
  48. _POSIX_TRACE_USER_EVENT_MAX :: 32
  49. _POSIX_TTY_NAME_MAX :: 9
  50. _POSIX_TZNAME_MAX :: 6
  51. _POSIX2_BC_BASE_MAX :: 99
  52. _POSIX2_BC_DIM_MAX :: 2048
  53. _POSIX2_BC_SCALE_MAX :: 99
  54. _POSIX2_CHARCLASS_NAME_MAX :: 14
  55. _POSIX2_COLL_WEIGHTS_MAX :: 2
  56. _POSIX2_EXPR_NEST_MAX :: 32
  57. _POSIX2_LINE_MAX :: 2048
  58. _POSIX2_RE_DUP_MAX :: 255
  59. _XOPEN_IOV_MAX :: 16
  60. _XOPEN_NAME_MAX :: 255
  61. _XOPEN_PATH_MAX :: 1024
  62. /*
  63. NOTE: for full portability, usage should look something like:
  64. page_size: uint
  65. when #defined(posix.PAGESIZE) {
  66. page_size = posix.PAGESIZE
  67. } else {
  68. page_size = posix.sysconf(._PAGESIZE)
  69. }
  70. */
  71. when ODIN_OS == .Darwin {
  72. // A definition of one of the symbolic constants in the following list shall be omitted from
  73. // <limits.h> on specific implementations where the corresponding value is equal to or greater
  74. // than the stated minimum, but is unspecified.
  75. //
  76. // This indetermination might depend on the amount of available memory space on a specific
  77. // instance of a specific implementation. The actual value supported by a specific instance shall
  78. // be provided by the sysconf() function.
  79. // AIO_LISTIO_MAX :: sysconf(._AIO_LISTIO_MAX)
  80. // AIO_MAX :: sysconf(._AIO_MAX)
  81. // AIO_PRIO_DELTA_MAX :: sysconf(._AIO_PRIO_DELTA_MAX)
  82. ARG_MAX :: 1024 * 1024
  83. // ATEXIT_MAX :: sysconf(._ATEXIT_MAX)
  84. CHILD_MAX :: 266
  85. // DELAYTIMER_MAX :: sysconf(._DELAYTIMER_MAX)
  86. // HOST_NAME_MAX :: sysconf(._HOST_NAME_MAX)
  87. IOV_MAX :: 1024
  88. // LOGIN_NAME_MAX :: sysconf(._LOGIN_NAME_MAX)
  89. // MQ_OPEN_MAX :: sysconf(._MQ_OPEN_MAX)
  90. // MQ_PRIO_MAX :: sysconf(._MQ_PRIO_MAX)
  91. PAGESIZE :: PAGE_SIZE
  92. PAGE_SIZE :: 1 << 12
  93. PTHREAD_DESTRUCTOR_ITERATIONS :: 4
  94. PTHREAD_KEYS_MAX :: 512
  95. PTHREAD_STACK_MIN :: 16384 when ODIN_ARCH == .arm64 else 8192
  96. // RTSIG_MAX :: sysconf(._RTSIG_MAX)
  97. // SEM_NSEMS_MAX :: sysconf(._SEM_NSEMS_MAX)
  98. // SEM_VALUE_MAX :: sysconf(._SEM_VALUE_MAX)
  99. // SIGQUEUE_MAX :: sysconf(._SIGQUEUE_MAX)
  100. // SS_REPL_MAX :: sysconf(._SS_REPL_MAX)
  101. // STREAM_MAX :: sysconf(._STREAM_MAX)
  102. // SYMLOOP_MAX :: sysconf(._SYMLOOP_MAX)
  103. // TIMER_MAX :: sysconf(._TIMER_MAX)
  104. // TRACE_EVENT_NAME_MAX :: sysconf(._TRACE_EVENT_NAME_MAX)
  105. // TRACE_NAME_MAX :: sysconf(._TRACE_NAME_MAX)
  106. // TRACE_SYS_MAX :: sysconf(._TRACE_SYS_MAX)
  107. // TRACE_USER_EVENT_MAX :: sysconf(._TRACE_USER_EVENT_MAX)
  108. // TTY_NAME_MAX :: sysconf(._TTY_NAME_MAX)
  109. // TZNAME_MAX :: sysconf(._TZNAME_MAX)
  110. // The values in the following list may be constants within an implementation or may vary from
  111. // one pathname to another.
  112. // For example, file systems or directories may have different characteristics.
  113. //
  114. // A definition of one of the symbolic constants in the following list shall be omitted from the
  115. // <limits.h> header on specific implementations where the corresponding value is equal to or
  116. // greater than the stated minimum, but where the value can vary depending on the file to which
  117. // it is applied.
  118. // The actual value supported for a specific pathname shall be provided by the pathconf() function.
  119. // FILESIZEBITS :: pathconf(".", ._FILESIZEBITS)
  120. LINK_MAX :: 32767
  121. MAX_CANON :: 1024
  122. MAX_INPUT :: 1024
  123. NAME_MAX :: 255
  124. PATH_MAX :: 1024
  125. PIPE_BUF :: 512
  126. // POSIX_ALLOC_SIZE_MIN :: pathconf("foo.txt", ._POSIX_ALLOC_SIZE_MIN)
  127. // POSIX_REC_INCR_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_INCR_XFER_SIZE)
  128. // POSIX_REC_MAX_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MAX_XFER_SIZE)
  129. // POSIX_REC_MIN_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MIN_XFER_SIZE)
  130. // POSIX_REC_XFER_ALIGN :: pathconf("foo.txt", ._POSIX_REC_XFER_ALIGN)
  131. // SYMLINK_MAX :: pathconf(".", ._SYMLINK_MAX)
  132. // The magnitude limitations in the following list shall be fixed by specific implementations.
  133. // An application should assume that the value of the symbolic constant defined by <limits.h>
  134. // in a specific implementation is the minimum that pertains whenever the application is run
  135. // under that implementation.
  136. // A specific instance of a specific implementation may increase the value relative to that
  137. // supplied by <limits.h> for that implementation.
  138. // The actual value supported by a specific instance shall be provided by the sysconf() function.
  139. BC_BASE_MAX :: 99
  140. BC_DIM_MAX :: 2048
  141. BC_SCALE_MAX :: 99
  142. BC_STRING_MAX :: 1000
  143. CHARCLASS_NAME_MAX :: 14
  144. COLL_WEIGHTS_MAX :: 2
  145. EXPR_NEST_MAX :: 2
  146. LINE_MAX :: 2048
  147. NGROUPS_MAX :: 16
  148. RE_DUP_MAX :: 255
  149. // Other limits.
  150. NL_ARGMAX :: 9
  151. NL_LANGMAX :: 14
  152. NL_MSGMAX :: 32767
  153. NL_SETMAX :: 255
  154. NL_TEXTMAX :: 2048
  155. NZERO :: 20
  156. } else when ODIN_OS == .FreeBSD {
  157. // A definition of one of the symbolic constants in the following list shall be omitted from
  158. // <limits.h> on specific implementations where the corresponding value is equal to or greater
  159. // than the stated minimum, but is unspecified.
  160. //
  161. // This indetermination might depend on the amount of available memory space on a specific
  162. // instance of a specific implementation. The actual value supported by a specific instance shall
  163. // be provided by the sysconf() function.
  164. // AIO_LISTIO_MAX :: sysconf(._AIO_LISTIO_MAX)
  165. // AIO_MAX :: sysconf(._AIO_MAX)
  166. // AIO_PRIO_DELTA_MAX :: sysconf(._AIO_PRIO_DELTA_MAX)
  167. ARG_MAX :: 2 * 256 * 1024
  168. // ATEXIT_MAX :: sysconf(._ATEXIT_MAX)
  169. CHILD_MAX :: 40
  170. // DELAYTIMER_MAX :: sysconf(._DELAYTIMER_MAX)
  171. // HOST_NAME_MAX :: sysconf(._HOST_NAME_MAX)
  172. IOV_MAX :: 1024
  173. // LOGIN_NAME_MAX :: sysconf(._LOGIN_NAME_MAX)
  174. // MQ_OPEN_MAX :: sysconf(._MQ_OPEN_MAX)
  175. MQ_PRIO_MAX :: 64
  176. PAGESIZE :: PAGE_SIZE
  177. PAGE_SIZE :: 1 << 12
  178. PTHREAD_DESTRUCTOR_ITERATIONS :: 4
  179. PTHREAD_KEYS_MAX :: 256
  180. PTHREAD_STACK_MIN :: MINSIGSTKSZ
  181. // RTSIG_MAX :: sysconf(._RTSIG_MAX)
  182. // SEM_NSEMS_MAX :: sysconf(._SEM_NSEMS_MAX)
  183. // SEM_VALUE_MAX :: sysconf(._SEM_VALUE_MAX)
  184. // SIGQUEUE_MAX :: sysconf(._SIGQUEUE_MAX)
  185. // SS_REPL_MAX :: sysconf(._SS_REPL_MAX)
  186. // STREAM_MAX :: sysconf(._STREAM_MAX)
  187. // SYMLOOP_MAX :: sysconf(._SYMLOOP_MAX)
  188. // TIMER_MAX :: sysconf(._TIMER_MAX)
  189. // TRACE_EVENT_NAME_MAX :: sysconf(._TRACE_EVENT_NAME_MAX)
  190. // TRACE_NAME_MAX :: sysconf(._TRACE_NAME_MAX)
  191. // TRACE_SYS_MAX :: sysconf(._TRACE_SYS_MAX)
  192. // TRACE_USER_EVENT_MAX :: sysconf(._TRACE_USER_EVENT_MAX)
  193. // TTY_NAME_MAX :: sysconf(._TTY_NAME_MAX)
  194. // TZNAME_MAX :: sysconf(._TZNAME_MAX)
  195. // The values in the following list may be constants within an implementation or may vary from
  196. // one pathname to another.
  197. // For example, file systems or directories may have different characteristics.
  198. //
  199. // A definition of one of the symbolic constants in the following list shall be omitted from the
  200. // <limits.h> header on specific implementations where the corresponding value is equal to or
  201. // greater than the stated minimum, but where the value can vary depending on the file to which
  202. // it is applied.
  203. // The actual value supported for a specific pathname shall be provided by the pathconf() function.
  204. // FILESIZEBITS :: pathconf(".", ._FILESIZEBITS)
  205. // LINK_MAX :: pathconf(foo.txt", ._LINK_MAX)
  206. MAX_CANON :: 255
  207. MAX_INPUT :: 255
  208. NAME_MAX :: 255
  209. PATH_MAX :: 1024
  210. PIPE_BUF :: 512
  211. // POSIX_ALLOC_SIZE_MIN :: pathconf("foo.txt", ._POSIX_ALLOC_SIZE_MIN)
  212. // POSIX_REC_INCR_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_INCR_XFER_SIZE)
  213. // POSIX_REC_MAX_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MAX_XFER_SIZE)
  214. // POSIX_REC_MIN_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MIN_XFER_SIZE)
  215. // POSIX_REC_XFER_ALIGN :: pathconf("foo.txt", ._POSIX_REC_XFER_ALIGN)
  216. // SYMLINK_MAX :: pathconf(".", ._SYMLINK_MAX)
  217. // The magnitude limitations in the following list shall be fixed by specific implementations.
  218. // An application should assume that the value of the symbolic constant defined by <limits.h>
  219. // in a specific implementation is the minimum that pertains whenever the application is run
  220. // under that implementation.
  221. // A specific instance of a specific implementation may increase the value relative to that
  222. // supplied by <limits.h> for that implementation.
  223. // The actual value supported by a specific instance shall be provided by the sysconf() function.
  224. BC_BASE_MAX :: 99
  225. BC_DIM_MAX :: 2048
  226. BC_SCALE_MAX :: 99
  227. BC_STRING_MAX :: 1000
  228. CHARCLASS_NAME_MAX :: 14
  229. COLL_WEIGHTS_MAX :: 10
  230. EXPR_NEST_MAX :: 32
  231. LINE_MAX :: 2048
  232. NGROUPS_MAX :: 1023
  233. RE_DUP_MAX :: 255
  234. // Other limits.
  235. NL_ARGMAX :: 4096
  236. NL_LANGMAX :: 31
  237. NL_MSGMAX :: 32767
  238. NL_SETMAX :: 255
  239. NL_TEXTMAX :: 2048
  240. NZERO :: 0
  241. } else when ODIN_OS == .NetBSD {
  242. // A definition of one of the symbolic constants in the following list shall be omitted from
  243. // <limits.h> on specific implementations where the corresponding value is equal to or greater
  244. // than the stated minimum, but is unspecified.
  245. //
  246. // This indetermination might depend on the amount of available memory space on a specific
  247. // instance of a specific implementation. The actual value supported by a specific instance shall
  248. // be provided by the sysconf() function.
  249. // AIO_LISTIO_MAX :: sysconf(._AIO_LISTIO_MAX)
  250. // AIO_MAX :: sysconf(._AIO_MAX)
  251. // AIO_PRIO_DELTA_MAX :: sysconf(._AIO_PRIO_DELTA_MAX)
  252. ARG_MAX :: 256 * 1024
  253. // ATEXIT_MAX :: sysconf(._ATEXIT_MAX)
  254. CHILD_MAX :: 160
  255. // DELAYTIMER_MAX :: sysconf(._DELAYTIMER_MAX)
  256. // HOST_NAME_MAX :: sysconf(._HOST_NAME_MAX)
  257. IOV_MAX :: 1024
  258. LOGIN_NAME_MAX :: 17
  259. MQ_OPEN_MAX :: 512
  260. MQ_PRIO_MAX :: 32
  261. PAGESIZE :: PAGE_SIZE
  262. PAGE_SIZE :: 1 << 12
  263. PTHREAD_DESTRUCTOR_ITERATIONS :: 4
  264. PTHREAD_KEYS_MAX :: 256
  265. // PTHREAD_STACK_MIN :: sysconf(._THREAD_STACK_MIN)
  266. // RTSIG_MAX :: sysconf(._RTSIG_MAX)
  267. // SEM_NSEMS_MAX :: sysconf(._SEM_NSEMS_MAX)
  268. // SEM_VALUE_MAX :: sysconf(._SEM_VALUE_MAX)
  269. // SIGQUEUE_MAX :: sysconf(._SIGQUEUE_MAX)
  270. // SS_REPL_MAX :: sysconf(._SS_REPL_MAX)
  271. // STREAM_MAX :: sysconf(._STREAM_MAX)
  272. // SYMLOOP_MAX :: sysconf(._SYMLOOP_MAX)
  273. // TIMER_MAX :: sysconf(._TIMER_MAX)
  274. // TRACE_EVENT_NAME_MAX :: sysconf(._TRACE_EVENT_NAME_MAX)
  275. // TRACE_NAME_MAX :: sysconf(._TRACE_NAME_MAX)
  276. // TRACE_SYS_MAX :: sysconf(._TRACE_SYS_MAX)
  277. // TRACE_USER_EVENT_MAX :: sysconf(._TRACE_USER_EVENT_MAX)
  278. // TTY_NAME_MAX :: sysconf(._TTY_NAME_MAX)
  279. // TZNAME_MAX :: sysconf(._TZNAME_MAX)
  280. // The values in the following list may be constants within an implementation or may vary from
  281. // one pathname to another.
  282. // For example, file systems or directories may have different characteristics.
  283. //
  284. // A definition of one of the symbolic constants in the following list shall be omitted from the
  285. // <limits.h> header on specific implementations where the corresponding value is equal to or
  286. // greater than the stated minimum, but where the value can vary depending on the file to which
  287. // it is applied.
  288. // The actual value supported for a specific pathname shall be provided by the pathconf() function.
  289. // FILESIZEBITS :: pathconf(".", ._FILESIZEBITS)
  290. LINK_MAX :: 32767
  291. MAX_CANON :: 255
  292. MAX_INPUT :: 255
  293. NAME_MAX :: 511
  294. PATH_MAX :: 1024
  295. PIPE_BUF :: 512
  296. // POSIX_ALLOC_SIZE_MIN :: pathconf("foo.txt", ._POSIX_ALLOC_SIZE_MIN)
  297. // POSIX_REC_INCR_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_INCR_XFER_SIZE)
  298. // POSIX_REC_MAX_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MAX_XFER_SIZE)
  299. // POSIX_REC_MIN_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MIN_XFER_SIZE)
  300. // POSIX_REC_XFER_ALIGN :: pathconf("foo.txt", ._POSIX_REC_XFER_ALIGN)
  301. // SYMLINK_MAX :: pathconf(".", ._SYMLINK_MAX)
  302. // The magnitude limitations in the following list shall be fixed by specific implementations.
  303. // An application should assume that the value of the symbolic constant defined by <limits.h>
  304. // in a specific implementation is the minimum that pertains whenever the application is run
  305. // under that implementation.
  306. // A specific instance of a specific implementation may increase the value relative to that
  307. // supplied by <limits.h> for that implementation.
  308. // The actual value supported by a specific instance shall be provided by the sysconf() function.
  309. BC_BASE_MAX :: max(i32)
  310. BC_DIM_MAX :: 65535
  311. BC_SCALE_MAX :: max(i32)
  312. BC_STRING_MAX :: max(i32)
  313. CHARCLASS_NAME_MAX :: 14
  314. COLL_WEIGHTS_MAX :: 2
  315. EXPR_NEST_MAX :: 32
  316. LINE_MAX :: 2048
  317. NGROUPS_MAX :: 16
  318. RE_DUP_MAX :: 255
  319. // Other limits.
  320. NL_ARGMAX :: 9
  321. NL_LANGMAX :: 14
  322. NL_MSGMAX :: 32767
  323. NL_SETMAX :: 255
  324. NL_TEXTMAX :: 2048
  325. NZERO :: 20
  326. } else when ODIN_OS == .OpenBSD {
  327. // A definition of one of the symbolic constants in the following list shall be omitted from
  328. // <limits.h> on specific implementations where the corresponding value is equal to or greater
  329. // than the stated minimum, but is unspecified.
  330. //
  331. // This indetermination might depend on the amount of available memory space on a specific
  332. // instance of a specific implementation. The actual value supported by a specific instance shall
  333. // be provided by the sysconf() function.
  334. // AIO_LISTIO_MAX :: sysconf(._AIO_LISTIO_MAX)
  335. // AIO_MAX :: sysconf(._AIO_MAX)
  336. // AIO_PRIO_DELTA_MAX :: sysconf(._AIO_PRIO_DELTA_MAX)
  337. ARG_MAX :: 512 * 1024
  338. // ATEXIT_MAX :: sysconf(._ATEXIT_MAX)
  339. CHILD_MAX :: 80
  340. // DELAYTIMER_MAX :: sysconf(._DELAYTIMER_MAX)
  341. // HOST_NAME_MAX :: sysconf(._HOST_NAME_MAX)
  342. IOV_MAX :: 1024
  343. LOGIN_NAME_MAX :: 32
  344. MQ_OPEN_MAX :: 512
  345. MQ_PRIO_MAX :: 32
  346. PAGESIZE :: PAGE_SIZE
  347. PAGE_SIZE :: 1 << 12
  348. PTHREAD_DESTRUCTOR_ITERATIONS :: 4
  349. PTHREAD_KEYS_MAX :: 256
  350. PTHREAD_STACK_MIN :: 1 << 12
  351. // RTSIG_MAX :: sysconf(._RTSIG_MAX)
  352. // SEM_NSEMS_MAX :: sysconf(._SEM_NSEMS_MAX)
  353. SEM_VALUE_MAX :: max(u32)
  354. // SIGQUEUE_MAX :: sysconf(._SIGQUEUE_MAX)
  355. // SS_REPL_MAX :: sysconf(._SS_REPL_MAX)
  356. // STREAM_MAX :: sysconf(._STREAM_MAX)
  357. SYMLOOP_MAX :: 32
  358. // TIMER_MAX :: sysconf(._TIMER_MAX)
  359. // TRACE_EVENT_NAME_MAX :: sysconf(._TRACE_EVENT_NAME_MAX)
  360. // TRACE_NAME_MAX :: sysconf(._TRACE_NAME_MAX)
  361. // TRACE_SYS_MAX :: sysconf(._TRACE_SYS_MAX)
  362. // TRACE_USER_EVENT_MAX :: sysconf(._TRACE_USER_EVENT_MAX)
  363. // TTY_NAME_MAX :: sysconf(._TTY_NAME_MAX)
  364. // TZNAME_MAX :: sysconf(._TZNAME_MAX)
  365. // The values in the following list may be constants within an implementation or may vary from
  366. // one pathname to another.
  367. // For example, file systems or directories may have different characteristics.
  368. //
  369. // A definition of one of the symbolic constants in the following list shall be omitted from the
  370. // <limits.h> header on specific implementations where the corresponding value is equal to or
  371. // greater than the stated minimum, but where the value can vary depending on the file to which
  372. // it is applied.
  373. // The actual value supported for a specific pathname shall be provided by the pathconf() function.
  374. // FILESIZEBITS :: pathconf(".", ._FILESIZEBITS)
  375. LINK_MAX :: 32767
  376. MAX_CANON :: 255
  377. MAX_INPUT :: 255
  378. NAME_MAX :: 255
  379. PATH_MAX :: 1024
  380. PIPE_BUF :: 512
  381. // POSIX_ALLOC_SIZE_MIN :: pathconf("foo.txt", ._POSIX_ALLOC_SIZE_MIN)
  382. // POSIX_REC_INCR_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_INCR_XFER_SIZE)
  383. // POSIX_REC_MAX_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MAX_XFER_SIZE)
  384. // POSIX_REC_MIN_XFER_SIZE :: pathconf("foo.txt", ._POSIX_REC_MIN_XFER_SIZE)
  385. // POSIX_REC_XFER_ALIGN :: pathconf("foo.txt", ._POSIX_REC_XFER_ALIGN)
  386. SYMLINK_MAX :: PATH_MAX
  387. // The magnitude limitations in the following list shall be fixed by specific implementations.
  388. // An application should assume that the value of the symbolic constant defined by <limits.h>
  389. // in a specific implementation is the minimum that pertains whenever the application is run
  390. // under that implementation.
  391. // A specific instance of a specific implementation may increase the value relative to that
  392. // supplied by <limits.h> for that implementation.
  393. // The actual value supported by a specific instance shall be provided by the sysconf() function.
  394. BC_BASE_MAX :: max(i32)
  395. BC_DIM_MAX :: 65535
  396. BC_SCALE_MAX :: max(i32)
  397. BC_STRING_MAX :: max(i32)
  398. CHARCLASS_NAME_MAX :: 14
  399. COLL_WEIGHTS_MAX :: 2
  400. EXPR_NEST_MAX :: 32
  401. LINE_MAX :: 2048
  402. NGROUPS_MAX :: 16
  403. RE_DUP_MAX :: 255
  404. // Other limits.
  405. NL_ARGMAX :: 9
  406. NL_LANGMAX :: 14
  407. NL_MSGMAX :: 32767
  408. NL_SETMAX :: 255
  409. NL_TEXTMAX :: 255
  410. NZERO :: 20
  411. } else when ODIN_OS == .Linux {
  412. // A definition of one of the symbolic constants in the following list shall be omitted from
  413. // <limits.h> on specific implementations where the corresponding value is equal to or greater
  414. // than the stated minimum, but is unspecified.
  415. //
  416. // This indetermination might depend on the amount of available memory space on a specific
  417. // instance of a specific implementation. The actual value supported by a specific instance shall
  418. // be provided by the sysconf() function.
  419. // AIO_LISTIO_MAX :: sysconf(._AIO_LISTIO_MAX)
  420. // AIO_MAX :: sysconf(._AIO_MAX)
  421. // AIO_PRIO_DELTA_MAX :: sysconf(._AIO_PRIO_DELTA_MAX)
  422. ARG_MAX :: 131_072
  423. // ATEXIT_MAX :: sysconf(._ATEXIT_MAX)
  424. // CHILD_MAX :: sysconf(._POSIX_ARG_MAX)
  425. // DELAYTIMER_MAX :: sysconf(._DELAYTIMER_MAX)
  426. // HOST_NAME_MAX :: sysconf(._HOST_NAME_MAX)
  427. // IOV_MAX :: sysconf(._XOPEN_IOV_MAX)
  428. // LOGIN_NAME_MAX :: sysconf(._LOGIN_NAME_MAX)
  429. // MQ_OPEN_MAX :: sysconf(._MQ_OPEN_MAX)
  430. // MQ_PRIO_MAX :: sysconf(._MQ_PRIO_MAX)
  431. // PAGESIZE :: PAGE_SIZE
  432. // PAGE_SIZE :: sysconf(._PAGE_SIZE)
  433. PTHREAD_DESTRUCTOR_ITERATIONS :: 4
  434. // PTHREAD_KEYS_MAX :: sysconf(._PTHREAD_KEYS_MAX)
  435. // PTHREAD_STACK_MIN :: sysconf(._PTHREAD_STACK_MIN)
  436. // RTSIG_MAX :: sysconf(._RTSIG_MAX)
  437. // SEM_NSEMS_MAX :: sysconf(._SEM_NSEMS_MAX)
  438. // SEM_VALUE_MAX :: sysconf(._SEM_VALUE_MAX)
  439. // SIGQUEUE_MAX :: sysconf(._SIGQUEUE_MAX)
  440. // SS_REPL_MAX :: sysconf(._SS_REPL_MAX)
  441. // STREAM_MAX :: sysconf(._STREAM_MAX)
  442. // SYMLOOP_MAX :: sysconf(._SYSLOOP_MAX)
  443. // TIMER_MAX :: sysconf(._TIMER_MAX)
  444. // TRACE_EVENT_NAME_MAX :: sysconf(._TRACE_EVENT_NAME_MAX)
  445. // TRACE_NAME_MAX :: sysconf(._TRACE_NAME_MAX)
  446. // TRACE_SYS_MAX :: sysconf(._TRACE_SYS_MAX)
  447. // TRACE_USER_EVENT_MAX :: sysconf(._TRACE_USER_EVENT_MAX)
  448. // TTY_NAME_MAX :: sysconf(._TTY_NAME_MAX)
  449. // TZNAME_MAX :: sysconf(._TZNAME_MAX)
  450. // The values in the following list may be constants within an implementation or may vary from
  451. // one pathname to another.
  452. // For example, file systems or directories may have different characteristics.
  453. //
  454. // A definition of one of the symbolic constants in the following list shall be omitted from the
  455. // <limits.h> header on specific implementations where the corresponding value is equal to or
  456. // greater than the stated minimum, but where the value can vary depending on the file to which
  457. // it is applied.
  458. // The actual value supported for a specific pathname shall be provided by the pathconf() function.
  459. // FILESIZEBITS :: pathconf(".", ._FILESIZEBITS)
  460. LINK_MAX :: 127
  461. MAX_CANON :: 255
  462. MAX_INPUT :: 255
  463. NAME_MAX :: 255
  464. PATH_MAX :: 4096
  465. PIPE_BUF :: 4096
  466. // POSIX_ALLOC_SIZE_MIN :: sysconf(._POSIX_ALLOC_SIZE_MIN)
  467. // POSIX_REC_INCR_XFER_SIZE :: sysconf(._POSIX_REC_INCR_XFER_SIZE)
  468. // POSIX_REC_MAX_XFER_SIZE :: sysconf(._POSIX_REC_MAX_XFER_SIZE)
  469. // POSIX_REC_MIN_XFER_SIZE :: sysconf(._POSIX_REC_MIN_XFER_SIZE)
  470. // POSIX_REC_XFER_ALIGN :: sysconf(._POSIX_REC_XFER_ALIGN)
  471. // SYMLINK_MAX :: pathconf(".", ._SYMLINK_MAX)
  472. // The magnitude limitations in the following list shall be fixed by specific implementations.
  473. // An application should assume that the value of the symbolic constant defined by <limits.h>
  474. // in a specific implementation is the minimum that pertains whenever the application is run
  475. // under that implementation.
  476. // A specific instance of a specific implementation may increase the value relative to that
  477. // supplied by <limits.h> for that implementation.
  478. // The actual value supported by a specific instance shall be provided by the sysconf() function.
  479. BC_BASE_MAX :: 99
  480. BC_DIM_MAX :: 2048
  481. BC_SCALE_MAX :: 99
  482. BC_STRING_MAX :: 1000
  483. CHARCLASS_NAME_MAX :: 14
  484. COLL_WEIGHTS_MAX :: 2
  485. EXPR_NEST_MAX :: 32
  486. // LINE_MAX :: sysconf(._LINE_MAX)
  487. // NGROUPS_MAX :: sysconf(._NGROUPS_MAX)
  488. RE_DUP_MAX :: 255
  489. // Other limits.
  490. NL_ARGMAX :: 9
  491. NL_LANGMAX :: 32 // 14 on glibc, 32 on musl
  492. NL_MSGMAX :: 32_767
  493. NL_SETMAX :: 255
  494. NL_TEXTMAX :: 2048 // 255 on glibc, 2048 on musl
  495. NZERO :: 20
  496. }