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