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