changeset 13548:ef9e5cf5e179

Support for a minimally operational version for BSD Authored by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 16 Apr 2016 16:31:31 -0700
parents a5fd610da7d1
children c840e0c34b25
files src/java.base/bsd/classes/sun/nio/ch/DefaultSelectorProvider.java src/java.base/bsd/classes/sun/nio/fs/BsdFileStore.java src/java.base/bsd/classes/sun/nio/fs/BsdFileSystem.java src/java.base/bsd/classes/sun/nio/fs/BsdFileSystemProvider.java src/java.base/bsd/classes/sun/nio/fs/BsdNativeDispatcher.java src/java.base/bsd/native/libnio/fs/BsdNativeDispatcher.c src/java.base/share/native/libjli/jli_util.h src/java.base/share/native/libzip/zlib-1.2.8/gzguts.h src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c src/java.base/unix/native/libjava/TimeZone_md.c src/java.base/unix/native/libjli/ergo_i586.c src/java.base/unix/native/libnet/NetworkInterface.c src/java.base/unix/native/libnet/net_util_md.c src/java.base/unix/native/libnet/portconfig.c src/java.base/unix/native/libnio/ch/Net.c src/java.base/unix/native/libnio/fs/GioFileTypeDetector.c src/java.desktop/share/native/common/awt/medialib/mlib_sys.c src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h src/java.desktop/unix/native/common/awt/awt_Font.c src/java.desktop/unix/native/common/awt/fontpath.c src/jdk.crypto.pkcs11/unix/native/libj2pkcs11/j2secmod_md.c src/jdk.management/bsd/native/libmanagement_ext/UnixOperatingSystem.c src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c src/jdk.sctp/bsd/classes/sun/nio/ch/sctp/SctpChannelImpl.java src/jdk.sctp/bsd/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java src/jdk.sctp/bsd/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
diffstat 27 files changed, 1079 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/bsd/classes/sun/nio/ch/DefaultSelectorProvider.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.nio.ch;
+
+import java.nio.channels.spi.SelectorProvider;
+
+/**
+ * Creates this platform's default SelectorProvider
+ */
+
+public class DefaultSelectorProvider {
+
+    /**
+     * Prevent instantiation.
+     */
+    private DefaultSelectorProvider() { }
+
+    /**
+     * Returns the default SelectorProvider.
+     */
+    public static SelectorProvider create() {
+        return new sun.nio.ch.PollSelectorProvider();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/bsd/classes/sun/nio/fs/BsdFileStore.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package sun.nio.fs;
+
+import java.nio.file.attribute.*;
+import java.util.*;
+import java.io.IOException;
+
+/**
+ * Bsd implementation of FileStore
+ */
+
+class BsdFileStore
+    extends UnixFileStore
+{
+    BsdFileStore(UnixPath file) throws IOException {
+        super(file);
+    }
+
+    BsdFileStore(UnixFileSystem fs, UnixMountEntry entry) throws IOException {
+        super(fs, entry);
+    }
+
+    /**
+     * Finds, and returns, the mount entry for the file system where the file
+     * resides.
+     */
+    @Override
+    UnixMountEntry findMountEntry() throws IOException {
+        UnixFileSystem fs = file().getFileSystem();
+
+        // step 1: get realpath
+        UnixPath path = null;
+        try {
+            byte[] rp = UnixNativeDispatcher.realpath(file());
+            path = new UnixPath(fs, rp);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file());
+        }
+
+        // step 2: find mount point
+        UnixPath parent = path.getParent();
+        while (parent != null) {
+            UnixFileAttributes attrs = null;
+            try {
+                attrs = UnixFileAttributes.get(parent, true);
+            } catch (UnixException x) {
+                x.rethrowAsIOException(parent);
+            }
+            if (attrs.dev() != dev())
+                break;
+            path = parent;
+            parent = parent.getParent();
+        }
+
+        // step 3: lookup mounted file systems
+        byte[] dir = path.asByteArray();
+        for (UnixMountEntry entry: fs.getMountEntries()) {
+            if (Arrays.equals(dir, entry.dir()))
+                return entry;
+        }
+
+        throw new IOException("Mount point not found in fstab");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/bsd/classes/sun/nio/fs/BsdFileSystem.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package sun.nio.fs;
+
+import java.nio.file.*;
+import java.io.IOException;
+import java.util.*;
+import java.security.AccessController;
+import sun.security.action.GetPropertyAction;
+
+/**
+ * Bsd implementation of FileSystem
+ */
+
+class BsdFileSystem extends UnixFileSystem {
+
+    BsdFileSystem(UnixFileSystemProvider provider, String dir) {
+        super(provider, dir);
+    }
+
+    @Override
+    public WatchService newWatchService()
+        throws IOException
+    {
+        // use polling implementation until we implement a BSD/kqueue one
+        return new PollingWatchService();
+    }
+
+    // lazy initialization of the list of supported attribute views
+    private static class SupportedFileFileAttributeViewsHolder {
+        static final Set<String> supportedFileAttributeViews =
+            supportedFileAttributeViews();
+        private static Set<String> supportedFileAttributeViews() {
+            Set<String> result = new HashSet<String>();
+            result.addAll(standardFileAttributeViews());
+            return Collections.unmodifiableSet(result);
+        }
+    }
+
+    @Override
+    public Set<String> supportedFileAttributeViews() {
+        return SupportedFileFileAttributeViewsHolder.supportedFileAttributeViews;
+    }
+
+    @Override
+    void copyNonPosixAttributes(int ofd, int nfd) {
+    }
+
+    /**
+     * Returns object to iterate over mount entries
+     */
+    @Override
+    Iterable<UnixMountEntry> getMountEntries() {
+        ArrayList<UnixMountEntry> entries = new ArrayList<UnixMountEntry>();
+        try {
+            long iter = BsdNativeDispatcher.getfsstat();
+            try {
+                for (;;) {
+                    UnixMountEntry entry = new UnixMountEntry();
+                    int res = BsdNativeDispatcher.fsstatEntry(iter, entry);
+                    if (res < 0)
+                        break;
+                    entries.add(entry);
+                }
+            } finally {
+                BsdNativeDispatcher.endfsstat(iter);
+            }
+
+        } catch (UnixException x) {
+            // nothing we can do
+        }
+        return entries;
+    }
+
+
+
+    @Override
+    FileStore getFileStore(UnixMountEntry entry) throws IOException {
+        return new BsdFileStore(this, entry);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/bsd/classes/sun/nio/fs/BsdFileSystemProvider.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package sun.nio.fs;
+
+import java.io.IOException;
+
+/**
+ * Bsd implementation of FileSystemProvider
+ */
+
+public class BsdFileSystemProvider extends UnixFileSystemProvider {
+    public BsdFileSystemProvider() {
+        super();
+    }
+
+    @Override
+    BsdFileSystem newFileSystem(String dir) {
+        return new BsdFileSystem(this, dir);
+    }
+
+    @Override
+    BsdFileStore getFileStore(UnixPath path) throws IOException {
+        return new BsdFileStore(path);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/bsd/classes/sun/nio/fs/BsdNativeDispatcher.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package sun.nio.fs;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Bsd specific system calls.
+ */
+
+class BsdNativeDispatcher extends UnixNativeDispatcher {
+    protected BsdNativeDispatcher() { }
+
+   /**
+    * struct fsstat_iter *getfsstat();
+    */
+    static native long getfsstat() throws UnixException;
+
+   /**
+    * int fsstatEntry(struct fsstat_iter * iter, UnixMountEntry entry);
+    */
+    static native int fsstatEntry(long iter, UnixMountEntry entry)
+        throws UnixException;
+
+   /**
+    * void endfsstat(struct fsstat_iter * iter);
+    */
+    static native void endfsstat(long iter) throws UnixException;
+
+    // initialize field IDs
+    private static native void initIDs();
+
+    static {
+         initIDs();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/bsd/native/libnio/fs/BsdNativeDispatcher.c	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,205 @@
+/*
+ * 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 "jni.h"
+#include "jni_util.h"
+#include "jvm.h"
+#include "jlong.h"
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#ifdef ST_RDONLY
+#define statfs statvfs
+#define getfsstat getvfsstat
+#define f_flags f_flag
+#define ISREADONLY ST_RDONLY
+#else
+#define ISREADONLY MNT_RDONLY
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+static jfieldID entry_name;
+static jfieldID entry_dir;
+static jfieldID entry_fstype;
+static jfieldID entry_options;
+
+struct fsstat_iter {
+    struct statfs *buf;
+    int pos;
+    int nentries;
+};
+
+#include "sun_nio_fs_BsdNativeDispatcher.h"
+
+static void throwUnixException(JNIEnv* env, int errnum) {
+    jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException",
+        "(I)V", errnum);
+    if (x != NULL) {
+        (*env)->Throw(env, x);
+    }
+}
+
+/**
+ * Initialize jfieldIDs
+ */
+JNIEXPORT void JNICALL
+Java_sun_nio_fs_BsdNativeDispatcher_initIDs(JNIEnv* env, jclass this)
+{
+    jclass clazz;
+
+    clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
+    CHECK_NULL(clazz);
+    entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+    CHECK_NULL(entry_name);
+    entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+    CHECK_NULL(entry_dir);
+    entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+    CHECK_NULL(entry_fstype);
+    entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+    CHECK_NULL(entry_options);
+}
+
+JNIEXPORT jlong JNICALL
+Java_sun_nio_fs_BsdNativeDispatcher_getfsstat(JNIEnv* env, jclass this)
+{
+    int nentries;
+    size_t bufsize;
+    struct fsstat_iter *iter = malloc(sizeof(*iter));
+
+    if (iter == NULL) {
+        JNU_ThrowOutOfMemoryError(env, "native heap");
+        return 0;
+    }
+
+    iter->pos = 0;
+    iter->nentries = 0;
+    iter->buf = NULL;
+
+    nentries = getfsstat(NULL, 0, MNT_NOWAIT);
+
+    if (nentries <= 0) {
+        free(iter);
+        throwUnixException(env, errno);
+        return 0;
+    }
+
+    // It's possible that a new filesystem gets mounted between
+    // the first getfsstat and the second so loop until consistant
+
+    while (nentries != iter->nentries) {
+        if (iter->buf != NULL)
+            free(iter->buf);
+
+        bufsize = nentries * sizeof(struct statfs);
+        iter->nentries = nentries;
+
+        iter->buf = malloc(bufsize);
+        if (iter->buf == NULL) {
+            free(iter);
+            JNU_ThrowOutOfMemoryError(env, "native heap");
+            return 0;
+        }
+
+        nentries = getfsstat(iter->buf, bufsize, MNT_WAIT);
+        if (nentries <= 0) {
+            free(iter->buf);
+            free(iter);
+            throwUnixException(env, errno);
+            return 0;
+        }
+    }
+
+    return (jlong)iter;
+}
+
+JNIEXPORT jint JNICALL
+Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry(JNIEnv* env, jclass this,
+    jlong value, jobject entry)
+{
+    struct fsstat_iter *iter = jlong_to_ptr(value);
+    jsize len;
+    jbyteArray bytes;
+    char* name;
+    char* dir;
+    char* fstype;
+    char* options;
+    dev_t dev;
+
+    if (iter == NULL || iter->pos >= iter->nentries)
+       return -1;
+
+    name = iter->buf[iter->pos].f_mntfromname;
+    dir = iter->buf[iter->pos].f_mntonname;
+    fstype = iter->buf[iter->pos].f_fstypename;
+    if (iter->buf[iter->pos].f_flags & ISREADONLY)
+        options="ro";
+    else
+        options="";
+
+    iter->pos++;
+
+    len = strlen(name);
+    bytes = (*env)->NewByteArray(env, len);
+    if (bytes == NULL)
+        return -1;
+    (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
+    (*env)->SetObjectField(env, entry, entry_name, bytes);
+
+    len = strlen(dir);
+    bytes = (*env)->NewByteArray(env, len);
+    if (bytes == NULL)
+        return -1;
+    (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
+    (*env)->SetObjectField(env, entry, entry_dir, bytes);
+
+    len = strlen(fstype);
+    bytes = (*env)->NewByteArray(env, len);
+    if (bytes == NULL)
+        return -1;
+    (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
+    (*env)->SetObjectField(env, entry, entry_fstype, bytes);
+
+    len = strlen(options);
+    bytes = (*env)->NewByteArray(env, len);
+    if (bytes == NULL)
+        return -1;
+    (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
+    (*env)->SetObjectField(env, entry, entry_options, bytes);
+
+    return 0;
+}
+
+JNIEXPORT void JNICALL
+Java_sun_nio_fs_BsdNativeDispatcher_endfsstat(JNIEnv* env, jclass this, jlong value)
+{
+    struct fsstat_iter *iter = jlong_to_ptr(value);
+
+    if (iter != NULL) {
+        free(iter->buf);
+        free(iter);
+    }
+}
--- a/src/java.base/share/native/libjli/jli_util.h	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/share/native/libjli/jli_util.h	Sat Apr 16 16:31:31 2016 -0700
@@ -99,6 +99,9 @@
 #ifdef MACOSX
 #define JLI_Lseek                       lseek
 #endif
+#ifdef _ALLBSD_SOURCE
+#define JLI_Lseek                       lseek
+#endif
 #ifdef _AIX
 #define JLI_Lseek                       lseek
 #endif
--- a/src/java.base/share/native/libzip/zlib-1.2.8/gzguts.h	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/share/native/libzip/zlib-1.2.8/gzguts.h	Sat Apr 16 16:31:31 2016 -0700
@@ -42,6 +42,7 @@
 #  define ZLIB_INTERNAL
 #endif
 
+#include <unistd.h>
 #include <stdio.h>
 #include "zlib.h"
 #ifdef STDC
--- a/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/classes/sun/nio/fs/DefaultFileSystemProvider.java	Sat Apr 16 16:31:31 2016 -0700
@@ -63,6 +63,8 @@
             return createProvider("sun.nio.fs.LinuxFileSystemProvider");
         if (osname.contains("OS X"))
             return createProvider("sun.nio.fs.MacOSXFileSystemProvider");
+        if (osname.contains("BSD"))
+            return createProvider("sun.nio.fs.BsdFileSystemProvider");
         if (osname.equals("AIX"))
             return createProvider("sun.nio.fs.AixFileSystemProvider");
         throw new AssertionError("Platform not recognized");
--- a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c	Sat Apr 16 16:31:31 2016 -0700
@@ -253,6 +253,7 @@
             return status;
         }
      } else {
+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
         /*
          * Wait for the child process to exit without reaping the exitValue.
          * waitid() is standard on all POSIX platforms.
@@ -283,6 +284,28 @@
               */
              return siginfo.si_status;
         }
+#else
+        /*
+         * waitid() is not available on OpenBSD. Do the next best thing and wait
+         * as with reapStatus == JNI_TRUE.
+         */
+        int status;
+        while (waitpid(pid, &status, 0) < 0) {
+            switch (errno) {
+                case ECHILD: return 0;
+                case EINTR: break;
+                default: return -1;
+            }
+        }
+
+        if (WIFEXITED(status)) {
+            return WEXITSTATUS(status);
+        } else if (WIFSIGNALED(status)) {
+            return WTERMSIG_RETURN(status);
+        } else {
+            return status;
+        }
+#endif
     }
 }
 
--- a/src/java.base/unix/native/libjava/TimeZone_md.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c	Sat Apr 16 16:31:31 2016 -0700
@@ -69,7 +69,7 @@
 static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
 #endif
 
-#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__solaris__)
 
 /*
  * Returns a pointer to the zone ID portion of the given zoneinfo file
@@ -215,7 +215,7 @@
     return tz;
 }
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
 
 /*
  * Performs Linux specific mapping and returns a zone ID
@@ -815,7 +815,7 @@
  * Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
  */
 
-#if defined(MACOSX)
+#if defined(_ALLBSD_SOURCE)
 
 char *
 getGMTOffsetID()
@@ -877,4 +877,4 @@
             sign, (int)(offset/3600), (int)((offset%3600)/60));
     return strdup(buf);
 }
-#endif /* MACOSX */
+#endif /* _ALLBSD_SOURCE */
--- a/src/java.base/unix/native/libjli/ergo_i586.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libjli/ergo_i586.c	Sat Apr 16 16:31:31 2016 -0700
@@ -106,7 +106,7 @@
 
 #endif /* __solaris__ */
 
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
 
 /*
  * A utility method for asking the CPU about itself.
@@ -197,7 +197,7 @@
            (result == JNI_TRUE ? "true" : "false"));
   return result;
 }
-#endif /* __linux__ */
+#endif /* __linux__ || _ALLBSD_SOURCE */
 
 /*
  * Routines shared by solaris-i586 and linux-i586.
--- a/src/java.base/unix/native/libnet/NetworkInterface.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c	Sat Apr 16 16:31:31 2016 -0700
@@ -26,9 +26,6 @@
 
 #include <errno.h>
 #include <strings.h>
-#if defined(_ALLBSD_SOURCE) && defined(__OpenBSD__)
-#include <sys/types.h>
-#endif
 #include <netinet/in.h>
 #include <stdlib.h>
 #include <string.h>
@@ -67,14 +64,19 @@
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/sockio.h>
-#if defined(__APPLE__)
+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
 #include <net/ethernet.h>
+#else
+#include <netinet6/in6_var.h>
+#include <netinet/if_ether.h>
+#endif
+#if !defined(__NetBSD__)
 #include <net/if_var.h>
+#endif
 #include <net/if_dl.h>
 #include <netinet/in_var.h>
 #include <ifaddrs.h>
 #endif
-#endif
 
 #include "jvm.h"
 #include "jni_util.h"
--- a/src/java.base/unix/native/libnet/net_util_md.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libnet/net_util_md.c	Sat Apr 16 16:31:31 2016 -0700
@@ -46,6 +46,10 @@
 #endif
 #endif
 
+#ifdef __OpenBSD__
+#include <sys/socketvar.h>
+#endif
+
 #ifdef __solaris__
 #include <sys/filio.h>
 #include <sys/sockio.h>
--- a/src/java.base/unix/native/libnet/portconfig.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libnet/portconfig.c	Sat Apr 16 16:31:31 2016 -0700
@@ -67,6 +67,21 @@
         range->lower = net_getParam("/dev/tcp", "tcp_smallest_anon_port");
         return 0;
     }
+#elif defined(__OpenBSD__)
+    {
+        int ret;
+        size_t size = sizeof(range->lower);
+        int mib_lower[3] = { CTL_NET, PF_INET, IPCTL_IPPORT_HIFIRSTAUTO };
+        ret = sysctl(mib_lower, 3, &range->lower, &size, NULL, 0);
+        if (ret == -1) {
+            return -1;
+        }
+
+        int mib_higher[3] = { CTL_NET, PF_INET, IPCTL_IPPORT_HILASTAUTO };
+        size = sizeof(range->higher);
+        ret = sysctl(mib_higher, 3, &range->higher, &size, NULL, 0);
+        return ret;
+    }
 #elif defined(_ALLBSD_SOURCE)
     {
         int ret;
--- a/src/java.base/unix/native/libnio/ch/Net.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libnio/ch/Net.c	Sat Apr 16 16:31:31 2016 -0700
@@ -57,9 +57,9 @@
 #endif
 
 /**
- * IPV6_ADD_MEMBERSHIP/IPV6_DROP_MEMBERSHIP may not be defined on OSX and AIX
+ * IPV6_ADD_MEMBERSHIP/IPV6_DROP_MEMBERSHIP may not be defined on OSX, AIX and BSD
  */
-#if defined(__APPLE__) || defined(_AIX)
+#if defined(__APPLE__) || defined(_AIX) || defined(_ALLBSD_SOURCE)
   #ifndef IPV6_ADD_MEMBERSHIP
     #define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP
     #define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
@@ -102,6 +102,7 @@
  * into group_source_req structure.
  */
 #ifdef AF_INET6
+  #if !defined(__OpenBSD__) && !defined(__NetBSD__)
 static void initGroupSourceReq(JNIEnv* env, jbyteArray group, jint index,
                                jbyteArray source, struct group_source_req* req)
 {
@@ -117,6 +118,7 @@
     sin6->sin6_family = AF_INET6;
     COPY_INET6_ADDRESS(env, source, (jbyte*)&(sin6->sin6_addr));
 }
+  #endif
 #endif
 
 #ifdef _AIX
@@ -492,6 +494,10 @@
 Java_sun_nio_ch_Net_joinOrDrop4(JNIEnv *env, jobject this, jboolean join, jobject fdo,
                                 jint group, jint interf, jint source)
 {
+#if defined(__OpenBSD__) || defined(__NetBSD__)
+    /* no IPv4 exclude-mode filtering for now */
+    return IOS_UNAVAILABLE;
+#else
     struct ip_mreq mreq;
     struct ip_mreq_source mreq_source;
     int opt, n, optlen;
@@ -527,13 +533,14 @@
         handleSocketError(env, errno);
     }
     return 0;
+#endif
 }
 
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_Net_blockOrUnblock4(JNIEnv *env, jobject this, jboolean block, jobject fdo,
                                     jint group, jint interf, jint source)
 {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__)
     /* no IPv4 exclude-mode filtering for now */
     return IOS_UNAVAILABLE;
 #else
@@ -569,7 +576,6 @@
 {
 #ifdef AF_INET6
     struct ipv6_mreq mreq6;
-    struct group_source_req req;
     int opt, n, optlen;
     void* optval;
 
@@ -580,10 +586,12 @@
         optval = (void*)&mreq6;
         optlen = sizeof(mreq6);
     } else {
-#ifdef __APPLE__
+#if defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
         /* no IPv6 include-mode filtering for now */
         return IOS_UNAVAILABLE;
 #else
+        struct group_source_req req;
+
         initGroupSourceReq(env, group, index, source, &req);
         opt = (join) ? MCAST_JOIN_SOURCE_GROUP : MCAST_LEAVE_SOURCE_GROUP;
         optval = (void*)&req;
@@ -609,7 +617,7 @@
                                     jbyteArray group, jint index, jbyteArray source)
 {
 #ifdef AF_INET6
-  #ifdef __APPLE__
+  #if defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__)
     /* no IPv6 exclude-mode filtering for now */
     return IOS_UNAVAILABLE;
   #else
--- a/src/java.base/unix/native/libnio/fs/GioFileTypeDetector.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.base/unix/native/libnio/fs/GioFileTypeDetector.c	Sat Apr 16 16:31:31 2016 -0700
@@ -39,6 +39,10 @@
 #include <string.h>
 #endif
 
+#if defined(_ALLBSD_SOURCE)
+#include <string.h>
+#endif
+
 /*
  * For reference see for example the GFileInfo section at
  * https://developer.gnome.org/gio/unstable/.
--- a/src/java.desktop/share/native/common/awt/medialib/mlib_sys.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.desktop/share/native/common/awt/medialib/mlib_sys.c	Sat Apr 16 16:31:31 2016 -0700
@@ -26,7 +26,7 @@
 
 #include <stdlib.h>
 #include <string.h>
-#ifdef MACOSX
+#if defined(MACOSX) || defined(_ALLBSD_SOURCE)
 #include <unistd.h>
 #include <sys/param.h>
 #else
@@ -95,7 +95,7 @@
    * aligned for the storage of any type of object (see 'man malloc').
    */
   return (void *) malloc(size);
-#elif defined(MACOSX)
+#elif defined(MACOSX) || defined(_ALLBSD_SOURCE)
   return valloc(size);
 #else
   return (void *) memalign(8, size);
--- a/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h	Sat Apr 16 16:31:31 2016 -0700
@@ -31,6 +31,9 @@
 #endif
 
 #include <stddef.h>
+#if defined(__OpenBSD__) || defined (__NetBSD__)
+#include <stdint.h>
+#endif
 
 #include "java_awt_AlphaComposite.h"
 
--- a/src/java.desktop/unix/native/common/awt/awt_Font.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.desktop/unix/native/common/awt/awt_Font.c	Sat Apr 16 16:31:31 2016 -0700
@@ -638,7 +638,7 @@
 
             /* XXX: sometimes XLoadQueryFont returns a bogus font structure */
             /* with negative ascent. */
-            if (xfont == (Font) NULL || xfont->ascent < 0) {
+            if (xfont == NULL || xfont->ascent < 0) {
                 if (xfont != NULL) {
                     XFreeFont(display, xfont);
                 }
--- a/src/java.desktop/unix/native/common/awt/fontpath.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c	Sat Apr 16 16:31:31 2016 -0700
@@ -23,9 +23,9 @@
  * questions.
  */
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
 #include <string.h>
-#endif /* __linux__ */
+#endif /* __linux__ || _ALLBSD_SOURCE */
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
--- a/src/jdk.crypto.pkcs11/unix/native/libj2pkcs11/j2secmod_md.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/jdk.crypto.pkcs11/unix/native/libj2pkcs11/j2secmod_md.c	Sat Apr 16 16:31:31 2016 -0700
@@ -55,7 +55,7 @@
     }
 
     // look up existing handle only, do not load
-#if defined(AIX)
+#if defined(AIX) || defined(__OpenBSD__)
     void *hModule = dlopen(libName, RTLD_LAZY);
 #else
     void *hModule = dlopen(libName, RTLD_NOLOAD);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.management/bsd/native/libmanagement_ext/UnixOperatingSystem.c	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2015 SAP AG. 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.
+ */
+
+/* Empty stubs for now to satisfy the new build process.                 */
+/* Implement and update https://bugs.openjdk.java.net/browse/JDK-8030957 */
+
+#include <jni.h>
+#include "com_sun_management_internal_OperatingSystemImpl.h"
+
+JNIEXPORT jdouble JNICALL
+Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0
+(JNIEnv *env, jobject dummy)
+{
+    return -1.0;
+}
+
+JNIEXPORT jdouble JNICALL
+Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0
+(JNIEnv *env, jobject dummy)
+{
+    return -1.0;
+}
--- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c	Sat Apr 16 16:21:10 2016 -0700
+++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c	Sat Apr 16 16:31:31 2016 -0700
@@ -355,7 +355,11 @@
     size_t rlen;
 
     mib[0] = CTL_HW;
+#ifdef __APPLE__
     mib[1] = HW_MEMSIZE;
+#else
+    mib[1] = HW_PHYSMEM;
+#endif
     rlen = sizeof(result);
     if (sysctl(mib, 2, &result, &rlen, NULL, 0) != 0) {
         throw_internal_error(env, "sysctl failed");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.sctp/bsd/classes/sun/nio/ch/sctp/SctpChannelImpl.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import java.net.InetAddress;
+import java.io.IOException;
+import java.util.Set;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.NotificationHandler;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+
+/**
+ * Unimplemented.
+ */
+public class SctpChannelImpl extends SctpChannel
+{
+    private static final String message = "SCTP not supported on this platform";
+
+    public SctpChannelImpl(SelectorProvider provider) {
+        super(provider);
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Association association() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel bind(SocketAddress local)
+                            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel bindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel unbindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean connect(SocketAddress remote) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean connect(SocketAddress remote, int maxOutStreams,
+       int maxInStreams) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean isConnectionPending() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean finishConnect() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getRemoteAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel shutdown() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> T getOption(SctpSocketOption<T> name)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> SctpChannel setOption(SctpSocketOption<T> name, T value)
+        throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SctpSocketOption<?>> supportedOptions() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> MessageInfo receive(ByteBuffer dst, T attachment,
+            NotificationHandler<T> handler) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public int send(ByteBuffer src, MessageInfo messageInfo)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.sctp/bsd/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import java.net.InetAddress;
+import java.io.IOException;
+import java.util.Set;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.NotificationHandler;
+import com.sun.nio.sctp.SctpMultiChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+
+/**
+ * Unimplemented.
+ */
+public class SctpMultiChannelImpl extends SctpMultiChannel
+{
+    private static final String message = "SCTP not supported on this platform";
+
+    public SctpMultiChannelImpl(SelectorProvider provider) {
+        super(provider);
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<Association> associations() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel bind(SocketAddress local,
+            int backlog) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel bindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel unbindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getRemoteAddresses
+            (Association association) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel shutdown(Association association)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> T getOption(SctpSocketOption<T> name,
+            Association association) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
+            T value, Association association) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SctpSocketOption<?>> supportedOptions() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> MessageInfo receive(ByteBuffer buffer, T attachment,
+            NotificationHandler<T> handler) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public int send(ByteBuffer buffer, MessageInfo messageInfo)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel branch(Association association)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.sctp/bsd/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java	Sat Apr 16 16:31:31 2016 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import java.net.InetAddress;
+import java.io.IOException;
+import java.util.Set;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.SctpServerChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+
+/**
+ * Unimplemented.
+ */
+public class SctpServerChannelImpl extends SctpServerChannel
+{
+    private static final String message = "SCTP not supported on this platform";
+
+    public SctpServerChannelImpl(SelectorProvider provider) {
+        super(provider);
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel accept() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpServerChannel bind(SocketAddress local,
+            int backlog) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpServerChannel bindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpServerChannel unbindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> T getOption(SctpSocketOption<T> name) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> SctpServerChannel setOption(SctpSocketOption<T> name,
+            T value) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SctpSocketOption<?>> supportedOptions() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+}