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