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