blob: ecf26bad72fddc74b0b761c1f4c48fb9ed81bd3c [file] [log] [blame]
Josh Gao8c8ef592016-04-07 16:33:30 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +000029#pragma once
Josh Gao8c8ef592016-04-07 16:33:30 -070030
31#include <sys/cdefs.h>
32
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +000033/** sysconf() query for the maximum number of bytes of exec() arguments. */
34#define _SC_ARG_MAX 0x0000
35/** sysconf() query for bc(1) behavior equivalent to _POSIX2_BC_BASE_MAX. */
36#define _SC_BC_BASE_MAX 0x0001
37/** sysconf() query for bc(1) behavior equivalent to _POSIX2_BC_DIM_MAX. */
38#define _SC_BC_DIM_MAX 0x0002
39/** sysconf() query for bc(1) behavior equivalent to _POSIX2_BC_SCALE_MAX. */
40#define _SC_BC_SCALE_MAX 0x0003
41/** sysconf() query for bc(1) behavior equivalent to _POSIX2_BC_STRING_MAX. */
42#define _SC_BC_STRING_MAX 0x0004
43/** sysconf() query equivalent to RLIMIT_NPROC. */
44#define _SC_CHILD_MAX 0x0005
45/** sysconf() query equivalent to AT_CLKTCK. */
46#define _SC_CLK_TCK 0x0006
47/** sysconf() query for collation behavior equivalent to _POSIX2_COLL_WEIGHTS_MAX. */
48#define _SC_COLL_WEIGHTS_MAX 0x0007
49/** sysconf() query for expr(1) behavior equivalent to _POSIX2_EXPR_NEST_MAX. */
50#define _SC_EXPR_NEST_MAX 0x0008
51/** sysconf() query for command-line tool behavior equivalent to _POSIX2_LINE_MAX. */
52#define _SC_LINE_MAX 0x0009
53/** sysconf() query equivalent to NGROUPS_MAX. */
54#define _SC_NGROUPS_MAX 0x000a
55/** sysconf() query equivalent to RLIMIT_NOFILE. */
56#define _SC_OPEN_MAX 0x000b
57/** sysconf() query equivalent to PASS_MAX. */
58#define _SC_PASS_MAX 0x000c
59/** sysconf() query equivalent to _POSIX2_C_BIND. */
60#define _SC_2_C_BIND 0x000d
61/** sysconf() query equivalent to _POSIX2_C_DEV. */
62#define _SC_2_C_DEV 0x000e
63/** Obsolescent in POSIX.1-2008. */
64#define _SC_2_C_VERSION 0x000f
65/** sysconf() query equivalent to _POSIX2_CHAR_TERM. */
66#define _SC_2_CHAR_TERM 0x0010
67/** sysconf() query equivalent to _POSIX2_FORT_DEV. */
68#define _SC_2_FORT_DEV 0x0011
69/** sysconf() query equivalent to _POSIX2_FORT_RUN. */
70#define _SC_2_FORT_RUN 0x0012
71/** sysconf() query equivalent to _POSIX2_LOCALEDEF. */
72#define _SC_2_LOCALEDEF 0x0013
73/** sysconf() query equivalent to _POSIX2_SW_DEV. */
74#define _SC_2_SW_DEV 0x0014
75/** sysconf() query equivalent to _POSIX2_UPE. */
76#define _SC_2_UPE 0x0015
77/** sysconf() query equivalent to _POSIX2_VERSION. */
78#define _SC_2_VERSION 0x0016
79/** sysconf() query equivalent to _POSIX_JOB_CONTROL. */
80#define _SC_JOB_CONTROL 0x0017
81/** sysconf() query equivalent to _POSIX_SAVED_IDS. */
82#define _SC_SAVED_IDS 0x0018
83/** sysconf() query equivalent to _POSIX_VERSION. */
84#define _SC_VERSION 0x0019
85/** sysconf() query equivalent to _POSIX_RE_DUP_MAX. */
86#define _SC_RE_DUP_MAX 0x001a
87/** sysconf() query equivalent to FOPEN_MAX. */
88#define _SC_STREAM_MAX 0x001b
89/** sysconf() query equivalent to _POSIX_TZNAME_MAX. */
90#define _SC_TZNAME_MAX 0x001c
91/** sysconf() query equivalent to _XOPEN_CRYPT. */
92#define _SC_XOPEN_CRYPT 0x001d
93/** sysconf() query equivalent to _XOPEN_ENH_I18N. */
94#define _SC_XOPEN_ENH_I18N 0x001e
95/** sysconf() query equivalent to _XOPEN_SHM. */
96#define _SC_XOPEN_SHM 0x001f
97/** sysconf() query equivalent to _XOPEN_VERSION. */
98#define _SC_XOPEN_VERSION 0x0020
99/** Obsolescent in POSIX.1-2008. */
100#define _SC_XOPEN_XCU_VERSION 0x0021
101/** sysconf() query equivalent to _XOPEN_REALTIME. */
102#define _SC_XOPEN_REALTIME 0x0022
103/** sysconf() query equivalent to _XOPEN_REALTIME_THREADS. */
104#define _SC_XOPEN_REALTIME_THREADS 0x0023
105/** sysconf() query equivalent to _XOPEN_LEGACY. */
106#define _SC_XOPEN_LEGACY 0x0024
107/** sysconf() query for the maximum number of atexit() handlers. Unlimited on Android. */
108#define _SC_ATEXIT_MAX 0x0025
109/** sysconf() query equivalent to IOV_MAX. */
110#define _SC_IOV_MAX 0x0026
111/** Same as _SC_IOV_MAX. */
Elliott Hughes82ab4812018-10-09 13:56:06 -0700112#define _SC_UIO_MAXIOV _SC_IOV_MAX
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +0000113/** Same as _SC_PAGE_SIZE. */
114#define _SC_PAGESIZE 0x0027
115/** sysconf() query equivalent to getpagesize(). */
116#define _SC_PAGE_SIZE 0x0028
117/** sysconf() query equivalent to _XOPEN_UNIX. */
118#define _SC_XOPEN_UNIX 0x0029
119/** Obsolescent in POSIX.1-2008. */
120#define _SC_XBS5_ILP32_OFF32 0x002a
121/** Obsolescent in POSIX.1-2008. */
122#define _SC_XBS5_ILP32_OFFBIG 0x002b
123/** Obsolescent in POSIX.1-2008. */
124#define _SC_XBS5_LP64_OFF64 0x002c
125/** Obsolescent in POSIX.1-2008. */
126#define _SC_XBS5_LPBIG_OFFBIG 0x002d
127/** sysconf() query equivalent to _POSIX_AIO_LISTIO_MAX. */
128#define _SC_AIO_LISTIO_MAX 0x002e
129/** sysconf() query equivalent to _POSIX_AIO_MAX. */
130#define _SC_AIO_MAX 0x002f
131/** Unimplemented on Android. */
Josh Gao8c8ef592016-04-07 16:33:30 -0700132#define _SC_AIO_PRIO_DELTA_MAX 0x0030
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +0000133/** sysconf() query equivalent to _POSIX_DELAYTIMER_MAX. */
134#define _SC_DELAYTIMER_MAX 0x0031
135/** sysconf() query equivalent to _POSIX_MQ_OPEN_MAX. */
136#define _SC_MQ_OPEN_MAX 0x0032
137/** sysconf() query equivalent to _POSIX_MQ_PRIO_MAX. */
138#define _SC_MQ_PRIO_MAX 0x0033
139/** sysconf() query equivalent to RTSIG_MAX. Constant on Android. */
140#define _SC_RTSIG_MAX 0x0034
141/** sysconf() query equivalent to _POSIX_SEM_NSEMS_MAX. Constant on Android. */
142#define _SC_SEM_NSEMS_MAX 0x0035
143/** sysconf() query equivalent to SEM_VALUE_MAX. Constant on Android. */
144#define _SC_SEM_VALUE_MAX 0x0036
145/** sysconf() query equivalent to _POSIX_SIGQUEUE_MAX. */
146#define _SC_SIGQUEUE_MAX 0x0037
147/** sysconf() query equivalent to _POSIX_TIMER_MAX. */
148#define _SC_TIMER_MAX 0x0038
149/** sysconf() query equivalent to _POSIX_ASYNCHRONOUS_IO. */
150#define _SC_ASYNCHRONOUS_IO 0x0039
151/** sysconf() query equivalent to _POSIX_FSYNC. */
152#define _SC_FSYNC 0x003a
153/** sysconf() query equivalent to _POSIX_MAPPED_FILES. */
154#define _SC_MAPPED_FILES 0x003b
155/** sysconf() query equivalent to _POSIX_MEMLOCK. */
156#define _SC_MEMLOCK 0x003c
157/** sysconf() query equivalent to _POSIX_MEMLOCK_RANGE. */
158#define _SC_MEMLOCK_RANGE 0x003d
159/** sysconf() query equivalent to _POSIX_MEMORY_PROTECTION. */
160#define _SC_MEMORY_PROTECTION 0x003e
161/** sysconf() query equivalent to _POSIX_MESSAGE_PASSING. */
162#define _SC_MESSAGE_PASSING 0x003f
163/** sysconf() query equivalent to _POSIX_PRIORITIZED_IO. */
164#define _SC_PRIORITIZED_IO 0x0040
165/** sysconf() query equivalent to _POSIX_PRIORITY_SCHEDULING. */
Josh Gao8c8ef592016-04-07 16:33:30 -0700166#define _SC_PRIORITY_SCHEDULING 0x0041
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +0000167/** sysconf() query equivalent to _POSIX_REALTIME_SIGNALS. */
168#define _SC_REALTIME_SIGNALS 0x0042
169/** sysconf() query equivalent to _POSIX_SEMAPHORES. */
170#define _SC_SEMAPHORES 0x0043
171/** sysconf() query equivalent to _POSIX_SHARED_MEMORY_OBJECTS. */
172#define _SC_SHARED_MEMORY_OBJECTS 0x0044
173/** sysconf() query equivalent to _POSIX_SYNCHRONIZED_IO. */
174#define _SC_SYNCHRONIZED_IO 0x0045
175/** sysconf() query equivalent to _POSIX_TIMERS. */
176#define _SC_TIMERS 0x0046
177/** sysconf() query for an initial size for getgrgid_r() and getgrnam_r() buffers. */
178#define _SC_GETGR_R_SIZE_MAX 0x0047
179/** sysconf() query for an initial size for getpwuid_r() and getpwnam_r() buffers. */
180#define _SC_GETPW_R_SIZE_MAX 0x0048
181/** sysconf() query equivalent to LOGIN_NAME_MAX. */
182#define _SC_LOGIN_NAME_MAX 0x0049
183/** sysconf() query equivalent to PTHREAD_DESTRUCTOR_ITERATIONS. */
184#define _SC_THREAD_DESTRUCTOR_ITERATIONS 0x004a
185/** sysconf() query equivalent to PTHREAD_KEYS_MAX. */
186#define _SC_THREAD_KEYS_MAX 0x004b
187/** sysconf() query equivalent to PTHREAD_STACK_MIN. */
188#define _SC_THREAD_STACK_MIN 0x004c
189/** sysconf() query for a maximum number of threads. Unlimited on Android. */
190#define _SC_THREAD_THREADS_MAX 0x004d
191/** sysconf() query equivalent to TTY_NAME_MAX. */
192#define _SC_TTY_NAME_MAX 0x004e
193/** sysconf() query equivalent to _POSIX_THREADS. */
194#define _SC_THREADS 0x004f
195/** sysconf() query equivalent to _POSIX_THREAD_ATTR_STACKADDR. */
196#define _SC_THREAD_ATTR_STACKADDR 0x0050
197/** sysconf() query equivalent to _POSIX_THREAD_ATTR_STACKSIZE. */
198#define _SC_THREAD_ATTR_STACKSIZE 0x0051
199/** sysconf() query equivalent to _POSIX_THREAD_PRIORITY_SCHEDULING. */
200#define _SC_THREAD_PRIORITY_SCHEDULING 0x0052
201/** sysconf() query equivalent to _POSIX_THREAD_PRIO_INHERIT. */
202#define _SC_THREAD_PRIO_INHERIT 0x0053
203/** sysconf() query equivalent to _POSIX_THREAD_PRIO_PROTECT. */
204#define _SC_THREAD_PRIO_PROTECT 0x0054
205/** sysconf() query equivalent to _POSIX_THREAD_SAFE_FUNCTIONS. */
206#define _SC_THREAD_SAFE_FUNCTIONS 0x0055
207/** sysconf() query equivalent to get_nprocs_conf(). */
208#define _SC_NPROCESSORS_CONF 0x0060
209/** sysconf() query equivalent to get_nprocs(). */
210#define _SC_NPROCESSORS_ONLN 0x0061
211/** sysconf() query equivalent to get_phys_pages(). */
212#define _SC_PHYS_PAGES 0x0062
213/** sysconf() query equivalent to get_avphys_pages(). */
214#define _SC_AVPHYS_PAGES 0x0063
215/** sysconf() query equivalent to _POSIX_MONOTONIC_CLOCK. */
216#define _SC_MONOTONIC_CLOCK 0x0064
217/** Obsolescent in POSIX.1-2008. */
218#define _SC_2_PBS 0x0065
219/** Obsolescent in POSIX.1-2008. */
220#define _SC_2_PBS_ACCOUNTING 0x0066
221/** Obsolescent in POSIX.1-2008. */
222#define _SC_2_PBS_CHECKPOINT 0x0067
223/** Obsolescent in POSIX.1-2008. */
224#define _SC_2_PBS_LOCATE 0x0068
225/** Obsolescent in POSIX.1-2008. */
226#define _SC_2_PBS_MESSAGE 0x0069
227/** Obsolescent in POSIX.1-2008. */
228#define _SC_2_PBS_TRACK 0x006a
229/** sysconf() query equivalent to _POSIX_ADVISORY_INFO. */
230#define _SC_ADVISORY_INFO 0x006b
231/** sysconf() query equivalent to _POSIX_BARRIERS. */
232#define _SC_BARRIERS 0x006c
233/** sysconf() query equivalent to _POSIX_CLOCK_SELECTION. */
234#define _SC_CLOCK_SELECTION 0x006d
235/** sysconf() query equivalent to _POSIX_CPUTIME. */
236#define _SC_CPUTIME 0x006e
237/** sysconf() query equivalent to _POSIX_HOST_NAME_MAX. */
238#define _SC_HOST_NAME_MAX 0x006f
239/** sysconf() query equivalent to _POSIX_IPV6. */
240#define _SC_IPV6 0x0070
241/** sysconf() query equivalent to _POSIX_RAW_SOCKETS. */
242#define _SC_RAW_SOCKETS 0x0071
243/** sysconf() query equivalent to _POSIX_READER_WRITER_LOCKS. */
Josh Gao8c8ef592016-04-07 16:33:30 -0700244#define _SC_READER_WRITER_LOCKS 0x0072
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +0000245/** sysconf() query equivalent to _POSIX_REGEXP. */
246#define _SC_REGEXP 0x0073
247/** sysconf() query equivalent to _POSIX_SHELL. */
248#define _SC_SHELL 0x0074
249/** sysconf() query equivalent to _POSIX_SPAWN. */
250#define _SC_SPAWN 0x0075
251/** sysconf() query equivalent to _POSIX_SPIN_LOCKS. */
252#define _SC_SPIN_LOCKS 0x0076
253/** sysconf() query equivalent to _POSIX_SPORADIC_SERVER. */
254#define _SC_SPORADIC_SERVER 0x0077
255/** sysconf() query equivalent to _POSIX_SS_REPL_MAX. */
256#define _SC_SS_REPL_MAX 0x0078
257/** sysconf() query equivalent to _POSIX_SYMLOOP_MAX. */
258#define _SC_SYMLOOP_MAX 0x0079
259/** sysconf() query equivalent to _POSIX_THREAD_CPUTIME. */
260#define _SC_THREAD_CPUTIME 0x007a
261/** sysconf() query equivalent to _POSIX_THREAD_PROCESS_SHARED. */
262#define _SC_THREAD_PROCESS_SHARED 0x007b
263/** sysconf() query equivalent to _POSIX_THREAD_ROBUST_PRIO_INHERIT. */
264#define _SC_THREAD_ROBUST_PRIO_INHERIT 0x007c
265/** sysconf() query equivalent to _POSIX_THREAD_ROBUST_PRIO_PROTECT. */
266#define _SC_THREAD_ROBUST_PRIO_PROTECT 0x007d
267/** sysconf() query equivalent to _POSIX_THREAD_SPORADIC_SERVER. */
268#define _SC_THREAD_SPORADIC_SERVER 0x007e
269/** sysconf() query equivalent to _POSIX_TIMEOUTS. */
270#define _SC_TIMEOUTS 0x007f
271/** Unimplemented. */
272#define _SC_TRACE 0x0080
273/** Unimplemented. */
274#define _SC_TRACE_EVENT_FILTER 0x0081
275/** Unimplemented. */
276#define _SC_TRACE_EVENT_NAME_MAX 0x0082
277/** Unimplemented. */
278#define _SC_TRACE_INHERIT 0x0083
279/** Unimplemented. */
280#define _SC_TRACE_LOG 0x0084
281/** Unimplemented. */
282#define _SC_TRACE_NAME_MAX 0x0085
283/** Unimplemented. */
284#define _SC_TRACE_SYS_MAX 0x0086
285/** Unimplemented. */
286#define _SC_TRACE_USER_EVENT_MAX 0x0087
287/** sysconf() query equivalent to _POSIX_TYPED_MEMORY_OBJECTS. */
288#define _SC_TYPED_MEMORY_OBJECTS 0x0088
289/** sysconf() query equivalent to _POSIX_V7_ILP32_OFF32. */
290#define _SC_V7_ILP32_OFF32 0x0089
291/** sysconf() query equivalent to _POSIX_V7_ILP32_OFFBIG. */
292#define _SC_V7_ILP32_OFFBIG 0x008a
293/** sysconf() query equivalent to _POSIX_V7_ILP64_OFF64. */
294#define _SC_V7_LP64_OFF64 0x008b
295/** sysconf() query equivalent to _POSIX_V7_ILP64_OFFBIG. */
296#define _SC_V7_LPBIG_OFFBIG 0x008c
297/** Unimplemented. */
298#define _SC_XOPEN_STREAMS 0x008d
299/** Meaningless in Android, unsupported in every other libc (but defined by POSIX). */
300#define _SC_XOPEN_UUCP 0x008e
301/** sysconf() query for the L1 instruction cache size. Not available on all architectures. */
302#define _SC_LEVEL1_ICACHE_SIZE 0x008f
303/** sysconf() query for the L1 instruction cache associativity. Not available on all architectures. */
304#define _SC_LEVEL1_ICACHE_ASSOC 0x0090
305/** sysconf() query for the L1 instruction cache line size. Not available on all architectures. */
306#define _SC_LEVEL1_ICACHE_LINESIZE 0x0091
307/** sysconf() query for the L1 data cache size. Not available on all architectures. */
308#define _SC_LEVEL1_DCACHE_SIZE 0x0092
309/** sysconf() query for the L1 data cache associativity. Not available on all architectures. */
310#define _SC_LEVEL1_DCACHE_ASSOC 0x0093
311/** sysconf() query for the L1 data cache line size. Not available on all architectures. */
312#define _SC_LEVEL1_DCACHE_LINESIZE 0x0094
313/** sysconf() query for the L2 cache size. Not available on all architectures. */
314#define _SC_LEVEL2_CACHE_SIZE 0x0095
315/** sysconf() query for the L2 cache associativity. Not available on all architectures. */
316#define _SC_LEVEL2_CACHE_ASSOC 0x0096
317/** sysconf() query for the L2 cache line size. Not available on all architectures. */
318#define _SC_LEVEL2_CACHE_LINESIZE 0x0097
319/** sysconf() query for the L3 cache size. Not available on all architectures. */
320#define _SC_LEVEL3_CACHE_SIZE 0x0098
321/** sysconf() query for the L3 cache associativity. Not available on all architectures. */
322#define _SC_LEVEL3_CACHE_ASSOC 0x0099
323/** sysconf() query for the L3 cache line size. Not available on all architectures. */
324#define _SC_LEVEL3_CACHE_LINESIZE 0x009a
325/** sysconf() query for the L4 cache size. Not available on all architectures. */
326#define _SC_LEVEL4_CACHE_SIZE 0x009b
327/** sysconf() query for the L4 cache associativity. Not available on all architectures. */
328#define _SC_LEVEL4_CACHE_ASSOC 0x009c
329/** sysconf() query for the L4 cache line size. Not available on all architectures. */
330#define _SC_LEVEL4_CACHE_LINESIZE 0x009d
Josh Gao8c8ef592016-04-07 16:33:30 -0700331
332__BEGIN_DECLS
333
Elliott Hughes3bfb6ee2024-03-27 21:23:42 +0000334/**
335 * [sysconf(3)](https://man7.org/linux/man-pages/man3/sysconf.3.html)
336 * gets system configuration at runtime, corresponding to the given
337 * `_SC_` constant. See the man page for details on how to interpret
338 * the results.
339 *
340 * For `_SC_` constants where an equivalent is given, it's cheaper on Android
341 * to go straight to that function call --- sysconf() is just a multiplexer.
342 * This may not be true on other systems, and other systems may not support the
343 * direct function, so sysconf() can be useful for portability, though despite
344 * POSIX's best efforts, the exact set of constants that return useful results
345 * will also vary by system.
346 */
Josh Gao8c8ef592016-04-07 16:33:30 -0700347long sysconf(int __name);
348
349__END_DECLS