8034179: Clean up nio genConstants
authorerikj
Thu, 13 Feb 2014 17:14:24 +0100
changeset 22966 b76a460d4246
parent 22965 78610fb00fff
child 22967 bfcfd51c9e5c
8034179: Clean up nio genConstants Reviewed-by: alanb, ihse
jdk/make/CompileJavaClasses.gmk
jdk/make/gensrc/GensrcMisc.gmk
jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c
jdk/make/src/native/genconstants/fs/genSolarisConstants.c
jdk/make/src/native/genconstants/fs/genUnixConstants.c
jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c
jdk/src/solaris/native/sun/nio/fs/genSolarisConstants.c
jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c
--- a/jdk/make/CompileJavaClasses.gmk	Thu Feb 13 15:59:04 2014 +0000
+++ b/jdk/make/CompileJavaClasses.gmk	Thu Feb 13 17:14:24 2014 +0100
@@ -239,11 +239,6 @@
   EXFILES += sun/nio/fs/PollingWatchService.java
 endif
 
-# TODO: Fix when converting NIO
-# Exclude *-linux-arm.java and *-linux-ppc.java from closed.
-EXFILES += -linux-arm.java \
-    -linux-ppc.java
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
   EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \
       sun/nio/ch/PollSelectorProvider.java \
--- a/jdk/make/gensrc/GensrcMisc.gmk	Thu Feb 13 15:59:04 2014 +0000
+++ b/jdk/make/gensrc/GensrcMisc.gmk	Thu Feb 13 17:14:24 2014 +0100
@@ -83,9 +83,9 @@
 
 GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java
 
-GENSRC_SOR_SRC := $(JDK_TOPDIR)/src/share/native/sun/nio/ch
+GENSRC_SOR_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/ch
 GENSRC_SOR_SRC_FILE := genSocketOptionRegistry.c
-GENSRC_SOR_BIN := $(JDK_OUTPUTDIR)/gensrc/genSocketOptionRegistry
+GENSRC_SOR_BIN := $(JDK_OUTPUTDIR)/btnative/genSocketOptionRegistry
 
 SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
     $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -100,11 +100,9 @@
     OUTPUT_DIR := $(GENSRC_SOR_BIN), \
     PROGRAM := genSocketOptionRegistry))
 
-ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java), )
-  HAS_SOCKET_OPTION_REGISTRY := true
-endif
+SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
 
-ifneq ($(HAS_SOCKET_OPTION_REGISTRY), true)
+ifeq ($(wildcard $(SOR_PREGEN_FILE)), )
   $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
@@ -112,7 +110,7 @@
 	$(BUILD_GENSRC_SOR_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 else
-  $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java
+  $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
 	$(call install-file)
 endif
 
@@ -122,9 +120,9 @@
 
   GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java
 
-  GENSRC_UC_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
+  GENSRC_UC_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
   GENSRC_UC_SRC_FILE := genUnixConstants.c
-  GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/gensrc/genUnixConstants
+  GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/btnative/genUnixConstants
 
   UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
       $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -140,11 +138,9 @@
       OUTPUT_DIR := $(GENSRC_UC_BIN), \
       PROGRAM := genUnixConstants))
 
-  ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java), )
-    HAS_UNIX_CONSTANTS := true
-  endif
+  UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
 
-  ifneq ($(HAS_UNIX_CONSTANTS), true)
+  ifeq ($(wildcard $(UC_PREGEN_FILE)), )
     $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
@@ -152,7 +148,7 @@
 	$(BUILD_GENSRC_UC_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
   else
-    $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java
+    $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
 	$(call install-file)
   endif
 
@@ -164,9 +160,9 @@
 
   GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/SolarisConstants.java
 
-  GENSRC_SOL_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
+  GENSRC_SOL_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
   GENSRC_SOL_SRC_FILE := genSolarisConstants.c
-  GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/gensrc/genSolarisConstants
+  GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/btnative/genSolarisConstants
 
   SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
       $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c	Thu Feb 13 17:14:24 2014 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdio.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#endif
+
+/**
+ * Generates sun.nio.ch.SocketOptionRegistry, a class that maps Java-level
+ * socket options to the platform specific level and option.
+ */
+
+static void out(char* s) {
+    printf("%s\n", s);
+}
+
+static void emit(const char *name, char * family, int level, int optname) {
+    printf("            map.put(new RegistryKey(%s, %s),", name, family);
+    printf(" new OptionKey(%d, %d));\n", level, optname);
+}
+
+static void emit_unspec(const char *name, int level, int optname) {
+    emit(name, "Net.UNSPEC", level, optname);
+}
+
+static  void emit_inet(const char *name, int level, int optname) {
+    emit(name, "StandardProtocolFamily.INET", level, optname);
+}
+
+static void emit_inet6(const char *name, int level, int optname) {
+    emit(name, "StandardProtocolFamily.INET6", level, optname);
+}
+
+int main(int argc, const char* argv[]) {
+    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
+    out("package sun.nio.ch;                                                            ");
+    out("import java.net.SocketOption;                                                  ");
+    out("import java.net.StandardSocketOptions;                                         ");
+    out("import java.net.ProtocolFamily;                                                ");
+    out("import java.net.StandardProtocolFamily;                                        ");
+    out("import java.util.Map;                                                          ");
+    out("import java.util.HashMap;                                                      ");
+    out("class SocketOptionRegistry {                                                   ");
+    out("    private SocketOptionRegistry() { }                                         ");
+    out("    private static class RegistryKey {                                         ");
+    out("        private final SocketOption<?> name;                                    ");
+    out("        private final ProtocolFamily family;                                   ");
+    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {             ");
+    out("            this.name = name;                                                  ");
+    out("            this.family = family;                                              ");
+    out("        }                                                                      ");
+    out("        public int hashCode() {                                                ");
+    out("            return name.hashCode() + family.hashCode();                        ");
+    out("        }                                                                      ");
+    out("        public boolean equals(Object ob) {                                     ");
+    out("            if (ob == null) return false;                                      ");
+    out("            if (!(ob instanceof RegistryKey)) return false;                    ");
+    out("            RegistryKey other = (RegistryKey)ob;                               ");
+    out("            if (this.name != other.name) return false;                         ");
+    out("            if (this.family != other.family) return false;                     ");
+    out("            return true;                                                       ");
+    out("        }                                                                      ");
+    out("    }                                                                          ");
+    out("    private static class LazyInitialization {                                  ");
+    out("        static final Map<RegistryKey,OptionKey> options = options();           ");
+    out("        private static Map<RegistryKey,OptionKey> options() {                  ");
+    out("            Map<RegistryKey,OptionKey> map =                                   ");
+    out("                new HashMap<RegistryKey,OptionKey>();                          ");
+
+    emit_unspec("StandardSocketOptions.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
+    emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
+    emit_unspec("StandardSocketOptions.SO_LINGER",    SOL_SOCKET, SO_LINGER);
+    emit_unspec("StandardSocketOptions.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
+    emit_unspec("StandardSocketOptions.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
+    emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
+    emit_unspec("StandardSocketOptions.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
+
+    emit_inet("StandardSocketOptions.IP_TOS",            IPPROTO_IP,     IP_TOS);
+    emit_inet("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
+    emit_inet("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
+    emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
+
+#ifdef AF_INET6
+    emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
+    emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
+    emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
+#endif
+
+    emit_unspec("ExtendedSocketOption.SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE);
+
+    out("            return map;                                                        ");
+    out("        }                                                                      ");
+    out("    }                                                                          ");
+    out("    public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) { ");
+    out("        RegistryKey key = new RegistryKey(name, family);                       ");
+    out("        return LazyInitialization.options.get(key);                            ");
+    out("    }                                                                          ");
+    out("}                                                                              ");
+
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/native/genconstants/fs/genSolarisConstants.c	Thu Feb 13 17:14:24 2014 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/acl.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/**
+ * Generates sun.nio.fs.SolarisConstants
+ */
+
+static void out(char* s) {
+    printf("%s\n", s);
+}
+
+static void emit(char* name, int value) {
+    printf("    static final int %s = %d;\n", name, value);
+}
+
+static void emitX(char* name, int value) {
+    printf("    static final int %s = 0x%x;\n", name, value);
+}
+
+#define DEF(X) emit(#X, X);
+#define DEFX(X) emitX(#X, X);
+
+int main(int argc, const char* argv[]) {
+    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
+    out("package sun.nio.fs;                                                            ");
+    out("class SolarisConstants {                                                       ");
+    out("    private SolarisConstants() { }                                             ");
+
+    // extended attributes
+    DEFX(O_XATTR);
+    DEF(_PC_XATTR_ENABLED);
+
+    // ACL configuration
+    DEF(_PC_ACL_ENABLED);
+    DEFX(_ACL_ACE_ENABLED);
+
+    // ACL commands
+    DEFX(ACE_GETACL);
+    DEFX(ACE_SETACL);
+
+    // ACL mask/flags/types
+    emitX("ACE_ACCESS_ALLOWED_ACE_TYPE",        0x0000);
+    emitX("ACE_ACCESS_DENIED_ACE_TYPE",         0x0001);
+    emitX("ACE_SYSTEM_AUDIT_ACE_TYPE",          0x0002);
+    emitX("ACE_SYSTEM_ALARM_ACE_TYPE",          0x0003);
+    emitX("ACE_READ_DATA",                      0x00000001);
+    emitX("ACE_LIST_DIRECTORY",                 0x00000001);
+    emitX("ACE_WRITE_DATA",                     0x00000002);
+    emitX("ACE_ADD_FILE",                       0x00000002);
+    emitX("ACE_APPEND_DATA",                    0x00000004);
+    emitX("ACE_ADD_SUBDIRECTORY",               0x00000004);
+    emitX("ACE_READ_NAMED_ATTRS",               0x00000008);
+    emitX("ACE_WRITE_NAMED_ATTRS",              0x00000010);
+    emitX("ACE_EXECUTE",                        0x00000020);
+    emitX("ACE_DELETE_CHILD",                   0x00000040);
+    emitX("ACE_READ_ATTRIBUTES",                0x00000080);
+    emitX("ACE_WRITE_ATTRIBUTES",               0x00000100);
+    emitX("ACE_DELETE",                         0x00010000);
+    emitX("ACE_READ_ACL",                       0x00020000);
+    emitX("ACE_WRITE_ACL",                      0x00040000);
+    emitX("ACE_WRITE_OWNER",                    0x00080000);
+    emitX("ACE_SYNCHRONIZE",                    0x00100000);
+    emitX("ACE_FILE_INHERIT_ACE",               0x0001);
+    emitX("ACE_DIRECTORY_INHERIT_ACE",          0x0002);
+    emitX("ACE_NO_PROPAGATE_INHERIT_ACE",       0x0004);
+    emitX("ACE_INHERIT_ONLY_ACE",               0x0008);
+    emitX("ACE_SUCCESSFUL_ACCESS_ACE_FLAG",     0x0010);
+    emitX("ACE_FAILED_ACCESS_ACE_FLAG",         0x0020);
+    emitX("ACE_IDENTIFIER_GROUP",               0x0040);
+    emitX("ACE_OWNER",                          0x1000);
+    emitX("ACE_GROUP",                          0x2000);
+    emitX("ACE_EVERYONE",                       0x4000);
+
+    out("}                                                                              ");
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/native/genconstants/fs/genUnixConstants.c	Thu Feb 13 17:14:24 2014 +0100
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/**
+ * Generates sun.nio.fs.UnixConstants
+ */
+
+static void out(char* s) {
+    printf("%s\n", s);
+}
+
+static void emit(char* name, int value) {
+    printf("    static final int %s = %d;\n", name, value);
+}
+
+static void emitX(char* name, int value) {
+    printf("    static final int %s = 0x%x;\n", name, value);
+}
+
+#define DEF(X) emit(#X, X);
+#define DEFX(X) emitX(#X, X);
+
+int main(int argc, const char* argv[]) {
+    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
+    out("package sun.nio.fs;                                                            ");
+    out("class UnixConstants {                                                          ");
+    out("    private UnixConstants() { }                                                ");
+
+    // open flags
+    DEF(O_RDONLY);
+    DEF(O_WRONLY);
+    DEF(O_RDWR);
+    DEFX(O_APPEND);
+    DEFX(O_CREAT);
+    DEFX(O_EXCL);
+    DEFX(O_TRUNC);
+    DEFX(O_SYNC);
+#ifndef O_DSYNC
+    // At least FreeBSD doesn't define O_DSYNC
+    emit("O_DSYNC", O_SYNC);
+#else
+    DEFX(O_DSYNC);
+#endif
+#ifdef O_NOFOLLOW
+    DEFX(O_NOFOLLOW);
+#else
+    // not supported (dummy values will not be used at runtime).
+    emitX("O_NOFOLLOW", 0x0);
+#endif
+
+    // mode masks
+    emitX("S_IAMB",
+         (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH));
+    DEF(S_IRUSR);
+    DEF(S_IWUSR);
+    DEF(S_IXUSR);
+    DEF(S_IRGRP);
+    DEF(S_IWGRP);
+    DEF(S_IXGRP);
+    DEF(S_IROTH);
+    DEF(S_IWOTH);
+    DEF(S_IXOTH);
+    DEFX(S_IFMT);
+    DEFX(S_IFREG);
+    DEFX(S_IFDIR);
+    DEFX(S_IFLNK);
+    DEFX(S_IFCHR);
+    DEFX(S_IFBLK);
+    DEFX(S_IFIFO);
+
+    // access modes
+    DEF(R_OK);
+    DEF(W_OK);
+    DEF(X_OK);
+    DEF(F_OK);
+
+    // errors
+    DEF(ENOENT);
+    DEF(EACCES);
+    DEF(EEXIST);
+    DEF(ENOTDIR);
+    DEF(EINVAL);
+    DEF(EXDEV);
+    DEF(EISDIR);
+    DEF(ENOTEMPTY);
+    DEF(ENOSPC);
+    DEF(EAGAIN);
+    DEF(ENOSYS);
+    DEF(ELOOP);
+    DEF(EROFS);
+#ifndef ENODATA
+    // Only used in Linux java source, provide any value so it compiles
+    emit("ENODATA", ELAST);
+#else
+    DEF(ENODATA);
+#endif
+    DEF(ERANGE);
+    DEF(EMFILE);
+
+    // flags used with openat/unlinkat/etc.
+#if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)
+    DEFX(AT_SYMLINK_NOFOLLOW)
+    DEFX(AT_REMOVEDIR);
+#else
+    // not supported (dummy values will not be used at runtime).
+    emitX("AT_SYMLINK_NOFOLLOW", 0x0);
+    emitX("AT_REMOVEDIR", 0x0);
+#endif
+
+    out("}                                                                              ");
+
+    return 0;
+}
--- a/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c	Thu Feb 13 15:59:04 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#ifdef _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#endif
-
-/**
- * Generates sun.nio.ch.SocketOptionRegistry, a class that maps Java-level
- * socket options to the platform specific level and option.
- */
-
-static void out(char* s) {
-    printf("%s\n", s);
-}
-
-static void emit(const char *name, char * family, int level, int optname) {
-    printf("            map.put(new RegistryKey(%s, %s),", name, family);
-    printf(" new OptionKey(%d, %d));\n", level, optname);
-}
-
-static void emit_unspec(const char *name, int level, int optname) {
-    emit(name, "Net.UNSPEC", level, optname);
-}
-
-static  void emit_inet(const char *name, int level, int optname) {
-    emit(name, "StandardProtocolFamily.INET", level, optname);
-}
-
-static void emit_inet6(const char *name, int level, int optname) {
-    emit(name, "StandardProtocolFamily.INET6", level, optname);
-}
-
-int main(int argc, const char* argv[]) {
-    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
-    out("package sun.nio.ch;                                                            ");
-    out("import java.net.SocketOption;                                                  ");
-    out("import java.net.StandardSocketOptions;                                         ");
-    out("import java.net.ProtocolFamily;                                                ");
-    out("import java.net.StandardProtocolFamily;                                        ");
-    out("import java.util.Map;                                                          ");
-    out("import java.util.HashMap;                                                      ");
-    out("class SocketOptionRegistry {                                                   ");
-    out("    private SocketOptionRegistry() { }                                         ");
-    out("    private static class RegistryKey {                                         ");
-    out("        private final SocketOption<?> name;                                    ");
-    out("        private final ProtocolFamily family;                                   ");
-    out("        RegistryKey(SocketOption<?> name, ProtocolFamily family) {             ");
-    out("            this.name = name;                                                  ");
-    out("            this.family = family;                                              ");
-    out("        }                                                                      ");
-    out("        public int hashCode() {                                                ");
-    out("            return name.hashCode() + family.hashCode();                        ");
-    out("        }                                                                      ");
-    out("        public boolean equals(Object ob) {                                     ");
-    out("            if (ob == null) return false;                                      ");
-    out("            if (!(ob instanceof RegistryKey)) return false;                    ");
-    out("            RegistryKey other = (RegistryKey)ob;                               ");
-    out("            if (this.name != other.name) return false;                         ");
-    out("            if (this.family != other.family) return false;                     ");
-    out("            return true;                                                       ");
-    out("        }                                                                      ");
-    out("    }                                                                          ");
-    out("    private static class LazyInitialization {                                  ");
-    out("        static final Map<RegistryKey,OptionKey> options = options();           ");
-    out("        private static Map<RegistryKey,OptionKey> options() {                  ");
-    out("            Map<RegistryKey,OptionKey> map =                                   ");
-    out("                new HashMap<RegistryKey,OptionKey>();                          ");
-
-    emit_unspec("StandardSocketOptions.SO_BROADCAST", SOL_SOCKET, SO_BROADCAST);
-    emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE);
-    emit_unspec("StandardSocketOptions.SO_LINGER",    SOL_SOCKET, SO_LINGER);
-    emit_unspec("StandardSocketOptions.SO_SNDBUF",    SOL_SOCKET, SO_SNDBUF);
-    emit_unspec("StandardSocketOptions.SO_RCVBUF",    SOL_SOCKET, SO_RCVBUF);
-    emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR);
-    emit_unspec("StandardSocketOptions.TCP_NODELAY",  IPPROTO_TCP, TCP_NODELAY);
-
-    emit_inet("StandardSocketOptions.IP_TOS",            IPPROTO_IP,     IP_TOS);
-    emit_inet("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IP,     IP_MULTICAST_IF);
-    emit_inet("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IP,     IP_MULTICAST_TTL);
-    emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP,     IP_MULTICAST_LOOP);
-
-#ifdef AF_INET6
-    emit_inet6("StandardSocketOptions.IP_MULTICAST_IF",   IPPROTO_IPV6,  IPV6_MULTICAST_IF);
-    emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL",  IPPROTO_IPV6,  IPV6_MULTICAST_HOPS);
-    emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6,  IPV6_MULTICAST_LOOP);
-#endif
-
-    emit_unspec("ExtendedSocketOption.SO_OOBINLINE", SOL_SOCKET, SO_OOBINLINE);
-
-    out("            return map;                                                        ");
-    out("        }                                                                      ");
-    out("    }                                                                          ");
-    out("    public static OptionKey findOption(SocketOption<?> name, ProtocolFamily family) { ");
-    out("        RegistryKey key = new RegistryKey(name, family);                       ");
-    out("        return LazyInitialization.options.get(key);                            ");
-    out("    }                                                                          ");
-    out("}                                                                              ");
-
-    return 0;
-}
--- a/jdk/src/solaris/native/sun/nio/fs/genSolarisConstants.c	Thu Feb 13 15:59:04 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/acl.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-/**
- * Generates sun.nio.fs.SolarisConstants
- */
-
-static void out(char* s) {
-    printf("%s\n", s);
-}
-
-static void emit(char* name, int value) {
-    printf("    static final int %s = %d;\n", name, value);
-}
-
-static void emitX(char* name, int value) {
-    printf("    static final int %s = 0x%x;\n", name, value);
-}
-
-#define DEF(X) emit(#X, X);
-#define DEFX(X) emitX(#X, X);
-
-int main(int argc, const char* argv[]) {
-    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
-    out("package sun.nio.fs;                                                            ");
-    out("class SolarisConstants {                                                       ");
-    out("    private SolarisConstants() { }                                             ");
-
-    // extended attributes
-    DEFX(O_XATTR);
-    DEF(_PC_XATTR_ENABLED);
-
-    // ACL configuration
-    DEF(_PC_ACL_ENABLED);
-    DEFX(_ACL_ACE_ENABLED);
-
-    // ACL commands
-    DEFX(ACE_GETACL);
-    DEFX(ACE_SETACL);
-
-    // ACL mask/flags/types
-    emitX("ACE_ACCESS_ALLOWED_ACE_TYPE",        0x0000);
-    emitX("ACE_ACCESS_DENIED_ACE_TYPE",         0x0001);
-    emitX("ACE_SYSTEM_AUDIT_ACE_TYPE",          0x0002);
-    emitX("ACE_SYSTEM_ALARM_ACE_TYPE",          0x0003);
-    emitX("ACE_READ_DATA",                      0x00000001);
-    emitX("ACE_LIST_DIRECTORY",                 0x00000001);
-    emitX("ACE_WRITE_DATA",                     0x00000002);
-    emitX("ACE_ADD_FILE",                       0x00000002);
-    emitX("ACE_APPEND_DATA",                    0x00000004);
-    emitX("ACE_ADD_SUBDIRECTORY",               0x00000004);
-    emitX("ACE_READ_NAMED_ATTRS",               0x00000008);
-    emitX("ACE_WRITE_NAMED_ATTRS",              0x00000010);
-    emitX("ACE_EXECUTE",                        0x00000020);
-    emitX("ACE_DELETE_CHILD",                   0x00000040);
-    emitX("ACE_READ_ATTRIBUTES",                0x00000080);
-    emitX("ACE_WRITE_ATTRIBUTES",               0x00000100);
-    emitX("ACE_DELETE",                         0x00010000);
-    emitX("ACE_READ_ACL",                       0x00020000);
-    emitX("ACE_WRITE_ACL",                      0x00040000);
-    emitX("ACE_WRITE_OWNER",                    0x00080000);
-    emitX("ACE_SYNCHRONIZE",                    0x00100000);
-    emitX("ACE_FILE_INHERIT_ACE",               0x0001);
-    emitX("ACE_DIRECTORY_INHERIT_ACE",          0x0002);
-    emitX("ACE_NO_PROPAGATE_INHERIT_ACE",       0x0004);
-    emitX("ACE_INHERIT_ONLY_ACE",               0x0008);
-    emitX("ACE_SUCCESSFUL_ACCESS_ACE_FLAG",     0x0010);
-    emitX("ACE_FAILED_ACCESS_ACE_FLAG",         0x0020);
-    emitX("ACE_IDENTIFIER_GROUP",               0x0040);
-    emitX("ACE_OWNER",                          0x1000);
-    emitX("ACE_GROUP",                          0x2000);
-    emitX("ACE_EVERYONE",                       0x4000);
-
-    out("}                                                                              ");
-    return 0;
-}
--- a/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c	Thu Feb 13 15:59:04 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-/**
- * Generates sun.nio.fs.UnixConstants
- */
-
-static void out(char* s) {
-    printf("%s\n", s);
-}
-
-static void emit(char* name, int value) {
-    printf("    static final int %s = %d;\n", name, value);
-}
-
-static void emitX(char* name, int value) {
-    printf("    static final int %s = 0x%x;\n", name, value);
-}
-
-#define DEF(X) emit(#X, X);
-#define DEFX(X) emitX(#X, X);
-
-int main(int argc, const char* argv[]) {
-    out("// AUTOMATICALLY GENERATED FILE - DO NOT EDIT                                  ");
-    out("package sun.nio.fs;                                                            ");
-    out("class UnixConstants {                                                          ");
-    out("    private UnixConstants() { }                                                ");
-
-    // open flags
-    DEF(O_RDONLY);
-    DEF(O_WRONLY);
-    DEF(O_RDWR);
-    DEFX(O_APPEND);
-    DEFX(O_CREAT);
-    DEFX(O_EXCL);
-    DEFX(O_TRUNC);
-    DEFX(O_SYNC);
-#ifndef O_DSYNC
-    // At least FreeBSD doesn't define O_DSYNC
-    emit("O_DSYNC", O_SYNC);
-#else
-    DEFX(O_DSYNC);
-#endif
-#ifdef O_NOFOLLOW
-    DEFX(O_NOFOLLOW);
-#else
-    // not supported (dummy values will not be used at runtime).
-    emitX("O_NOFOLLOW", 0x0);
-#endif
-
-    // mode masks
-    emitX("S_IAMB",
-         (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH));
-    DEF(S_IRUSR);
-    DEF(S_IWUSR);
-    DEF(S_IXUSR);
-    DEF(S_IRGRP);
-    DEF(S_IWGRP);
-    DEF(S_IXGRP);
-    DEF(S_IROTH);
-    DEF(S_IWOTH);
-    DEF(S_IXOTH);
-    DEFX(S_IFMT);
-    DEFX(S_IFREG);
-    DEFX(S_IFDIR);
-    DEFX(S_IFLNK);
-    DEFX(S_IFCHR);
-    DEFX(S_IFBLK);
-    DEFX(S_IFIFO);
-
-    // access modes
-    DEF(R_OK);
-    DEF(W_OK);
-    DEF(X_OK);
-    DEF(F_OK);
-
-    // errors
-    DEF(ENOENT);
-    DEF(EACCES);
-    DEF(EEXIST);
-    DEF(ENOTDIR);
-    DEF(EINVAL);
-    DEF(EXDEV);
-    DEF(EISDIR);
-    DEF(ENOTEMPTY);
-    DEF(ENOSPC);
-    DEF(EAGAIN);
-    DEF(ENOSYS);
-    DEF(ELOOP);
-    DEF(EROFS);
-#ifndef ENODATA
-    // Only used in Linux java source, provide any value so it compiles
-    emit("ENODATA", ELAST);
-#else
-    DEF(ENODATA);
-#endif
-    DEF(ERANGE);
-    DEF(EMFILE);
-
-    // flags used with openat/unlinkat/etc.
-#if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_REMOVEDIR)
-    DEFX(AT_SYMLINK_NOFOLLOW)
-    DEFX(AT_REMOVEDIR);
-#else
-    // not supported (dummy values will not be used at runtime).
-    emitX("AT_SYMLINK_NOFOLLOW", 0x0);
-    emitX("AT_REMOVEDIR", 0x0);
-#endif
-
-    out("}                                                                              ");
-
-    return 0;
-}