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 package android.system; 17 18 import com.android.ravenwood.common.RavenwoodCommonUtils; 19 20 /** 21 * Copied from libcore's version, with the local changes: 22 * - All the imports are removed. (they're only used in javadoc) 23 * - All the annotations are removed. 24 * - The initConstants() method is moved to a nested class. 25 * 26 * TODO(b/340887115): Need a better integration with libcore. 27 */ 28 29 public class OsConstants { 30 // @UnsupportedAppUsage OsConstants()31 private OsConstants() { 32 } 33 34 /** 35 * Returns the index of the element in the {@link StructCapUserData} (cap_user_data) 36 * array that this capability is stored in. 37 * 38 * @param x capability 39 * @return index of the element in the {@link StructCapUserData} array storing this capability 40 * 41 * @hide 42 */ 43 // @UnsupportedAppUsage 44 // @SystemApi(client = MODULE_LIBRARIES) CAP_TO_INDEX(int x)45 public static int CAP_TO_INDEX(int x) { return x >>> 5; } 46 47 /** 48 * Returns the mask for the given capability. This is relative to the capability's 49 * {@link StructCapUserData} (cap_user_data) element, the index of which can be 50 * retrieved with {@link CAP_TO_INDEX}. 51 * 52 * @param x capability 53 * @return mask for given capability 54 * 55 * @hide 56 */ 57 // @UnsupportedAppUsage 58 // @SystemApi(client = MODULE_LIBRARIES) CAP_TO_MASK(int x)59 public static int CAP_TO_MASK(int x) { return 1 << (x & 31); } 60 61 /** 62 * Tests whether the given mode is a block device. 63 */ S_ISBLK(int mode)64 public static boolean S_ISBLK(int mode) { return (mode & S_IFMT) == S_IFBLK; } 65 66 /** 67 * Tests whether the given mode is a character device. 68 */ S_ISCHR(int mode)69 public static boolean S_ISCHR(int mode) { return (mode & S_IFMT) == S_IFCHR; } 70 71 /** 72 * Tests whether the given mode is a directory. 73 */ S_ISDIR(int mode)74 public static boolean S_ISDIR(int mode) { return (mode & S_IFMT) == S_IFDIR; } 75 76 /** 77 * Tests whether the given mode is a FIFO. 78 */ S_ISFIFO(int mode)79 public static boolean S_ISFIFO(int mode) { return (mode & S_IFMT) == S_IFIFO; } 80 81 /** 82 * Tests whether the given mode is a regular file. 83 */ S_ISREG(int mode)84 public static boolean S_ISREG(int mode) { return (mode & S_IFMT) == S_IFREG; } 85 86 /** 87 * Tests whether the given mode is a symbolic link. 88 */ S_ISLNK(int mode)89 public static boolean S_ISLNK(int mode) { return (mode & S_IFMT) == S_IFLNK; } 90 91 /** 92 * Tests whether the given mode is a socket. 93 */ S_ISSOCK(int mode)94 public static boolean S_ISSOCK(int mode) { return (mode & S_IFMT) == S_IFSOCK; } 95 96 /** 97 * Extracts the exit status of a child. Only valid if WIFEXITED returns true. 98 */ WEXITSTATUS(int status)99 public static int WEXITSTATUS(int status) { return (status & 0xff00) >> 8; } 100 101 /** 102 * Tests whether the child dumped core. Only valid if WIFSIGNALED returns true. 103 */ WCOREDUMP(int status)104 public static boolean WCOREDUMP(int status) { return (status & 0x80) != 0; } 105 106 /** 107 * Returns the signal that caused the child to exit. Only valid if WIFSIGNALED returns true. 108 */ WTERMSIG(int status)109 public static int WTERMSIG(int status) { return status & 0x7f; } 110 111 /** 112 * Returns the signal that cause the child to stop. Only valid if WIFSTOPPED returns true. 113 */ WSTOPSIG(int status)114 public static int WSTOPSIG(int status) { return WEXITSTATUS(status); } 115 116 /** 117 * Tests whether the child exited normally. 118 */ WIFEXITED(int status)119 public static boolean WIFEXITED(int status) { return (WTERMSIG(status) == 0); } 120 121 /** 122 * Tests whether the child was stopped (not terminated) by a signal. 123 */ WIFSTOPPED(int status)124 public static boolean WIFSTOPPED(int status) { return (WTERMSIG(status) == 0x7f); } 125 126 /** 127 * Tests whether the child was terminated by a signal. 128 */ WIFSIGNALED(int status)129 public static boolean WIFSIGNALED(int status) { return (WTERMSIG(status + 1) >= 2); } 130 131 public static final int AF_INET = placeholder(); 132 public static final int AF_INET6 = placeholder(); 133 public static final int AF_NETLINK = placeholder(); 134 public static final int AF_PACKET = placeholder(); 135 public static final int AF_UNIX = placeholder(); 136 137 /** 138 * The virt-vsock address family, linux specific. 139 * It is used with {@code struct sockaddr_vm} from uapi/linux/vm_sockets.h. 140 * 141 * @see <a href="https://man7.org/linux/man-pages/man7/vsock.7.html">vsock(7)</a> 142 * @see VmSocketAddress 143 */ 144 public static final int AF_VSOCK = placeholder(); 145 public static final int AF_UNSPEC = placeholder(); 146 public static final int AI_ADDRCONFIG = placeholder(); 147 public static final int AI_ALL = placeholder(); 148 public static final int AI_CANONNAME = placeholder(); 149 public static final int AI_NUMERICHOST = placeholder(); 150 public static final int AI_NUMERICSERV = placeholder(); 151 public static final int AI_PASSIVE = placeholder(); 152 public static final int AI_V4MAPPED = placeholder(); 153 public static final int ARPHRD_ETHER = placeholder(); 154 155 /** 156 * The virtio-vsock {@code svmPort} value to bind for any available port. 157 * 158 * @see <a href="https://man7.org/linux/man-pages/man7/vsock.7.html">vsock(7)</a> 159 * @see VmSocketAddress 160 */ 161 public static final int VMADDR_PORT_ANY = placeholder(); 162 163 /** 164 * The virtio-vsock {@code svmCid} value to listens for all CIDs. 165 * 166 * @see <a href="https://man7.org/linux/man-pages/man7/vsock.7.html">vsock(7)</a> 167 * @see VmSocketAddress 168 */ 169 public static final int VMADDR_CID_ANY = placeholder(); 170 171 /** 172 * The virtio-vsock {@code svmCid} value for host communication. 173 * 174 * @see <a href="https://man7.org/linux/man-pages/man7/vsock.7.html">vsock(7)</a> 175 * @see VmSocketAddress 176 */ 177 public static final int VMADDR_CID_LOCAL = placeholder(); 178 179 /** 180 * The virtio-vsock {@code svmCid} value for loopback communication. 181 * 182 * @see <a href="https://man7.org/linux/man-pages/man7/vsock.7.html">vsock(7)</a> 183 * @see VmSocketAddress 184 */ 185 public static final int VMADDR_CID_HOST = placeholder(); 186 187 /** 188 * ARP protocol loopback device identifier. 189 * 190 * @hide 191 */ 192 // @UnsupportedAppUsage 193 // @SystemApi(client = MODULE_LIBRARIES) 194 public static final int ARPHRD_LOOPBACK = placeholder(); 195 public static final int CAP_AUDIT_CONTROL = placeholder(); 196 public static final int CAP_AUDIT_WRITE = placeholder(); 197 public static final int CAP_BLOCK_SUSPEND = placeholder(); 198 public static final int CAP_CHOWN = placeholder(); 199 public static final int CAP_DAC_OVERRIDE = placeholder(); 200 public static final int CAP_DAC_READ_SEARCH = placeholder(); 201 public static final int CAP_FOWNER = placeholder(); 202 public static final int CAP_FSETID = placeholder(); 203 public static final int CAP_IPC_LOCK = placeholder(); 204 public static final int CAP_IPC_OWNER = placeholder(); 205 public static final int CAP_KILL = placeholder(); 206 public static final int CAP_LAST_CAP = placeholder(); 207 public static final int CAP_LEASE = placeholder(); 208 public static final int CAP_LINUX_IMMUTABLE = placeholder(); 209 public static final int CAP_MAC_ADMIN = placeholder(); 210 public static final int CAP_MAC_OVERRIDE = placeholder(); 211 public static final int CAP_MKNOD = placeholder(); 212 public static final int CAP_NET_ADMIN = placeholder(); 213 public static final int CAP_NET_BIND_SERVICE = placeholder(); 214 public static final int CAP_NET_BROADCAST = placeholder(); 215 public static final int CAP_NET_RAW = placeholder(); 216 public static final int CAP_SETFCAP = placeholder(); 217 public static final int CAP_SETGID = placeholder(); 218 public static final int CAP_SETPCAP = placeholder(); 219 public static final int CAP_SETUID = placeholder(); 220 public static final int CAP_SYS_ADMIN = placeholder(); 221 public static final int CAP_SYS_BOOT = placeholder(); 222 public static final int CAP_SYS_CHROOT = placeholder(); 223 public static final int CAP_SYSLOG = placeholder(); 224 public static final int CAP_SYS_MODULE = placeholder(); 225 public static final int CAP_SYS_NICE = placeholder(); 226 public static final int CAP_SYS_PACCT = placeholder(); 227 public static final int CAP_SYS_PTRACE = placeholder(); 228 public static final int CAP_SYS_RAWIO = placeholder(); 229 public static final int CAP_SYS_RESOURCE = placeholder(); 230 public static final int CAP_SYS_TIME = placeholder(); 231 public static final int CAP_SYS_TTY_CONFIG = placeholder(); 232 public static final int CAP_WAKE_ALARM = placeholder(); 233 public static final int E2BIG = placeholder(); 234 public static final int EACCES = placeholder(); 235 public static final int EADDRINUSE = placeholder(); 236 public static final int EADDRNOTAVAIL = placeholder(); 237 public static final int EAFNOSUPPORT = placeholder(); 238 public static final int EAGAIN = placeholder(); 239 public static final int EAI_AGAIN = placeholder(); 240 public static final int EAI_BADFLAGS = placeholder(); 241 public static final int EAI_FAIL = placeholder(); 242 public static final int EAI_FAMILY = placeholder(); 243 public static final int EAI_MEMORY = placeholder(); 244 public static final int EAI_NODATA = placeholder(); 245 public static final int EAI_NONAME = placeholder(); 246 public static final int EAI_OVERFLOW = placeholder(); 247 public static final int EAI_SERVICE = placeholder(); 248 public static final int EAI_SOCKTYPE = placeholder(); 249 public static final int EAI_SYSTEM = placeholder(); 250 public static final int EALREADY = placeholder(); 251 public static final int EBADF = placeholder(); 252 public static final int EBADMSG = placeholder(); 253 public static final int EBUSY = placeholder(); 254 public static final int ECANCELED = placeholder(); 255 public static final int ECHILD = placeholder(); 256 public static final int ECONNABORTED = placeholder(); 257 public static final int ECONNREFUSED = placeholder(); 258 public static final int ECONNRESET = placeholder(); 259 public static final int EDEADLK = placeholder(); 260 public static final int EDESTADDRREQ = placeholder(); 261 public static final int EDOM = placeholder(); 262 public static final int EDQUOT = placeholder(); 263 public static final int EEXIST = placeholder(); 264 public static final int EFAULT = placeholder(); 265 public static final int EFBIG = placeholder(); 266 public static final int EHOSTUNREACH = placeholder(); 267 public static final int EIDRM = placeholder(); 268 public static final int EILSEQ = placeholder(); 269 public static final int EINPROGRESS = placeholder(); 270 public static final int EINTR = placeholder(); 271 public static final int EINVAL = placeholder(); 272 public static final int EIO = placeholder(); 273 public static final int EISCONN = placeholder(); 274 public static final int EISDIR = placeholder(); 275 public static final int ELOOP = placeholder(); 276 public static final int EMFILE = placeholder(); 277 public static final int EMLINK = placeholder(); 278 public static final int EMSGSIZE = placeholder(); 279 public static final int EMULTIHOP = placeholder(); 280 public static final int ENAMETOOLONG = placeholder(); 281 public static final int ENETDOWN = placeholder(); 282 public static final int ENETRESET = placeholder(); 283 public static final int ENETUNREACH = placeholder(); 284 public static final int ENFILE = placeholder(); 285 public static final int ENOBUFS = placeholder(); 286 public static final int ENODATA = placeholder(); 287 public static final int ENODEV = placeholder(); 288 public static final int ENOENT = placeholder(); 289 public static final int ENOEXEC = placeholder(); 290 public static final int ENOLCK = placeholder(); 291 public static final int ENOLINK = placeholder(); 292 public static final int ENOMEM = placeholder(); 293 public static final int ENOMSG = placeholder(); 294 public static final int ENONET = placeholder(); 295 public static final int ENOPROTOOPT = placeholder(); 296 public static final int ENOSPC = placeholder(); 297 public static final int ENOSR = placeholder(); 298 public static final int ENOSTR = placeholder(); 299 public static final int ENOSYS = placeholder(); 300 public static final int ENOTCONN = placeholder(); 301 public static final int ENOTDIR = placeholder(); 302 public static final int ENOTEMPTY = placeholder(); 303 public static final int ENOTSOCK = placeholder(); 304 public static final int ENOTSUP = placeholder(); 305 public static final int ENOTTY = placeholder(); 306 public static final int ENXIO = placeholder(); 307 public static final int EOPNOTSUPP = placeholder(); 308 public static final int EOVERFLOW = placeholder(); 309 public static final int EPERM = placeholder(); 310 public static final int EPIPE = placeholder(); 311 public static final int EPROTO = placeholder(); 312 public static final int EPROTONOSUPPORT = placeholder(); 313 public static final int EPROTOTYPE = placeholder(); 314 public static final int ERANGE = placeholder(); 315 public static final int EROFS = placeholder(); 316 public static final int ESPIPE = placeholder(); 317 public static final int ESRCH = placeholder(); 318 public static final int ESTALE = placeholder(); 319 public static final int ETH_P_ALL = placeholder(); 320 public static final int ETH_P_ARP = placeholder(); 321 public static final int ETH_P_IP = placeholder(); 322 public static final int ETH_P_IPV6 = placeholder(); 323 public static final int ETIME = placeholder(); 324 public static final int ETIMEDOUT = placeholder(); 325 public static final int ETXTBSY = placeholder(); 326 /** 327 * "Too many users" error. 328 * See <a href="https://man7.org/linux/man-pages/man3/errno.3.html">errno(3)</a>. 329 * 330 * @hide 331 */ 332 // @UnsupportedAppUsage 333 // @SystemApi(client = MODULE_LIBRARIES) 334 public static final int EUSERS = placeholder(); 335 // On Linux, EWOULDBLOCK == EAGAIN. Use EAGAIN instead, to reduce confusion. 336 public static final int EXDEV = placeholder(); 337 public static final int EXIT_FAILURE = placeholder(); 338 public static final int EXIT_SUCCESS = placeholder(); 339 public static final int FD_CLOEXEC = placeholder(); 340 public static final int FIONREAD = placeholder(); 341 public static final int F_DUPFD = placeholder(); 342 public static final int F_DUPFD_CLOEXEC = placeholder(); 343 public static final int F_GETFD = placeholder(); 344 public static final int F_GETFL = placeholder(); 345 public static final int F_GETLK = placeholder(); 346 public static final int F_GETLK64 = placeholder(); 347 public static final int F_GETOWN = placeholder(); 348 public static final int F_OK = placeholder(); 349 public static final int F_RDLCK = placeholder(); 350 public static final int F_SETFD = placeholder(); 351 public static final int F_SETFL = placeholder(); 352 public static final int F_SETLK = placeholder(); 353 public static final int F_SETLK64 = placeholder(); 354 public static final int F_SETLKW = placeholder(); 355 public static final int F_SETLKW64 = placeholder(); 356 public static final int F_SETOWN = placeholder(); 357 public static final int F_UNLCK = placeholder(); 358 public static final int F_WRLCK = placeholder(); 359 public static final int ICMP_ECHO = placeholder(); 360 public static final int ICMP_ECHOREPLY = placeholder(); 361 public static final int ICMP6_ECHO_REQUEST = placeholder(); 362 public static final int ICMP6_ECHO_REPLY = placeholder(); 363 public static final int IFA_F_DADFAILED = placeholder(); 364 public static final int IFA_F_DEPRECATED = placeholder(); 365 public static final int IFA_F_HOMEADDRESS = placeholder(); 366 public static final int IFA_F_MANAGETEMPADDR = placeholder(); 367 public static final int IFA_F_NODAD = placeholder(); 368 public static final int IFA_F_NOPREFIXROUTE = placeholder(); 369 public static final int IFA_F_OPTIMISTIC = placeholder(); 370 public static final int IFA_F_PERMANENT = placeholder(); 371 public static final int IFA_F_SECONDARY = placeholder(); 372 public static final int IFA_F_TEMPORARY = placeholder(); 373 public static final int IFA_F_TENTATIVE = placeholder(); 374 public static final int IFF_ALLMULTI = placeholder(); 375 public static final int IFF_AUTOMEDIA = placeholder(); 376 public static final int IFF_BROADCAST = placeholder(); 377 public static final int IFF_DEBUG = placeholder(); 378 public static final int IFF_DYNAMIC = placeholder(); 379 public static final int IFF_LOOPBACK = placeholder(); 380 public static final int IFF_MASTER = placeholder(); 381 public static final int IFF_MULTICAST = placeholder(); 382 public static final int IFF_NOARP = placeholder(); 383 public static final int IFF_NOTRAILERS = placeholder(); 384 public static final int IFF_POINTOPOINT = placeholder(); 385 public static final int IFF_PORTSEL = placeholder(); 386 public static final int IFF_PROMISC = placeholder(); 387 public static final int IFF_RUNNING = placeholder(); 388 public static final int IFF_SLAVE = placeholder(); 389 public static final int IFF_UP = placeholder(); 390 public static final int IPPROTO_ICMP = placeholder(); 391 public static final int IPPROTO_ICMPV6 = placeholder(); 392 public static final int IPPROTO_IP = placeholder(); 393 public static final int IPPROTO_IPV6 = placeholder(); 394 public static final int IPPROTO_RAW = placeholder(); 395 public static final int IPPROTO_TCP = placeholder(); 396 public static final int IPPROTO_UDP = placeholder(); 397 398 /** 399 * Encapsulation Security Payload protocol 400 * 401 * <p>Defined in /uapi/linux/in.h 402 */ 403 public static final int IPPROTO_ESP = placeholder(); 404 405 public static final int IPV6_CHECKSUM = placeholder(); 406 public static final int IPV6_MULTICAST_HOPS = placeholder(); 407 public static final int IPV6_MULTICAST_IF = placeholder(); 408 public static final int IPV6_MULTICAST_LOOP = placeholder(); 409 public static final int IPV6_PKTINFO = placeholder(); 410 public static final int IPV6_RECVDSTOPTS = placeholder(); 411 public static final int IPV6_RECVHOPLIMIT = placeholder(); 412 public static final int IPV6_RECVHOPOPTS = placeholder(); 413 public static final int IPV6_RECVPKTINFO = placeholder(); 414 public static final int IPV6_RECVRTHDR = placeholder(); 415 public static final int IPV6_RECVTCLASS = placeholder(); 416 public static final int IPV6_TCLASS = placeholder(); 417 public static final int IPV6_UNICAST_HOPS = placeholder(); 418 public static final int IPV6_V6ONLY = placeholder(); 419 /** @hide */ 420 // @UnsupportedAppUsage 421 public static final int IP_MULTICAST_ALL = placeholder(); 422 public static final int IP_MULTICAST_IF = placeholder(); 423 public static final int IP_MULTICAST_LOOP = placeholder(); 424 public static final int IP_MULTICAST_TTL = placeholder(); 425 /** @hide */ 426 // @UnsupportedAppUsage 427 public static final int IP_RECVTOS = placeholder(); 428 public static final int IP_TOS = placeholder(); 429 public static final int IP_TTL = placeholder(); 430 /** 431 * Version constant to be used in {@link StructCapUserHeader} with 432 * {@link Os#capset(StructCapUserHeader, StructCapUserData[])} and 433 * {@link Os#capget(StructCapUserHeader)}. 434 * 435 * See <a href="https://man7.org/linux/man-pages/man2/capget.2.html">capget(2)</a>. 436 * 437 * @hide 438 */ 439 // @UnsupportedAppUsage 440 // @SystemApi(client = MODULE_LIBRARIES) 441 public static final int _LINUX_CAPABILITY_VERSION_3 = placeholder(); 442 public static final int MAP_FIXED = placeholder(); 443 public static final int MAP_ANONYMOUS = placeholder(); 444 /** 445 * Flag argument for {@code mmap(long, long, int, int, FileDescriptor, long)}. 446 * 447 * See <a href="http://man7.org/linux/man-pages/man2/mmap.2.html">mmap(2)</a>. 448 * 449 * @hide 450 */ 451 // @UnsupportedAppUsage 452 // @SystemApi(client = MODULE_LIBRARIES) 453 public static final int MAP_POPULATE = placeholder(); 454 public static final int MAP_PRIVATE = placeholder(); 455 public static final int MAP_SHARED = placeholder(); 456 public static final int MCAST_JOIN_GROUP = placeholder(); 457 public static final int MCAST_LEAVE_GROUP = placeholder(); 458 public static final int MCAST_JOIN_SOURCE_GROUP = placeholder(); 459 public static final int MCAST_LEAVE_SOURCE_GROUP = placeholder(); 460 public static final int MCAST_BLOCK_SOURCE = placeholder(); 461 public static final int MCAST_UNBLOCK_SOURCE = placeholder(); 462 public static final int MCL_CURRENT = placeholder(); 463 public static final int MCL_FUTURE = placeholder(); 464 public static final int MFD_CLOEXEC = placeholder(); 465 public static final int MSG_CTRUNC = placeholder(); 466 public static final int MSG_DONTROUTE = placeholder(); 467 public static final int MSG_EOR = placeholder(); 468 public static final int MSG_OOB = placeholder(); 469 public static final int MSG_PEEK = placeholder(); 470 public static final int MSG_TRUNC = placeholder(); 471 public static final int MSG_WAITALL = placeholder(); 472 public static final int MS_ASYNC = placeholder(); 473 public static final int MS_INVALIDATE = placeholder(); 474 public static final int MS_SYNC = placeholder(); 475 public static final int NETLINK_NETFILTER = placeholder(); 476 public static final int NETLINK_ROUTE = placeholder(); 477 /** 478 * SELinux enforces that only system_server and netd may use this netlink socket type. 479 */ 480 public static final int NETLINK_INET_DIAG = placeholder(); 481 482 /** 483 * SELinux enforces that only system_server and netd may use this netlink socket type. 484 * 485 * @see <a href="https://man7.org/linux/man-pages/man7/netlink.7.html">netlink(7)</a> 486 */ 487 public static final int NETLINK_XFRM = placeholder(); 488 489 public static final int NI_DGRAM = placeholder(); 490 public static final int NI_NAMEREQD = placeholder(); 491 public static final int NI_NOFQDN = placeholder(); 492 public static final int NI_NUMERICHOST = placeholder(); 493 public static final int NI_NUMERICSERV = placeholder(); 494 public static final int O_ACCMODE = placeholder(); 495 public static final int O_APPEND = placeholder(); 496 public static final int O_CLOEXEC = placeholder(); 497 public static final int O_CREAT = placeholder(); 498 /** 499 * Flag for {@code Os#open(String, int, int)}. 500 * 501 * When enabled, tries to minimize cache effects of the I/O to and from this 502 * file. In general this will degrade performance, but it is 503 * useful in special situations, such as when applications do 504 * their own caching. File I/O is done directly to/from 505 * user-space buffers. The {@link O_DIRECT} flag on its own makes an 506 * effort to transfer data synchronously, but does not give 507 * the guarantees of the {@link O_SYNC} flag that data and necessary 508 * metadata are transferred. To guarantee synchronous I/O, 509 * {@link O_SYNC} must be used in addition to {@link O_DIRECT}. 510 * 511 * See <a href="https://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>. 512 * 513 * @hide 514 */ 515 // @UnsupportedAppUsage 516 // @SystemApi(client = MODULE_LIBRARIES) 517 public static final int O_DIRECT = placeholder(); 518 public static final int O_EXCL = placeholder(); 519 public static final int O_NOCTTY = placeholder(); 520 public static final int O_NOFOLLOW = placeholder(); 521 public static final int O_NONBLOCK = placeholder(); 522 public static final int O_RDONLY = placeholder(); 523 public static final int O_RDWR = placeholder(); 524 public static final int O_SYNC = placeholder(); 525 public static final int O_DSYNC = placeholder(); 526 public static final int O_TRUNC = placeholder(); 527 public static final int O_WRONLY = placeholder(); 528 public static final int POLLERR = placeholder(); 529 public static final int POLLHUP = placeholder(); 530 public static final int POLLIN = placeholder(); 531 public static final int POLLNVAL = placeholder(); 532 public static final int POLLOUT = placeholder(); 533 public static final int POLLPRI = placeholder(); 534 public static final int POLLRDBAND = placeholder(); 535 public static final int POLLRDNORM = placeholder(); 536 public static final int POLLWRBAND = placeholder(); 537 public static final int POLLWRNORM = placeholder(); 538 /** 539 * Reads or changes the ambient capability set of the calling thread. 540 * Has to be used as a first argument for {@link Os#prctl(int, long, long, long, long)}. 541 * 542 * See <a href="https://man7.org/linux/man-pages/man2/prctl.2.html">prctl(2)</a>. 543 * 544 * @hide 545 */ 546 // @UnsupportedAppUsage 547 // @SystemApi(client = MODULE_LIBRARIES) 548 public static final int PR_CAP_AMBIENT = placeholder(); 549 /** 550 * The capability specified in {@code arg3} of {@link Os#prctl(int, long, long, long, long)} 551 * is added to the ambient set. The specified capability must already 552 * be present in both the permitted and the inheritable sets of the process. 553 * Has to be used as a second argument for {@link Os#prctl(int, long, long, long, long)}. 554 * 555 * See <a href="https://man7.org/linux/man-pages/man2/prctl.2.html">prctl(2)</a>. 556 * @hide 557 */ 558 // @UnsupportedAppUsage 559 // @SystemApi(client = MODULE_LIBRARIES) 560 public static final int PR_CAP_AMBIENT_RAISE = placeholder(); 561 public static final int PR_GET_DUMPABLE = placeholder(); 562 public static final int PR_SET_DUMPABLE = placeholder(); 563 public static final int PR_SET_NO_NEW_PRIVS = placeholder(); 564 public static final int PROT_EXEC = placeholder(); 565 public static final int PROT_NONE = placeholder(); 566 public static final int PROT_READ = placeholder(); 567 public static final int PROT_WRITE = placeholder(); 568 public static final int R_OK = placeholder(); 569 /** 570 * Specifies a value one greater than the maximum file 571 * descriptor number that can be opened by this process. 572 * 573 * <p>Attempts ({@link Os#open(String, int, int)}, {@link Os#pipe()}, 574 * {@link Os#dup(java.io.FileDescriptor)}, etc.) to exceed this 575 * limit yield the error {@link EMFILE}. 576 * 577 * See <a href="https://man7.org/linux/man-pages/man3/vlimit.3.html">getrlimit(2)</a>. 578 * 579 * @hide 580 */ 581 // @UnsupportedAppUsage 582 // @SystemApi(client = MODULE_LIBRARIES) 583 public static final int RLIMIT_NOFILE = placeholder(); 584 public static final int RT_SCOPE_HOST = placeholder(); 585 public static final int RT_SCOPE_LINK = placeholder(); 586 public static final int RT_SCOPE_NOWHERE = placeholder(); 587 public static final int RT_SCOPE_SITE = placeholder(); 588 public static final int RT_SCOPE_UNIVERSE = placeholder(); 589 /** 590 * Bitmask for IPv4 addresses add/delete events multicast groups mask. 591 * Used in {@link NetlinkSocketAddress}. 592 * 593 * See <a href="https://man7.org/linux/man-pages/man7/netlink.7.html">netlink(7)</a>. 594 * 595 * @hide 596 */ 597 // @UnsupportedAppUsage 598 // @SystemApi(client = MODULE_LIBRARIES) 599 public static final int RTMGRP_IPV4_IFADDR = placeholder(); 600 /** @hide */ 601 // @UnsupportedAppUsage 602 public static final int RTMGRP_IPV4_MROUTE = placeholder(); 603 /** @hide */ 604 // @UnsupportedAppUsage 605 public static final int RTMGRP_IPV4_ROUTE = placeholder(); 606 /** @hide */ 607 // @UnsupportedAppUsage 608 public static final int RTMGRP_IPV4_RULE = placeholder(); 609 /** @hide */ 610 // @UnsupportedAppUsage 611 public static final int RTMGRP_IPV6_IFADDR = placeholder(); 612 /** @hide */ 613 // @UnsupportedAppUsage 614 public static final int RTMGRP_IPV6_IFINFO = placeholder(); 615 /** @hide */ 616 // @UnsupportedAppUsage 617 public static final int RTMGRP_IPV6_MROUTE = placeholder(); 618 /** @hide */ 619 // @UnsupportedAppUsage 620 public static final int RTMGRP_IPV6_PREFIX = placeholder(); 621 /** @hide */ 622 // @UnsupportedAppUsage 623 public static final int RTMGRP_IPV6_ROUTE = placeholder(); 624 /** @hide */ 625 // @UnsupportedAppUsage 626 public static final int RTMGRP_LINK = placeholder(); 627 public static final int RTMGRP_NEIGH = placeholder(); 628 /** @hide */ 629 // @UnsupportedAppUsage 630 public static final int RTMGRP_NOTIFY = placeholder(); 631 /** @hide */ 632 // @UnsupportedAppUsage 633 public static final int RTMGRP_TC = placeholder(); 634 public static final int SEEK_CUR = placeholder(); 635 public static final int SEEK_END = placeholder(); 636 public static final int SEEK_SET = placeholder(); 637 public static final int SHUT_RD = placeholder(); 638 public static final int SHUT_RDWR = placeholder(); 639 public static final int SHUT_WR = placeholder(); 640 public static final int SIGABRT = placeholder(); 641 public static final int SIGALRM = placeholder(); 642 public static final int SIGBUS = placeholder(); 643 public static final int SIGCHLD = placeholder(); 644 public static final int SIGCONT = placeholder(); 645 public static final int SIGFPE = placeholder(); 646 public static final int SIGHUP = placeholder(); 647 public static final int SIGILL = placeholder(); 648 public static final int SIGINT = placeholder(); 649 public static final int SIGIO = placeholder(); 650 public static final int SIGKILL = placeholder(); 651 public static final int SIGPIPE = placeholder(); 652 public static final int SIGPROF = placeholder(); 653 public static final int SIGPWR = placeholder(); 654 public static final int SIGQUIT = placeholder(); 655 public static final int SIGRTMAX = placeholder(); 656 public static final int SIGRTMIN = placeholder(); 657 public static final int SIGSEGV = placeholder(); 658 public static final int SIGSTKFLT = placeholder(); 659 public static final int SIGSTOP = placeholder(); 660 public static final int SIGSYS = placeholder(); 661 public static final int SIGTERM = placeholder(); 662 public static final int SIGTRAP = placeholder(); 663 public static final int SIGTSTP = placeholder(); 664 public static final int SIGTTIN = placeholder(); 665 public static final int SIGTTOU = placeholder(); 666 public static final int SIGURG = placeholder(); 667 public static final int SIGUSR1 = placeholder(); 668 public static final int SIGUSR2 = placeholder(); 669 public static final int SIGVTALRM = placeholder(); 670 public static final int SIGWINCH = placeholder(); 671 public static final int SIGXCPU = placeholder(); 672 public static final int SIGXFSZ = placeholder(); 673 public static final int SIOCGIFADDR = placeholder(); 674 public static final int SIOCGIFBRDADDR = placeholder(); 675 public static final int SIOCGIFDSTADDR = placeholder(); 676 public static final int SIOCGIFNETMASK = placeholder(); 677 678 /** 679 * Set the close-on-exec ({@code FD_CLOEXEC}) flag on the new file 680 * descriptor created by {@link Os#socket(int,int,int)} or 681 * {@link Os#socketpair(int,int,int,java.io.FileDescriptor,java.io.FileDescriptor)}. 682 * See the description of the O_CLOEXEC flag in 683 * <a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a> 684 * for reasons why this may be useful. 685 * 686 * <p>Applications wishing to make use of this flag on older API versions 687 * may use {@link #O_CLOEXEC} instead. On Android, {@code O_CLOEXEC} and 688 * {@code SOCK_CLOEXEC} are the same value. 689 */ 690 public static final int SOCK_CLOEXEC = placeholder(); 691 public static final int SOCK_DGRAM = placeholder(); 692 693 /** 694 * Set the O_NONBLOCK file status flag on the file descriptor 695 * created by {@link Os#socket(int,int,int)} or 696 * {@link Os#socketpair(int,int,int,java.io.FileDescriptor,java.io.FileDescriptor)}. 697 * 698 * <p>Applications wishing to make use of this flag on older API versions 699 * may use {@link #O_NONBLOCK} instead. On Android, {@code O_NONBLOCK} 700 * and {@code SOCK_NONBLOCK} are the same value. 701 */ 702 public static final int SOCK_NONBLOCK = placeholder(); 703 public static final int SOCK_RAW = placeholder(); 704 public static final int SOCK_SEQPACKET = placeholder(); 705 public static final int SOCK_STREAM = placeholder(); 706 public static final int SOL_SOCKET = placeholder(); 707 public static final int SOL_UDP = placeholder(); 708 public static final int SOL_PACKET = placeholder(); 709 public static final int SO_BINDTODEVICE = placeholder(); 710 public static final int SO_BROADCAST = placeholder(); 711 public static final int SO_DEBUG = placeholder(); 712 /** @hide */ 713 // @UnsupportedAppUsage 714 public static final int SO_DOMAIN = placeholder(); 715 public static final int SO_DONTROUTE = placeholder(); 716 public static final int SO_ERROR = placeholder(); 717 public static final int SO_KEEPALIVE = placeholder(); 718 public static final int SO_LINGER = placeholder(); 719 public static final int SO_OOBINLINE = placeholder(); 720 public static final int SO_PASSCRED = placeholder(); 721 public static final int SO_PEERCRED = placeholder(); 722 /** @hide */ 723 // @UnsupportedAppUsage 724 public static final int SO_PROTOCOL = placeholder(); 725 public static final int SO_RCVBUF = placeholder(); 726 public static final int SO_RCVLOWAT = placeholder(); 727 public static final int SO_RCVTIMEO = placeholder(); 728 public static final int SO_REUSEADDR = placeholder(); 729 public static final int SO_SNDBUF = placeholder(); 730 public static final int SO_SNDLOWAT = placeholder(); 731 public static final int SO_SNDTIMEO = placeholder(); 732 public static final int SO_TYPE = placeholder(); 733 public static final int PACKET_IGNORE_OUTGOING = placeholder(); 734 /** 735 * Bitmask for flags argument of 736 * {@link splice(java.io.FileDescriptor, Int64Ref , FileDescriptor, Int64Ref, long, int)}. 737 * 738 * Attempt to move pages instead of copying. This is only a 739 * hint to the kernel: pages may still be copied if the 740 * kernel cannot move the pages from the pipe, or if the pipe 741 * buffers don't refer to full pages. 742 * 743 * See <a href="https://man7.org/linux/man-pages/man2/splice.2.html">splice(2)</a>. 744 * 745 * @hide 746 */ 747 // @UnsupportedAppUsage 748 // @SystemApi(client = MODULE_LIBRARIES) 749 public static final int SPLICE_F_MOVE = placeholder(); 750 /** @hide */ 751 // @UnsupportedAppUsage 752 public static final int SPLICE_F_NONBLOCK = placeholder(); 753 /** 754 * Bitmask for flags argument of 755 * {@link splice(java.io.FileDescriptor, Int64Ref, FileDescriptor, Int64Ref, long, int)}. 756 * 757 * <p>Indicates that more data will be coming in a subsequent splice. This is 758 * a helpful hint when the {@code fdOut} refers to a socket. 759 * 760 * See <a href="https://man7.org/linux/man-pages/man2/splice.2.html">splice(2)</a>. 761 * 762 * @hide 763 */ 764 // @UnsupportedAppUsage 765 // @SystemApi(client = MODULE_LIBRARIES) 766 public static final int SPLICE_F_MORE = placeholder(); 767 public static final int STDERR_FILENO = placeholder(); 768 public static final int STDIN_FILENO = placeholder(); 769 public static final int STDOUT_FILENO = placeholder(); 770 public static final int ST_MANDLOCK = placeholder(); 771 public static final int ST_NOATIME = placeholder(); 772 public static final int ST_NODEV = placeholder(); 773 public static final int ST_NODIRATIME = placeholder(); 774 public static final int ST_NOEXEC = placeholder(); 775 public static final int ST_NOSUID = placeholder(); 776 public static final int ST_RDONLY = placeholder(); 777 public static final int ST_RELATIME = placeholder(); 778 public static final int ST_SYNCHRONOUS = placeholder(); 779 public static final int S_IFBLK = placeholder(); 780 public static final int S_IFCHR = placeholder(); 781 public static final int S_IFDIR = placeholder(); 782 public static final int S_IFIFO = placeholder(); 783 public static final int S_IFLNK = placeholder(); 784 public static final int S_IFMT = placeholder(); 785 public static final int S_IFREG = placeholder(); 786 public static final int S_IFSOCK = placeholder(); 787 public static final int S_IRGRP = placeholder(); 788 public static final int S_IROTH = placeholder(); 789 public static final int S_IRUSR = placeholder(); 790 public static final int S_IRWXG = placeholder(); 791 public static final int S_IRWXO = placeholder(); 792 public static final int S_IRWXU = placeholder(); 793 public static final int S_ISGID = placeholder(); 794 public static final int S_ISUID = placeholder(); 795 public static final int S_ISVTX = placeholder(); 796 public static final int S_IWGRP = placeholder(); 797 public static final int S_IWOTH = placeholder(); 798 public static final int S_IWUSR = placeholder(); 799 public static final int S_IXGRP = placeholder(); 800 public static final int S_IXOTH = placeholder(); 801 public static final int S_IXUSR = placeholder(); 802 public static final int TCP_NODELAY = placeholder(); 803 public static final int TCP_USER_TIMEOUT = placeholder(); 804 public static final int UDP_GRO = placeholder(); 805 public static final int UDP_SEGMENT = placeholder(); 806 /** 807 * Get the number of bytes in the output buffer. 808 * 809 * See <a href="https://man7.org/linux/man-pages/man2/ioctl.2.html">ioctl(2)</a>. 810 * 811 * @hide 812 */ 813 // @UnsupportedAppUsage 814 // @SystemApi(client = MODULE_LIBRARIES) 815 public static final int TIOCOUTQ = placeholder(); 816 /** 817 * Sockopt option to encapsulate ESP packets in UDP. 818 * 819 * @hide 820 */ 821 // @UnsupportedAppUsage 822 // @SystemApi(client = MODULE_LIBRARIES) 823 public static final int UDP_ENCAP = placeholder(); 824 /** @hide */ 825 // @UnsupportedAppUsage 826 public static final int UDP_ENCAP_ESPINUDP_NON_IKE = placeholder(); 827 /** @hide */ 828 // @UnsupportedAppUsage 829 // @SystemApi(client = MODULE_LIBRARIES) 830 public static final int UDP_ENCAP_ESPINUDP = placeholder(); 831 /** @hide */ 832 // @UnsupportedAppUsage 833 public static final int UNIX_PATH_MAX = placeholder(); 834 public static final int WCONTINUED = placeholder(); 835 public static final int WEXITED = placeholder(); 836 public static final int WNOHANG = placeholder(); 837 public static final int WNOWAIT = placeholder(); 838 public static final int WSTOPPED = placeholder(); 839 public static final int WUNTRACED = placeholder(); 840 public static final int W_OK = placeholder(); 841 /** 842 * {@code flags} option for {@link Os#setxattr(String, String, byte[], int)}. 843 * 844 * <p>Performs a pure create, which fails if the named attribute exists already. 845 * 846 * See <a href="http://man7.org/linux/man-pages/man2/setxattr.2.html">setxattr(2)</a>. 847 * 848 * @hide 849 */ 850 // @UnsupportedAppUsage 851 // @SystemApi(client = MODULE_LIBRARIES) 852 public static final int XATTR_CREATE = placeholder(); 853 /** 854 * {@code flags} option for {@link Os#setxattr(String, String, byte[], int)}. 855 * 856 * <p>Perform a pure replace operation, which fails if the named attribute 857 * does not already exist. 858 * 859 * See <a href="http://man7.org/linux/man-pages/man2/setxattr.2.html">setxattr(2)</a>. 860 * 861 * @hide 862 */ 863 // @UnsupportedAppUsage 864 // @SystemApi(client = MODULE_LIBRARIES) 865 public static final int XATTR_REPLACE = placeholder(); 866 public static final int X_OK = placeholder(); 867 public static final int _SC_2_CHAR_TERM = placeholder(); 868 public static final int _SC_2_C_BIND = placeholder(); 869 public static final int _SC_2_C_DEV = placeholder(); 870 public static final int _SC_2_C_VERSION = placeholder(); 871 public static final int _SC_2_FORT_DEV = placeholder(); 872 public static final int _SC_2_FORT_RUN = placeholder(); 873 public static final int _SC_2_LOCALEDEF = placeholder(); 874 public static final int _SC_2_SW_DEV = placeholder(); 875 public static final int _SC_2_UPE = placeholder(); 876 public static final int _SC_2_VERSION = placeholder(); 877 public static final int _SC_AIO_LISTIO_MAX = placeholder(); 878 public static final int _SC_AIO_MAX = placeholder(); 879 public static final int _SC_AIO_PRIO_DELTA_MAX = placeholder(); 880 public static final int _SC_ARG_MAX = placeholder(); 881 public static final int _SC_ASYNCHRONOUS_IO = placeholder(); 882 public static final int _SC_ATEXIT_MAX = placeholder(); 883 public static final int _SC_AVPHYS_PAGES = placeholder(); 884 public static final int _SC_BC_BASE_MAX = placeholder(); 885 public static final int _SC_BC_DIM_MAX = placeholder(); 886 public static final int _SC_BC_SCALE_MAX = placeholder(); 887 public static final int _SC_BC_STRING_MAX = placeholder(); 888 public static final int _SC_CHILD_MAX = placeholder(); 889 public static final int _SC_CLK_TCK = placeholder(); 890 public static final int _SC_COLL_WEIGHTS_MAX = placeholder(); 891 public static final int _SC_DELAYTIMER_MAX = placeholder(); 892 public static final int _SC_EXPR_NEST_MAX = placeholder(); 893 public static final int _SC_FSYNC = placeholder(); 894 public static final int _SC_GETGR_R_SIZE_MAX = placeholder(); 895 public static final int _SC_GETPW_R_SIZE_MAX = placeholder(); 896 public static final int _SC_IOV_MAX = placeholder(); 897 public static final int _SC_JOB_CONTROL = placeholder(); 898 public static final int _SC_LINE_MAX = placeholder(); 899 public static final int _SC_LOGIN_NAME_MAX = placeholder(); 900 public static final int _SC_MAPPED_FILES = placeholder(); 901 public static final int _SC_MEMLOCK = placeholder(); 902 public static final int _SC_MEMLOCK_RANGE = placeholder(); 903 public static final int _SC_MEMORY_PROTECTION = placeholder(); 904 public static final int _SC_MESSAGE_PASSING = placeholder(); 905 public static final int _SC_MQ_OPEN_MAX = placeholder(); 906 public static final int _SC_MQ_PRIO_MAX = placeholder(); 907 public static final int _SC_NGROUPS_MAX = placeholder(); 908 public static final int _SC_NPROCESSORS_CONF = placeholder(); 909 public static final int _SC_NPROCESSORS_ONLN = placeholder(); 910 public static final int _SC_OPEN_MAX = placeholder(); 911 public static final int _SC_PAGESIZE = placeholder(); 912 public static final int _SC_PAGE_SIZE = placeholder(); 913 public static final int _SC_PASS_MAX = placeholder(); 914 public static final int _SC_PHYS_PAGES = placeholder(); 915 public static final int _SC_PRIORITIZED_IO = placeholder(); 916 public static final int _SC_PRIORITY_SCHEDULING = placeholder(); 917 public static final int _SC_REALTIME_SIGNALS = placeholder(); 918 public static final int _SC_RE_DUP_MAX = placeholder(); 919 public static final int _SC_RTSIG_MAX = placeholder(); 920 public static final int _SC_SAVED_IDS = placeholder(); 921 public static final int _SC_SEMAPHORES = placeholder(); 922 public static final int _SC_SEM_NSEMS_MAX = placeholder(); 923 public static final int _SC_SEM_VALUE_MAX = placeholder(); 924 public static final int _SC_SHARED_MEMORY_OBJECTS = placeholder(); 925 public static final int _SC_SIGQUEUE_MAX = placeholder(); 926 public static final int _SC_STREAM_MAX = placeholder(); 927 public static final int _SC_SYNCHRONIZED_IO = placeholder(); 928 public static final int _SC_THREADS = placeholder(); 929 public static final int _SC_THREAD_ATTR_STACKADDR = placeholder(); 930 public static final int _SC_THREAD_ATTR_STACKSIZE = placeholder(); 931 public static final int _SC_THREAD_DESTRUCTOR_ITERATIONS = placeholder(); 932 public static final int _SC_THREAD_KEYS_MAX = placeholder(); 933 public static final int _SC_THREAD_PRIORITY_SCHEDULING = placeholder(); 934 public static final int _SC_THREAD_PRIO_INHERIT = placeholder(); 935 public static final int _SC_THREAD_PRIO_PROTECT = placeholder(); 936 public static final int _SC_THREAD_SAFE_FUNCTIONS = placeholder(); 937 public static final int _SC_THREAD_STACK_MIN = placeholder(); 938 public static final int _SC_THREAD_THREADS_MAX = placeholder(); 939 public static final int _SC_TIMERS = placeholder(); 940 public static final int _SC_TIMER_MAX = placeholder(); 941 public static final int _SC_TTY_NAME_MAX = placeholder(); 942 public static final int _SC_TZNAME_MAX = placeholder(); 943 public static final int _SC_VERSION = placeholder(); 944 public static final int _SC_XBS5_ILP32_OFF32 = placeholder(); 945 public static final int _SC_XBS5_ILP32_OFFBIG = placeholder(); 946 public static final int _SC_XBS5_LP64_OFF64 = placeholder(); 947 public static final int _SC_XBS5_LPBIG_OFFBIG = placeholder(); 948 public static final int _SC_XOPEN_CRYPT = placeholder(); 949 public static final int _SC_XOPEN_ENH_I18N = placeholder(); 950 public static final int _SC_XOPEN_LEGACY = placeholder(); 951 public static final int _SC_XOPEN_REALTIME = placeholder(); 952 public static final int _SC_XOPEN_REALTIME_THREADS = placeholder(); 953 public static final int _SC_XOPEN_SHM = placeholder(); 954 public static final int _SC_XOPEN_UNIX = placeholder(); 955 public static final int _SC_XOPEN_VERSION = placeholder(); 956 public static final int _SC_XOPEN_XCU_VERSION = placeholder(); 957 958 /** 959 * Returns the string name of a getaddrinfo(3) error value. 960 * For example, "EAI_AGAIN". 961 */ gaiName(int error)962 public static String gaiName(int error) { 963 if (error == EAI_AGAIN) { 964 return "EAI_AGAIN"; 965 } 966 if (error == EAI_BADFLAGS) { 967 return "EAI_BADFLAGS"; 968 } 969 if (error == EAI_FAIL) { 970 return "EAI_FAIL"; 971 } 972 if (error == EAI_FAMILY) { 973 return "EAI_FAMILY"; 974 } 975 if (error == EAI_MEMORY) { 976 return "EAI_MEMORY"; 977 } 978 if (error == EAI_NODATA) { 979 return "EAI_NODATA"; 980 } 981 if (error == EAI_NONAME) { 982 return "EAI_NONAME"; 983 } 984 if (error == EAI_OVERFLOW) { 985 return "EAI_OVERFLOW"; 986 } 987 if (error == EAI_SERVICE) { 988 return "EAI_SERVICE"; 989 } 990 if (error == EAI_SOCKTYPE) { 991 return "EAI_SOCKTYPE"; 992 } 993 if (error == EAI_SYSTEM) { 994 return "EAI_SYSTEM"; 995 } 996 return null; 997 } 998 999 /** 1000 * Returns the string name of an errno value. 1001 * For example, "EACCES". See {@link Os#strerror} for human-readable errno descriptions. 1002 */ errnoName(int errno)1003 public static String errnoName(int errno) { 1004 if (errno == E2BIG) { 1005 return "E2BIG"; 1006 } 1007 if (errno == EACCES) { 1008 return "EACCES"; 1009 } 1010 if (errno == EADDRINUSE) { 1011 return "EADDRINUSE"; 1012 } 1013 if (errno == EADDRNOTAVAIL) { 1014 return "EADDRNOTAVAIL"; 1015 } 1016 if (errno == EAFNOSUPPORT) { 1017 return "EAFNOSUPPORT"; 1018 } 1019 if (errno == EAGAIN) { 1020 return "EAGAIN"; 1021 } 1022 if (errno == EALREADY) { 1023 return "EALREADY"; 1024 } 1025 if (errno == EBADF) { 1026 return "EBADF"; 1027 } 1028 if (errno == EBADMSG) { 1029 return "EBADMSG"; 1030 } 1031 if (errno == EBUSY) { 1032 return "EBUSY"; 1033 } 1034 if (errno == ECANCELED) { 1035 return "ECANCELED"; 1036 } 1037 if (errno == ECHILD) { 1038 return "ECHILD"; 1039 } 1040 if (errno == ECONNABORTED) { 1041 return "ECONNABORTED"; 1042 } 1043 if (errno == ECONNREFUSED) { 1044 return "ECONNREFUSED"; 1045 } 1046 if (errno == ECONNRESET) { 1047 return "ECONNRESET"; 1048 } 1049 if (errno == EDEADLK) { 1050 return "EDEADLK"; 1051 } 1052 if (errno == EDESTADDRREQ) { 1053 return "EDESTADDRREQ"; 1054 } 1055 if (errno == EDOM) { 1056 return "EDOM"; 1057 } 1058 if (errno == EDQUOT) { 1059 return "EDQUOT"; 1060 } 1061 if (errno == EEXIST) { 1062 return "EEXIST"; 1063 } 1064 if (errno == EFAULT) { 1065 return "EFAULT"; 1066 } 1067 if (errno == EFBIG) { 1068 return "EFBIG"; 1069 } 1070 if (errno == EHOSTUNREACH) { 1071 return "EHOSTUNREACH"; 1072 } 1073 if (errno == EIDRM) { 1074 return "EIDRM"; 1075 } 1076 if (errno == EILSEQ) { 1077 return "EILSEQ"; 1078 } 1079 if (errno == EINPROGRESS) { 1080 return "EINPROGRESS"; 1081 } 1082 if (errno == EINTR) { 1083 return "EINTR"; 1084 } 1085 if (errno == EINVAL) { 1086 return "EINVAL"; 1087 } 1088 if (errno == EIO) { 1089 return "EIO"; 1090 } 1091 if (errno == EISCONN) { 1092 return "EISCONN"; 1093 } 1094 if (errno == EISDIR) { 1095 return "EISDIR"; 1096 } 1097 if (errno == ELOOP) { 1098 return "ELOOP"; 1099 } 1100 if (errno == EMFILE) { 1101 return "EMFILE"; 1102 } 1103 if (errno == EMLINK) { 1104 return "EMLINK"; 1105 } 1106 if (errno == EMSGSIZE) { 1107 return "EMSGSIZE"; 1108 } 1109 if (errno == EMULTIHOP) { 1110 return "EMULTIHOP"; 1111 } 1112 if (errno == ENAMETOOLONG) { 1113 return "ENAMETOOLONG"; 1114 } 1115 if (errno == ENETDOWN) { 1116 return "ENETDOWN"; 1117 } 1118 if (errno == ENETRESET) { 1119 return "ENETRESET"; 1120 } 1121 if (errno == ENETUNREACH) { 1122 return "ENETUNREACH"; 1123 } 1124 if (errno == ENFILE) { 1125 return "ENFILE"; 1126 } 1127 if (errno == ENOBUFS) { 1128 return "ENOBUFS"; 1129 } 1130 if (errno == ENODATA) { 1131 return "ENODATA"; 1132 } 1133 if (errno == ENODEV) { 1134 return "ENODEV"; 1135 } 1136 if (errno == ENOENT) { 1137 return "ENOENT"; 1138 } 1139 if (errno == ENOEXEC) { 1140 return "ENOEXEC"; 1141 } 1142 if (errno == ENOLCK) { 1143 return "ENOLCK"; 1144 } 1145 if (errno == ENOLINK) { 1146 return "ENOLINK"; 1147 } 1148 if (errno == ENOMEM) { 1149 return "ENOMEM"; 1150 } 1151 if (errno == ENOMSG) { 1152 return "ENOMSG"; 1153 } 1154 if (errno == ENONET) { 1155 return "ENONET"; 1156 } 1157 if (errno == ENOPROTOOPT) { 1158 return "ENOPROTOOPT"; 1159 } 1160 if (errno == ENOSPC) { 1161 return "ENOSPC"; 1162 } 1163 if (errno == ENOSR) { 1164 return "ENOSR"; 1165 } 1166 if (errno == ENOSTR) { 1167 return "ENOSTR"; 1168 } 1169 if (errno == ENOSYS) { 1170 return "ENOSYS"; 1171 } 1172 if (errno == ENOTCONN) { 1173 return "ENOTCONN"; 1174 } 1175 if (errno == ENOTDIR) { 1176 return "ENOTDIR"; 1177 } 1178 if (errno == ENOTEMPTY) { 1179 return "ENOTEMPTY"; 1180 } 1181 if (errno == ENOTSOCK) { 1182 return "ENOTSOCK"; 1183 } 1184 if (errno == ENOTSUP) { 1185 return "ENOTSUP"; 1186 } 1187 if (errno == ENOTTY) { 1188 return "ENOTTY"; 1189 } 1190 if (errno == ENXIO) { 1191 return "ENXIO"; 1192 } 1193 if (errno == EOPNOTSUPP) { 1194 return "EOPNOTSUPP"; 1195 } 1196 if (errno == EOVERFLOW) { 1197 return "EOVERFLOW"; 1198 } 1199 if (errno == EPERM) { 1200 return "EPERM"; 1201 } 1202 if (errno == EPIPE) { 1203 return "EPIPE"; 1204 } 1205 if (errno == EPROTO) { 1206 return "EPROTO"; 1207 } 1208 if (errno == EPROTONOSUPPORT) { 1209 return "EPROTONOSUPPORT"; 1210 } 1211 if (errno == EPROTOTYPE) { 1212 return "EPROTOTYPE"; 1213 } 1214 if (errno == ERANGE) { 1215 return "ERANGE"; 1216 } 1217 if (errno == EROFS) { 1218 return "EROFS"; 1219 } 1220 if (errno == ESPIPE) { 1221 return "ESPIPE"; 1222 } 1223 if (errno == ESRCH) { 1224 return "ESRCH"; 1225 } 1226 if (errno == ESTALE) { 1227 return "ESTALE"; 1228 } 1229 if (errno == ETIME) { 1230 return "ETIME"; 1231 } 1232 if (errno == ETIMEDOUT) { 1233 return "ETIMEDOUT"; 1234 } 1235 if (errno == ETXTBSY) { 1236 return "ETXTBSY"; 1237 } 1238 if (errno == EXDEV) { 1239 return "EXDEV"; 1240 } 1241 return null; 1242 } 1243 1244 // [ravenwood-change] Moved to a nested class. 1245 // @UnsupportedAppUsage 1246 static class Native { initConstants()1247 private static native void initConstants(); 1248 } 1249 1250 // A hack to avoid these constants being inlined by javac... 1251 // @UnsupportedAppUsage placeholder()1252 private static int placeholder() { return 0; } 1253 // ...because we want to initialize them at runtime. 1254 static { 1255 // [ravenwood-change] Load the JNI lib. RavenwoodCommonUtils.loadRavenwoodNativeRuntime()1256 RavenwoodCommonUtils.loadRavenwoodNativeRuntime(); Native.initConstants()1257 Native.initConstants(); 1258 } 1259 } 1260