limits.odin 21 KB

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