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