blob: 4e436cf693b4e921e1e4c4292380b779a416eeb0 [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"
Elliott Hughesbdb717a2011-03-17 16:08:50 -070021#include "ScopedLocalRef.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>
Elliott Hughes2822a842011-03-16 15:10:43 -070026#include <netinet/in.h>
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -070027#include <netinet/tcp.h>
Elliott Hughes2822a842011-03-16 15:10:43 -070028#include <stdlib.h>
Elliott Hughes461d0d82011-03-28 15:12:20 -070029#include <sys/ioctl.h>
Elliott Hughes2822a842011-03-16 15:10:43 -070030#include <sys/mman.h>
31#include <sys/socket.h>
32#include <sys/stat.h>
33#include <sys/wait.h>
Elliott Hughescdf7a1f2011-03-15 16:13:35 -070034#include <unistd.h>
35
Elliott Hughesbdb717a2011-03-17 16:08:50 -070036static void initConstant(JNIEnv* env, jclass c, const char* fieldName, int value) {
37 jfieldID field = env->GetStaticFieldID(c, fieldName, "I");
38 env->SetStaticIntField(c, field, value);
39}
40
41static void OsConstants_initConstants(JNIEnv* env, jclass c) {
42 initConstant(env, c, "AF_INET", AF_INET);
43 initConstant(env, c, "AF_INET6", AF_INET6);
44 initConstant(env, c, "AF_UNIX", AF_UNIX);
45 initConstant(env, c, "AF_UNSPEC", AF_UNSPEC);
46 initConstant(env, c, "E2BIG", E2BIG);
47 initConstant(env, c, "EACCES", EACCES);
48 initConstant(env, c, "EADDRINUSE", EADDRINUSE);
49 initConstant(env, c, "EADDRNOTAVAIL", EADDRNOTAVAIL);
50 initConstant(env, c, "EAFNOSUPPORT", EAFNOSUPPORT);
51 initConstant(env, c, "EAGAIN", EAGAIN);
Elliott Hughes4f11ebe2011-04-19 15:38:10 -070052 initConstant(env, c, "EAI_AGAIN", EAI_AGAIN);
53 initConstant(env, c, "EAI_BADFLAGS", EAI_BADFLAGS);
54 initConstant(env, c, "EAI_FAIL", EAI_FAIL);
55 initConstant(env, c, "EAI_FAMILY", EAI_FAMILY);
56 initConstant(env, c, "EAI_MEMORY", EAI_MEMORY);
57 initConstant(env, c, "EAI_NODATA", EAI_NODATA);
58 initConstant(env, c, "EAI_NONAME", EAI_NONAME);
59 initConstant(env, c, "EAI_OVERFLOW", EAI_OVERFLOW);
60 initConstant(env, c, "EAI_SERVICE", EAI_SERVICE);
61 initConstant(env, c, "EAI_SOCKTYPE", EAI_SOCKTYPE);
62 initConstant(env, c, "EAI_SYSTEM", EAI_SYSTEM);
Elliott Hughesbdb717a2011-03-17 16:08:50 -070063 initConstant(env, c, "EALREADY", EALREADY);
64 initConstant(env, c, "EBADF", EBADF);
65 initConstant(env, c, "EBADMSG", EBADMSG);
66 initConstant(env, c, "EBUSY", EBUSY);
67 initConstant(env, c, "ECANCELED", ECANCELED);
68 initConstant(env, c, "ECHILD", ECHILD);
69 initConstant(env, c, "ECONNABORTED", ECONNABORTED);
70 initConstant(env, c, "ECONNREFUSED", ECONNREFUSED);
71 initConstant(env, c, "ECONNRESET", ECONNRESET);
72 initConstant(env, c, "EDEADLK", EDEADLK);
73 initConstant(env, c, "EDESTADDRREQ", EDESTADDRREQ);
74 initConstant(env, c, "EDOM", EDOM);
75 initConstant(env, c, "EDQUOT", EDQUOT);
76 initConstant(env, c, "EEXIST", EEXIST);
77 initConstant(env, c, "EFAULT", EFAULT);
78 initConstant(env, c, "EFBIG", EFBIG);
79 initConstant(env, c, "EHOSTUNREACH", EHOSTUNREACH);
80 initConstant(env, c, "EIDRM", EIDRM);
81 initConstant(env, c, "EILSEQ", EILSEQ);
82 initConstant(env, c, "EINPROGRESS", EINPROGRESS);
83 initConstant(env, c, "EINTR", EINTR);
84 initConstant(env, c, "EINVAL", EINVAL);
85 initConstant(env, c, "EIO", EIO);
86 initConstant(env, c, "EISCONN", EISCONN);
87 initConstant(env, c, "EISDIR", EISDIR);
88 initConstant(env, c, "ELOOP", ELOOP);
89 initConstant(env, c, "EMFILE", EMFILE);
90 initConstant(env, c, "EMLINK", EMLINK);
91 initConstant(env, c, "EMSGSIZE", EMSGSIZE);
92 initConstant(env, c, "EMULTIHOP", EMULTIHOP);
93 initConstant(env, c, "ENAMETOOLONG", ENAMETOOLONG);
94 initConstant(env, c, "ENETDOWN", ENETDOWN);
95 initConstant(env, c, "ENETRESET", ENETRESET);
96 initConstant(env, c, "ENETUNREACH", ENETUNREACH);
97 initConstant(env, c, "ENFILE", ENFILE);
98 initConstant(env, c, "ENOBUFS", ENOBUFS);
99 initConstant(env, c, "ENODATA", ENODATA);
100 initConstant(env, c, "ENODEV", ENODEV);
101 initConstant(env, c, "ENOENT", ENOENT);
102 initConstant(env, c, "ENOEXEC", ENOEXEC);
103 initConstant(env, c, "ENOLCK", ENOLCK);
104 initConstant(env, c, "ENOLINK", ENOLINK);
105 initConstant(env, c, "ENOMEM", ENOMEM);
106 initConstant(env, c, "ENOMSG", ENOMSG);
107 initConstant(env, c, "ENOPROTOOPT", ENOPROTOOPT);
108 initConstant(env, c, "ENOSPC", ENOSPC);
109 initConstant(env, c, "ENOSR", ENOSR);
110 initConstant(env, c, "ENOSTR", ENOSTR);
111 initConstant(env, c, "ENOSYS", ENOSYS);
112 initConstant(env, c, "ENOTCONN", ENOTCONN);
113 initConstant(env, c, "ENOTDIR", ENOTDIR);
114 initConstant(env, c, "ENOTEMPTY", ENOTEMPTY);
115 initConstant(env, c, "ENOTSOCK", ENOTSOCK);
116 initConstant(env, c, "ENOTSUP", ENOTSUP);
117 initConstant(env, c, "ENOTTY", ENOTTY);
118 initConstant(env, c, "ENXIO", ENXIO);
119 initConstant(env, c, "EOPNOTSUPP", EOPNOTSUPP);
120 initConstant(env, c, "EOVERFLOW", EOVERFLOW);
121 initConstant(env, c, "EPERM", EPERM);
122 initConstant(env, c, "EPIPE", EPIPE);
123 initConstant(env, c, "EPROTO", EPROTO);
124 initConstant(env, c, "EPROTONOSUPPORT", EPROTONOSUPPORT);
125 initConstant(env, c, "EPROTOTYPE", EPROTOTYPE);
126 initConstant(env, c, "ERANGE", ERANGE);
127 initConstant(env, c, "EROFS", EROFS);
128 initConstant(env, c, "ESPIPE", ESPIPE);
129 initConstant(env, c, "ESRCH", ESRCH);
130 initConstant(env, c, "ESTALE", ESTALE);
131 initConstant(env, c, "ETIME", ETIME);
132 initConstant(env, c, "ETIMEDOUT", ETIMEDOUT);
133 initConstant(env, c, "ETXTBSY", ETXTBSY);
134 initConstant(env, c, "EWOULDBLOCK", EWOULDBLOCK);
135 initConstant(env, c, "EXDEV", EXDEV);
136 initConstant(env, c, "EXIT_FAILURE", EXIT_FAILURE);
137 initConstant(env, c, "EXIT_SUCCESS", EXIT_SUCCESS);
138 initConstant(env, c, "FD_CLOEXEC", FD_CLOEXEC);
Elliott Hughes461d0d82011-03-28 15:12:20 -0700139 initConstant(env, c, "FIONREAD", FIONREAD);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700140 initConstant(env, c, "F_DUPFD", F_DUPFD);
141 initConstant(env, c, "F_GETFD", F_GETFD);
142 initConstant(env, c, "F_GETFL", F_GETFL);
143 initConstant(env, c, "F_GETLK", F_GETLK);
Elliott Hughesfc549a02011-03-24 16:38:05 -0700144 initConstant(env, c, "F_GETLK64", F_GETLK64);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700145 initConstant(env, c, "F_GETOWN", F_GETOWN);
146 initConstant(env, c, "F_OK", F_OK);
147 initConstant(env, c, "F_RDLCK", F_RDLCK);
148 initConstant(env, c, "F_SETFD", F_SETFD);
149 initConstant(env, c, "F_SETFL", F_SETFL);
150 initConstant(env, c, "F_SETLK", F_SETLK);
Elliott Hughesfc549a02011-03-24 16:38:05 -0700151 initConstant(env, c, "F_SETLK64", F_SETLK64);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700152 initConstant(env, c, "F_SETLKW", F_SETLKW);
Elliott Hughesfc549a02011-03-24 16:38:05 -0700153 initConstant(env, c, "F_SETLKW64", F_SETLKW64);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700154 initConstant(env, c, "F_SETOWN", F_SETOWN);
155 initConstant(env, c, "F_UNLCK", F_UNLCK);
156 initConstant(env, c, "F_WRLCK", F_WRLCK);
157 initConstant(env, c, "IPPROTO_ICMP", IPPROTO_ICMP);
158 initConstant(env, c, "IPPROTO_IP", IPPROTO_IP);
159 initConstant(env, c, "IPPROTO_IPV6", IPPROTO_IPV6);
160 initConstant(env, c, "IPPROTO_RAW", IPPROTO_RAW);
161 initConstant(env, c, "IPPROTO_TCP", IPPROTO_TCP);
162 initConstant(env, c, "IPPROTO_UDP", IPPROTO_UDP);
Elliott Hughes454a95f2011-03-29 18:00:14 -0700163 initConstant(env, c, "IPV6_CHECKSUM", IPV6_CHECKSUM);
164 initConstant(env, c, "IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS);
165 initConstant(env, c, "IPV6_MULTICAST_IF", IPV6_MULTICAST_IF);
166 initConstant(env, c, "IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP);
167 initConstant(env, c, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS);
168 initConstant(env, c, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT);
169 initConstant(env, c, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS);
170 initConstant(env, c, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO);
171 initConstant(env, c, "IPV6_RECVRTHDR", IPV6_RECVRTHDR);
172 initConstant(env, c, "IPV6_RECVTCLASS", IPV6_RECVTCLASS);
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -0700173 initConstant(env, c, "IPV6_TCLASS", IPV6_TCLASS);
Elliott Hughes454a95f2011-03-29 18:00:14 -0700174 initConstant(env, c, "IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS);
175 initConstant(env, c, "IPV6_V6ONLY", IPV6_V6ONLY);
176 initConstant(env, c, "IP_MULTICAST_IF", IP_MULTICAST_IF);
177 initConstant(env, c, "IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
178 initConstant(env, c, "IP_MULTICAST_TTL", IP_MULTICAST_TTL);
179 initConstant(env, c, "IP_TOS", IP_TOS);
180 initConstant(env, c, "IP_TTL", IP_TTL);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700181 initConstant(env, c, "MAP_FIXED", MAP_FIXED);
182 initConstant(env, c, "MAP_PRIVATE", MAP_PRIVATE);
183 initConstant(env, c, "MAP_SHARED", MAP_SHARED);
Elliott Hughes454a95f2011-03-29 18:00:14 -0700184 initConstant(env, c, "MCAST_JOIN_GROUP", MCAST_JOIN_GROUP);
185 initConstant(env, c, "MCAST_LEAVE_GROUP", MCAST_LEAVE_GROUP);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700186 initConstant(env, c, "MCL_CURRENT", MCL_CURRENT);
187 initConstant(env, c, "MCL_FUTURE", MCL_FUTURE);
188 initConstant(env, c, "MSG_CTRUNC", MSG_CTRUNC);
189 initConstant(env, c, "MSG_DONTROUTE", MSG_DONTROUTE);
190 initConstant(env, c, "MSG_EOR", MSG_EOR);
191 initConstant(env, c, "MSG_OOB", MSG_OOB);
192 initConstant(env, c, "MSG_PEEK", MSG_PEEK);
193 initConstant(env, c, "MSG_TRUNC", MSG_TRUNC);
194 initConstant(env, c, "MSG_WAITALL", MSG_WAITALL);
195 initConstant(env, c, "MS_ASYNC", MS_ASYNC);
196 initConstant(env, c, "MS_INVALIDATE", MS_INVALIDATE);
197 initConstant(env, c, "MS_SYNC", MS_SYNC);
Elliott Hughes4f11ebe2011-04-19 15:38:10 -0700198 initConstant(env, c, "NI_DGRAM", NI_DGRAM);
199 initConstant(env, c, "NI_NAMEREQD", NI_NAMEREQD);
200 initConstant(env, c, "NI_NOFQDN", NI_NOFQDN);
201 initConstant(env, c, "NI_NUMERICHOST", NI_NUMERICHOST);
202 initConstant(env, c, "NI_NUMERICSERV", NI_NUMERICSERV);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700203 initConstant(env, c, "O_ACCMODE", O_ACCMODE);
204 initConstant(env, c, "O_APPEND", O_APPEND);
205 initConstant(env, c, "O_CREAT", O_CREAT);
206 initConstant(env, c, "O_EXCL", O_EXCL);
207 initConstant(env, c, "O_NOCTTY", O_NOCTTY);
208 initConstant(env, c, "O_NONBLOCK", O_NONBLOCK);
209 initConstant(env, c, "O_RDONLY", O_RDONLY);
210 initConstant(env, c, "O_RDWR", O_RDWR);
211 initConstant(env, c, "O_SYNC", O_SYNC);
212 initConstant(env, c, "O_TRUNC", O_TRUNC);
213 initConstant(env, c, "O_WRONLY", O_WRONLY);
214 initConstant(env, c, "PROT_EXEC", PROT_EXEC);
215 initConstant(env, c, "PROT_NONE", PROT_NONE);
216 initConstant(env, c, "PROT_READ", PROT_READ);
217 initConstant(env, c, "PROT_WRITE", PROT_WRITE);
218 initConstant(env, c, "R_OK", R_OK);
219 initConstant(env, c, "SEEK_CUR", SEEK_CUR);
220 initConstant(env, c, "SEEK_END", SEEK_END);
221 initConstant(env, c, "SEEK_SET", SEEK_SET);
222 initConstant(env, c, "SHUT_RD", SHUT_RD);
223 initConstant(env, c, "SHUT_RDWR", SHUT_RDWR);
224 initConstant(env, c, "SHUT_WR", SHUT_WR);
225 initConstant(env, c, "SOCK_DGRAM", SOCK_DGRAM);
226 initConstant(env, c, "SOCK_RAW", SOCK_RAW);
227 initConstant(env, c, "SOCK_SEQPACKET", SOCK_SEQPACKET);
228 initConstant(env, c, "SOCK_STREAM", SOCK_STREAM);
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -0700229 initConstant(env, c, "SOL_SOCKET", SOL_SOCKET);
Elliott Hughesb9746662011-04-06 12:01:16 -0700230 initConstant(env, c, "SO_BINDTODEVICE", SO_BINDTODEVICE);
Elliott Hughes454a95f2011-03-29 18:00:14 -0700231 initConstant(env, c, "SO_BROADCAST", SO_BROADCAST);
232 initConstant(env, c, "SO_DEBUG", SO_DEBUG);
233 initConstant(env, c, "SO_DONTROUTE", SO_DONTROUTE);
234 initConstant(env, c, "SO_ERROR", SO_ERROR);
235 initConstant(env, c, "SO_KEEPALIVE", SO_KEEPALIVE);
236 initConstant(env, c, "SO_LINGER", SO_LINGER);
237 initConstant(env, c, "SO_OOBINLINE", SO_OOBINLINE);
238 initConstant(env, c, "SO_RCVBUF", SO_RCVBUF);
239 initConstant(env, c, "SO_RCVLOWAT", SO_RCVLOWAT);
240 initConstant(env, c, "SO_RCVTIMEO", SO_RCVTIMEO);
241 initConstant(env, c, "SO_REUSEADDR", SO_REUSEADDR);
242 initConstant(env, c, "SO_SNDBUF", SO_SNDBUF);
243 initConstant(env, c, "SO_SNDLOWAT", SO_SNDLOWAT);
244 initConstant(env, c, "SO_SNDTIMEO", SO_SNDTIMEO);
245 initConstant(env, c, "SO_TYPE", SO_TYPE);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700246 initConstant(env, c, "STDERR_FILENO", STDERR_FILENO);
247 initConstant(env, c, "STDIN_FILENO", STDIN_FILENO);
248 initConstant(env, c, "STDOUT_FILENO", STDOUT_FILENO);
249 initConstant(env, c, "S_IFBLK", S_IFBLK);
250 initConstant(env, c, "S_IFCHR", S_IFCHR);
251 initConstant(env, c, "S_IFDIR", S_IFDIR);
252 initConstant(env, c, "S_IFIFO", S_IFIFO);
253 initConstant(env, c, "S_IFLNK", S_IFLNK);
254 initConstant(env, c, "S_IFMT", S_IFMT);
255 initConstant(env, c, "S_IFREG", S_IFREG);
256 initConstant(env, c, "S_IFSOCK", S_IFSOCK);
257 initConstant(env, c, "S_IRGRP", S_IRGRP);
258 initConstant(env, c, "S_IROTH", S_IROTH);
259 initConstant(env, c, "S_IRUSR", S_IRUSR);
260 initConstant(env, c, "S_IRWXG", S_IRWXG);
261 initConstant(env, c, "S_IRWXO", S_IRWXO);
262 initConstant(env, c, "S_IRWXU", S_IRWXU);
263 initConstant(env, c, "S_ISGID", S_ISGID);
264 initConstant(env, c, "S_ISUID", S_ISUID);
265 initConstant(env, c, "S_ISVTX", S_ISVTX);
266 initConstant(env, c, "S_IWGRP", S_IWGRP);
267 initConstant(env, c, "S_IWOTH", S_IWOTH);
268 initConstant(env, c, "S_IWUSR", S_IWUSR);
269 initConstant(env, c, "S_IXGRP", S_IXGRP);
270 initConstant(env, c, "S_IXOTH", S_IXOTH);
271 initConstant(env, c, "S_IXUSR", S_IXUSR);
Elliott Hughes0a9d1ee2011-03-30 15:35:16 -0700272 initConstant(env, c, "TCP_NODELAY", TCP_NODELAY);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700273 initConstant(env, c, "WCONTINUED", WCONTINUED);
274 initConstant(env, c, "WEXITED", WEXITED);
275 initConstant(env, c, "WNOHANG", WNOHANG);
276 initConstant(env, c, "WNOWAIT", WNOWAIT);
277 initConstant(env, c, "WSTOPPED", WSTOPPED);
278 initConstant(env, c, "WUNTRACED", WUNTRACED);
279 initConstant(env, c, "W_OK", W_OK);
280 initConstant(env, c, "X_OK", X_OK);
Elliott Hughes6fc1a0e2011-03-18 10:28:24 -0700281 initConstant(env, c, "_SC_2_CHAR_TERM", _SC_2_CHAR_TERM);
282 initConstant(env, c, "_SC_2_C_BIND", _SC_2_C_BIND);
283 initConstant(env, c, "_SC_2_C_DEV", _SC_2_C_DEV);
284 initConstant(env, c, "_SC_2_C_VERSION", _SC_2_C_VERSION);
285 initConstant(env, c, "_SC_2_FORT_DEV", _SC_2_FORT_DEV);
286 initConstant(env, c, "_SC_2_FORT_RUN", _SC_2_FORT_RUN);
287 initConstant(env, c, "_SC_2_LOCALEDEF", _SC_2_LOCALEDEF);
288 initConstant(env, c, "_SC_2_SW_DEV", _SC_2_SW_DEV);
289 initConstant(env, c, "_SC_2_UPE", _SC_2_UPE);
290 initConstant(env, c, "_SC_2_VERSION", _SC_2_VERSION);
291 initConstant(env, c, "_SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX);
292 initConstant(env, c, "_SC_AIO_MAX", _SC_AIO_MAX);
293 initConstant(env, c, "_SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX);
294 initConstant(env, c, "_SC_ARG_MAX", _SC_ARG_MAX);
295 initConstant(env, c, "_SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO);
296 initConstant(env, c, "_SC_ATEXIT_MAX", _SC_ATEXIT_MAX);
297 initConstant(env, c, "_SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES);
298 initConstant(env, c, "_SC_BC_BASE_MAX", _SC_BC_BASE_MAX);
299 initConstant(env, c, "_SC_BC_DIM_MAX", _SC_BC_DIM_MAX);
300 initConstant(env, c, "_SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX);
301 initConstant(env, c, "_SC_BC_STRING_MAX", _SC_BC_STRING_MAX);
302 initConstant(env, c, "_SC_CHILD_MAX", _SC_CHILD_MAX);
303 initConstant(env, c, "_SC_CLK_TCK", _SC_CLK_TCK);
304 initConstant(env, c, "_SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX);
305 initConstant(env, c, "_SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX);
306 initConstant(env, c, "_SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX);
307 initConstant(env, c, "_SC_FSYNC", _SC_FSYNC);
308 initConstant(env, c, "_SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX);
309 initConstant(env, c, "_SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX);
310 initConstant(env, c, "_SC_IOV_MAX", _SC_IOV_MAX);
311 initConstant(env, c, "_SC_JOB_CONTROL", _SC_JOB_CONTROL);
312 initConstant(env, c, "_SC_LINE_MAX", _SC_LINE_MAX);
313 initConstant(env, c, "_SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX);
314 initConstant(env, c, "_SC_MAPPED_FILES", _SC_MAPPED_FILES);
315 initConstant(env, c, "_SC_MEMLOCK", _SC_MEMLOCK);
316 initConstant(env, c, "_SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE);
317 initConstant(env, c, "_SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION);
318 initConstant(env, c, "_SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING);
319 initConstant(env, c, "_SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX);
320 initConstant(env, c, "_SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX);
321 initConstant(env, c, "_SC_NGROUPS_MAX", _SC_NGROUPS_MAX);
322 initConstant(env, c, "_SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF);
323 initConstant(env, c, "_SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN);
324 initConstant(env, c, "_SC_OPEN_MAX", _SC_OPEN_MAX);
325 initConstant(env, c, "_SC_PAGESIZE", _SC_PAGESIZE);
326 initConstant(env, c, "_SC_PAGE_SIZE", _SC_PAGE_SIZE);
327 initConstant(env, c, "_SC_PASS_MAX", _SC_PASS_MAX);
328 initConstant(env, c, "_SC_PHYS_PAGES", _SC_PHYS_PAGES);
329 initConstant(env, c, "_SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO);
330 initConstant(env, c, "_SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING);
331 initConstant(env, c, "_SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS);
332 initConstant(env, c, "_SC_RE_DUP_MAX", _SC_RE_DUP_MAX);
333 initConstant(env, c, "_SC_RTSIG_MAX", _SC_RTSIG_MAX);
334 initConstant(env, c, "_SC_SAVED_IDS", _SC_SAVED_IDS);
335 initConstant(env, c, "_SC_SEMAPHORES", _SC_SEMAPHORES);
336 initConstant(env, c, "_SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX);
337 initConstant(env, c, "_SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX);
338 initConstant(env, c, "_SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS);
339 initConstant(env, c, "_SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX);
340 initConstant(env, c, "_SC_STREAM_MAX", _SC_STREAM_MAX);
341 initConstant(env, c, "_SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO);
342 initConstant(env, c, "_SC_THREADS", _SC_THREADS);
343 initConstant(env, c, "_SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR);
344 initConstant(env, c, "_SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE);
345 initConstant(env, c, "_SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS);
346 initConstant(env, c, "_SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX);
347 initConstant(env, c, "_SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING);
348 initConstant(env, c, "_SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT);
349 initConstant(env, c, "_SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT);
350 initConstant(env, c, "_SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS);
351 initConstant(env, c, "_SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN);
352 initConstant(env, c, "_SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX);
353 initConstant(env, c, "_SC_TIMERS", _SC_TIMERS);
354 initConstant(env, c, "_SC_TIMER_MAX", _SC_TIMER_MAX);
355 initConstant(env, c, "_SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX);
356 initConstant(env, c, "_SC_TZNAME_MAX", _SC_TZNAME_MAX);
357 initConstant(env, c, "_SC_VERSION", _SC_VERSION);
358 initConstant(env, c, "_SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32);
359 initConstant(env, c, "_SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG);
360 initConstant(env, c, "_SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64);
361 initConstant(env, c, "_SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG);
362 initConstant(env, c, "_SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT);
363 initConstant(env, c, "_SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N);
364 initConstant(env, c, "_SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY);
365 initConstant(env, c, "_SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME);
366 initConstant(env, c, "_SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS);
367 initConstant(env, c, "_SC_XOPEN_SHM", _SC_XOPEN_SHM);
368 initConstant(env, c, "_SC_XOPEN_UNIX", _SC_XOPEN_UNIX);
369 initConstant(env, c, "_SC_XOPEN_VERSION", _SC_XOPEN_VERSION);
370 initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700371}
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700372
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700373static JNINativeMethod gMethods[] = {
Elliott Hughesbdb717a2011-03-17 16:08:50 -0700374 NATIVE_METHOD(OsConstants, initConstants, "()V"),
Elliott Hughescdf7a1f2011-03-15 16:13:35 -0700375};
376int register_libcore_io_OsConstants(JNIEnv* env) {
377 return jniRegisterNativeMethods(env, "libcore/io/OsConstants", gMethods, NELEM(gMethods));
378}