blob: 1be201b705ed1c20492a09a4e1727763ac014775 [file] [log] [blame]
Elliott Hughescdf7a1f2011-03-15 16:13:35 -07001/*
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 "JNIHelp.h"
20#include "JniConstants.h"
Michael Wrightd87d8832013-09-25 17:49:44 -070021#include "Portability.h"
Elliott Hughescdf7a1f2011-03-15 16:13:35 -070022
Elliott Hughes2822a842011-03-16 15:10:43 -070023#include <errno.h>
Elliott Hughescdf7a1f2011-03-15 16:13:35 -070024#include <fcntl.h>
Elliott Hughes4f11ebe2011-04-19 15:38:10 -070025#include <netdb.h>
Lorenzo Colitti638c4552013-11-15 20:29:06 +090026#include <linux/if_addr.h>
Lorenzo Colittid6fcc6c2013-11-28 15:18:47 +090027#include <linux/rtnetlink.h>
Elliott Hughes2822a842011-03-16 15:10:43 -070028#include <netinet/in.h>
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -070029#include <netinet/tcp.h>
Elliott Hughes70c82042011-05-11 16:12:36 -070030#include <poll.h>
Elliott Hughesa5fb7062011-04-28 15:36:47 -070031#include <signal.h>
Elliott Hughes2822a842011-03-16 15:10:43 -070032#include <stdlib.h>
Alex Klyubin9e0ca152013-04-18 15:20:42 -070033#include <sys/capability.h>
Elliott Hughes461d0d82011-03-28 15:12:20 -070034#include <sys/ioctl.h>
Elliott Hughes2822a842011-03-16 15:10:43 -070035#include <sys/mman.h>
36#include <sys/socket.h>
37#include <sys/stat.h>
38#include <sys/wait.h>
Elliott Hughescdf7a1f2011-03-15 16:13:35 -070039#include <unistd.h>
40
Elliott Hughes6c1e5f42013-01-25 15:10:58 -080041#include <net/if.h> // After <sys/socket.h> to work around a Mac header file bug.
42
Elliott Hughesbdb717a2011-03-17 16:08:50 -070043static void initConstant(JNIEnv* env, jclass c, const char* fieldName, int value) {
44 jfieldID field = env->GetStaticFieldID(c, fieldName, "I");
45 env->SetStaticIntField(c, field, value);
46}
47
48static void OsConstants_initConstants(JNIEnv* env, jclass c) {
49 initConstant(env, c, "AF_INET", AF_INET);
50 initConstant(env, c, "AF_INET6", AF_INET6);
51 initConstant(env, c, "AF_UNIX", AF_UNIX);
52 initConstant(env, c, "AF_UNSPEC", AF_UNSPEC);
Elliott Hughes1c039d72011-05-04 16:04:04 -070053 initConstant(env, c, "AI_ADDRCONFIG", AI_ADDRCONFIG);
54 initConstant(env, c, "AI_ALL", AI_ALL);
55 initConstant(env, c, "AI_CANONNAME", AI_CANONNAME);
56 initConstant(env, c, "AI_NUMERICHOST", AI_NUMERICHOST);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -080057#if defined(AI_NUMERICSERV)
Elliott Hughes1c039d72011-05-04 16:04:04 -070058 initConstant(env, c, "AI_NUMERICSERV", AI_NUMERICSERV);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -080059#endif
Elliott Hughes1c039d72011-05-04 16:04:04 -070060 initConstant(env, c, "AI_PASSIVE", AI_PASSIVE);
61 initConstant(env, c, "AI_V4MAPPED", AI_V4MAPPED);
Alex Klyubin9e0ca152013-04-18 15:20:42 -070062 initConstant(env, c, "CAP_AUDIT_CONTROL", CAP_AUDIT_CONTROL);
63 initConstant(env, c, "CAP_AUDIT_WRITE", CAP_AUDIT_WRITE);
Michael Wrightd87d8832013-09-25 17:49:44 -070064 initConstant(env, c, "CAP_BLOCK_SUSPEND", CAP_BLOCK_SUSPEND);
Alex Klyubin9e0ca152013-04-18 15:20:42 -070065 initConstant(env, c, "CAP_CHOWN", CAP_CHOWN);
66 initConstant(env, c, "CAP_DAC_OVERRIDE", CAP_DAC_OVERRIDE);
67 initConstant(env, c, "CAP_DAC_READ_SEARCH", CAP_DAC_READ_SEARCH);
68 initConstant(env, c, "CAP_FOWNER", CAP_FOWNER);
69 initConstant(env, c, "CAP_FSETID", CAP_FSETID);
70 initConstant(env, c, "CAP_IPC_LOCK", CAP_IPC_LOCK);
71 initConstant(env, c, "CAP_IPC_OWNER", CAP_IPC_OWNER);
72 initConstant(env, c, "CAP_KILL", CAP_KILL);
73 initConstant(env, c, "CAP_LAST_CAP", CAP_LAST_CAP);
74 initConstant(env, c, "CAP_LEASE", CAP_LEASE);
75 initConstant(env, c, "CAP_LINUX_IMMUTABLE", CAP_LINUX_IMMUTABLE);
76 initConstant(env, c, "CAP_MAC_ADMIN", CAP_MAC_ADMIN);
77 initConstant(env, c, "CAP_MAC_OVERRIDE", CAP_MAC_OVERRIDE);
78 initConstant(env, c, "CAP_MKNOD", CAP_MKNOD);
79 initConstant(env, c, "CAP_NET_ADMIN", CAP_NET_ADMIN);
80 initConstant(env, c, "CAP_NET_BIND_SERVICE", CAP_NET_BIND_SERVICE);
81 initConstant(env, c, "CAP_NET_BROADCAST", CAP_NET_BROADCAST);
82 initConstant(env, c, "CAP_NET_RAW", CAP_NET_RAW);
83 initConstant(env, c, "CAP_SETFCAP", CAP_SETFCAP);
84 initConstant(env, c, "CAP_SETGID", CAP_SETGID);
85 initConstant(env, c, "CAP_SETPCAP", CAP_SETPCAP);
86 initConstant(env, c, "CAP_SETUID", CAP_SETUID);
87 initConstant(env, c, "CAP_SYS_ADMIN", CAP_SYS_ADMIN);
88 initConstant(env, c, "CAP_SYS_BOOT", CAP_SYS_BOOT);
89 initConstant(env, c, "CAP_SYS_CHROOT", CAP_SYS_CHROOT);
90 initConstant(env, c, "CAP_SYSLOG", CAP_SYSLOG);
91 initConstant(env, c, "CAP_SYS_MODULE", CAP_SYS_MODULE);
92 initConstant(env, c, "CAP_SYS_NICE", CAP_SYS_NICE);
93 initConstant(env, c, "CAP_SYS_PACCT", CAP_SYS_PACCT);
94 initConstant(env, c, "CAP_SYS_PTRACE", CAP_SYS_PTRACE);
95 initConstant(env, c, "CAP_SYS_RAWIO", CAP_SYS_RAWIO);
96 initConstant(env, c, "CAP_SYS_RESOURCE", CAP_SYS_RESOURCE);
97 initConstant(env, c, "CAP_SYS_TIME", CAP_SYS_TIME);
98 initConstant(env, c, "CAP_SYS_TTY_CONFIG", CAP_SYS_TTY_CONFIG);
99 initConstant(env, c, "CAP_WAKE_ALARM", CAP_WAKE_ALARM);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700100 initConstant(env, c, "E2BIG", E2BIG);
101 initConstant(env, c, "EACCES", EACCES);
102 initConstant(env, c, "EADDRINUSE", EADDRINUSE);
103 initConstant(env, c, "EADDRNOTAVAIL", EADDRNOTAVAIL);
104 initConstant(env, c, "EAFNOSUPPORT", EAFNOSUPPORT);
105 initConstant(env, c, "EAGAIN", EAGAIN);
Elliott Hughes4f11ebe2011-04-19 15:38:10 -0700106 initConstant(env, c, "EAI_AGAIN", EAI_AGAIN);
107 initConstant(env, c, "EAI_BADFLAGS", EAI_BADFLAGS);
108 initConstant(env, c, "EAI_FAIL", EAI_FAIL);
109 initConstant(env, c, "EAI_FAMILY", EAI_FAMILY);
110 initConstant(env, c, "EAI_MEMORY", EAI_MEMORY);
111 initConstant(env, c, "EAI_NODATA", EAI_NODATA);
112 initConstant(env, c, "EAI_NONAME", EAI_NONAME);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800113#if defined(EAI_OVERFLOW)
Elliott Hughes4f11ebe2011-04-19 15:38:10 -0700114 initConstant(env, c, "EAI_OVERFLOW", EAI_OVERFLOW);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800115#endif
Elliott Hughes4f11ebe2011-04-19 15:38:10 -0700116 initConstant(env, c, "EAI_SERVICE", EAI_SERVICE);
117 initConstant(env, c, "EAI_SOCKTYPE", EAI_SOCKTYPE);
118 initConstant(env, c, "EAI_SYSTEM", EAI_SYSTEM);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700119 initConstant(env, c, "EALREADY", EALREADY);
120 initConstant(env, c, "EBADF", EBADF);
121 initConstant(env, c, "EBADMSG", EBADMSG);
122 initConstant(env, c, "EBUSY", EBUSY);
123 initConstant(env, c, "ECANCELED", ECANCELED);
124 initConstant(env, c, "ECHILD", ECHILD);
125 initConstant(env, c, "ECONNABORTED", ECONNABORTED);
126 initConstant(env, c, "ECONNREFUSED", ECONNREFUSED);
127 initConstant(env, c, "ECONNRESET", ECONNRESET);
128 initConstant(env, c, "EDEADLK", EDEADLK);
129 initConstant(env, c, "EDESTADDRREQ", EDESTADDRREQ);
130 initConstant(env, c, "EDOM", EDOM);
131 initConstant(env, c, "EDQUOT", EDQUOT);
132 initConstant(env, c, "EEXIST", EEXIST);
133 initConstant(env, c, "EFAULT", EFAULT);
134 initConstant(env, c, "EFBIG", EFBIG);
135 initConstant(env, c, "EHOSTUNREACH", EHOSTUNREACH);
136 initConstant(env, c, "EIDRM", EIDRM);
137 initConstant(env, c, "EILSEQ", EILSEQ);
138 initConstant(env, c, "EINPROGRESS", EINPROGRESS);
139 initConstant(env, c, "EINTR", EINTR);
140 initConstant(env, c, "EINVAL", EINVAL);
141 initConstant(env, c, "EIO", EIO);
142 initConstant(env, c, "EISCONN", EISCONN);
143 initConstant(env, c, "EISDIR", EISDIR);
144 initConstant(env, c, "ELOOP", ELOOP);
145 initConstant(env, c, "EMFILE", EMFILE);
146 initConstant(env, c, "EMLINK", EMLINK);
147 initConstant(env, c, "EMSGSIZE", EMSGSIZE);
148 initConstant(env, c, "EMULTIHOP", EMULTIHOP);
149 initConstant(env, c, "ENAMETOOLONG", ENAMETOOLONG);
150 initConstant(env, c, "ENETDOWN", ENETDOWN);
151 initConstant(env, c, "ENETRESET", ENETRESET);
152 initConstant(env, c, "ENETUNREACH", ENETUNREACH);
153 initConstant(env, c, "ENFILE", ENFILE);
154 initConstant(env, c, "ENOBUFS", ENOBUFS);
155 initConstant(env, c, "ENODATA", ENODATA);
156 initConstant(env, c, "ENODEV", ENODEV);
157 initConstant(env, c, "ENOENT", ENOENT);
158 initConstant(env, c, "ENOEXEC", ENOEXEC);
159 initConstant(env, c, "ENOLCK", ENOLCK);
160 initConstant(env, c, "ENOLINK", ENOLINK);
161 initConstant(env, c, "ENOMEM", ENOMEM);
162 initConstant(env, c, "ENOMSG", ENOMSG);
163 initConstant(env, c, "ENOPROTOOPT", ENOPROTOOPT);
164 initConstant(env, c, "ENOSPC", ENOSPC);
165 initConstant(env, c, "ENOSR", ENOSR);
166 initConstant(env, c, "ENOSTR", ENOSTR);
167 initConstant(env, c, "ENOSYS", ENOSYS);
168 initConstant(env, c, "ENOTCONN", ENOTCONN);
169 initConstant(env, c, "ENOTDIR", ENOTDIR);
170 initConstant(env, c, "ENOTEMPTY", ENOTEMPTY);
171 initConstant(env, c, "ENOTSOCK", ENOTSOCK);
172 initConstant(env, c, "ENOTSUP", ENOTSUP);
173 initConstant(env, c, "ENOTTY", ENOTTY);
174 initConstant(env, c, "ENXIO", ENXIO);
175 initConstant(env, c, "EOPNOTSUPP", EOPNOTSUPP);
176 initConstant(env, c, "EOVERFLOW", EOVERFLOW);
177 initConstant(env, c, "EPERM", EPERM);
178 initConstant(env, c, "EPIPE", EPIPE);
179 initConstant(env, c, "EPROTO", EPROTO);
180 initConstant(env, c, "EPROTONOSUPPORT", EPROTONOSUPPORT);
181 initConstant(env, c, "EPROTOTYPE", EPROTOTYPE);
182 initConstant(env, c, "ERANGE", ERANGE);
183 initConstant(env, c, "EROFS", EROFS);
184 initConstant(env, c, "ESPIPE", ESPIPE);
185 initConstant(env, c, "ESRCH", ESRCH);
186 initConstant(env, c, "ESTALE", ESTALE);
187 initConstant(env, c, "ETIME", ETIME);
188 initConstant(env, c, "ETIMEDOUT", ETIMEDOUT);
189 initConstant(env, c, "ETXTBSY", ETXTBSY);
Elliott Hughesf4a42592013-03-21 16:27:26 -0700190#if EWOULDBLOCK != EAGAIN
191#error EWOULDBLOCK != EAGAIN
192#endif
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700193 initConstant(env, c, "EXDEV", EXDEV);
194 initConstant(env, c, "EXIT_FAILURE", EXIT_FAILURE);
195 initConstant(env, c, "EXIT_SUCCESS", EXIT_SUCCESS);
196 initConstant(env, c, "FD_CLOEXEC", FD_CLOEXEC);
Elliott Hughes461d0d82011-03-28 15:12:20 -0700197 initConstant(env, c, "FIONREAD", FIONREAD);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700198 initConstant(env, c, "F_DUPFD", F_DUPFD);
199 initConstant(env, c, "F_GETFD", F_GETFD);
200 initConstant(env, c, "F_GETFL", F_GETFL);
201 initConstant(env, c, "F_GETLK", F_GETLK);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800202#if defined(F_GETLK64)
Elliott Hughesfc549a02011-03-24 16:38:05 -0700203 initConstant(env, c, "F_GETLK64", F_GETLK64);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800204#endif
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700205 initConstant(env, c, "F_GETOWN", F_GETOWN);
206 initConstant(env, c, "F_OK", F_OK);
207 initConstant(env, c, "F_RDLCK", F_RDLCK);
208 initConstant(env, c, "F_SETFD", F_SETFD);
209 initConstant(env, c, "F_SETFL", F_SETFL);
210 initConstant(env, c, "F_SETLK", F_SETLK);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800211#if defined(F_SETLK64)
Elliott Hughesfc549a02011-03-24 16:38:05 -0700212 initConstant(env, c, "F_SETLK64", F_SETLK64);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800213#endif
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700214 initConstant(env, c, "F_SETLKW", F_SETLKW);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800215#if defined(F_SETLKW64)
Elliott Hughesfc549a02011-03-24 16:38:05 -0700216 initConstant(env, c, "F_SETLKW64", F_SETLKW64);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800217#endif
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700218 initConstant(env, c, "F_SETOWN", F_SETOWN);
219 initConstant(env, c, "F_UNLCK", F_UNLCK);
220 initConstant(env, c, "F_WRLCK", F_WRLCK);
Lorenzo Colitti638c4552013-11-15 20:29:06 +0900221#if defined(IFA_F_DADFAILED)
222 initConstant(env, c, "IFA_F_DADFAILED", IFA_F_DADFAILED);
223#endif
224 initConstant(env, c, "IFA_F_DEPRECATED", IFA_F_DEPRECATED);
225 initConstant(env, c, "IFA_F_HOMEADDRESS", IFA_F_HOMEADDRESS);
226 initConstant(env, c, "IFA_F_NODAD", IFA_F_NODAD);
227 initConstant(env, c, "IFA_F_OPTIMISTIC", IFA_F_OPTIMISTIC);
228 initConstant(env, c, "IFA_F_PERMANENT", IFA_F_PERMANENT);
229 initConstant(env, c, "IFA_F_SECONDARY", IFA_F_SECONDARY);
230 initConstant(env, c, "IFA_F_TEMPORARY", IFA_F_TEMPORARY);
231 initConstant(env, c, "IFA_F_TENTATIVE", IFA_F_TENTATIVE);
Elliott Hughesa37e9712011-04-21 14:07:01 -0700232 initConstant(env, c, "IFF_ALLMULTI", IFF_ALLMULTI);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800233#if defined(IFF_AUTOMEDIA)
Elliott Hughesa37e9712011-04-21 14:07:01 -0700234 initConstant(env, c, "IFF_AUTOMEDIA", IFF_AUTOMEDIA);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800235#endif
Elliott Hughesa37e9712011-04-21 14:07:01 -0700236 initConstant(env, c, "IFF_BROADCAST", IFF_BROADCAST);
237 initConstant(env, c, "IFF_DEBUG", IFF_DEBUG);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800238#if defined(IFF_DYNAMIC)
Elliott Hughesa37e9712011-04-21 14:07:01 -0700239 initConstant(env, c, "IFF_DYNAMIC", IFF_DYNAMIC);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800240#endif
Elliott Hughesa37e9712011-04-21 14:07:01 -0700241 initConstant(env, c, "IFF_LOOPBACK", IFF_LOOPBACK);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800242#if defined(IFF_MASTER)
Elliott Hughesa37e9712011-04-21 14:07:01 -0700243 initConstant(env, c, "IFF_MASTER", IFF_MASTER);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800244#endif
Elliott Hughesa37e9712011-04-21 14:07:01 -0700245 initConstant(env, c, "IFF_MULTICAST", IFF_MULTICAST);
246 initConstant(env, c, "IFF_NOARP", IFF_NOARP);
247 initConstant(env, c, "IFF_NOTRAILERS", IFF_NOTRAILERS);
248 initConstant(env, c, "IFF_POINTOPOINT", IFF_POINTOPOINT);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800249#if defined(IFF_PORTSEL)
Elliott Hughesa37e9712011-04-21 14:07:01 -0700250 initConstant(env, c, "IFF_PORTSEL", IFF_PORTSEL);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800251#endif
Elliott Hughesa37e9712011-04-21 14:07:01 -0700252 initConstant(env, c, "IFF_PROMISC", IFF_PROMISC);
253 initConstant(env, c, "IFF_RUNNING", IFF_RUNNING);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800254#if defined(IFF_SLAVE)
Elliott Hughesa37e9712011-04-21 14:07:01 -0700255 initConstant(env, c, "IFF_SLAVE", IFF_SLAVE);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800256#endif
Elliott Hughesa37e9712011-04-21 14:07:01 -0700257 initConstant(env, c, "IFF_UP", IFF_UP);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700258 initConstant(env, c, "IPPROTO_ICMP", IPPROTO_ICMP);
Lorenzo Colittidca34b52013-07-03 18:51:34 +0900259 initConstant(env, c, "IPPROTO_ICMPV6", IPPROTO_ICMPV6);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700260 initConstant(env, c, "IPPROTO_IP", IPPROTO_IP);
261 initConstant(env, c, "IPPROTO_IPV6", IPPROTO_IPV6);
262 initConstant(env, c, "IPPROTO_RAW", IPPROTO_RAW);
263 initConstant(env, c, "IPPROTO_TCP", IPPROTO_TCP);
264 initConstant(env, c, "IPPROTO_UDP", IPPROTO_UDP);
Elliott Hughes454a95f2011-03-29 18:00:14 -0700265 initConstant(env, c, "IPV6_CHECKSUM", IPV6_CHECKSUM);
266 initConstant(env, c, "IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS);
267 initConstant(env, c, "IPV6_MULTICAST_IF", IPV6_MULTICAST_IF);
268 initConstant(env, c, "IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800269#if defined(IPV6_RECVDSTOPTS)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700270 initConstant(env, c, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800271#endif
272#if defined(IPV6_RECVHOPLIMIT)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700273 initConstant(env, c, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800274#endif
275#if defined(IPV6_RECVHOPOPTS)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700276 initConstant(env, c, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800277#endif
278#if defined(IPV6_RECVPKTINFO)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700279 initConstant(env, c, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800280#endif
281#if defined(IPV6_RECVRTHDR)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700282 initConstant(env, c, "IPV6_RECVRTHDR", IPV6_RECVRTHDR);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800283#endif
284#if defined(IPV6_RECVTCLASS)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700285 initConstant(env, c, "IPV6_RECVTCLASS", IPV6_RECVTCLASS);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800286#endif
287#if defined(IPV6_TCLASS)
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -0700288 initConstant(env, c, "IPV6_TCLASS", IPV6_TCLASS);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800289#endif
Elliott Hughes454a95f2011-03-29 18:00:14 -0700290 initConstant(env, c, "IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS);
291 initConstant(env, c, "IPV6_V6ONLY", IPV6_V6ONLY);
292 initConstant(env, c, "IP_MULTICAST_IF", IP_MULTICAST_IF);
293 initConstant(env, c, "IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
294 initConstant(env, c, "IP_MULTICAST_TTL", IP_MULTICAST_TTL);
295 initConstant(env, c, "IP_TOS", IP_TOS);
296 initConstant(env, c, "IP_TTL", IP_TTL);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700297 initConstant(env, c, "MAP_FIXED", MAP_FIXED);
298 initConstant(env, c, "MAP_PRIVATE", MAP_PRIVATE);
299 initConstant(env, c, "MAP_SHARED", MAP_SHARED);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800300#if defined(MCAST_JOIN_GROUP)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700301 initConstant(env, c, "MCAST_JOIN_GROUP", MCAST_JOIN_GROUP);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800302#endif
303#if defined(MCAST_LEAVE_GROUP)
Elliott Hughes454a95f2011-03-29 18:00:14 -0700304 initConstant(env, c, "MCAST_LEAVE_GROUP", MCAST_LEAVE_GROUP);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800305#endif
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700306 initConstant(env, c, "MCL_CURRENT", MCL_CURRENT);
307 initConstant(env, c, "MCL_FUTURE", MCL_FUTURE);
308 initConstant(env, c, "MSG_CTRUNC", MSG_CTRUNC);
309 initConstant(env, c, "MSG_DONTROUTE", MSG_DONTROUTE);
310 initConstant(env, c, "MSG_EOR", MSG_EOR);
311 initConstant(env, c, "MSG_OOB", MSG_OOB);
312 initConstant(env, c, "MSG_PEEK", MSG_PEEK);
313 initConstant(env, c, "MSG_TRUNC", MSG_TRUNC);
314 initConstant(env, c, "MSG_WAITALL", MSG_WAITALL);
315 initConstant(env, c, "MS_ASYNC", MS_ASYNC);
316 initConstant(env, c, "MS_INVALIDATE", MS_INVALIDATE);
317 initConstant(env, c, "MS_SYNC", MS_SYNC);
Elliott Hughes4f11ebe2011-04-19 15:38:10 -0700318 initConstant(env, c, "NI_DGRAM", NI_DGRAM);
319 initConstant(env, c, "NI_NAMEREQD", NI_NAMEREQD);
320 initConstant(env, c, "NI_NOFQDN", NI_NOFQDN);
321 initConstant(env, c, "NI_NUMERICHOST", NI_NUMERICHOST);
322 initConstant(env, c, "NI_NUMERICSERV", NI_NUMERICSERV);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700323 initConstant(env, c, "O_ACCMODE", O_ACCMODE);
324 initConstant(env, c, "O_APPEND", O_APPEND);
325 initConstant(env, c, "O_CREAT", O_CREAT);
326 initConstant(env, c, "O_EXCL", O_EXCL);
327 initConstant(env, c, "O_NOCTTY", O_NOCTTY);
Kenny Rootdd538c32012-09-17 17:34:26 -0700328 initConstant(env, c, "O_NOFOLLOW", O_NOFOLLOW);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700329 initConstant(env, c, "O_NONBLOCK", O_NONBLOCK);
330 initConstant(env, c, "O_RDONLY", O_RDONLY);
331 initConstant(env, c, "O_RDWR", O_RDWR);
332 initConstant(env, c, "O_SYNC", O_SYNC);
333 initConstant(env, c, "O_TRUNC", O_TRUNC);
334 initConstant(env, c, "O_WRONLY", O_WRONLY);
Elliott Hughes70c82042011-05-11 16:12:36 -0700335 initConstant(env, c, "POLLERR", POLLERR);
336 initConstant(env, c, "POLLHUP", POLLHUP);
337 initConstant(env, c, "POLLIN", POLLIN);
338 initConstant(env, c, "POLLNVAL", POLLNVAL);
339 initConstant(env, c, "POLLOUT", POLLOUT);
340 initConstant(env, c, "POLLPRI", POLLPRI);
341 initConstant(env, c, "POLLRDBAND", POLLRDBAND);
342 initConstant(env, c, "POLLRDNORM", POLLRDNORM);
343 initConstant(env, c, "POLLWRBAND", POLLWRBAND);
344 initConstant(env, c, "POLLWRNORM", POLLWRNORM);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700345 initConstant(env, c, "PROT_EXEC", PROT_EXEC);
346 initConstant(env, c, "PROT_NONE", PROT_NONE);
347 initConstant(env, c, "PROT_READ", PROT_READ);
348 initConstant(env, c, "PROT_WRITE", PROT_WRITE);
349 initConstant(env, c, "R_OK", R_OK);
Lorenzo Colittid6fcc6c2013-11-28 15:18:47 +0900350 initConstant(env, c, "RT_SCOPE_HOST", RT_SCOPE_HOST);
351 initConstant(env, c, "RT_SCOPE_LINK", RT_SCOPE_LINK);
352 initConstant(env, c, "RT_SCOPE_NOWHERE", RT_SCOPE_NOWHERE);
353 initConstant(env, c, "RT_SCOPE_SITE", RT_SCOPE_SITE);
354 initConstant(env, c, "RT_SCOPE_UNIVERSE", RT_SCOPE_UNIVERSE);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700355 initConstant(env, c, "SEEK_CUR", SEEK_CUR);
356 initConstant(env, c, "SEEK_END", SEEK_END);
357 initConstant(env, c, "SEEK_SET", SEEK_SET);
358 initConstant(env, c, "SHUT_RD", SHUT_RD);
359 initConstant(env, c, "SHUT_RDWR", SHUT_RDWR);
360 initConstant(env, c, "SHUT_WR", SHUT_WR);
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700361 initConstant(env, c, "SIGABRT", SIGABRT);
362 initConstant(env, c, "SIGALRM", SIGALRM);
363 initConstant(env, c, "SIGBUS", SIGBUS);
364 initConstant(env, c, "SIGCHLD", SIGCHLD);
365 initConstant(env, c, "SIGCONT", SIGCONT);
366 initConstant(env, c, "SIGFPE", SIGFPE);
367 initConstant(env, c, "SIGHUP", SIGHUP);
368 initConstant(env, c, "SIGILL", SIGILL);
369 initConstant(env, c, "SIGINT", SIGINT);
370 initConstant(env, c, "SIGIO", SIGIO);
371 initConstant(env, c, "SIGKILL", SIGKILL);
372 initConstant(env, c, "SIGPIPE", SIGPIPE);
373 initConstant(env, c, "SIGPROF", SIGPROF);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800374#if defined(SIGPWR)
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700375 initConstant(env, c, "SIGPWR", SIGPWR);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800376#endif
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700377 initConstant(env, c, "SIGQUIT", SIGQUIT);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800378#if defined(SIGRTMAX)
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700379 initConstant(env, c, "SIGRTMAX", SIGRTMAX);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800380#endif
381#if defined(SIGRTMIN)
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700382 initConstant(env, c, "SIGRTMIN", SIGRTMIN);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800383#endif
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700384 initConstant(env, c, "SIGSEGV", SIGSEGV);
Chris Dearmanb7e07722012-05-01 16:11:58 -0700385#if defined(SIGSTKFLT)
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700386 initConstant(env, c, "SIGSTKFLT", SIGSTKFLT);
Chris Dearmanb7e07722012-05-01 16:11:58 -0700387#endif
Elliott Hughesa5fb7062011-04-28 15:36:47 -0700388 initConstant(env, c, "SIGSTOP", SIGSTOP);
389 initConstant(env, c, "SIGSYS", SIGSYS);
390 initConstant(env, c, "SIGTERM", SIGTERM);
391 initConstant(env, c, "SIGTRAP", SIGTRAP);
392 initConstant(env, c, "SIGTSTP", SIGTSTP);
393 initConstant(env, c, "SIGTTIN", SIGTTIN);
394 initConstant(env, c, "SIGTTOU", SIGTTOU);
395 initConstant(env, c, "SIGURG", SIGURG);
396 initConstant(env, c, "SIGUSR1", SIGUSR1);
397 initConstant(env, c, "SIGUSR2", SIGUSR2);
398 initConstant(env, c, "SIGVTALRM", SIGVTALRM);
399 initConstant(env, c, "SIGWINCH", SIGWINCH);
400 initConstant(env, c, "SIGXCPU", SIGXCPU);
401 initConstant(env, c, "SIGXFSZ", SIGXFSZ);
Elliott Hughesa37e9712011-04-21 14:07:01 -0700402 initConstant(env, c, "SIOCGIFADDR", SIOCGIFADDR);
403 initConstant(env, c, "SIOCGIFBRDADDR", SIOCGIFBRDADDR);
404 initConstant(env, c, "SIOCGIFDSTADDR", SIOCGIFDSTADDR);
405 initConstant(env, c, "SIOCGIFNETMASK", SIOCGIFNETMASK);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700406 initConstant(env, c, "SOCK_DGRAM", SOCK_DGRAM);
407 initConstant(env, c, "SOCK_RAW", SOCK_RAW);
408 initConstant(env, c, "SOCK_SEQPACKET", SOCK_SEQPACKET);
409 initConstant(env, c, "SOCK_STREAM", SOCK_STREAM);
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -0700410 initConstant(env, c, "SOL_SOCKET", SOL_SOCKET);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800411#if defined(SO_BINDTODEVICE)
Elliott Hughesb9746662011-04-06 12:01:16 -0700412 initConstant(env, c, "SO_BINDTODEVICE", SO_BINDTODEVICE);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800413#endif
Elliott Hughes454a95f2011-03-29 18:00:14 -0700414 initConstant(env, c, "SO_BROADCAST", SO_BROADCAST);
415 initConstant(env, c, "SO_DEBUG", SO_DEBUG);
416 initConstant(env, c, "SO_DONTROUTE", SO_DONTROUTE);
417 initConstant(env, c, "SO_ERROR", SO_ERROR);
418 initConstant(env, c, "SO_KEEPALIVE", SO_KEEPALIVE);
419 initConstant(env, c, "SO_LINGER", SO_LINGER);
420 initConstant(env, c, "SO_OOBINLINE", SO_OOBINLINE);
Elliott Hughes482a3fc2013-03-20 16:10:12 -0700421 initConstant(env, c, "SO_PASSCRED", SO_PASSCRED);
422 initConstant(env, c, "SO_PEERCRED", SO_PEERCRED);
Elliott Hughes454a95f2011-03-29 18:00:14 -0700423 initConstant(env, c, "SO_RCVBUF", SO_RCVBUF);
424 initConstant(env, c, "SO_RCVLOWAT", SO_RCVLOWAT);
425 initConstant(env, c, "SO_RCVTIMEO", SO_RCVTIMEO);
426 initConstant(env, c, "SO_REUSEADDR", SO_REUSEADDR);
427 initConstant(env, c, "SO_SNDBUF", SO_SNDBUF);
428 initConstant(env, c, "SO_SNDLOWAT", SO_SNDLOWAT);
429 initConstant(env, c, "SO_SNDTIMEO", SO_SNDTIMEO);
430 initConstant(env, c, "SO_TYPE", SO_TYPE);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700431 initConstant(env, c, "STDERR_FILENO", STDERR_FILENO);
432 initConstant(env, c, "STDIN_FILENO", STDIN_FILENO);
433 initConstant(env, c, "STDOUT_FILENO", STDOUT_FILENO);
434 initConstant(env, c, "S_IFBLK", S_IFBLK);
435 initConstant(env, c, "S_IFCHR", S_IFCHR);
436 initConstant(env, c, "S_IFDIR", S_IFDIR);
437 initConstant(env, c, "S_IFIFO", S_IFIFO);
438 initConstant(env, c, "S_IFLNK", S_IFLNK);
439 initConstant(env, c, "S_IFMT", S_IFMT);
440 initConstant(env, c, "S_IFREG", S_IFREG);
441 initConstant(env, c, "S_IFSOCK", S_IFSOCK);
442 initConstant(env, c, "S_IRGRP", S_IRGRP);
443 initConstant(env, c, "S_IROTH", S_IROTH);
444 initConstant(env, c, "S_IRUSR", S_IRUSR);
445 initConstant(env, c, "S_IRWXG", S_IRWXG);
446 initConstant(env, c, "S_IRWXO", S_IRWXO);
447 initConstant(env, c, "S_IRWXU", S_IRWXU);
448 initConstant(env, c, "S_ISGID", S_ISGID);
449 initConstant(env, c, "S_ISUID", S_ISUID);
450 initConstant(env, c, "S_ISVTX", S_ISVTX);
451 initConstant(env, c, "S_IWGRP", S_IWGRP);
452 initConstant(env, c, "S_IWOTH", S_IWOTH);
453 initConstant(env, c, "S_IWUSR", S_IWUSR);
454 initConstant(env, c, "S_IXGRP", S_IXGRP);
455 initConstant(env, c, "S_IXOTH", S_IXOTH);
456 initConstant(env, c, "S_IXUSR", S_IXUSR);
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -0700457 initConstant(env, c, "TCP_NODELAY", TCP_NODELAY);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700458 initConstant(env, c, "WCONTINUED", WCONTINUED);
459 initConstant(env, c, "WEXITED", WEXITED);
460 initConstant(env, c, "WNOHANG", WNOHANG);
461 initConstant(env, c, "WNOWAIT", WNOWAIT);
462 initConstant(env, c, "WSTOPPED", WSTOPPED);
463 initConstant(env, c, "WUNTRACED", WUNTRACED);
464 initConstant(env, c, "W_OK", W_OK);
465 initConstant(env, c, "X_OK", X_OK);
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700466 initConstant(env, c, "_SC_2_CHAR_TERM", _SC_2_CHAR_TERM);
467 initConstant(env, c, "_SC_2_C_BIND", _SC_2_C_BIND);
468 initConstant(env, c, "_SC_2_C_DEV", _SC_2_C_DEV);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800469#if defined(_SC_2_C_VERSION)
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700470 initConstant(env, c, "_SC_2_C_VERSION", _SC_2_C_VERSION);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800471#endif
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700472 initConstant(env, c, "_SC_2_FORT_DEV", _SC_2_FORT_DEV);
473 initConstant(env, c, "_SC_2_FORT_RUN", _SC_2_FORT_RUN);
474 initConstant(env, c, "_SC_2_LOCALEDEF", _SC_2_LOCALEDEF);
475 initConstant(env, c, "_SC_2_SW_DEV", _SC_2_SW_DEV);
476 initConstant(env, c, "_SC_2_UPE", _SC_2_UPE);
477 initConstant(env, c, "_SC_2_VERSION", _SC_2_VERSION);
478 initConstant(env, c, "_SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX);
479 initConstant(env, c, "_SC_AIO_MAX", _SC_AIO_MAX);
480 initConstant(env, c, "_SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX);
481 initConstant(env, c, "_SC_ARG_MAX", _SC_ARG_MAX);
482 initConstant(env, c, "_SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO);
483 initConstant(env, c, "_SC_ATEXIT_MAX", _SC_ATEXIT_MAX);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800484#if defined(_SC_AVPHYS_PAGES)
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700485 initConstant(env, c, "_SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800486#endif
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700487 initConstant(env, c, "_SC_BC_BASE_MAX", _SC_BC_BASE_MAX);
488 initConstant(env, c, "_SC_BC_DIM_MAX", _SC_BC_DIM_MAX);
489 initConstant(env, c, "_SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX);
490 initConstant(env, c, "_SC_BC_STRING_MAX", _SC_BC_STRING_MAX);
491 initConstant(env, c, "_SC_CHILD_MAX", _SC_CHILD_MAX);
492 initConstant(env, c, "_SC_CLK_TCK", _SC_CLK_TCK);
493 initConstant(env, c, "_SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX);
494 initConstant(env, c, "_SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX);
495 initConstant(env, c, "_SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX);
496 initConstant(env, c, "_SC_FSYNC", _SC_FSYNC);
497 initConstant(env, c, "_SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX);
498 initConstant(env, c, "_SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX);
499 initConstant(env, c, "_SC_IOV_MAX", _SC_IOV_MAX);
500 initConstant(env, c, "_SC_JOB_CONTROL", _SC_JOB_CONTROL);
501 initConstant(env, c, "_SC_LINE_MAX", _SC_LINE_MAX);
502 initConstant(env, c, "_SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX);
503 initConstant(env, c, "_SC_MAPPED_FILES", _SC_MAPPED_FILES);
504 initConstant(env, c, "_SC_MEMLOCK", _SC_MEMLOCK);
505 initConstant(env, c, "_SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE);
506 initConstant(env, c, "_SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION);
507 initConstant(env, c, "_SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING);
508 initConstant(env, c, "_SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX);
509 initConstant(env, c, "_SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX);
510 initConstant(env, c, "_SC_NGROUPS_MAX", _SC_NGROUPS_MAX);
511 initConstant(env, c, "_SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF);
512 initConstant(env, c, "_SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN);
513 initConstant(env, c, "_SC_OPEN_MAX", _SC_OPEN_MAX);
514 initConstant(env, c, "_SC_PAGESIZE", _SC_PAGESIZE);
515 initConstant(env, c, "_SC_PAGE_SIZE", _SC_PAGE_SIZE);
516 initConstant(env, c, "_SC_PASS_MAX", _SC_PASS_MAX);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800517#if defined(_SC_PHYS_PAGES)
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700518 initConstant(env, c, "_SC_PHYS_PAGES", _SC_PHYS_PAGES);
Elliott Hughes6c1e5f42013-01-25 15:10:58 -0800519#endif
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700520 initConstant(env, c, "_SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO);
521 initConstant(env, c, "_SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING);
522 initConstant(env, c, "_SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS);
523 initConstant(env, c, "_SC_RE_DUP_MAX", _SC_RE_DUP_MAX);
524 initConstant(env, c, "_SC_RTSIG_MAX", _SC_RTSIG_MAX);
525 initConstant(env, c, "_SC_SAVED_IDS", _SC_SAVED_IDS);
526 initConstant(env, c, "_SC_SEMAPHORES", _SC_SEMAPHORES);
527 initConstant(env, c, "_SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX);
528 initConstant(env, c, "_SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX);
529 initConstant(env, c, "_SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS);
530 initConstant(env, c, "_SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX);
531 initConstant(env, c, "_SC_STREAM_MAX", _SC_STREAM_MAX);
532 initConstant(env, c, "_SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO);
533 initConstant(env, c, "_SC_THREADS", _SC_THREADS);
534 initConstant(env, c, "_SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR);
535 initConstant(env, c, "_SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE);
536 initConstant(env, c, "_SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS);
537 initConstant(env, c, "_SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX);
538 initConstant(env, c, "_SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING);
539 initConstant(env, c, "_SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT);
540 initConstant(env, c, "_SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT);
541 initConstant(env, c, "_SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS);
542 initConstant(env, c, "_SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN);
543 initConstant(env, c, "_SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX);
544 initConstant(env, c, "_SC_TIMERS", _SC_TIMERS);
545 initConstant(env, c, "_SC_TIMER_MAX", _SC_TIMER_MAX);
546 initConstant(env, c, "_SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX);
547 initConstant(env, c, "_SC_TZNAME_MAX", _SC_TZNAME_MAX);
548 initConstant(env, c, "_SC_VERSION", _SC_VERSION);
549 initConstant(env, c, "_SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32);
550 initConstant(env, c, "_SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG);
551 initConstant(env, c, "_SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64);
552 initConstant(env, c, "_SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG);
553 initConstant(env, c, "_SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT);
554 initConstant(env, c, "_SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N);
555 initConstant(env, c, "_SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY);
556 initConstant(env, c, "_SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME);
557 initConstant(env, c, "_SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS);
558 initConstant(env, c, "_SC_XOPEN_SHM", _SC_XOPEN_SHM);
559 initConstant(env, c, "_SC_XOPEN_UNIX", _SC_XOPEN_UNIX);
560 initConstant(env, c, "_SC_XOPEN_VERSION", _SC_XOPEN_VERSION);
561 initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700562}
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700563
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700564static JNINativeMethod gMethods[] = {
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700565 NATIVE_METHOD(OsConstants, initConstants, "()V"),
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700566};
Elliott Hughes7cd67602012-05-03 17:21:04 -0700567void register_libcore_io_OsConstants(JNIEnv* env) {
568 jniRegisterNativeMethods(env, "libcore/io/OsConstants", gMethods, NELEM(gMethods));
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700569}