Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 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 "JNIHelp.h" |
| 20 | #include "JniConstants.h" |
Michael Wright | d87d883 | 2013-09-25 17:49:44 -0700 | [diff] [blame] | 21 | #include "Portability.h" |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 22 | |
Elliott Hughes | 2822a84 | 2011-03-16 15:10:43 -0700 | [diff] [blame] | 23 | #include <errno.h> |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 24 | #include <fcntl.h> |
Elliott Hughes | 4f11ebe | 2011-04-19 15:38:10 -0700 | [diff] [blame] | 25 | #include <netdb.h> |
Lorenzo Colitti | 638c455 | 2013-11-15 20:29:06 +0900 | [diff] [blame] | 26 | #include <linux/if_addr.h> |
Lorenzo Colitti | d6fcc6c | 2013-11-28 15:18:47 +0900 | [diff] [blame] | 27 | #include <linux/rtnetlink.h> |
Elliott Hughes | 2822a84 | 2011-03-16 15:10:43 -0700 | [diff] [blame] | 28 | #include <netinet/in.h> |
Elliott Hughes | 0a9d1ee | 2011-03-30 15:35:16 -0700 | [diff] [blame] | 29 | #include <netinet/tcp.h> |
Elliott Hughes | 70c8204 | 2011-05-11 16:12:36 -0700 | [diff] [blame] | 30 | #include <poll.h> |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 31 | #include <signal.h> |
Elliott Hughes | 2822a84 | 2011-03-16 15:10:43 -0700 | [diff] [blame] | 32 | #include <stdlib.h> |
Alex Klyubin | 9e0ca15 | 2013-04-18 15:20:42 -0700 | [diff] [blame] | 33 | #include <sys/capability.h> |
Elliott Hughes | 461d0d8 | 2011-03-28 15:12:20 -0700 | [diff] [blame] | 34 | #include <sys/ioctl.h> |
Elliott Hughes | 2822a84 | 2011-03-16 15:10:43 -0700 | [diff] [blame] | 35 | #include <sys/mman.h> |
| 36 | #include <sys/socket.h> |
| 37 | #include <sys/stat.h> |
| 38 | #include <sys/wait.h> |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 39 | #include <unistd.h> |
| 40 | |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 41 | #include <net/if.h> // After <sys/socket.h> to work around a Mac header file bug. |
| 42 | |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 43 | static 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 | |
| 48 | static 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 Hughes | 1c039d7 | 2011-05-04 16:04:04 -0700 | [diff] [blame] | 53 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 57 | #if defined(AI_NUMERICSERV) |
Elliott Hughes | 1c039d7 | 2011-05-04 16:04:04 -0700 | [diff] [blame] | 58 | initConstant(env, c, "AI_NUMERICSERV", AI_NUMERICSERV); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 59 | #endif |
Elliott Hughes | 1c039d7 | 2011-05-04 16:04:04 -0700 | [diff] [blame] | 60 | initConstant(env, c, "AI_PASSIVE", AI_PASSIVE); |
| 61 | initConstant(env, c, "AI_V4MAPPED", AI_V4MAPPED); |
Alex Klyubin | 9e0ca15 | 2013-04-18 15:20:42 -0700 | [diff] [blame] | 62 | initConstant(env, c, "CAP_AUDIT_CONTROL", CAP_AUDIT_CONTROL); |
| 63 | initConstant(env, c, "CAP_AUDIT_WRITE", CAP_AUDIT_WRITE); |
Michael Wright | d87d883 | 2013-09-25 17:49:44 -0700 | [diff] [blame] | 64 | initConstant(env, c, "CAP_BLOCK_SUSPEND", CAP_BLOCK_SUSPEND); |
Alex Klyubin | 9e0ca15 | 2013-04-18 15:20:42 -0700 | [diff] [blame] | 65 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 100 | 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 Hughes | 4f11ebe | 2011-04-19 15:38:10 -0700 | [diff] [blame] | 106 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 113 | #if defined(EAI_OVERFLOW) |
Elliott Hughes | 4f11ebe | 2011-04-19 15:38:10 -0700 | [diff] [blame] | 114 | initConstant(env, c, "EAI_OVERFLOW", EAI_OVERFLOW); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 115 | #endif |
Elliott Hughes | 4f11ebe | 2011-04-19 15:38:10 -0700 | [diff] [blame] | 116 | initConstant(env, c, "EAI_SERVICE", EAI_SERVICE); |
| 117 | initConstant(env, c, "EAI_SOCKTYPE", EAI_SOCKTYPE); |
| 118 | initConstant(env, c, "EAI_SYSTEM", EAI_SYSTEM); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 119 | 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 Hughes | f4a4259 | 2013-03-21 16:27:26 -0700 | [diff] [blame] | 190 | #if EWOULDBLOCK != EAGAIN |
| 191 | #error EWOULDBLOCK != EAGAIN |
| 192 | #endif |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 193 | 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 Hughes | 461d0d8 | 2011-03-28 15:12:20 -0700 | [diff] [blame] | 197 | initConstant(env, c, "FIONREAD", FIONREAD); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 198 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 202 | #if defined(F_GETLK64) |
Elliott Hughes | fc549a0 | 2011-03-24 16:38:05 -0700 | [diff] [blame] | 203 | initConstant(env, c, "F_GETLK64", F_GETLK64); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 204 | #endif |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 205 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 211 | #if defined(F_SETLK64) |
Elliott Hughes | fc549a0 | 2011-03-24 16:38:05 -0700 | [diff] [blame] | 212 | initConstant(env, c, "F_SETLK64", F_SETLK64); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 213 | #endif |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 214 | initConstant(env, c, "F_SETLKW", F_SETLKW); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 215 | #if defined(F_SETLKW64) |
Elliott Hughes | fc549a0 | 2011-03-24 16:38:05 -0700 | [diff] [blame] | 216 | initConstant(env, c, "F_SETLKW64", F_SETLKW64); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 217 | #endif |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 218 | initConstant(env, c, "F_SETOWN", F_SETOWN); |
| 219 | initConstant(env, c, "F_UNLCK", F_UNLCK); |
| 220 | initConstant(env, c, "F_WRLCK", F_WRLCK); |
Lorenzo Colitti | 638c455 | 2013-11-15 20:29:06 +0900 | [diff] [blame] | 221 | #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 Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 232 | initConstant(env, c, "IFF_ALLMULTI", IFF_ALLMULTI); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 233 | #if defined(IFF_AUTOMEDIA) |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 234 | initConstant(env, c, "IFF_AUTOMEDIA", IFF_AUTOMEDIA); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 235 | #endif |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 236 | initConstant(env, c, "IFF_BROADCAST", IFF_BROADCAST); |
| 237 | initConstant(env, c, "IFF_DEBUG", IFF_DEBUG); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 238 | #if defined(IFF_DYNAMIC) |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 239 | initConstant(env, c, "IFF_DYNAMIC", IFF_DYNAMIC); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 240 | #endif |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 241 | initConstant(env, c, "IFF_LOOPBACK", IFF_LOOPBACK); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 242 | #if defined(IFF_MASTER) |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 243 | initConstant(env, c, "IFF_MASTER", IFF_MASTER); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 244 | #endif |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 245 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 249 | #if defined(IFF_PORTSEL) |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 250 | initConstant(env, c, "IFF_PORTSEL", IFF_PORTSEL); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 251 | #endif |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 252 | initConstant(env, c, "IFF_PROMISC", IFF_PROMISC); |
| 253 | initConstant(env, c, "IFF_RUNNING", IFF_RUNNING); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 254 | #if defined(IFF_SLAVE) |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 255 | initConstant(env, c, "IFF_SLAVE", IFF_SLAVE); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 256 | #endif |
Elliott Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 257 | initConstant(env, c, "IFF_UP", IFF_UP); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 258 | initConstant(env, c, "IPPROTO_ICMP", IPPROTO_ICMP); |
Lorenzo Colitti | dca34b5 | 2013-07-03 18:51:34 +0900 | [diff] [blame] | 259 | initConstant(env, c, "IPPROTO_ICMPV6", IPPROTO_ICMPV6); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 260 | 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 Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 265 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 269 | #if defined(IPV6_RECVDSTOPTS) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 270 | initConstant(env, c, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 271 | #endif |
| 272 | #if defined(IPV6_RECVHOPLIMIT) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 273 | initConstant(env, c, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 274 | #endif |
| 275 | #if defined(IPV6_RECVHOPOPTS) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 276 | initConstant(env, c, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 277 | #endif |
| 278 | #if defined(IPV6_RECVPKTINFO) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 279 | initConstant(env, c, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 280 | #endif |
| 281 | #if defined(IPV6_RECVRTHDR) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 282 | initConstant(env, c, "IPV6_RECVRTHDR", IPV6_RECVRTHDR); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 283 | #endif |
| 284 | #if defined(IPV6_RECVTCLASS) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 285 | initConstant(env, c, "IPV6_RECVTCLASS", IPV6_RECVTCLASS); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 286 | #endif |
| 287 | #if defined(IPV6_TCLASS) |
Elliott Hughes | 0a9d1ee | 2011-03-30 15:35:16 -0700 | [diff] [blame] | 288 | initConstant(env, c, "IPV6_TCLASS", IPV6_TCLASS); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 289 | #endif |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 290 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 297 | initConstant(env, c, "MAP_FIXED", MAP_FIXED); |
| 298 | initConstant(env, c, "MAP_PRIVATE", MAP_PRIVATE); |
| 299 | initConstant(env, c, "MAP_SHARED", MAP_SHARED); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 300 | #if defined(MCAST_JOIN_GROUP) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 301 | initConstant(env, c, "MCAST_JOIN_GROUP", MCAST_JOIN_GROUP); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 302 | #endif |
| 303 | #if defined(MCAST_LEAVE_GROUP) |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 304 | initConstant(env, c, "MCAST_LEAVE_GROUP", MCAST_LEAVE_GROUP); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 305 | #endif |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 306 | 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 Hughes | 4f11ebe | 2011-04-19 15:38:10 -0700 | [diff] [blame] | 318 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 323 | 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 Root | dd538c3 | 2012-09-17 17:34:26 -0700 | [diff] [blame] | 328 | initConstant(env, c, "O_NOFOLLOW", O_NOFOLLOW); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 329 | 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 Hughes | 70c8204 | 2011-05-11 16:12:36 -0700 | [diff] [blame] | 335 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 345 | 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 Colitti | d6fcc6c | 2013-11-28 15:18:47 +0900 | [diff] [blame] | 350 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 355 | 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 Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 361 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 374 | #if defined(SIGPWR) |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 375 | initConstant(env, c, "SIGPWR", SIGPWR); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 376 | #endif |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 377 | initConstant(env, c, "SIGQUIT", SIGQUIT); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 378 | #if defined(SIGRTMAX) |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 379 | initConstant(env, c, "SIGRTMAX", SIGRTMAX); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 380 | #endif |
| 381 | #if defined(SIGRTMIN) |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 382 | initConstant(env, c, "SIGRTMIN", SIGRTMIN); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 383 | #endif |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 384 | initConstant(env, c, "SIGSEGV", SIGSEGV); |
Chris Dearman | b7e0772 | 2012-05-01 16:11:58 -0700 | [diff] [blame] | 385 | #if defined(SIGSTKFLT) |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 386 | initConstant(env, c, "SIGSTKFLT", SIGSTKFLT); |
Chris Dearman | b7e0772 | 2012-05-01 16:11:58 -0700 | [diff] [blame] | 387 | #endif |
Elliott Hughes | a5fb706 | 2011-04-28 15:36:47 -0700 | [diff] [blame] | 388 | 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 Hughes | a37e971 | 2011-04-21 14:07:01 -0700 | [diff] [blame] | 402 | initConstant(env, c, "SIOCGIFADDR", SIOCGIFADDR); |
| 403 | initConstant(env, c, "SIOCGIFBRDADDR", SIOCGIFBRDADDR); |
| 404 | initConstant(env, c, "SIOCGIFDSTADDR", SIOCGIFDSTADDR); |
| 405 | initConstant(env, c, "SIOCGIFNETMASK", SIOCGIFNETMASK); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 406 | 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 Hughes | 0a9d1ee | 2011-03-30 15:35:16 -0700 | [diff] [blame] | 410 | initConstant(env, c, "SOL_SOCKET", SOL_SOCKET); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 411 | #if defined(SO_BINDTODEVICE) |
Elliott Hughes | b974666 | 2011-04-06 12:01:16 -0700 | [diff] [blame] | 412 | initConstant(env, c, "SO_BINDTODEVICE", SO_BINDTODEVICE); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 413 | #endif |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 414 | 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 Hughes | 482a3fc | 2013-03-20 16:10:12 -0700 | [diff] [blame] | 421 | initConstant(env, c, "SO_PASSCRED", SO_PASSCRED); |
| 422 | initConstant(env, c, "SO_PEERCRED", SO_PEERCRED); |
Elliott Hughes | 454a95f | 2011-03-29 18:00:14 -0700 | [diff] [blame] | 423 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 431 | 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 Hughes | 0a9d1ee | 2011-03-30 15:35:16 -0700 | [diff] [blame] | 457 | initConstant(env, c, "TCP_NODELAY", TCP_NODELAY); |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 458 | 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 Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 466 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 469 | #if defined(_SC_2_C_VERSION) |
Elliott Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 470 | initConstant(env, c, "_SC_2_C_VERSION", _SC_2_C_VERSION); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 471 | #endif |
Elliott Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 472 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 484 | #if defined(_SC_AVPHYS_PAGES) |
Elliott Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 485 | initConstant(env, c, "_SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 486 | #endif |
Elliott Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 487 | 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 Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 517 | #if defined(_SC_PHYS_PAGES) |
Elliott Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 518 | initConstant(env, c, "_SC_PHYS_PAGES", _SC_PHYS_PAGES); |
Elliott Hughes | 6c1e5f4 | 2013-01-25 15:10:58 -0800 | [diff] [blame] | 519 | #endif |
Elliott Hughes | 6fc1a0e | 2011-03-18 10:28:24 -0700 | [diff] [blame] | 520 | 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 Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 562 | } |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 563 | |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 564 | static JNINativeMethod gMethods[] = { |
Elliott Hughes | bdb717a | 2011-03-17 16:08:50 -0700 | [diff] [blame] | 565 | NATIVE_METHOD(OsConstants, initConstants, "()V"), |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 566 | }; |
Elliott Hughes | 7cd6760 | 2012-05-03 17:21:04 -0700 | [diff] [blame] | 567 | void register_libcore_io_OsConstants(JNIEnv* env) { |
| 568 | jniRegisterNativeMethods(env, "libcore/io/OsConstants", gMethods, NELEM(gMethods)); |
Elliott Hughes | cdf7a1f | 2011-03-15 16:13:35 -0700 | [diff] [blame] | 569 | } |