893N/A/*
2362N/A * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
893N/A *
893N/A * This code is free software; you can redistribute it and/or modify it
893N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
893N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
893N/A *
893N/A * This code is distributed in the hope that it will be useful, but WITHOUT
893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
893N/A * version 2 for more details (a copy is included in the LICENSE file that
893N/A * accompanied this code).
893N/A *
893N/A * You should have received a copy of the GNU General Public License version
893N/A * 2 along with this work; if not, write to the Free Software Foundation,
893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
893N/A */
893N/A
893N/A#include <stdio.h>
893N/A#include <errno.h>
893N/A#include <unistd.h>
893N/A#include <sys/acl.h>
5196N/A#include <fcntl.h>
893N/A#include <sys/stat.h>
893N/A
893N/A/**
893N/A * Generates sun.nio.fs.SolarisConstants
893N/A */
893N/A
893N/Astatic void out(char* s) {
893N/A printf("%s\n", s);
893N/A}
893N/A
893N/Astatic void emit(char* name, int value) {
893N/A printf(" static final int %s = %d;\n", name, value);
893N/A}
893N/A
893N/Astatic void emitX(char* name, int value) {
893N/A printf(" static final int %s = 0x%x;\n", name, value);
893N/A}
893N/A
893N/A#define DEF(X) emit(#X, X);
893N/A#define DEFX(X) emitX(#X, X);
893N/A
893N/Aint main(int argc, const char* argv[]) {
893N/A out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT ");
893N/A out("package sun.nio.fs; ");
893N/A out("class SolarisConstants { ");
893N/A out(" private SolarisConstants() { } ");
893N/A
893N/A // extended attributes
893N/A DEFX(O_XATTR);
893N/A DEF(_PC_XATTR_ENABLED);
893N/A
893N/A // ACL configuration
893N/A DEF(_PC_ACL_ENABLED);
893N/A DEFX(_ACL_ACE_ENABLED);
893N/A
893N/A // ACL commands
893N/A DEFX(ACE_GETACL);
893N/A DEFX(ACE_SETACL);
893N/A
893N/A // ACL mask/flags/types
912N/A emitX("ACE_ACCESS_ALLOWED_ACE_TYPE", 0x0000);
912N/A emitX("ACE_ACCESS_DENIED_ACE_TYPE", 0x0001);
912N/A emitX("ACE_SYSTEM_AUDIT_ACE_TYPE", 0x0002);
912N/A emitX("ACE_SYSTEM_ALARM_ACE_TYPE", 0x0003);
912N/A emitX("ACE_READ_DATA", 0x00000001);
912N/A emitX("ACE_LIST_DIRECTORY", 0x00000001);
912N/A emitX("ACE_WRITE_DATA", 0x00000002);
912N/A emitX("ACE_ADD_FILE", 0x00000002);
912N/A emitX("ACE_APPEND_DATA", 0x00000004);
912N/A emitX("ACE_ADD_SUBDIRECTORY", 0x00000004);
912N/A emitX("ACE_READ_NAMED_ATTRS", 0x00000008);
912N/A emitX("ACE_WRITE_NAMED_ATTRS", 0x00000010);
912N/A emitX("ACE_EXECUTE", 0x00000020);
912N/A emitX("ACE_DELETE_CHILD", 0x00000040);
912N/A emitX("ACE_READ_ATTRIBUTES", 0x00000080);
912N/A emitX("ACE_WRITE_ATTRIBUTES", 0x00000100);
912N/A emitX("ACE_DELETE", 0x00010000);
912N/A emitX("ACE_READ_ACL", 0x00020000);
912N/A emitX("ACE_WRITE_ACL", 0x00040000);
912N/A emitX("ACE_WRITE_OWNER", 0x00080000);
912N/A emitX("ACE_SYNCHRONIZE", 0x00100000);
912N/A emitX("ACE_FILE_INHERIT_ACE", 0x0001);
912N/A emitX("ACE_DIRECTORY_INHERIT_ACE", 0x0002);
912N/A emitX("ACE_NO_PROPAGATE_INHERIT_ACE", 0x0004);
912N/A emitX("ACE_INHERIT_ONLY_ACE", 0x0008);
912N/A emitX("ACE_SUCCESSFUL_ACCESS_ACE_FLAG", 0x0010);
912N/A emitX("ACE_FAILED_ACCESS_ACE_FLAG", 0x0020);
912N/A emitX("ACE_IDENTIFIER_GROUP", 0x0040);
912N/A emitX("ACE_OWNER", 0x1000);
912N/A emitX("ACE_GROUP", 0x2000);
912N/A emitX("ACE_EVERYONE", 0x4000);
893N/A
893N/A out("} ");
893N/A return 0;
893N/A}