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 /** 20 * Constants and helper functions for use with {@link Os}. 21 */ 22 public final class OsConstants { OsConstants()23 private OsConstants() { 24 } 25 26 /** 27 * Tests whether the given mode is a block device. 28 */ S_ISBLK(int mode)29 public static boolean S_ISBLK(int mode) { return (mode & S_IFMT) == S_IFBLK; } 30 31 /** 32 * Tests whether the given mode is a character device. 33 */ S_ISCHR(int mode)34 public static boolean S_ISCHR(int mode) { return (mode & S_IFMT) == S_IFCHR; } 35 36 /** 37 * Tests whether the given mode is a directory. 38 */ S_ISDIR(int mode)39 public static boolean S_ISDIR(int mode) { return (mode & S_IFMT) == S_IFDIR; } 40 41 /** 42 * Tests whether the given mode is a FIFO. 43 */ S_ISFIFO(int mode)44 public static boolean S_ISFIFO(int mode) { return (mode & S_IFMT) == S_IFIFO; } 45 46 /** 47 * Tests whether the given mode is a regular file. 48 */ S_ISREG(int mode)49 public static boolean S_ISREG(int mode) { return (mode & S_IFMT) == S_IFREG; } 50 51 /** 52 * Tests whether the given mode is a symbolic link. 53 */ S_ISLNK(int mode)54 public static boolean S_ISLNK(int mode) { return (mode & S_IFMT) == S_IFLNK; } 55 56 /** 57 * Tests whether the given mode is a socket. 58 */ S_ISSOCK(int mode)59 public static boolean S_ISSOCK(int mode) { return (mode & S_IFMT) == S_IFSOCK; } 60 61 /** 62 * Extracts the exit status of a child. Only valid if WIFEXITED returns true. 63 */ WEXITSTATUS(int status)64 public static int WEXITSTATUS(int status) { return (status & 0xff00) >> 8; } 65 66 /** 67 * Tests whether the child dumped core. Only valid if WIFSIGNALED returns true. 68 */ WCOREDUMP(int status)69 public static boolean WCOREDUMP(int status) { return (status & 0x80) != 0; } 70 71 /** 72 * Returns the signal that caused the child to exit. Only valid if WIFSIGNALED returns true. 73 */ WTERMSIG(int status)74 public static int WTERMSIG(int status) { return status & 0x7f; } 75 76 /** 77 * Returns the signal that cause the child to stop. Only valid if WIFSTOPPED returns true. 78 */ WSTOPSIG(int status)79 public static int WSTOPSIG(int status) { return WEXITSTATUS(status); } 80 81 /** 82 * Tests whether the child exited normally. 83 */ WIFEXITED(int status)84 public static boolean WIFEXITED(int status) { return (WTERMSIG(status) == 0); } 85 86 /** 87 * Tests whether the child was stopped (not terminated) by a signal. 88 */ WIFSTOPPED(int status)89 public static boolean WIFSTOPPED(int status) { return (WTERMSIG(status) == 0x7f); } 90 91 /** 92 * Tests whether the child was terminated by a signal. 93 */ WIFSIGNALED(int status)94 public static boolean WIFSIGNALED(int status) { return (WTERMSIG(status + 1) >= 2); } 95 96 public static final int AF_INET = placeholder(); 97 public static final int AF_INET6 = placeholder(); 98 public static final int AF_UNIX = placeholder(); 99 public static final int AF_UNSPEC = placeholder(); 100 public static final int AI_ADDRCONFIG = placeholder(); 101 public static final int AI_ALL = placeholder(); 102 public static final int AI_CANONNAME = placeholder(); 103 public static final int AI_NUMERICHOST = placeholder(); 104 public static final int AI_NUMERICSERV = placeholder(); 105 public static final int AI_PASSIVE = placeholder(); 106 public static final int AI_V4MAPPED = placeholder(); 107 public static final int CAP_AUDIT_CONTROL = placeholder(); 108 public static final int CAP_AUDIT_WRITE = placeholder(); 109 public static final int CAP_BLOCK_SUSPEND = placeholder(); 110 public static final int CAP_CHOWN = placeholder(); 111 public static final int CAP_DAC_OVERRIDE = placeholder(); 112 public static final int CAP_DAC_READ_SEARCH = placeholder(); 113 public static final int CAP_FOWNER = placeholder(); 114 public static final int CAP_FSETID = placeholder(); 115 public static final int CAP_IPC_LOCK = placeholder(); 116 public static final int CAP_IPC_OWNER = placeholder(); 117 public static final int CAP_KILL = placeholder(); 118 public static final int CAP_LAST_CAP = placeholder(); 119 public static final int CAP_LEASE = placeholder(); 120 public static final int CAP_LINUX_IMMUTABLE = placeholder(); 121 public static final int CAP_MAC_ADMIN = placeholder(); 122 public static final int CAP_MAC_OVERRIDE = placeholder(); 123 public static final int CAP_MKNOD = placeholder(); 124 public static final int CAP_NET_ADMIN = placeholder(); 125 public static final int CAP_NET_BIND_SERVICE = placeholder(); 126 public static final int CAP_NET_BROADCAST = placeholder(); 127 public static final int CAP_NET_RAW = placeholder(); 128 public static final int CAP_SETFCAP = placeholder(); 129 public static final int CAP_SETGID = placeholder(); 130 public static final int CAP_SETPCAP = placeholder(); 131 public static final int CAP_SETUID = placeholder(); 132 public static final int CAP_SYS_ADMIN = placeholder(); 133 public static final int CAP_SYS_BOOT = placeholder(); 134 public static final int CAP_SYS_CHROOT = placeholder(); 135 public static final int CAP_SYSLOG = placeholder(); 136 public static final int CAP_SYS_MODULE = placeholder(); 137 public static final int CAP_SYS_NICE = placeholder(); 138 public static final int CAP_SYS_PACCT = placeholder(); 139 public static final int CAP_SYS_PTRACE = placeholder(); 140 public static final int CAP_SYS_RAWIO = placeholder(); 141 public static final int CAP_SYS_RESOURCE = placeholder(); 142 public static final int CAP_SYS_TIME = placeholder(); 143 public static final int CAP_SYS_TTY_CONFIG = placeholder(); 144 public static final int CAP_WAKE_ALARM = placeholder(); 145 public static final int E2BIG = placeholder(); 146 public static final int EACCES = placeholder(); 147 public static final int EADDRINUSE = placeholder(); 148 public static final int EADDRNOTAVAIL = placeholder(); 149 public static final int EAFNOSUPPORT = placeholder(); 150 public static final int EAGAIN = placeholder(); 151 public static final int EAI_AGAIN = placeholder(); 152 public static final int EAI_BADFLAGS = placeholder(); 153 public static final int EAI_FAIL = placeholder(); 154 public static final int EAI_FAMILY = placeholder(); 155 public static final int EAI_MEMORY = placeholder(); 156 public static final int EAI_NODATA = placeholder(); 157 public static final int EAI_NONAME = placeholder(); 158 public static final int EAI_OVERFLOW = placeholder(); 159 public static final int EAI_SERVICE = placeholder(); 160 public static final int EAI_SOCKTYPE = placeholder(); 161 public static final int EAI_SYSTEM = placeholder(); 162 public static final int EALREADY = placeholder(); 163 public static final int EBADF = placeholder(); 164 public static final int EBADMSG = placeholder(); 165 public static final int EBUSY = placeholder(); 166 public static final int ECANCELED = placeholder(); 167 public static final int ECHILD = placeholder(); 168 public static final int ECONNABORTED = placeholder(); 169 public static final int ECONNREFUSED = placeholder(); 170 public static final int ECONNRESET = placeholder(); 171 public static final int EDEADLK = placeholder(); 172 public static final int EDESTADDRREQ = placeholder(); 173 public static final int EDOM = placeholder(); 174 public static final int EDQUOT = placeholder(); 175 public static final int EEXIST = placeholder(); 176 public static final int EFAULT = placeholder(); 177 public static final int EFBIG = placeholder(); 178 public static final int EHOSTUNREACH = placeholder(); 179 public static final int EIDRM = placeholder(); 180 public static final int EILSEQ = placeholder(); 181 public static final int EINPROGRESS = placeholder(); 182 public static final int EINTR = placeholder(); 183 public static final int EINVAL = placeholder(); 184 public static final int EIO = placeholder(); 185 public static final int EISCONN = placeholder(); 186 public static final int EISDIR = placeholder(); 187 public static final int ELOOP = placeholder(); 188 public static final int EMFILE = placeholder(); 189 public static final int EMLINK = placeholder(); 190 public static final int EMSGSIZE = placeholder(); 191 public static final int EMULTIHOP = placeholder(); 192 public static final int ENAMETOOLONG = placeholder(); 193 public static final int ENETDOWN = placeholder(); 194 public static final int ENETRESET = placeholder(); 195 public static final int ENETUNREACH = placeholder(); 196 public static final int ENFILE = placeholder(); 197 public static final int ENOBUFS = placeholder(); 198 public static final int ENODATA = placeholder(); 199 public static final int ENODEV = placeholder(); 200 public static final int ENOENT = placeholder(); 201 public static final int ENOEXEC = placeholder(); 202 public static final int ENOLCK = placeholder(); 203 public static final int ENOLINK = placeholder(); 204 public static final int ENOMEM = placeholder(); 205 public static final int ENOMSG = placeholder(); 206 public static final int ENOPROTOOPT = placeholder(); 207 public static final int ENOSPC = placeholder(); 208 public static final int ENOSR = placeholder(); 209 public static final int ENOSTR = placeholder(); 210 public static final int ENOSYS = placeholder(); 211 public static final int ENOTCONN = placeholder(); 212 public static final int ENOTDIR = placeholder(); 213 public static final int ENOTEMPTY = placeholder(); 214 public static final int ENOTSOCK = placeholder(); 215 public static final int ENOTSUP = placeholder(); 216 public static final int ENOTTY = placeholder(); 217 public static final int ENXIO = placeholder(); 218 public static final int EOPNOTSUPP = placeholder(); 219 public static final int EOVERFLOW = placeholder(); 220 public static final int EPERM = placeholder(); 221 public static final int EPIPE = placeholder(); 222 public static final int EPROTO = placeholder(); 223 public static final int EPROTONOSUPPORT = placeholder(); 224 public static final int EPROTOTYPE = placeholder(); 225 public static final int ERANGE = placeholder(); 226 public static final int EROFS = placeholder(); 227 public static final int ESPIPE = placeholder(); 228 public static final int ESRCH = placeholder(); 229 public static final int ESTALE = placeholder(); 230 public static final int ETIME = placeholder(); 231 public static final int ETIMEDOUT = placeholder(); 232 public static final int ETXTBSY = placeholder(); 233 // On Linux, EWOULDBLOCK == EAGAIN. Use EAGAIN instead, to reduce confusion. 234 public static final int EXDEV = placeholder(); 235 public static final int EXIT_FAILURE = placeholder(); 236 public static final int EXIT_SUCCESS = placeholder(); 237 public static final int FD_CLOEXEC = placeholder(); 238 public static final int FIONREAD = placeholder(); 239 public static final int F_DUPFD = placeholder(); 240 public static final int F_GETFD = placeholder(); 241 public static final int F_GETFL = placeholder(); 242 public static final int F_GETLK = placeholder(); 243 public static final int F_GETLK64 = placeholder(); 244 public static final int F_GETOWN = placeholder(); 245 public static final int F_OK = placeholder(); 246 public static final int F_RDLCK = placeholder(); 247 public static final int F_SETFD = placeholder(); 248 public static final int F_SETFL = placeholder(); 249 public static final int F_SETLK = placeholder(); 250 public static final int F_SETLK64 = placeholder(); 251 public static final int F_SETLKW = placeholder(); 252 public static final int F_SETLKW64 = placeholder(); 253 public static final int F_SETOWN = placeholder(); 254 public static final int F_UNLCK = placeholder(); 255 public static final int F_WRLCK = placeholder(); 256 public static final int IFA_F_DADFAILED = placeholder(); 257 public static final int IFA_F_DEPRECATED = placeholder(); 258 public static final int IFA_F_HOMEADDRESS = placeholder(); 259 public static final int IFA_F_NODAD = placeholder(); 260 public static final int IFA_F_OPTIMISTIC = placeholder(); 261 public static final int IFA_F_PERMANENT = placeholder(); 262 public static final int IFA_F_SECONDARY = placeholder(); 263 public static final int IFA_F_TEMPORARY = placeholder(); 264 public static final int IFA_F_TENTATIVE = placeholder(); 265 public static final int IFF_ALLMULTI = placeholder(); 266 public static final int IFF_AUTOMEDIA = placeholder(); 267 public static final int IFF_BROADCAST = placeholder(); 268 public static final int IFF_DEBUG = placeholder(); 269 public static final int IFF_DYNAMIC = placeholder(); 270 public static final int IFF_LOOPBACK = placeholder(); 271 public static final int IFF_MASTER = placeholder(); 272 public static final int IFF_MULTICAST = placeholder(); 273 public static final int IFF_NOARP = placeholder(); 274 public static final int IFF_NOTRAILERS = placeholder(); 275 public static final int IFF_POINTOPOINT = placeholder(); 276 public static final int IFF_PORTSEL = placeholder(); 277 public static final int IFF_PROMISC = placeholder(); 278 public static final int IFF_RUNNING = placeholder(); 279 public static final int IFF_SLAVE = placeholder(); 280 public static final int IFF_UP = placeholder(); 281 public static final int IPPROTO_ICMP = placeholder(); 282 public static final int IPPROTO_ICMPV6 = placeholder(); 283 public static final int IPPROTO_IP = placeholder(); 284 public static final int IPPROTO_IPV6 = placeholder(); 285 public static final int IPPROTO_RAW = placeholder(); 286 public static final int IPPROTO_TCP = placeholder(); 287 public static final int IPPROTO_UDP = placeholder(); 288 public static final int IPV6_CHECKSUM = placeholder(); 289 public static final int IPV6_MULTICAST_HOPS = placeholder(); 290 public static final int IPV6_MULTICAST_IF = placeholder(); 291 public static final int IPV6_MULTICAST_LOOP = placeholder(); 292 public static final int IPV6_RECVDSTOPTS = placeholder(); 293 public static final int IPV6_RECVHOPLIMIT = placeholder(); 294 public static final int IPV6_RECVHOPOPTS = placeholder(); 295 public static final int IPV6_RECVPKTINFO = placeholder(); 296 public static final int IPV6_RECVRTHDR = placeholder(); 297 public static final int IPV6_RECVTCLASS = placeholder(); 298 public static final int IPV6_TCLASS = placeholder(); 299 public static final int IPV6_UNICAST_HOPS = placeholder(); 300 public static final int IPV6_V6ONLY = placeholder(); 301 public static final int IP_MULTICAST_IF = placeholder(); 302 public static final int IP_MULTICAST_LOOP = placeholder(); 303 public static final int IP_MULTICAST_TTL = placeholder(); 304 public static final int IP_TOS = placeholder(); 305 public static final int IP_TTL = placeholder(); 306 public static final int MAP_FIXED = placeholder(); 307 public static final int MAP_PRIVATE = placeholder(); 308 public static final int MAP_SHARED = placeholder(); 309 public static final int MCAST_JOIN_GROUP = placeholder(); 310 public static final int MCAST_LEAVE_GROUP = placeholder(); 311 public static final int MCAST_JOIN_SOURCE_GROUP = placeholder(); 312 public static final int MCAST_LEAVE_SOURCE_GROUP = placeholder(); 313 public static final int MCAST_BLOCK_SOURCE = placeholder(); 314 public static final int MCAST_UNBLOCK_SOURCE = placeholder(); 315 public static final int MCL_CURRENT = placeholder(); 316 public static final int MCL_FUTURE = placeholder(); 317 public static final int MSG_CTRUNC = placeholder(); 318 public static final int MSG_DONTROUTE = placeholder(); 319 public static final int MSG_EOR = placeholder(); 320 public static final int MSG_OOB = placeholder(); 321 public static final int MSG_PEEK = placeholder(); 322 public static final int MSG_TRUNC = placeholder(); 323 public static final int MSG_WAITALL = placeholder(); 324 public static final int MS_ASYNC = placeholder(); 325 public static final int MS_INVALIDATE = placeholder(); 326 public static final int MS_SYNC = placeholder(); 327 public static final int NI_DGRAM = placeholder(); 328 public static final int NI_NAMEREQD = placeholder(); 329 public static final int NI_NOFQDN = placeholder(); 330 public static final int NI_NUMERICHOST = placeholder(); 331 public static final int NI_NUMERICSERV = placeholder(); 332 public static final int O_ACCMODE = placeholder(); 333 public static final int O_APPEND = placeholder(); 334 public static final int O_CREAT = placeholder(); 335 public static final int O_EXCL = placeholder(); 336 public static final int O_NOCTTY = placeholder(); 337 public static final int O_NOFOLLOW = placeholder(); 338 public static final int O_NONBLOCK = placeholder(); 339 public static final int O_RDONLY = placeholder(); 340 public static final int O_RDWR = placeholder(); 341 public static final int O_SYNC = placeholder(); 342 public static final int O_TRUNC = placeholder(); 343 public static final int O_WRONLY = placeholder(); 344 public static final int POLLERR = placeholder(); 345 public static final int POLLHUP = placeholder(); 346 public static final int POLLIN = placeholder(); 347 public static final int POLLNVAL = placeholder(); 348 public static final int POLLOUT = placeholder(); 349 public static final int POLLPRI = placeholder(); 350 public static final int POLLRDBAND = placeholder(); 351 public static final int POLLRDNORM = placeholder(); 352 public static final int POLLWRBAND = placeholder(); 353 public static final int POLLWRNORM = placeholder(); 354 public static final int PR_GET_DUMPABLE = placeholder(); 355 public static final int PR_SET_DUMPABLE = placeholder(); 356 public static final int PR_SET_NO_NEW_PRIVS = placeholder(); 357 public static final int PROT_EXEC = placeholder(); 358 public static final int PROT_NONE = placeholder(); 359 public static final int PROT_READ = placeholder(); 360 public static final int PROT_WRITE = placeholder(); 361 public static final int R_OK = placeholder(); 362 public static final int RT_SCOPE_HOST = placeholder(); 363 public static final int RT_SCOPE_LINK = placeholder(); 364 public static final int RT_SCOPE_NOWHERE = placeholder(); 365 public static final int RT_SCOPE_SITE = placeholder(); 366 public static final int RT_SCOPE_UNIVERSE = placeholder(); 367 public static final int SEEK_CUR = placeholder(); 368 public static final int SEEK_END = placeholder(); 369 public static final int SEEK_SET = placeholder(); 370 public static final int SHUT_RD = placeholder(); 371 public static final int SHUT_RDWR = placeholder(); 372 public static final int SHUT_WR = placeholder(); 373 public static final int SIGABRT = placeholder(); 374 public static final int SIGALRM = placeholder(); 375 public static final int SIGBUS = placeholder(); 376 public static final int SIGCHLD = placeholder(); 377 public static final int SIGCONT = placeholder(); 378 public static final int SIGFPE = placeholder(); 379 public static final int SIGHUP = placeholder(); 380 public static final int SIGILL = placeholder(); 381 public static final int SIGINT = placeholder(); 382 public static final int SIGIO = placeholder(); 383 public static final int SIGKILL = placeholder(); 384 public static final int SIGPIPE = placeholder(); 385 public static final int SIGPROF = placeholder(); 386 public static final int SIGPWR = placeholder(); 387 public static final int SIGQUIT = placeholder(); 388 public static final int SIGRTMAX = placeholder(); 389 public static final int SIGRTMIN = placeholder(); 390 public static final int SIGSEGV = placeholder(); 391 public static final int SIGSTKFLT = placeholder(); 392 public static final int SIGSTOP = placeholder(); 393 public static final int SIGSYS = placeholder(); 394 public static final int SIGTERM = placeholder(); 395 public static final int SIGTRAP = placeholder(); 396 public static final int SIGTSTP = placeholder(); 397 public static final int SIGTTIN = placeholder(); 398 public static final int SIGTTOU = placeholder(); 399 public static final int SIGURG = placeholder(); 400 public static final int SIGUSR1 = placeholder(); 401 public static final int SIGUSR2 = placeholder(); 402 public static final int SIGVTALRM = placeholder(); 403 public static final int SIGWINCH = placeholder(); 404 public static final int SIGXCPU = placeholder(); 405 public static final int SIGXFSZ = placeholder(); 406 public static final int SIOCGIFADDR = placeholder(); 407 public static final int SIOCGIFBRDADDR = placeholder(); 408 public static final int SIOCGIFDSTADDR = placeholder(); 409 public static final int SIOCGIFNETMASK = placeholder(); 410 public static final int SOCK_DGRAM = placeholder(); 411 public static final int SOCK_RAW = placeholder(); 412 public static final int SOCK_SEQPACKET = placeholder(); 413 public static final int SOCK_STREAM = placeholder(); 414 public static final int SOL_SOCKET = placeholder(); 415 public static final int SO_BINDTODEVICE = placeholder(); 416 public static final int SO_BROADCAST = placeholder(); 417 public static final int SO_DEBUG = placeholder(); 418 public static final int SO_DONTROUTE = placeholder(); 419 public static final int SO_ERROR = placeholder(); 420 public static final int SO_KEEPALIVE = placeholder(); 421 public static final int SO_LINGER = placeholder(); 422 public static final int SO_OOBINLINE = placeholder(); 423 public static final int SO_PASSCRED = placeholder(); 424 public static final int SO_PEERCRED = placeholder(); 425 public static final int SO_RCVBUF = placeholder(); 426 public static final int SO_RCVLOWAT = placeholder(); 427 public static final int SO_RCVTIMEO = placeholder(); 428 public static final int SO_REUSEADDR = placeholder(); 429 public static final int SO_SNDBUF = placeholder(); 430 public static final int SO_SNDLOWAT = placeholder(); 431 public static final int SO_SNDTIMEO = placeholder(); 432 public static final int SO_TYPE = placeholder(); 433 public static final int STDERR_FILENO = placeholder(); 434 public static final int STDIN_FILENO = placeholder(); 435 public static final int STDOUT_FILENO = placeholder(); 436 public static final int S_IFBLK = placeholder(); 437 public static final int S_IFCHR = placeholder(); 438 public static final int S_IFDIR = placeholder(); 439 public static final int S_IFIFO = placeholder(); 440 public static final int S_IFLNK = placeholder(); 441 public static final int S_IFMT = placeholder(); 442 public static final int S_IFREG = placeholder(); 443 public static final int S_IFSOCK = placeholder(); 444 public static final int S_IRGRP = placeholder(); 445 public static final int S_IROTH = placeholder(); 446 public static final int S_IRUSR = placeholder(); 447 public static final int S_IRWXG = placeholder(); 448 public static final int S_IRWXO = placeholder(); 449 public static final int S_IRWXU = placeholder(); 450 public static final int S_ISGID = placeholder(); 451 public static final int S_ISUID = placeholder(); 452 public static final int S_ISVTX = placeholder(); 453 public static final int S_IWGRP = placeholder(); 454 public static final int S_IWOTH = placeholder(); 455 public static final int S_IWUSR = placeholder(); 456 public static final int S_IXGRP = placeholder(); 457 public static final int S_IXOTH = placeholder(); 458 public static final int S_IXUSR = placeholder(); 459 public static final int TCP_NODELAY = placeholder(); 460 public static final int WCONTINUED = placeholder(); 461 public static final int WEXITED = placeholder(); 462 public static final int WNOHANG = placeholder(); 463 public static final int WNOWAIT = placeholder(); 464 public static final int WSTOPPED = placeholder(); 465 public static final int WUNTRACED = placeholder(); 466 public static final int W_OK = placeholder(); 467 public static final int X_OK = placeholder(); 468 public static final int _SC_2_CHAR_TERM = placeholder(); 469 public static final int _SC_2_C_BIND = placeholder(); 470 public static final int _SC_2_C_DEV = placeholder(); 471 public static final int _SC_2_C_VERSION = placeholder(); 472 public static final int _SC_2_FORT_DEV = placeholder(); 473 public static final int _SC_2_FORT_RUN = placeholder(); 474 public static final int _SC_2_LOCALEDEF = placeholder(); 475 public static final int _SC_2_SW_DEV = placeholder(); 476 public static final int _SC_2_UPE = placeholder(); 477 public static final int _SC_2_VERSION = placeholder(); 478 public static final int _SC_AIO_LISTIO_MAX = placeholder(); 479 public static final int _SC_AIO_MAX = placeholder(); 480 public static final int _SC_AIO_PRIO_DELTA_MAX = placeholder(); 481 public static final int _SC_ARG_MAX = placeholder(); 482 public static final int _SC_ASYNCHRONOUS_IO = placeholder(); 483 public static final int _SC_ATEXIT_MAX = placeholder(); 484 public static final int _SC_AVPHYS_PAGES = placeholder(); 485 public static final int _SC_BC_BASE_MAX = placeholder(); 486 public static final int _SC_BC_DIM_MAX = placeholder(); 487 public static final int _SC_BC_SCALE_MAX = placeholder(); 488 public static final int _SC_BC_STRING_MAX = placeholder(); 489 public static final int _SC_CHILD_MAX = placeholder(); 490 public static final int _SC_CLK_TCK = placeholder(); 491 public static final int _SC_COLL_WEIGHTS_MAX = placeholder(); 492 public static final int _SC_DELAYTIMER_MAX = placeholder(); 493 public static final int _SC_EXPR_NEST_MAX = placeholder(); 494 public static final int _SC_FSYNC = placeholder(); 495 public static final int _SC_GETGR_R_SIZE_MAX = placeholder(); 496 public static final int _SC_GETPW_R_SIZE_MAX = placeholder(); 497 public static final int _SC_IOV_MAX = placeholder(); 498 public static final int _SC_JOB_CONTROL = placeholder(); 499 public static final int _SC_LINE_MAX = placeholder(); 500 public static final int _SC_LOGIN_NAME_MAX = placeholder(); 501 public static final int _SC_MAPPED_FILES = placeholder(); 502 public static final int _SC_MEMLOCK = placeholder(); 503 public static final int _SC_MEMLOCK_RANGE = placeholder(); 504 public static final int _SC_MEMORY_PROTECTION = placeholder(); 505 public static final int _SC_MESSAGE_PASSING = placeholder(); 506 public static final int _SC_MQ_OPEN_MAX = placeholder(); 507 public static final int _SC_MQ_PRIO_MAX = placeholder(); 508 public static final int _SC_NGROUPS_MAX = placeholder(); 509 public static final int _SC_NPROCESSORS_CONF = placeholder(); 510 public static final int _SC_NPROCESSORS_ONLN = placeholder(); 511 public static final int _SC_OPEN_MAX = placeholder(); 512 public static final int _SC_PAGESIZE = placeholder(); 513 public static final int _SC_PAGE_SIZE = placeholder(); 514 public static final int _SC_PASS_MAX = placeholder(); 515 public static final int _SC_PHYS_PAGES = placeholder(); 516 public static final int _SC_PRIORITIZED_IO = placeholder(); 517 public static final int _SC_PRIORITY_SCHEDULING = placeholder(); 518 public static final int _SC_REALTIME_SIGNALS = placeholder(); 519 public static final int _SC_RE_DUP_MAX = placeholder(); 520 public static final int _SC_RTSIG_MAX = placeholder(); 521 public static final int _SC_SAVED_IDS = placeholder(); 522 public static final int _SC_SEMAPHORES = placeholder(); 523 public static final int _SC_SEM_NSEMS_MAX = placeholder(); 524 public static final int _SC_SEM_VALUE_MAX = placeholder(); 525 public static final int _SC_SHARED_MEMORY_OBJECTS = placeholder(); 526 public static final int _SC_SIGQUEUE_MAX = placeholder(); 527 public static final int _SC_STREAM_MAX = placeholder(); 528 public static final int _SC_SYNCHRONIZED_IO = placeholder(); 529 public static final int _SC_THREADS = placeholder(); 530 public static final int _SC_THREAD_ATTR_STACKADDR = placeholder(); 531 public static final int _SC_THREAD_ATTR_STACKSIZE = placeholder(); 532 public static final int _SC_THREAD_DESTRUCTOR_ITERATIONS = placeholder(); 533 public static final int _SC_THREAD_KEYS_MAX = placeholder(); 534 public static final int _SC_THREAD_PRIORITY_SCHEDULING = placeholder(); 535 public static final int _SC_THREAD_PRIO_INHERIT = placeholder(); 536 public static final int _SC_THREAD_PRIO_PROTECT = placeholder(); 537 public static final int _SC_THREAD_SAFE_FUNCTIONS = placeholder(); 538 public static final int _SC_THREAD_STACK_MIN = placeholder(); 539 public static final int _SC_THREAD_THREADS_MAX = placeholder(); 540 public static final int _SC_TIMERS = placeholder(); 541 public static final int _SC_TIMER_MAX = placeholder(); 542 public static final int _SC_TTY_NAME_MAX = placeholder(); 543 public static final int _SC_TZNAME_MAX = placeholder(); 544 public static final int _SC_VERSION = placeholder(); 545 public static final int _SC_XBS5_ILP32_OFF32 = placeholder(); 546 public static final int _SC_XBS5_ILP32_OFFBIG = placeholder(); 547 public static final int _SC_XBS5_LP64_OFF64 = placeholder(); 548 public static final int _SC_XBS5_LPBIG_OFFBIG = placeholder(); 549 public static final int _SC_XOPEN_CRYPT = placeholder(); 550 public static final int _SC_XOPEN_ENH_I18N = placeholder(); 551 public static final int _SC_XOPEN_LEGACY = placeholder(); 552 public static final int _SC_XOPEN_REALTIME = placeholder(); 553 public static final int _SC_XOPEN_REALTIME_THREADS = placeholder(); 554 public static final int _SC_XOPEN_SHM = placeholder(); 555 public static final int _SC_XOPEN_UNIX = placeholder(); 556 public static final int _SC_XOPEN_VERSION = placeholder(); 557 public static final int _SC_XOPEN_XCU_VERSION = placeholder(); 558 559 /** 560 * Returns the string name of a getaddrinfo(3) error value. 561 * For example, "EAI_AGAIN". 562 */ gaiName(int error)563 public static String gaiName(int error) { 564 if (error == EAI_AGAIN) { 565 return "EAI_AGAIN"; 566 } 567 if (error == EAI_BADFLAGS) { 568 return "EAI_BADFLAGS"; 569 } 570 if (error == EAI_FAIL) { 571 return "EAI_FAIL"; 572 } 573 if (error == EAI_FAMILY) { 574 return "EAI_FAMILY"; 575 } 576 if (error == EAI_MEMORY) { 577 return "EAI_MEMORY"; 578 } 579 if (error == EAI_NODATA) { 580 return "EAI_NODATA"; 581 } 582 if (error == EAI_NONAME) { 583 return "EAI_NONAME"; 584 } 585 if (error == EAI_OVERFLOW) { 586 return "EAI_OVERFLOW"; 587 } 588 if (error == EAI_SERVICE) { 589 return "EAI_SERVICE"; 590 } 591 if (error == EAI_SOCKTYPE) { 592 return "EAI_SOCKTYPE"; 593 } 594 if (error == EAI_SYSTEM) { 595 return "EAI_SYSTEM"; 596 } 597 return null; 598 } 599 600 /** 601 * Returns the string name of an errno value. 602 * For example, "EACCES". See {@link Os#strerror} for human-readable errno descriptions. 603 */ errnoName(int errno)604 public static String errnoName(int errno) { 605 if (errno == E2BIG) { 606 return "E2BIG"; 607 } 608 if (errno == EACCES) { 609 return "EACCES"; 610 } 611 if (errno == EADDRINUSE) { 612 return "EADDRINUSE"; 613 } 614 if (errno == EADDRNOTAVAIL) { 615 return "EADDRNOTAVAIL"; 616 } 617 if (errno == EAFNOSUPPORT) { 618 return "EAFNOSUPPORT"; 619 } 620 if (errno == EAGAIN) { 621 return "EAGAIN"; 622 } 623 if (errno == EALREADY) { 624 return "EALREADY"; 625 } 626 if (errno == EBADF) { 627 return "EBADF"; 628 } 629 if (errno == EBADMSG) { 630 return "EBADMSG"; 631 } 632 if (errno == EBUSY) { 633 return "EBUSY"; 634 } 635 if (errno == ECANCELED) { 636 return "ECANCELED"; 637 } 638 if (errno == ECHILD) { 639 return "ECHILD"; 640 } 641 if (errno == ECONNABORTED) { 642 return "ECONNABORTED"; 643 } 644 if (errno == ECONNREFUSED) { 645 return "ECONNREFUSED"; 646 } 647 if (errno == ECONNRESET) { 648 return "ECONNRESET"; 649 } 650 if (errno == EDEADLK) { 651 return "EDEADLK"; 652 } 653 if (errno == EDESTADDRREQ) { 654 return "EDESTADDRREQ"; 655 } 656 if (errno == EDOM) { 657 return "EDOM"; 658 } 659 if (errno == EDQUOT) { 660 return "EDQUOT"; 661 } 662 if (errno == EEXIST) { 663 return "EEXIST"; 664 } 665 if (errno == EFAULT) { 666 return "EFAULT"; 667 } 668 if (errno == EFBIG) { 669 return "EFBIG"; 670 } 671 if (errno == EHOSTUNREACH) { 672 return "EHOSTUNREACH"; 673 } 674 if (errno == EIDRM) { 675 return "EIDRM"; 676 } 677 if (errno == EILSEQ) { 678 return "EILSEQ"; 679 } 680 if (errno == EINPROGRESS) { 681 return "EINPROGRESS"; 682 } 683 if (errno == EINTR) { 684 return "EINTR"; 685 } 686 if (errno == EINVAL) { 687 return "EINVAL"; 688 } 689 if (errno == EIO) { 690 return "EIO"; 691 } 692 if (errno == EISCONN) { 693 return "EISCONN"; 694 } 695 if (errno == EISDIR) { 696 return "EISDIR"; 697 } 698 if (errno == ELOOP) { 699 return "ELOOP"; 700 } 701 if (errno == EMFILE) { 702 return "EMFILE"; 703 } 704 if (errno == EMLINK) { 705 return "EMLINK"; 706 } 707 if (errno == EMSGSIZE) { 708 return "EMSGSIZE"; 709 } 710 if (errno == EMULTIHOP) { 711 return "EMULTIHOP"; 712 } 713 if (errno == ENAMETOOLONG) { 714 return "ENAMETOOLONG"; 715 } 716 if (errno == ENETDOWN) { 717 return "ENETDOWN"; 718 } 719 if (errno == ENETRESET) { 720 return "ENETRESET"; 721 } 722 if (errno == ENETUNREACH) { 723 return "ENETUNREACH"; 724 } 725 if (errno == ENFILE) { 726 return "ENFILE"; 727 } 728 if (errno == ENOBUFS) { 729 return "ENOBUFS"; 730 } 731 if (errno == ENODATA) { 732 return "ENODATA"; 733 } 734 if (errno == ENODEV) { 735 return "ENODEV"; 736 } 737 if (errno == ENOENT) { 738 return "ENOENT"; 739 } 740 if (errno == ENOEXEC) { 741 return "ENOEXEC"; 742 } 743 if (errno == ENOLCK) { 744 return "ENOLCK"; 745 } 746 if (errno == ENOLINK) { 747 return "ENOLINK"; 748 } 749 if (errno == ENOMEM) { 750 return "ENOMEM"; 751 } 752 if (errno == ENOMSG) { 753 return "ENOMSG"; 754 } 755 if (errno == ENOPROTOOPT) { 756 return "ENOPROTOOPT"; 757 } 758 if (errno == ENOSPC) { 759 return "ENOSPC"; 760 } 761 if (errno == ENOSR) { 762 return "ENOSR"; 763 } 764 if (errno == ENOSTR) { 765 return "ENOSTR"; 766 } 767 if (errno == ENOSYS) { 768 return "ENOSYS"; 769 } 770 if (errno == ENOTCONN) { 771 return "ENOTCONN"; 772 } 773 if (errno == ENOTDIR) { 774 return "ENOTDIR"; 775 } 776 if (errno == ENOTEMPTY) { 777 return "ENOTEMPTY"; 778 } 779 if (errno == ENOTSOCK) { 780 return "ENOTSOCK"; 781 } 782 if (errno == ENOTSUP) { 783 return "ENOTSUP"; 784 } 785 if (errno == ENOTTY) { 786 return "ENOTTY"; 787 } 788 if (errno == ENXIO) { 789 return "ENXIO"; 790 } 791 if (errno == EOPNOTSUPP) { 792 return "EOPNOTSUPP"; 793 } 794 if (errno == EOVERFLOW) { 795 return "EOVERFLOW"; 796 } 797 if (errno == EPERM) { 798 return "EPERM"; 799 } 800 if (errno == EPIPE) { 801 return "EPIPE"; 802 } 803 if (errno == EPROTO) { 804 return "EPROTO"; 805 } 806 if (errno == EPROTONOSUPPORT) { 807 return "EPROTONOSUPPORT"; 808 } 809 if (errno == EPROTOTYPE) { 810 return "EPROTOTYPE"; 811 } 812 if (errno == ERANGE) { 813 return "ERANGE"; 814 } 815 if (errno == EROFS) { 816 return "EROFS"; 817 } 818 if (errno == ESPIPE) { 819 return "ESPIPE"; 820 } 821 if (errno == ESRCH) { 822 return "ESRCH"; 823 } 824 if (errno == ESTALE) { 825 return "ESTALE"; 826 } 827 if (errno == ETIME) { 828 return "ETIME"; 829 } 830 if (errno == ETIMEDOUT) { 831 return "ETIMEDOUT"; 832 } 833 if (errno == ETXTBSY) { 834 return "ETXTBSY"; 835 } 836 if (errno == EXDEV) { 837 return "EXDEV"; 838 } 839 return null; 840 } 841 initConstants()842 private static native void initConstants(); 843 844 // A hack to avoid these constants being inlined by javac... placeholder()845 private static int placeholder() { return 0; } 846 // ...because we want to initialize them at runtime. 847 static { initConstants()848 initConstants(); 849 } 850 } 851