1 /* 2 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #include <stdio.h> 27 #include <errno.h> 28 #include <unistd.h> 29 #include <sys/acl.h> 30 #include <fcntl.h> 31 #include <sys/stat.h> 32 33 /** 34 * Generates sun.nio.fs.SolarisConstants 35 */ 36 37 static void out(char* s) { 38 printf("%s\n", s); 39 } 40 41 static void emit(char* name, int value) { 42 printf(" static final int %s = %d;\n", name, value); 43 } 44 45 static void emitX(char* name, int value) { 46 printf(" static final int %s = 0x%x;\n", name, value); 47 } 48 49 #define DEF(X) emit(#X, X); 50 #define DEFX(X) emitX(#X, X); 51 52 int main(int argc, const char* argv[]) { 53 out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT "); 54 out("package sun.nio.fs; "); 55 out("class SolarisConstants { "); 56 out(" private SolarisConstants() { } "); 57 58 // extended attributes 59 DEFX(O_XATTR); 60 DEF(_PC_XATTR_ENABLED); 61 62 // ACL configuration 63 DEF(_PC_ACL_ENABLED); 64 DEFX(_ACL_ACE_ENABLED); 65 66 // ACL commands 67 DEFX(ACE_GETACL); 68 DEFX(ACE_SETACL); 69 70 // ACL mask/flags/types 71 emitX("ACE_ACCESS_ALLOWED_ACE_TYPE", 0x0000); 72 emitX("ACE_ACCESS_DENIED_ACE_TYPE", 0x0001); 73 emitX("ACE_SYSTEM_AUDIT_ACE_TYPE", 0x0002); 74 emitX("ACE_SYSTEM_ALARM_ACE_TYPE", 0x0003); 75 emitX("ACE_READ_DATA", 0x00000001); 76 emitX("ACE_LIST_DIRECTORY", 0x00000001); 77 emitX("ACE_WRITE_DATA", 0x00000002); 78 emitX("ACE_ADD_FILE", 0x00000002); 79 emitX("ACE_APPEND_DATA", 0x00000004); 80 emitX("ACE_ADD_SUBDIRECTORY", 0x00000004); 81 emitX("ACE_READ_NAMED_ATTRS", 0x00000008); 82 emitX("ACE_WRITE_NAMED_ATTRS", 0x00000010); 83 emitX("ACE_EXECUTE", 0x00000020); 84 emitX("ACE_DELETE_CHILD", 0x00000040); 85 emitX("ACE_READ_ATTRIBUTES", 0x00000080); 86 emitX("ACE_WRITE_ATTRIBUTES", 0x00000100); 87 emitX("ACE_DELETE", 0x00010000); 88 emitX("ACE_READ_ACL", 0x00020000); 89 emitX("ACE_WRITE_ACL", 0x00040000); 90 emitX("ACE_WRITE_OWNER", 0x00080000); 91 emitX("ACE_SYNCHRONIZE", 0x00100000); 92 emitX("ACE_FILE_INHERIT_ACE", 0x0001); 93 emitX("ACE_DIRECTORY_INHERIT_ACE", 0x0002); 94 emitX("ACE_NO_PROPAGATE_INHERIT_ACE", 0x0004); 95 emitX("ACE_INHERIT_ONLY_ACE", 0x0008); 96 emitX("ACE_SUCCESSFUL_ACCESS_ACE_FLAG", 0x0010); 97 emitX("ACE_FAILED_ACCESS_ACE_FLAG", 0x0020); 98 emitX("ACE_IDENTIFIER_GROUP", 0x0040); 99 emitX("ACE_OWNER", 0x1000); 100 emitX("ACE_GROUP", 0x2000); 101 emitX("ACE_EVERYONE", 0x4000); 102 103 out("} "); 104 return 0; 105 }