annotate src/solaris/native/sun/nio/fs/genSolarisConstants.c @ 912:58ba2cd5a250

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