1 /*
2  * Copyright (C) 2014 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 
29 #ifndef _BITS_POSIX_LIMITS_H_
30 #define _BITS_POSIX_LIMITS_H_
31 
32 #include <sys/cdefs.h>
33 
34 #define _POSIX_VERSION 200809L
35 #define _POSIX2_VERSION _POSIX_VERSION
36 #define _XOPEN_VERSION 700
37 
38 #define __BIONIC_POSIX_FEATURE_MISSING (-1)
39 #define __BIONIC_POSIX_FEATURE_SINCE(level) \
40     (((__ANDROID_API__) >= (level)) ? _POSIX_VERSION : __BIONIC_POSIX_FEATURE_MISSING)
41 
42 /* Availability macros. */
43 /* See http://man7.org/linux/man-pages/man7/posixoptions.7.html for documentation. */
44 /* Keep this list sorted by name. */
45 #define _POSIX_ADVISORY_INFO __BIONIC_POSIX_FEATURE_SINCE(23) /* posix_memadvise arrived late. */
46 #define _POSIX_ASYNCHRONOUS_IO __BIONIC_POSIX_FEATURE_MISSING
47 #define _POSIX_BARRIERS __BIONIC_POSIX_FEATURE_SINCE(24)
48 #define _POSIX_CHOWN_RESTRICTED 1 /* chown/fchown require appropriate privileges. */
49 #define _POSIX_CLOCK_SELECTION __BIONIC_POSIX_FEATURE_SINCE(21) /* clock_nanosleep/pthread_condattr_getclock/pthread_condattr_setclock. */
50 #define _POSIX_CPUTIME _POSIX_VERSION /* CLOCK_PROCESS_CPUTIME_ID. */
51 #define _POSIX_FSYNC _POSIX_VERSION /* fsync. */
52 #define _POSIX_IPV6 _POSIX_VERSION
53 #define _POSIX_JOB_CONTROL __BIONIC_POSIX_FEATURE_SINCE(21) /* setpgid/tcdrain/tcflush/tcgetpgrp/tcsendbreak/tcsetattr/tcsetpgrp. */
54 #define _POSIX_MAPPED_FILES _POSIX_VERSION /* mmap/msync/munmap. */
55 #define _POSIX_MEMLOCK __BIONIC_POSIX_FEATURE_SINCE(17) /* mlockall/munlockall. */
56 #define _POSIX_MEMLOCK_RANGE _POSIX_VERSION /* mlock/munlock. */
57 #define _POSIX_MEMORY_PROTECTION _POSIX_VERSION /* mprotect. */
58 #define _POSIX_MESSAGE_PASSING __BIONIC_POSIX_FEATURE_MISSING
59 #define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION /* CLOCK_MONOTONIC. */
60 #define _POSIX_NO_TRUNC 1 /* Over-long pathnames return errors. */
61 #define _POSIX_PRIORITIZED_IO __BIONIC_POSIX_FEATURE_MISSING
62 #define _POSIX_PRIORITY_SCHEDULING _POSIX_VERSION /* sched_*. */
63 #define _POSIX_RAW_SOCKETS _POSIX_VERSION
64 #define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION /* pthread_rwlock*. */
65 #define _POSIX_REALTIME_SIGNALS __BIONIC_POSIX_FEATURE_SINCE(23) /* sigqueue/sigtimedwait/sigwaitinfo. */
66 #define _POSIX_REGEXP 1
67 #define _POSIX_SAVED_IDS 1
68 #define _POSIX_SEMAPHORES _POSIX_VERSION /* sem_*. */
69 #define _POSIX_SHARED_MEMORY_OBJECTS __BIONIC_POSIX_FEATURE_MISSING /* mmap/munmap are implemented, but shm_open/shm_unlink are not. */
70 #define _POSIX_SHELL 1 /* system. */
71 #define _POSIX_SPAWN __BIONIC_POSIX_FEATURE_SINCE(28) /* <spawn.h> */
72 #define _POSIX_SPIN_LOCKS __BIONIC_POSIX_FEATURE_SINCE(24) /* pthread_spin_*. */
73 #define _POSIX_SPORADIC_SERVER __BIONIC_POSIX_FEATURE_MISSING /* No SCHED_SPORADIC. */
74 #define _POSIX_SYNCHRONIZED_IO _POSIX_VERSION
75 #define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION /* Strictly, we're missing the deprecated pthread_attr_getstackaddr/pthread_attr_setstackaddr, but we do have pthread_attr_getstack/pthread_attr_setstack. */
76 #define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION /* pthread_attr_getstack/pthread_attr_getstacksize/pthread_attr_setstack/pthread_attr_setstacksize. */
77 #define _POSIX_THREAD_CPUTIME _POSIX_VERSION /* CLOCK_THREAD_CPUTIME_ID. */
78 #define _POSIX_THREAD_PRIO_INHERIT __BIONIC_POSIX_FEATURE_MISSING
79 #define _POSIX_THREAD_PRIO_PROTECT __BIONIC_POSIX_FEATURE_MISSING
80 #define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION /* Strictly, pthread_attr_getinheritsched/pthread_attr_setinheritsched arrived in 28. */
81 #define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
82 #define _POSIX_THREAD_ROBUST_PRIO_INHERIT __BIONIC_POSIX_FEATURE_MISSING
83 #define _POSIX_THREAD_ROBUST_PRIO_PROTECT __BIONIC_POSIX_FEATURE_MISSING
84 #define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
85 #define _POSIX_THREAD_SPORADIC_SERVER __BIONIC_POSIX_FEATURE_MISSING /* No SCHED_SPORADIC. */
86 #define _POSIX_THREADS _POSIX_VERSION /* Strictly, pthread_cancel/pthread_testcancel are missing. */
87 #define _POSIX_TIMEOUTS __BIONIC_POSIX_FEATURE_SINCE(21) /* pthread_mutex_timedlock arrived late. */
88 #define _POSIX_TIMERS _POSIX_VERSION /* clock_getres/clock_gettime/clock_settime/nanosleep/timer_create/timer_delete/timer_gettime/timer_getoverrun/timer_settime. */
89 #define _POSIX_TRACE __BIONIC_POSIX_FEATURE_MISSING
90 #define _POSIX_TRACE_EVENT_FILTER __BIONIC_POSIX_FEATURE_MISSING
91 #define _POSIX_TRACE_INHERIT __BIONIC_POSIX_FEATURE_MISSING
92 #define _POSIX_TRACE_LOG __BIONIC_POSIX_FEATURE_MISSING
93 #define _POSIX_TYPED_MEMORY_OBJECTS __BIONIC_POSIX_FEATURE_MISSING
94 
95 #define _POSIX_VDISABLE             '\0'
96 
97 #define _POSIX2_C_BIND              _POSIX_VERSION
98 #define _POSIX2_C_DEV               __BIONIC_POSIX_FEATURE_MISSING
99 #define _POSIX2_CHAR_TERM           _POSIX_VERSION
100 #define _POSIX2_FORT_DEV            __BIONIC_POSIX_FEATURE_MISSING
101 #define _POSIX2_FORT_RUN            __BIONIC_POSIX_FEATURE_MISSING
102 #define _POSIX2_LOCALEDEF           __BIONIC_POSIX_FEATURE_MISSING
103 #define _POSIX2_SW_DEV              __BIONIC_POSIX_FEATURE_MISSING
104 #define _POSIX2_UPE                 __BIONIC_POSIX_FEATURE_MISSING
105 
106 #if defined(__LP64__)
107 #define _POSIX_V7_ILP32_OFF32      (-1)
108 #define _POSIX_V7_ILP32_OFFBIG     (-1)
109 #define _POSIX_V7_LP64_OFF64         1
110 #define _POSIX_V7_LPBIG_OFFBIG       1
111 #else
112 #define _POSIX_V7_ILP32_OFF32        1
113 #define _POSIX_V7_ILP32_OFFBIG     (-1)
114 #define _POSIX_V7_LP64_OFF64       (-1)
115 #define _POSIX_V7_LPBIG_OFFBIG     (-1)
116 #endif
117 
118 #define _XOPEN_CRYPT                __BIONIC_POSIX_FEATURE_MISSING
119 #define _XOPEN_ENH_I18N             1
120 #define _XOPEN_LEGACY               __BIONIC_POSIX_FEATURE_MISSING
121 #define _XOPEN_REALTIME             1
122 #define _XOPEN_REALTIME_THREADS     1
123 #define _XOPEN_SHM                  1
124 #define _XOPEN_STREAMS              __BIONIC_POSIX_FEATURE_MISSING
125 #define _XOPEN_UNIX                 1
126 
127 /* Minimum values for other maxima. These numbers are simply lower bounds mandated by POSIX. */
128 /* The constant values here are explicitly specified by POSIX, not implementation dependent. */
129 #define _POSIX_AIO_LISTIO_MAX       2
130 #define _POSIX_AIO_MAX              1
131 #define _POSIX_ARG_MAX              4096
132 #define _POSIX_CHILD_MAX            25
133 #define _POSIX_CLOCKRES_MIN         20000000
134 #define _POSIX_DELAYTIMER_MAX       32
135 #define _POSIX_HOST_NAME_MAX        255
136 #define _POSIX_LINK_MAX             8
137 #define _POSIX_LOGIN_NAME_MAX       9
138 #define _POSIX_MAX_CANON            255
139 #define _POSIX_MAX_INPUT            255
140 #define _POSIX_MQ_OPEN_MAX          8
141 #define _POSIX_MQ_PRIO_MAX          32
142 #define _POSIX_NAME_MAX             14
143 #define _POSIX_NGROUPS_MAX          8
144 #define _POSIX_OPEN_MAX             20
145 #define _POSIX_PATH_MAX             256
146 #define _POSIX_PIPE_BUF             512
147 #define _POSIX_RE_DUP_MAX           255
148 #define _POSIX_RTSIG_MAX            8
149 #define _POSIX_SEM_NSEMS_MAX        256
150 #define _POSIX_SEM_VALUE_MAX        32767
151 #define _POSIX_SIGQUEUE_MAX         32
152 #define _POSIX_SSIZE_MAX            32767
153 #define _POSIX_STREAM_MAX           8
154 #define _POSIX_SS_REPL_MAX          4
155 #define _POSIX_SYMLINK_MAX          255
156 #define _POSIX_SYMLOOP_MAX          8
157 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
158 #define _POSIX_THREAD_KEYS_MAX      128
159 #define _POSIX_THREAD_THREADS_MAX   64
160 #define _POSIX_TIMER_MAX            32
161 #define _POSIX_TRACE_EVENT_NAME_MAX 30
162 #define _POSIX_TRACE_NAME_MAX       8
163 #define _POSIX_TRACE_SYS_MAX        8
164 #define _POSIX_TRACE_USER_EVENT_MAX 32
165 #define _POSIX_TTY_NAME_MAX         9
166 #define _POSIX_TZNAME_MAX           6
167 #define _POSIX2_BC_BASE_MAX         99
168 #define _POSIX2_BC_DIM_MAX          2048
169 #define _POSIX2_BC_SCALE_MAX        99
170 #define _POSIX2_BC_STRING_MAX       1000
171 #define _POSIX2_CHARCLASS_NAME_MAX  14
172 #define _POSIX2_COLL_WEIGHTS_MAX    2
173 #define _POSIX2_EXPR_NEST_MAX       32
174 #define _POSIX2_LINE_MAX            2048
175 #define _POSIX2_RE_DUP_MAX          255
176 #define _XOPEN_IOV_MAX              16
177 #define _XOPEN_NAME_MAX             255
178 #define _XOPEN_PATH_MAX             1024
179 
180 #endif
181