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 28 @@END_COPYRIGHT@@ 29 30 #include <stdio.h> 31 #include <errno.h> 32 #include <unistd.h> 33 #include <fcntl.h> 34 #include <sys/stat.h> 35 36 /* On Solaris, "sun" is defined as a macro. Undefine to make package 37 declaration valid */ 38 #undef sun 39 40 /* To be able to name the Java constants the same as the C constants without 41 having the preprocessor rewrite those identifiers, add PREFIX_ to all 42 identifiers matching a C constant. The PREFIX_ is filtered out in the 43 makefile. */ 44 45 @@START_HERE@@ 46 47 package sun.nio.fs; 48 class UnixConstants { 49 private UnixConstants() { } 53 static final int PREFIX_O_APPEND = O_APPEND; 54 static final int PREFIX_O_CREAT = O_CREAT; 55 static final int PREFIX_O_EXCL = O_EXCL; 56 static final int PREFIX_O_TRUNC = O_TRUNC; 57 static final int PREFIX_O_SYNC = O_SYNC; 58 59 #ifndef O_DSYNC 60 // At least FreeBSD doesn't define O_DSYNC 61 static final int PREFIX_O_DSYNC = O_SYNC; 62 #else 63 static final int PREFIX_O_DSYNC = O_DSYNC; 64 #endif 65 66 #ifdef O_NOFOLLOW 67 static final int PREFIX_O_NOFOLLOW = O_NOFOLLOW; 68 #else 69 // not supported (dummy values will not be used at runtime). 70 static final int PREFIX_O_NOFOLLOW = 00; 71 #endif 72 73 74 static final int PREFIX_S_IAMB = 75 (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH); 76 static final int PREFIX_S_IRUSR = S_IRUSR; 77 static final int PREFIX_S_IWUSR = S_IWUSR; 78 static final int PREFIX_S_IXUSR = S_IXUSR; 79 static final int PREFIX_S_IRGRP = S_IRGRP; 80 static final int PREFIX_S_IWGRP = S_IWGRP; 81 static final int PREFIX_S_IXGRP = S_IXGRP; 82 static final int PREFIX_S_IROTH = S_IROTH; 83 static final int PREFIX_S_IWOTH = S_IWOTH; 84 static final int PREFIX_S_IXOTH = S_IXOTH; 85 86 static final int PREFIX_S_IFMT = S_IFMT; 87 static final int PREFIX_S_IFREG = S_IFREG; 88 static final int PREFIX_S_IFDIR = S_IFDIR; 89 static final int PREFIX_S_IFLNK = S_IFLNK; 90 static final int PREFIX_S_IFCHR = S_IFCHR; 91 static final int PREFIX_S_IFBLK = S_IFBLK; 92 static final int PREFIX_S_IFIFO = S_IFIFO; | 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 28 @@END_COPYRIGHT@@ 29 30 #ifdef __linux__ 31 #define _GNU_SOURCE 32 #endif 33 34 #include <stdio.h> 35 #include <errno.h> 36 #include <unistd.h> 37 #include <fcntl.h> 38 #include <sys/stat.h> 39 40 /* On Solaris, "sun" is defined as a macro. Undefine to make package 41 declaration valid */ 42 #undef sun 43 44 /* To be able to name the Java constants the same as the C constants without 45 having the preprocessor rewrite those identifiers, add PREFIX_ to all 46 identifiers matching a C constant. The PREFIX_ is filtered out in the 47 makefile. */ 48 49 @@START_HERE@@ 50 51 package sun.nio.fs; 52 class UnixConstants { 53 private UnixConstants() { } 57 static final int PREFIX_O_APPEND = O_APPEND; 58 static final int PREFIX_O_CREAT = O_CREAT; 59 static final int PREFIX_O_EXCL = O_EXCL; 60 static final int PREFIX_O_TRUNC = O_TRUNC; 61 static final int PREFIX_O_SYNC = O_SYNC; 62 63 #ifndef O_DSYNC 64 // At least FreeBSD doesn't define O_DSYNC 65 static final int PREFIX_O_DSYNC = O_SYNC; 66 #else 67 static final int PREFIX_O_DSYNC = O_DSYNC; 68 #endif 69 70 #ifdef O_NOFOLLOW 71 static final int PREFIX_O_NOFOLLOW = O_NOFOLLOW; 72 #else 73 // not supported (dummy values will not be used at runtime). 74 static final int PREFIX_O_NOFOLLOW = 00; 75 #endif 76 77 #ifdef O_DIRECT 78 static final int PREFIX_DIRECT = O_DIRECT; 79 #elif F_NOCACHE 80 static final int PREFIX_DIRECT = F_NOCACHE; 81 //#elif DIRECTIO_ON 82 // static final int PREFIX_DIRECT = DIRECTIO_ON; 83 #else 84 static final int PREFIX_DIRECT = 00; 85 #endif 86 87 static final int PREFIX_S_IAMB = 88 (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH); 89 static final int PREFIX_S_IRUSR = S_IRUSR; 90 static final int PREFIX_S_IWUSR = S_IWUSR; 91 static final int PREFIX_S_IXUSR = S_IXUSR; 92 static final int PREFIX_S_IRGRP = S_IRGRP; 93 static final int PREFIX_S_IWGRP = S_IWGRP; 94 static final int PREFIX_S_IXGRP = S_IXGRP; 95 static final int PREFIX_S_IROTH = S_IROTH; 96 static final int PREFIX_S_IWOTH = S_IWOTH; 97 static final int PREFIX_S_IXOTH = S_IXOTH; 98 99 static final int PREFIX_S_IFMT = S_IFMT; 100 static final int PREFIX_S_IFREG = S_IFREG; 101 static final int PREFIX_S_IFDIR = S_IFDIR; 102 static final int PREFIX_S_IFLNK = S_IFLNK; 103 static final int PREFIX_S_IFCHR = S_IFCHR; 104 static final int PREFIX_S_IFBLK = S_IFBLK; 105 static final int PREFIX_S_IFIFO = S_IFIFO; |