1 /*
2  * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 only, as
8  * published by the Free Software Foundation.  Oracle designates this
9  * particular file as subject to the "Classpath" exception as provided
10  * by Oracle in the LICENSE file that accompanied this code.
11  *
12  * This code is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  * version 2 for more details (a copy is included in the LICENSE file that
16  * accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License version
19  * 2 along with this work; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23  * or visit www.oracle.com if you need additional information or have any
24  * questions.
25  *
26  */
27 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
28 package sun.nio.fs;
29 
30 import android.system.OsConstants;
31 
32 import java.io.ObjectStreamClass;
33 
34 class UnixConstants {
35 
UnixConstants()36     private UnixConstants() {
37     }
38 
39     // Android-changed (http://b/32203242): Instead of maintaining a separate set of UnixConstants,
40     // use the values from android.system.OsConstants.  AT_SYMLINK_NOFOLLOW is used by fstatat when
41     // a symbolic link is passed. With AT_SYMLINK_NOLLOW, it doesn't dereference and instead return
42     // information about the link, and with it, returns the information about the target. There is
43     // no suitable alternative for the flag in android.system.OsConstant, therefore, left untouched.
44     // With AT_REMOVEDIR, unlinkat works equivalent to rmdir. Again there is no suitable alternative
45     // for the flag in android.system.OsConstant, therefore, left unchanged.
46     static final int O_RDONLY = OsConstants.O_RDONLY;
47 
48     static final int O_WRONLY = OsConstants.O_WRONLY;
49 
50     static final int O_RDWR = OsConstants.O_RDWR;
51 
52     static final int O_APPEND = OsConstants.O_APPEND;
53 
54     static final int O_CREAT = OsConstants.O_CREAT;
55 
56     static final int O_EXCL = OsConstants.O_EXCL;
57 
58     static final int O_TRUNC = OsConstants.O_TRUNC;
59 
60     static final int O_SYNC = OsConstants.O_SYNC;
61 
62     static final int O_DSYNC = OsConstants.O_DSYNC;
63 
64     static final int O_NOFOLLOW = OsConstants.O_NOFOLLOW;
65 
66     static final int S_IAMB = get_S_IAMB();
67 
68     static final int S_IRUSR = OsConstants.S_IRUSR;
69 
70     static final int S_IWUSR = OsConstants.S_IWUSR;
71 
72     static final int S_IXUSR = OsConstants.S_IXUSR;
73 
74     static final int S_IRGRP = OsConstants.S_IRGRP;
75 
76     static final int S_IWGRP = OsConstants.S_IWGRP;
77 
78     static final int S_IXGRP = OsConstants.S_IXGRP;
79 
80     static final int S_IROTH = OsConstants.S_IROTH;
81 
82     static final int S_IWOTH = OsConstants.S_IWOTH;
83 
84     static final int S_IXOTH = OsConstants.S_IXOTH;
85 
86     static final int S_IFMT = OsConstants.S_IFMT;
87 
88     static final int S_IFREG = OsConstants.S_IFREG;
89 
90     static final int S_IFDIR = OsConstants.S_IFDIR;
91 
92     static final int S_IFLNK = OsConstants.S_IFLNK;
93 
94     static final int S_IFCHR = OsConstants.S_IFCHR;
95 
96     static final int S_IFBLK = OsConstants.S_IFBLK;
97 
98     static final int S_IFIFO = OsConstants.S_IFIFO;
99 
100     static final int R_OK = OsConstants.R_OK;
101 
102     static final int W_OK = OsConstants.W_OK;
103 
104     static final int X_OK = OsConstants.X_OK;
105 
106     static final int F_OK = OsConstants.F_OK;
107 
108     static final int ENOENT = OsConstants.ENOENT;
109 
110     static final int EACCES = OsConstants.EACCES;
111 
112     static final int EEXIST = OsConstants.EEXIST;
113 
114     static final int ENOTDIR = OsConstants.ENOTDIR;
115 
116     static final int EINVAL = OsConstants.EINVAL;
117 
118     static final int EXDEV = OsConstants.EXDEV;
119 
120     static final int EISDIR = OsConstants.EISDIR;
121 
122     static final int ENOTEMPTY = OsConstants.ENOTEMPTY;
123 
124     static final int ENOSPC = OsConstants.ENOSPC;
125 
126     static final int EAGAIN = OsConstants.EAGAIN;
127 
128     static final int ENOSYS = OsConstants.ENOSYS;
129 
130     static final int ELOOP = OsConstants.ELOOP;
131 
132     static final int EROFS = OsConstants.EROFS;
133 
134     static final int ENODATA = OsConstants.ENODATA;
135 
136     static final int ERANGE = OsConstants.ERANGE;
137 
138     static final int EMFILE = OsConstants.EMFILE;
139 
140     static final int AT_SYMLINK_NOFOLLOW = 0x100;
141 
142     static final int AT_REMOVEDIR = 0x200;
143 
144     // S_IAMB are access mode bits, therefore, calculated by taking OR of all the read, write and
145     // execute permissions bits for owner, group and other.
get_S_IAMB()146     private static int get_S_IAMB() {
147         return (OsConstants.S_IRUSR | OsConstants.S_IWUSR | OsConstants.S_IXUSR |
148                 OsConstants.S_IRGRP | OsConstants.S_IWGRP | OsConstants.S_IXGRP |
149                 OsConstants.S_IROTH | OsConstants.S_IWOTH | OsConstants.S_IXOTH);
150     }
151 }
152