1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #define LOG_TAG "OsConstants"
18
19 #include <errno.h>
20 #include <fcntl.h>
21 #include <netdb.h>
22 #include <netinet/icmp6.h>
23 #include <netinet/in.h>
24 #include <netinet/ip_icmp.h>
25 #include <netinet/tcp.h>
26 #include <poll.h>
27 #include <signal.h>
28 #include <stdlib.h>
29 #include <sys/ioctl.h>
30 #include <sys/mman.h>
31 #include <sys/prctl.h>
32 #include <sys/resource.h>
33 #include <sys/socket.h>
34 #include <sys/stat.h>
35 #include <sys/un.h>
36 #include <sys/wait.h>
37 #include <sys/xattr.h>
38 #include <unistd.h>
39
40 #include <net/if_arp.h>
41 #include <linux/if_ether.h>
42
43 // After the others because these are not necessarily self-contained in glibc.
44 #include <linux/if_addr.h>
45 #include <linux/rtnetlink.h>
46
47 // Include linux socket constants for setting sockopts
48 #include <linux/udp.h>
49
50 #include <net/if.h> // After <sys/socket.h> to work around a Mac header file bug.
51
52 #if defined(__BIONIC__)
53 #include <linux/capability.h>
54 #endif
55
56 #include <nativehelper/JNIHelp.h>
57 #include <nativehelper/jni_macros.h>
58
59 #include "Portability.h"
60
initConstant(JNIEnv * env,jclass c,const char * fieldName,int value)61 static void initConstant(JNIEnv* env, jclass c, const char* fieldName, int value) {
62 jfieldID field = env->GetStaticFieldID(c, fieldName, "I");
63 env->SetStaticIntField(c, field, value);
64 }
65
OsConstants_initConstants(JNIEnv * env,jclass c)66 static void OsConstants_initConstants(JNIEnv* env, jclass c) {
67 initConstant(env, c, "AF_INET", AF_INET);
68 initConstant(env, c, "AF_INET6", AF_INET6);
69 initConstant(env, c, "AF_PACKET", AF_PACKET);
70 initConstant(env, c, "AF_NETLINK", AF_NETLINK);
71 initConstant(env, c, "AF_UNIX", AF_UNIX);
72 initConstant(env, c, "AF_UNSPEC", AF_UNSPEC);
73 initConstant(env, c, "AI_ADDRCONFIG", AI_ADDRCONFIG);
74 initConstant(env, c, "AI_ALL", AI_ALL);
75 initConstant(env, c, "AI_CANONNAME", AI_CANONNAME);
76 initConstant(env, c, "AI_NUMERICHOST", AI_NUMERICHOST);
77 #if defined(AI_NUMERICSERV)
78 initConstant(env, c, "AI_NUMERICSERV", AI_NUMERICSERV);
79 #endif
80 initConstant(env, c, "AI_PASSIVE", AI_PASSIVE);
81 initConstant(env, c, "AI_V4MAPPED", AI_V4MAPPED);
82 initConstant(env, c, "ARPHRD_ETHER", ARPHRD_ETHER);
83 initConstant(env, c, "ARPHRD_LOOPBACK", ARPHRD_LOOPBACK);
84 #if defined(CAP_LAST_CAP)
85 initConstant(env, c, "CAP_AUDIT_CONTROL", CAP_AUDIT_CONTROL);
86 initConstant(env, c, "CAP_AUDIT_WRITE", CAP_AUDIT_WRITE);
87 initConstant(env, c, "CAP_BLOCK_SUSPEND", CAP_BLOCK_SUSPEND);
88 initConstant(env, c, "CAP_CHOWN", CAP_CHOWN);
89 initConstant(env, c, "CAP_DAC_OVERRIDE", CAP_DAC_OVERRIDE);
90 initConstant(env, c, "CAP_DAC_READ_SEARCH", CAP_DAC_READ_SEARCH);
91 initConstant(env, c, "CAP_FOWNER", CAP_FOWNER);
92 initConstant(env, c, "CAP_FSETID", CAP_FSETID);
93 initConstant(env, c, "CAP_IPC_LOCK", CAP_IPC_LOCK);
94 initConstant(env, c, "CAP_IPC_OWNER", CAP_IPC_OWNER);
95 initConstant(env, c, "CAP_KILL", CAP_KILL);
96 initConstant(env, c, "CAP_LAST_CAP", CAP_LAST_CAP);
97 initConstant(env, c, "CAP_LEASE", CAP_LEASE);
98 initConstant(env, c, "CAP_LINUX_IMMUTABLE", CAP_LINUX_IMMUTABLE);
99 initConstant(env, c, "CAP_MAC_ADMIN", CAP_MAC_ADMIN);
100 initConstant(env, c, "CAP_MAC_OVERRIDE", CAP_MAC_OVERRIDE);
101 initConstant(env, c, "CAP_MKNOD", CAP_MKNOD);
102 initConstant(env, c, "CAP_NET_ADMIN", CAP_NET_ADMIN);
103 initConstant(env, c, "CAP_NET_BIND_SERVICE", CAP_NET_BIND_SERVICE);
104 initConstant(env, c, "CAP_NET_BROADCAST", CAP_NET_BROADCAST);
105 initConstant(env, c, "CAP_NET_RAW", CAP_NET_RAW);
106 initConstant(env, c, "CAP_SETFCAP", CAP_SETFCAP);
107 initConstant(env, c, "CAP_SETGID", CAP_SETGID);
108 initConstant(env, c, "CAP_SETPCAP", CAP_SETPCAP);
109 initConstant(env, c, "CAP_SETUID", CAP_SETUID);
110 initConstant(env, c, "CAP_SYS_ADMIN", CAP_SYS_ADMIN);
111 initConstant(env, c, "CAP_SYS_BOOT", CAP_SYS_BOOT);
112 initConstant(env, c, "CAP_SYS_CHROOT", CAP_SYS_CHROOT);
113 initConstant(env, c, "CAP_SYSLOG", CAP_SYSLOG);
114 initConstant(env, c, "CAP_SYS_MODULE", CAP_SYS_MODULE);
115 initConstant(env, c, "CAP_SYS_NICE", CAP_SYS_NICE);
116 initConstant(env, c, "CAP_SYS_PACCT", CAP_SYS_PACCT);
117 initConstant(env, c, "CAP_SYS_PTRACE", CAP_SYS_PTRACE);
118 initConstant(env, c, "CAP_SYS_RAWIO", CAP_SYS_RAWIO);
119 initConstant(env, c, "CAP_SYS_RESOURCE", CAP_SYS_RESOURCE);
120 initConstant(env, c, "CAP_SYS_TIME", CAP_SYS_TIME);
121 initConstant(env, c, "CAP_SYS_TTY_CONFIG", CAP_SYS_TTY_CONFIG);
122 initConstant(env, c, "CAP_WAKE_ALARM", CAP_WAKE_ALARM);
123 #endif
124 initConstant(env, c, "E2BIG", E2BIG);
125 initConstant(env, c, "EACCES", EACCES);
126 initConstant(env, c, "EADDRINUSE", EADDRINUSE);
127 initConstant(env, c, "EADDRNOTAVAIL", EADDRNOTAVAIL);
128 initConstant(env, c, "EAFNOSUPPORT", EAFNOSUPPORT);
129 initConstant(env, c, "EAGAIN", EAGAIN);
130 initConstant(env, c, "EAI_AGAIN", EAI_AGAIN);
131 initConstant(env, c, "EAI_BADFLAGS", EAI_BADFLAGS);
132 initConstant(env, c, "EAI_FAIL", EAI_FAIL);
133 initConstant(env, c, "EAI_FAMILY", EAI_FAMILY);
134 initConstant(env, c, "EAI_MEMORY", EAI_MEMORY);
135 initConstant(env, c, "EAI_NODATA", EAI_NODATA);
136 initConstant(env, c, "EAI_NONAME", EAI_NONAME);
137 #if defined(EAI_OVERFLOW)
138 initConstant(env, c, "EAI_OVERFLOW", EAI_OVERFLOW);
139 #endif
140 initConstant(env, c, "EAI_SERVICE", EAI_SERVICE);
141 initConstant(env, c, "EAI_SOCKTYPE", EAI_SOCKTYPE);
142 initConstant(env, c, "EAI_SYSTEM", EAI_SYSTEM);
143 initConstant(env, c, "EALREADY", EALREADY);
144 initConstant(env, c, "EBADF", EBADF);
145 initConstant(env, c, "EBADMSG", EBADMSG);
146 initConstant(env, c, "EBUSY", EBUSY);
147 initConstant(env, c, "ECANCELED", ECANCELED);
148 initConstant(env, c, "ECHILD", ECHILD);
149 initConstant(env, c, "ECONNABORTED", ECONNABORTED);
150 initConstant(env, c, "ECONNREFUSED", ECONNREFUSED);
151 initConstant(env, c, "ECONNRESET", ECONNRESET);
152 initConstant(env, c, "EDEADLK", EDEADLK);
153 initConstant(env, c, "EDESTADDRREQ", EDESTADDRREQ);
154 initConstant(env, c, "EDOM", EDOM);
155 initConstant(env, c, "EDQUOT", EDQUOT);
156 initConstant(env, c, "EEXIST", EEXIST);
157 initConstant(env, c, "EFAULT", EFAULT);
158 initConstant(env, c, "EFBIG", EFBIG);
159 initConstant(env, c, "EHOSTUNREACH", EHOSTUNREACH);
160 initConstant(env, c, "EIDRM", EIDRM);
161 initConstant(env, c, "EILSEQ", EILSEQ);
162 initConstant(env, c, "EINPROGRESS", EINPROGRESS);
163 initConstant(env, c, "EINTR", EINTR);
164 initConstant(env, c, "EINVAL", EINVAL);
165 initConstant(env, c, "EIO", EIO);
166 initConstant(env, c, "EISCONN", EISCONN);
167 initConstant(env, c, "EISDIR", EISDIR);
168 initConstant(env, c, "ELOOP", ELOOP);
169 initConstant(env, c, "EMFILE", EMFILE);
170 initConstant(env, c, "EMLINK", EMLINK);
171 initConstant(env, c, "EMSGSIZE", EMSGSIZE);
172 initConstant(env, c, "EMULTIHOP", EMULTIHOP);
173 initConstant(env, c, "ENAMETOOLONG", ENAMETOOLONG);
174 initConstant(env, c, "ENETDOWN", ENETDOWN);
175 initConstant(env, c, "ENETRESET", ENETRESET);
176 initConstant(env, c, "ENETUNREACH", ENETUNREACH);
177 initConstant(env, c, "ENFILE", ENFILE);
178 initConstant(env, c, "ENOBUFS", ENOBUFS);
179 initConstant(env, c, "ENODATA", ENODATA);
180 initConstant(env, c, "ENODEV", ENODEV);
181 initConstant(env, c, "ENOENT", ENOENT);
182 initConstant(env, c, "ENOEXEC", ENOEXEC);
183 initConstant(env, c, "ENOLCK", ENOLCK);
184 initConstant(env, c, "ENOLINK", ENOLINK);
185 initConstant(env, c, "ENOMEM", ENOMEM);
186 initConstant(env, c, "ENOMSG", ENOMSG);
187 initConstant(env, c, "ENONET", ENONET);
188 initConstant(env, c, "ENOPROTOOPT", ENOPROTOOPT);
189 initConstant(env, c, "ENOSPC", ENOSPC);
190 initConstant(env, c, "ENOSR", ENOSR);
191 initConstant(env, c, "ENOSTR", ENOSTR);
192 initConstant(env, c, "ENOSYS", ENOSYS);
193 initConstant(env, c, "ENOTCONN", ENOTCONN);
194 initConstant(env, c, "ENOTDIR", ENOTDIR);
195 initConstant(env, c, "ENOTEMPTY", ENOTEMPTY);
196 initConstant(env, c, "ENOTSOCK", ENOTSOCK);
197 initConstant(env, c, "ENOTSUP", ENOTSUP);
198 initConstant(env, c, "ENOTTY", ENOTTY);
199 initConstant(env, c, "ENXIO", ENXIO);
200 initConstant(env, c, "EOPNOTSUPP", EOPNOTSUPP);
201 initConstant(env, c, "EOVERFLOW", EOVERFLOW);
202 initConstant(env, c, "EPERM", EPERM);
203 initConstant(env, c, "EPIPE", EPIPE);
204 initConstant(env, c, "EPROTO", EPROTO);
205 initConstant(env, c, "EPROTONOSUPPORT", EPROTONOSUPPORT);
206 initConstant(env, c, "EPROTOTYPE", EPROTOTYPE);
207 initConstant(env, c, "ERANGE", ERANGE);
208 initConstant(env, c, "EROFS", EROFS);
209 initConstant(env, c, "ESPIPE", ESPIPE);
210 initConstant(env, c, "ESRCH", ESRCH);
211 initConstant(env, c, "ESTALE", ESTALE);
212 initConstant(env, c, "ETH_P_ALL", ETH_P_ALL);
213 initConstant(env, c, "ETH_P_ARP", ETH_P_ARP);
214 initConstant(env, c, "ETH_P_IP", ETH_P_IP);
215 initConstant(env, c, "ETH_P_IPV6", ETH_P_IPV6);
216 initConstant(env, c, "ETIME", ETIME);
217 initConstant(env, c, "ETIMEDOUT", ETIMEDOUT);
218 initConstant(env, c, "ETXTBSY", ETXTBSY);
219 initConstant(env, c, "EUSERS", EUSERS);
220 #if EWOULDBLOCK != EAGAIN
221 #error EWOULDBLOCK != EAGAIN
222 #endif
223 initConstant(env, c, "EXDEV", EXDEV);
224 initConstant(env, c, "EXIT_FAILURE", EXIT_FAILURE);
225 initConstant(env, c, "EXIT_SUCCESS", EXIT_SUCCESS);
226 initConstant(env, c, "FD_CLOEXEC", FD_CLOEXEC);
227 initConstant(env, c, "FIONREAD", FIONREAD);
228 initConstant(env, c, "F_DUPFD", F_DUPFD);
229 initConstant(env, c, "F_DUPFD_CLOEXEC", F_DUPFD_CLOEXEC);
230 initConstant(env, c, "F_GETFD", F_GETFD);
231 initConstant(env, c, "F_GETFL", F_GETFL);
232 initConstant(env, c, "F_GETLK", F_GETLK);
233 #if defined(F_GETLK64)
234 initConstant(env, c, "F_GETLK64", F_GETLK64);
235 #endif
236 initConstant(env, c, "F_GETOWN", F_GETOWN);
237 initConstant(env, c, "F_OK", F_OK);
238 initConstant(env, c, "F_RDLCK", F_RDLCK);
239 initConstant(env, c, "F_SETFD", F_SETFD);
240 initConstant(env, c, "F_SETFL", F_SETFL);
241 initConstant(env, c, "F_SETLK", F_SETLK);
242 #if defined(F_SETLK64)
243 initConstant(env, c, "F_SETLK64", F_SETLK64);
244 #endif
245 initConstant(env, c, "F_SETLKW", F_SETLKW);
246 #if defined(F_SETLKW64)
247 initConstant(env, c, "F_SETLKW64", F_SETLKW64);
248 #endif
249 initConstant(env, c, "F_SETOWN", F_SETOWN);
250 initConstant(env, c, "F_UNLCK", F_UNLCK);
251 initConstant(env, c, "F_WRLCK", F_WRLCK);
252 initConstant(env, c, "ICMP_ECHO", ICMP_ECHO);
253 initConstant(env, c, "ICMP_ECHOREPLY", ICMP_ECHOREPLY);
254 initConstant(env, c, "ICMP6_ECHO_REQUEST", ICMP6_ECHO_REQUEST);
255 initConstant(env, c, "ICMP6_ECHO_REPLY", ICMP6_ECHO_REPLY);
256 #if defined(IFA_F_DADFAILED)
257 initConstant(env, c, "IFA_F_DADFAILED", IFA_F_DADFAILED);
258 #endif
259 #if defined(IFA_F_DEPRECATED)
260 initConstant(env, c, "IFA_F_DEPRECATED", IFA_F_DEPRECATED);
261 #endif
262 #if defined(IFA_F_HOMEADDRESS)
263 initConstant(env, c, "IFA_F_HOMEADDRESS", IFA_F_HOMEADDRESS);
264 #endif
265 #if defined(IFA_F_NODAD)
266 initConstant(env, c, "IFA_F_NODAD", IFA_F_NODAD);
267 #endif
268 #if defined(IFA_F_OPTIMISTIC)
269 initConstant(env, c, "IFA_F_OPTIMISTIC", IFA_F_OPTIMISTIC);
270 #endif
271 #if defined(IFA_F_PERMANENT)
272 initConstant(env, c, "IFA_F_PERMANENT", IFA_F_PERMANENT);
273 #endif
274 #if defined(IFA_F_SECONDARY)
275 initConstant(env, c, "IFA_F_SECONDARY", IFA_F_SECONDARY);
276 #endif
277 #if defined(IFA_F_TEMPORARY)
278 initConstant(env, c, "IFA_F_TEMPORARY", IFA_F_TEMPORARY);
279 #endif
280 #if defined(IFA_F_TENTATIVE)
281 initConstant(env, c, "IFA_F_TENTATIVE", IFA_F_TENTATIVE);
282 #endif
283 initConstant(env, c, "IFF_ALLMULTI", IFF_ALLMULTI);
284 #if defined(IFF_AUTOMEDIA)
285 initConstant(env, c, "IFF_AUTOMEDIA", IFF_AUTOMEDIA);
286 #endif
287 initConstant(env, c, "IFF_BROADCAST", IFF_BROADCAST);
288 initConstant(env, c, "IFF_DEBUG", IFF_DEBUG);
289 #if defined(IFF_DYNAMIC)
290 initConstant(env, c, "IFF_DYNAMIC", IFF_DYNAMIC);
291 #endif
292 initConstant(env, c, "IFF_LOOPBACK", IFF_LOOPBACK);
293 #if defined(IFF_MASTER)
294 initConstant(env, c, "IFF_MASTER", IFF_MASTER);
295 #endif
296 initConstant(env, c, "IFF_MULTICAST", IFF_MULTICAST);
297 initConstant(env, c, "IFF_NOARP", IFF_NOARP);
298 initConstant(env, c, "IFF_NOTRAILERS", IFF_NOTRAILERS);
299 initConstant(env, c, "IFF_POINTOPOINT", IFF_POINTOPOINT);
300 #if defined(IFF_PORTSEL)
301 initConstant(env, c, "IFF_PORTSEL", IFF_PORTSEL);
302 #endif
303 initConstant(env, c, "IFF_PROMISC", IFF_PROMISC);
304 initConstant(env, c, "IFF_RUNNING", IFF_RUNNING);
305 #if defined(IFF_SLAVE)
306 initConstant(env, c, "IFF_SLAVE", IFF_SLAVE);
307 #endif
308 initConstant(env, c, "IFF_UP", IFF_UP);
309 initConstant(env, c, "IPPROTO_ICMP", IPPROTO_ICMP);
310 initConstant(env, c, "IPPROTO_ICMPV6", IPPROTO_ICMPV6);
311 initConstant(env, c, "IPPROTO_IP", IPPROTO_IP);
312 initConstant(env, c, "IPPROTO_IPV6", IPPROTO_IPV6);
313 initConstant(env, c, "IPPROTO_RAW", IPPROTO_RAW);
314 initConstant(env, c, "IPPROTO_TCP", IPPROTO_TCP);
315 initConstant(env, c, "IPPROTO_UDP", IPPROTO_UDP);
316 initConstant(env, c, "IPV6_CHECKSUM", IPV6_CHECKSUM);
317 initConstant(env, c, "IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS);
318 initConstant(env, c, "IPV6_MULTICAST_IF", IPV6_MULTICAST_IF);
319 initConstant(env, c, "IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP);
320 #if defined(IPV6_RECVDSTOPTS)
321 initConstant(env, c, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS);
322 #endif
323 #if defined(IPV6_RECVHOPLIMIT)
324 initConstant(env, c, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT);
325 #endif
326 #if defined(IPV6_RECVHOPOPTS)
327 initConstant(env, c, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS);
328 #endif
329 #if defined(IPV6_RECVPKTINFO)
330 initConstant(env, c, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO);
331 #endif
332 #if defined(IPV6_RECVRTHDR)
333 initConstant(env, c, "IPV6_RECVRTHDR", IPV6_RECVRTHDR);
334 #endif
335 #if defined(IPV6_RECVTCLASS)
336 initConstant(env, c, "IPV6_RECVTCLASS", IPV6_RECVTCLASS);
337 #endif
338 #if defined(IPV6_TCLASS)
339 initConstant(env, c, "IPV6_TCLASS", IPV6_TCLASS);
340 #endif
341 initConstant(env, c, "IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS);
342 initConstant(env, c, "IPV6_V6ONLY", IPV6_V6ONLY);
343 initConstant(env, c, "IP_MULTICAST_ALL", IP_MULTICAST_ALL);
344 initConstant(env, c, "IP_MULTICAST_IF", IP_MULTICAST_IF);
345 initConstant(env, c, "IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
346 initConstant(env, c, "IP_MULTICAST_TTL", IP_MULTICAST_TTL);
347 initConstant(env, c, "IP_RECVTOS", IP_RECVTOS);
348 initConstant(env, c, "IP_TOS", IP_TOS);
349 initConstant(env, c, "IP_TTL", IP_TTL);
350 #if defined(_LINUX_CAPABILITY_VERSION_3)
351 initConstant(env, c, "_LINUX_CAPABILITY_VERSION_3", _LINUX_CAPABILITY_VERSION_3);
352 #endif
353 initConstant(env, c, "MAP_FIXED", MAP_FIXED);
354 initConstant(env, c, "MAP_ANONYMOUS", MAP_ANONYMOUS);
355 initConstant(env, c, "MAP_POPULATE", MAP_POPULATE);
356 initConstant(env, c, "MAP_PRIVATE", MAP_PRIVATE);
357 initConstant(env, c, "MAP_SHARED", MAP_SHARED);
358 #if defined(MCAST_JOIN_GROUP)
359 initConstant(env, c, "MCAST_JOIN_GROUP", MCAST_JOIN_GROUP);
360 #endif
361 #if defined(MCAST_LEAVE_GROUP)
362 initConstant(env, c, "MCAST_LEAVE_GROUP", MCAST_LEAVE_GROUP);
363 #endif
364 #if defined(MCAST_JOIN_SOURCE_GROUP)
365 initConstant(env, c, "MCAST_JOIN_SOURCE_GROUP", MCAST_JOIN_SOURCE_GROUP);
366 #endif
367 #if defined(MCAST_LEAVE_SOURCE_GROUP)
368 initConstant(env, c, "MCAST_LEAVE_SOURCE_GROUP", MCAST_LEAVE_SOURCE_GROUP);
369 #endif
370 #if defined(MCAST_BLOCK_SOURCE)
371 initConstant(env, c, "MCAST_BLOCK_SOURCE", MCAST_BLOCK_SOURCE);
372 #endif
373 #if defined(MCAST_UNBLOCK_SOURCE)
374 initConstant(env, c, "MCAST_UNBLOCK_SOURCE", MCAST_UNBLOCK_SOURCE);
375 #endif
376 initConstant(env, c, "MCL_CURRENT", MCL_CURRENT);
377 initConstant(env, c, "MCL_FUTURE", MCL_FUTURE);
378 #if defined(MFD_CLOEXEC)
379 initConstant(env, c, "MFD_CLOEXEC", MFD_CLOEXEC);
380 #endif
381 initConstant(env, c, "MSG_CTRUNC", MSG_CTRUNC);
382 initConstant(env, c, "MSG_DONTROUTE", MSG_DONTROUTE);
383 initConstant(env, c, "MSG_EOR", MSG_EOR);
384 initConstant(env, c, "MSG_OOB", MSG_OOB);
385 initConstant(env, c, "MSG_PEEK", MSG_PEEK);
386 initConstant(env, c, "MSG_TRUNC", MSG_TRUNC);
387 initConstant(env, c, "MSG_WAITALL", MSG_WAITALL);
388 initConstant(env, c, "MS_ASYNC", MS_ASYNC);
389 initConstant(env, c, "MS_INVALIDATE", MS_INVALIDATE);
390 initConstant(env, c, "MS_SYNC", MS_SYNC);
391 initConstant(env, c, "NETLINK_NETFILTER", NETLINK_NETFILTER);
392 initConstant(env, c, "NETLINK_ROUTE", NETLINK_ROUTE);
393 initConstant(env, c, "NETLINK_INET_DIAG", NETLINK_INET_DIAG);
394 initConstant(env, c, "NI_DGRAM", NI_DGRAM);
395 initConstant(env, c, "NI_NAMEREQD", NI_NAMEREQD);
396 initConstant(env, c, "NI_NOFQDN", NI_NOFQDN);
397 initConstant(env, c, "NI_NUMERICHOST", NI_NUMERICHOST);
398 initConstant(env, c, "NI_NUMERICSERV", NI_NUMERICSERV);
399 initConstant(env, c, "O_ACCMODE", O_ACCMODE);
400 initConstant(env, c, "O_APPEND", O_APPEND);
401 initConstant(env, c, "O_CLOEXEC", O_CLOEXEC);
402 initConstant(env, c, "O_CREAT", O_CREAT);
403 initConstant(env, c, "O_DIRECT", O_DIRECT);
404 initConstant(env, c, "O_EXCL", O_EXCL);
405 initConstant(env, c, "O_NOCTTY", O_NOCTTY);
406 initConstant(env, c, "O_NOFOLLOW", O_NOFOLLOW);
407 initConstant(env, c, "O_NONBLOCK", O_NONBLOCK);
408 initConstant(env, c, "O_RDONLY", O_RDONLY);
409 initConstant(env, c, "O_RDWR", O_RDWR);
410 initConstant(env, c, "O_SYNC", O_SYNC);
411 initConstant(env, c, "O_DSYNC", O_DSYNC);
412 initConstant(env, c, "O_TRUNC", O_TRUNC);
413 initConstant(env, c, "O_WRONLY", O_WRONLY);
414 initConstant(env, c, "POLLERR", POLLERR);
415 initConstant(env, c, "POLLHUP", POLLHUP);
416 initConstant(env, c, "POLLIN", POLLIN);
417 initConstant(env, c, "POLLNVAL", POLLNVAL);
418 initConstant(env, c, "POLLOUT", POLLOUT);
419 initConstant(env, c, "POLLPRI", POLLPRI);
420 initConstant(env, c, "POLLRDBAND", POLLRDBAND);
421 initConstant(env, c, "POLLRDNORM", POLLRDNORM);
422 initConstant(env, c, "POLLWRBAND", POLLWRBAND);
423 initConstant(env, c, "POLLWRNORM", POLLWRNORM);
424 #if defined(PR_CAP_AMBIENT)
425 initConstant(env, c, "PR_CAP_AMBIENT", PR_CAP_AMBIENT);
426 #endif
427 #if defined(PR_CAP_AMBIENT_RAISE)
428 initConstant(env, c, "PR_CAP_AMBIENT_RAISE", PR_CAP_AMBIENT_RAISE);
429 #endif
430 #if defined(PR_GET_DUMPABLE)
431 initConstant(env, c, "PR_GET_DUMPABLE", PR_GET_DUMPABLE);
432 #endif
433 #if defined(PR_SET_DUMPABLE)
434 initConstant(env, c, "PR_SET_DUMPABLE", PR_SET_DUMPABLE);
435 #endif
436 #if defined(PR_SET_NO_NEW_PRIVS)
437 initConstant(env, c, "PR_SET_NO_NEW_PRIVS", PR_SET_NO_NEW_PRIVS);
438 #endif
439 initConstant(env, c, "PROT_EXEC", PROT_EXEC);
440 initConstant(env, c, "PROT_NONE", PROT_NONE);
441 initConstant(env, c, "PROT_READ", PROT_READ);
442 initConstant(env, c, "PROT_WRITE", PROT_WRITE);
443 initConstant(env, c, "R_OK", R_OK);
444 initConstant(env, c, "RLIMIT_NOFILE", RLIMIT_NOFILE);
445 // NOTE: The RT_* constants are not preprocessor defines, they're enum
446 // members. The best we can do (barring UAPI / kernel version checks) is
447 // to hope they exist on all host linuxes we're building on. These
448 // constants have been around since 2.6.35 at least, so we should be ok.
449 initConstant(env, c, "RT_SCOPE_HOST", RT_SCOPE_HOST);
450 initConstant(env, c, "RT_SCOPE_LINK", RT_SCOPE_LINK);
451 initConstant(env, c, "RT_SCOPE_NOWHERE", RT_SCOPE_NOWHERE);
452 initConstant(env, c, "RT_SCOPE_SITE", RT_SCOPE_SITE);
453 initConstant(env, c, "RT_SCOPE_UNIVERSE", RT_SCOPE_UNIVERSE);
454 initConstant(env, c, "RTMGRP_IPV4_IFADDR", RTMGRP_IPV4_IFADDR);
455 initConstant(env, c, "RTMGRP_IPV4_MROUTE", RTMGRP_IPV4_MROUTE);
456 initConstant(env, c, "RTMGRP_IPV4_ROUTE", RTMGRP_IPV4_ROUTE);
457 initConstant(env, c, "RTMGRP_IPV4_RULE", RTMGRP_IPV4_RULE);
458 initConstant(env, c, "RTMGRP_IPV6_IFADDR", RTMGRP_IPV6_IFADDR);
459 initConstant(env, c, "RTMGRP_IPV6_IFINFO", RTMGRP_IPV6_IFINFO);
460 initConstant(env, c, "RTMGRP_IPV6_MROUTE", RTMGRP_IPV6_MROUTE);
461 initConstant(env, c, "RTMGRP_IPV6_PREFIX", RTMGRP_IPV6_PREFIX);
462 initConstant(env, c, "RTMGRP_IPV6_ROUTE", RTMGRP_IPV6_ROUTE);
463 initConstant(env, c, "RTMGRP_LINK", RTMGRP_LINK);
464 initConstant(env, c, "RTMGRP_NEIGH", RTMGRP_NEIGH);
465 initConstant(env, c, "RTMGRP_NOTIFY", RTMGRP_NOTIFY);
466 initConstant(env, c, "RTMGRP_TC", RTMGRP_TC);
467 initConstant(env, c, "SEEK_CUR", SEEK_CUR);
468 initConstant(env, c, "SEEK_END", SEEK_END);
469 initConstant(env, c, "SEEK_SET", SEEK_SET);
470 initConstant(env, c, "SHUT_RD", SHUT_RD);
471 initConstant(env, c, "SHUT_RDWR", SHUT_RDWR);
472 initConstant(env, c, "SHUT_WR", SHUT_WR);
473 initConstant(env, c, "SIGABRT", SIGABRT);
474 initConstant(env, c, "SIGALRM", SIGALRM);
475 initConstant(env, c, "SIGBUS", SIGBUS);
476 initConstant(env, c, "SIGCHLD", SIGCHLD);
477 initConstant(env, c, "SIGCONT", SIGCONT);
478 initConstant(env, c, "SIGFPE", SIGFPE);
479 initConstant(env, c, "SIGHUP", SIGHUP);
480 initConstant(env, c, "SIGILL", SIGILL);
481 initConstant(env, c, "SIGINT", SIGINT);
482 initConstant(env, c, "SIGIO", SIGIO);
483 initConstant(env, c, "SIGKILL", SIGKILL);
484 initConstant(env, c, "SIGPIPE", SIGPIPE);
485 initConstant(env, c, "SIGPROF", SIGPROF);
486 #if defined(SIGPWR)
487 initConstant(env, c, "SIGPWR", SIGPWR);
488 #endif
489 initConstant(env, c, "SIGQUIT", SIGQUIT);
490 #if defined(SIGRTMAX)
491 initConstant(env, c, "SIGRTMAX", SIGRTMAX);
492 #endif
493 #if defined(SIGRTMIN)
494 initConstant(env, c, "SIGRTMIN", SIGRTMIN);
495 #endif
496 initConstant(env, c, "SIGSEGV", SIGSEGV);
497 #if defined(SIGSTKFLT)
498 initConstant(env, c, "SIGSTKFLT", SIGSTKFLT);
499 #endif
500 initConstant(env, c, "SIGSTOP", SIGSTOP);
501 initConstant(env, c, "SIGSYS", SIGSYS);
502 initConstant(env, c, "SIGTERM", SIGTERM);
503 initConstant(env, c, "SIGTRAP", SIGTRAP);
504 initConstant(env, c, "SIGTSTP", SIGTSTP);
505 initConstant(env, c, "SIGTTIN", SIGTTIN);
506 initConstant(env, c, "SIGTTOU", SIGTTOU);
507 initConstant(env, c, "SIGURG", SIGURG);
508 initConstant(env, c, "SIGUSR1", SIGUSR1);
509 initConstant(env, c, "SIGUSR2", SIGUSR2);
510 initConstant(env, c, "SIGVTALRM", SIGVTALRM);
511 initConstant(env, c, "SIGWINCH", SIGWINCH);
512 initConstant(env, c, "SIGXCPU", SIGXCPU);
513 initConstant(env, c, "SIGXFSZ", SIGXFSZ);
514 initConstant(env, c, "SIOCGIFADDR", SIOCGIFADDR);
515 initConstant(env, c, "SIOCGIFBRDADDR", SIOCGIFBRDADDR);
516 initConstant(env, c, "SIOCGIFDSTADDR", SIOCGIFDSTADDR);
517 initConstant(env, c, "SIOCGIFNETMASK", SIOCGIFNETMASK);
518 initConstant(env, c, "SOCK_CLOEXEC", SOCK_CLOEXEC);
519 initConstant(env, c, "SOCK_DGRAM", SOCK_DGRAM);
520 initConstant(env, c, "SOCK_NONBLOCK", SOCK_NONBLOCK);
521 initConstant(env, c, "SOCK_RAW", SOCK_RAW);
522 initConstant(env, c, "SOCK_SEQPACKET", SOCK_SEQPACKET);
523 initConstant(env, c, "SOCK_STREAM", SOCK_STREAM);
524 initConstant(env, c, "SOL_SOCKET", SOL_SOCKET);
525 #if defined(SO_BINDTODEVICE)
526 initConstant(env, c, "SO_BINDTODEVICE", SO_BINDTODEVICE);
527 #endif
528 initConstant(env, c, "SO_BROADCAST", SO_BROADCAST);
529 initConstant(env, c, "SO_DEBUG", SO_DEBUG);
530 #if defined(SO_DOMAIN)
531 initConstant(env, c, "SO_DOMAIN", SO_DOMAIN);
532 #endif
533 initConstant(env, c, "SO_DONTROUTE", SO_DONTROUTE);
534 initConstant(env, c, "SO_ERROR", SO_ERROR);
535 initConstant(env, c, "SO_KEEPALIVE", SO_KEEPALIVE);
536 initConstant(env, c, "SO_LINGER", SO_LINGER);
537 initConstant(env, c, "SO_OOBINLINE", SO_OOBINLINE);
538 #if defined(SO_PASSCRED)
539 initConstant(env, c, "SO_PASSCRED", SO_PASSCRED);
540 #endif
541 #if defined(SO_PEERCRED)
542 initConstant(env, c, "SO_PEERCRED", SO_PEERCRED);
543 #endif
544 #if defined(SO_PROTOCOL)
545 initConstant(env, c, "SO_PROTOCOL", SO_PROTOCOL);
546 #endif
547 initConstant(env, c, "SO_RCVBUF", SO_RCVBUF);
548 initConstant(env, c, "SO_RCVLOWAT", SO_RCVLOWAT);
549 initConstant(env, c, "SO_RCVTIMEO", SO_RCVTIMEO);
550 initConstant(env, c, "SO_REUSEADDR", SO_REUSEADDR);
551 initConstant(env, c, "SO_SNDBUF", SO_SNDBUF);
552 initConstant(env, c, "SO_SNDLOWAT", SO_SNDLOWAT);
553 initConstant(env, c, "SO_SNDTIMEO", SO_SNDTIMEO);
554 initConstant(env, c, "SO_TYPE", SO_TYPE);
555 initConstant(env, c, "SPLICE_F_MOVE", SPLICE_F_MOVE);
556 initConstant(env, c, "SPLICE_F_NONBLOCK", SPLICE_F_NONBLOCK);
557 initConstant(env, c, "SPLICE_F_MORE", SPLICE_F_MORE);
558 initConstant(env, c, "STDERR_FILENO", STDERR_FILENO);
559 initConstant(env, c, "STDIN_FILENO", STDIN_FILENO);
560 initConstant(env, c, "STDOUT_FILENO", STDOUT_FILENO);
561 initConstant(env, c, "ST_MANDLOCK", ST_MANDLOCK);
562 initConstant(env, c, "ST_NOATIME", ST_NOATIME);
563 initConstant(env, c, "ST_NODEV", ST_NODEV);
564 initConstant(env, c, "ST_NODIRATIME", ST_NODIRATIME);
565 initConstant(env, c, "ST_NOEXEC", ST_NOEXEC);
566 initConstant(env, c, "ST_NOSUID", ST_NOSUID);
567 initConstant(env, c, "ST_RDONLY", ST_RDONLY);
568 initConstant(env, c, "ST_RELATIME", ST_RELATIME);
569 initConstant(env, c, "ST_SYNCHRONOUS", ST_SYNCHRONOUS);
570 initConstant(env, c, "S_IFBLK", S_IFBLK);
571 initConstant(env, c, "S_IFCHR", S_IFCHR);
572 initConstant(env, c, "S_IFDIR", S_IFDIR);
573 initConstant(env, c, "S_IFIFO", S_IFIFO);
574 initConstant(env, c, "S_IFLNK", S_IFLNK);
575 initConstant(env, c, "S_IFMT", S_IFMT);
576 initConstant(env, c, "S_IFREG", S_IFREG);
577 initConstant(env, c, "S_IFSOCK", S_IFSOCK);
578 initConstant(env, c, "S_IRGRP", S_IRGRP);
579 initConstant(env, c, "S_IROTH", S_IROTH);
580 initConstant(env, c, "S_IRUSR", S_IRUSR);
581 initConstant(env, c, "S_IRWXG", S_IRWXG);
582 initConstant(env, c, "S_IRWXO", S_IRWXO);
583 initConstant(env, c, "S_IRWXU", S_IRWXU);
584 initConstant(env, c, "S_ISGID", S_ISGID);
585 initConstant(env, c, "S_ISUID", S_ISUID);
586 initConstant(env, c, "S_ISVTX", S_ISVTX);
587 initConstant(env, c, "S_IWGRP", S_IWGRP);
588 initConstant(env, c, "S_IWOTH", S_IWOTH);
589 initConstant(env, c, "S_IWUSR", S_IWUSR);
590 initConstant(env, c, "S_IXGRP", S_IXGRP);
591 initConstant(env, c, "S_IXOTH", S_IXOTH);
592 initConstant(env, c, "S_IXUSR", S_IXUSR);
593 initConstant(env, c, "TCP_NODELAY", TCP_NODELAY);
594 #if defined(TCP_USER_TIMEOUT)
595 initConstant(env, c, "TCP_USER_TIMEOUT", TCP_USER_TIMEOUT);
596 #endif
597 initConstant(env, c, "TIOCOUTQ", TIOCOUTQ);
598 initConstant(env, c, "UDP_ENCAP", UDP_ENCAP);
599 initConstant(env, c, "UDP_ENCAP_ESPINUDP_NON_IKE", UDP_ENCAP_ESPINUDP_NON_IKE);
600 initConstant(env, c, "UDP_ENCAP_ESPINUDP", UDP_ENCAP_ESPINUDP);
601 // UNIX_PATH_MAX is mentioned in some versions of unix(7), but not actually declared.
602 initConstant(env, c, "UNIX_PATH_MAX", sizeof(sockaddr_un::sun_path));
603 initConstant(env, c, "WCONTINUED", WCONTINUED);
604 initConstant(env, c, "WEXITED", WEXITED);
605 initConstant(env, c, "WNOHANG", WNOHANG);
606 initConstant(env, c, "WNOWAIT", WNOWAIT);
607 initConstant(env, c, "WSTOPPED", WSTOPPED);
608 initConstant(env, c, "WUNTRACED", WUNTRACED);
609 initConstant(env, c, "W_OK", W_OK);
610 initConstant(env, c, "XATTR_CREATE", XATTR_CREATE);
611 initConstant(env, c, "XATTR_REPLACE", XATTR_REPLACE);
612 initConstant(env, c, "X_OK", X_OK);
613 initConstant(env, c, "_SC_2_CHAR_TERM", _SC_2_CHAR_TERM);
614 initConstant(env, c, "_SC_2_C_BIND", _SC_2_C_BIND);
615 initConstant(env, c, "_SC_2_C_DEV", _SC_2_C_DEV);
616 #if defined(_SC_2_C_VERSION)
617 initConstant(env, c, "_SC_2_C_VERSION", _SC_2_C_VERSION);
618 #endif
619 initConstant(env, c, "_SC_2_FORT_DEV", _SC_2_FORT_DEV);
620 initConstant(env, c, "_SC_2_FORT_RUN", _SC_2_FORT_RUN);
621 initConstant(env, c, "_SC_2_LOCALEDEF", _SC_2_LOCALEDEF);
622 initConstant(env, c, "_SC_2_SW_DEV", _SC_2_SW_DEV);
623 initConstant(env, c, "_SC_2_UPE", _SC_2_UPE);
624 initConstant(env, c, "_SC_2_VERSION", _SC_2_VERSION);
625 initConstant(env, c, "_SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX);
626 initConstant(env, c, "_SC_AIO_MAX", _SC_AIO_MAX);
627 initConstant(env, c, "_SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX);
628 initConstant(env, c, "_SC_ARG_MAX", _SC_ARG_MAX);
629 initConstant(env, c, "_SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO);
630 initConstant(env, c, "_SC_ATEXIT_MAX", _SC_ATEXIT_MAX);
631 #if defined(_SC_AVPHYS_PAGES)
632 initConstant(env, c, "_SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES);
633 #endif
634 initConstant(env, c, "_SC_BC_BASE_MAX", _SC_BC_BASE_MAX);
635 initConstant(env, c, "_SC_BC_DIM_MAX", _SC_BC_DIM_MAX);
636 initConstant(env, c, "_SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX);
637 initConstant(env, c, "_SC_BC_STRING_MAX", _SC_BC_STRING_MAX);
638 initConstant(env, c, "_SC_CHILD_MAX", _SC_CHILD_MAX);
639 initConstant(env, c, "_SC_CLK_TCK", _SC_CLK_TCK);
640 initConstant(env, c, "_SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX);
641 initConstant(env, c, "_SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX);
642 initConstant(env, c, "_SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX);
643 initConstant(env, c, "_SC_FSYNC", _SC_FSYNC);
644 initConstant(env, c, "_SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX);
645 initConstant(env, c, "_SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX);
646 initConstant(env, c, "_SC_IOV_MAX", _SC_IOV_MAX);
647 initConstant(env, c, "_SC_JOB_CONTROL", _SC_JOB_CONTROL);
648 initConstant(env, c, "_SC_LINE_MAX", _SC_LINE_MAX);
649 initConstant(env, c, "_SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX);
650 initConstant(env, c, "_SC_MAPPED_FILES", _SC_MAPPED_FILES);
651 initConstant(env, c, "_SC_MEMLOCK", _SC_MEMLOCK);
652 initConstant(env, c, "_SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE);
653 initConstant(env, c, "_SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION);
654 initConstant(env, c, "_SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING);
655 initConstant(env, c, "_SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX);
656 initConstant(env, c, "_SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX);
657 initConstant(env, c, "_SC_NGROUPS_MAX", _SC_NGROUPS_MAX);
658 initConstant(env, c, "_SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF);
659 initConstant(env, c, "_SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN);
660 initConstant(env, c, "_SC_OPEN_MAX", _SC_OPEN_MAX);
661 initConstant(env, c, "_SC_PAGESIZE", _SC_PAGESIZE);
662 initConstant(env, c, "_SC_PAGE_SIZE", _SC_PAGE_SIZE);
663 initConstant(env, c, "_SC_PASS_MAX", _SC_PASS_MAX);
664 #if defined(_SC_PHYS_PAGES)
665 initConstant(env, c, "_SC_PHYS_PAGES", _SC_PHYS_PAGES);
666 #endif
667 initConstant(env, c, "_SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO);
668 initConstant(env, c, "_SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING);
669 initConstant(env, c, "_SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS);
670 initConstant(env, c, "_SC_RE_DUP_MAX", _SC_RE_DUP_MAX);
671 initConstant(env, c, "_SC_RTSIG_MAX", _SC_RTSIG_MAX);
672 initConstant(env, c, "_SC_SAVED_IDS", _SC_SAVED_IDS);
673 initConstant(env, c, "_SC_SEMAPHORES", _SC_SEMAPHORES);
674 initConstant(env, c, "_SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX);
675 initConstant(env, c, "_SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX);
676 initConstant(env, c, "_SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS);
677 initConstant(env, c, "_SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX);
678 initConstant(env, c, "_SC_STREAM_MAX", _SC_STREAM_MAX);
679 initConstant(env, c, "_SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO);
680 initConstant(env, c, "_SC_THREADS", _SC_THREADS);
681 initConstant(env, c, "_SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR);
682 initConstant(env, c, "_SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE);
683 initConstant(env, c, "_SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS);
684 initConstant(env, c, "_SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX);
685 initConstant(env, c, "_SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING);
686 initConstant(env, c, "_SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT);
687 initConstant(env, c, "_SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT);
688 initConstant(env, c, "_SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS);
689 initConstant(env, c, "_SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN);
690 initConstant(env, c, "_SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX);
691 initConstant(env, c, "_SC_TIMERS", _SC_TIMERS);
692 initConstant(env, c, "_SC_TIMER_MAX", _SC_TIMER_MAX);
693 initConstant(env, c, "_SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX);
694 initConstant(env, c, "_SC_TZNAME_MAX", _SC_TZNAME_MAX);
695 initConstant(env, c, "_SC_VERSION", _SC_VERSION);
696 initConstant(env, c, "_SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32);
697 initConstant(env, c, "_SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG);
698 initConstant(env, c, "_SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64);
699 initConstant(env, c, "_SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG);
700 initConstant(env, c, "_SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT);
701 initConstant(env, c, "_SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N);
702 initConstant(env, c, "_SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY);
703 initConstant(env, c, "_SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME);
704 initConstant(env, c, "_SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS);
705 initConstant(env, c, "_SC_XOPEN_SHM", _SC_XOPEN_SHM);
706 initConstant(env, c, "_SC_XOPEN_UNIX", _SC_XOPEN_UNIX);
707 initConstant(env, c, "_SC_XOPEN_VERSION", _SC_XOPEN_VERSION);
708 initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
709 }
710
711 static JNINativeMethod gMethods[] = {
712 NATIVE_METHOD(OsConstants, initConstants, "()V"),
713 };
register_android_system_OsConstants(JNIEnv * env)714 void register_android_system_OsConstants(JNIEnv* env) {
715 jniRegisterNativeMethods(env, "android/system/OsConstants", gMethods, NELEM(gMethods));
716 }
717