8187443: Forest Consolidation: Move files to unified layout

Reviewed-by: darcy, ihse
This commit is contained in:
Erik Joelsson 2017-09-12 19:03:39 +02:00
parent 270fe13182
commit 3789983e89
56923 changed files with 3 additions and 15727 deletions

View file

@ -0,0 +1,91 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 SAP SE. 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.*;
import java.nio.channels.spi.AsynchronousChannelProvider;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
import java.io.IOException;
public class AixAsynchronousChannelProvider
extends AsynchronousChannelProvider
{
private static volatile AixPollPort defaultPort;
private AixPollPort defaultEventPort() throws IOException {
if (defaultPort == null) {
synchronized (AixAsynchronousChannelProvider.class) {
if (defaultPort == null) {
defaultPort = new AixPollPort(this, ThreadPool.getDefault()).start();
}
}
}
return defaultPort;
}
public AixAsynchronousChannelProvider() {
}
@Override
public AsynchronousChannelGroup openAsynchronousChannelGroup(int nThreads, ThreadFactory factory)
throws IOException
{
return new AixPollPort(this, ThreadPool.create(nThreads, factory)).start();
}
@Override
public AsynchronousChannelGroup openAsynchronousChannelGroup(ExecutorService executor, int initialSize)
throws IOException
{
return new AixPollPort(this, ThreadPool.wrap(executor, initialSize)).start();
}
private Port toPort(AsynchronousChannelGroup group) throws IOException {
if (group == null) {
return defaultEventPort();
} else {
if (!(group instanceof AixPollPort))
throw new IllegalChannelGroupException();
return (Port)group;
}
}
@Override
public AsynchronousServerSocketChannel openAsynchronousServerSocketChannel(AsynchronousChannelGroup group)
throws IOException
{
return new UnixAsynchronousServerSocketChannelImpl(toPort(group));
}
@Override
public AsynchronousSocketChannel openAsynchronousSocketChannel(AsynchronousChannelGroup group)
throws IOException
{
return new UnixAsynchronousSocketChannelImpl(toPort(group));
}
}

View file

@ -0,0 +1,542 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 SAP SE. 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.AsynchronousChannelProvider;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
import jdk.internal.misc.Unsafe;
/**
* AsynchronousChannelGroup implementation based on the AIX pollset framework.
*/
final class AixPollPort
extends Port
{
private static final Unsafe unsafe = Unsafe.getUnsafe();
static {
IOUtil.load();
init();
}
/**
* struct pollfd {
* int fd;
* short events;
* short revents;
* }
*/
private static final int SIZEOF_POLLFD = eventSize();
private static final int OFFSETOF_EVENTS = eventsOffset();
private static final int OFFSETOF_REVENTS = reventsOffset();
private static final int OFFSETOF_FD = fdOffset();
// opcodes
private static final int PS_ADD = 0x0;
private static final int PS_MOD = 0x1;
private static final int PS_DELETE = 0x2;
// maximum number of events to poll at a time
private static final int MAX_POLL_EVENTS = 512;
// pollset ID
private final int pollset;
// true if port is closed
private boolean closed;
// socket pair used for wakeup
private final int sp[];
// socket pair used to indicate pending pollsetCtl calls
// Background info: pollsetCtl blocks when another thread is in a pollsetPoll call.
private final int ctlSp[];
// number of wakeups pending
private final AtomicInteger wakeupCount = new AtomicInteger();
// address of the poll array passed to pollset_poll
private final long address;
// encapsulates an event for a channel
static class Event {
final PollableChannel channel;
final int events;
Event(PollableChannel channel, int events) {
this.channel = channel;
this.events = events;
}
PollableChannel channel() { return channel; }
int events() { return events; }
}
// queue of events for cases that a polling thread dequeues more than one
// event
private final ArrayBlockingQueue<Event> queue;
private final Event NEED_TO_POLL = new Event(null, 0);
private final Event EXECUTE_TASK_OR_SHUTDOWN = new Event(null, 0);
private final Event CONTINUE_AFTER_CTL_EVENT = new Event(null, 0);
// encapsulates a pollset control event for a file descriptor
static class ControlEvent {
final int fd;
final int events;
final boolean removeOnly;
int error = 0;
ControlEvent(int fd, int events, boolean removeOnly) {
this.fd = fd;
this.events = events;
this.removeOnly = removeOnly;
}
int fd() { return fd; }
int events() { return events; }
boolean removeOnly() { return removeOnly; }
int error() { return error; }
void setError(int error) { this.error = error; }
}
// queue of control events that need to be processed
// (this object is also used for synchronization)
private final HashSet<ControlEvent> controlQueue = new HashSet<ControlEvent>();
// lock used to check whether a poll operation is ongoing
private final ReentrantLock controlLock = new ReentrantLock();
AixPollPort(AsynchronousChannelProvider provider, ThreadPool pool)
throws IOException
{
super(provider, pool);
// open pollset
this.pollset = pollsetCreate();
// create socket pair for wakeup mechanism
int[] sv = new int[2];
try {
socketpair(sv);
// register one end with pollset
pollsetCtl(pollset, PS_ADD, sv[0], Net.POLLIN);
} catch (IOException x) {
pollsetDestroy(pollset);
throw x;
}
this.sp = sv;
// create socket pair for pollset control mechanism
sv = new int[2];
try {
socketpair(sv);
// register one end with pollset
pollsetCtl(pollset, PS_ADD, sv[0], Net.POLLIN);
} catch (IOException x) {
pollsetDestroy(pollset);
throw x;
}
this.ctlSp = sv;
// allocate the poll array
this.address = allocatePollArray(MAX_POLL_EVENTS);
// create the queue and offer the special event to ensure that the first
// threads polls
this.queue = new ArrayBlockingQueue<Event>(MAX_POLL_EVENTS);
this.queue.offer(NEED_TO_POLL);
}
AixPollPort start() {
startThreads(new EventHandlerTask());
return this;
}
/**
* Release all resources
*/
private void implClose() {
synchronized (this) {
if (closed)
return;
closed = true;
}
freePollArray(address);
close0(sp[0]);
close0(sp[1]);
close0(ctlSp[0]);
close0(ctlSp[1]);
pollsetDestroy(pollset);
}
private void wakeup() {
if (wakeupCount.incrementAndGet() == 1) {
// write byte to socketpair to force wakeup
try {
interrupt(sp[1]);
} catch (IOException x) {
throw new AssertionError(x);
}
}
}
@Override
void executeOnHandlerTask(Runnable task) {
synchronized (this) {
if (closed)
throw new RejectedExecutionException();
offerTask(task);
wakeup();
}
}
@Override
void shutdownHandlerTasks() {
/*
* If no tasks are running then just release resources; otherwise
* write to the one end of the socketpair to wakeup any polling threads.
*/
int nThreads = threadCount();
if (nThreads == 0) {
implClose();
} else {
// send interrupt to each thread
while (nThreads-- > 0) {
wakeup();
}
}
}
// invoke by clients to register a file descriptor
@Override
void startPoll(int fd, int events) {
queueControlEvent(new ControlEvent(fd, events, false));
}
// Callback method for implementations that need special handling when fd is removed
@Override
protected void preUnregister(int fd) {
queueControlEvent(new ControlEvent(fd, 0, true));
}
// Add control event into queue and wait for completion.
// In case the control lock is free, this method also tries to apply the control change directly.
private void queueControlEvent(ControlEvent ev) {
// pollsetCtl blocks when a poll call is ongoing. This is very probable.
// Therefore we let the polling thread do the pollsetCtl call.
synchronized (controlQueue) {
controlQueue.add(ev);
// write byte to socketpair to force wakeup
try {
interrupt(ctlSp[1]);
} catch (IOException x) {
throw new AssertionError(x);
}
do {
// Directly empty queue if no poll call is ongoing.
if (controlLock.tryLock()) {
try {
processControlQueue();
} finally {
controlLock.unlock();
}
} else {
try {
// Do not starve in case the polling thread returned before
// we could write to ctlSp[1] but the polling thread did not
// release the control lock until we checked. Therefore, use
// a timed wait for the time being.
controlQueue.wait(100);
} catch (InterruptedException e) {
// ignore exception and try again
}
}
} while (controlQueue.contains(ev));
}
if (ev.error() != 0) {
throw new AssertionError();
}
}
// Process all events currently stored in the control queue.
private void processControlQueue() {
synchronized (controlQueue) {
// On Aix it is only possible to set the event
// bits on the first call of pollsetCtl. Later
// calls only add bits, but cannot remove them.
// Therefore, we always remove the file
// descriptor ignoring the error and then add it.
Iterator<ControlEvent> iter = controlQueue.iterator();
while (iter.hasNext()) {
ControlEvent ev = iter.next();
pollsetCtl(pollset, PS_DELETE, ev.fd(), 0);
if (!ev.removeOnly()) {
ev.setError(pollsetCtl(pollset, PS_MOD, ev.fd(), ev.events()));
}
iter.remove();
}
controlQueue.notifyAll();
}
}
/*
* Task to process events from pollset and dispatch to the channel's
* onEvent handler.
*
* Events are retreived from pollset in batch and offered to a BlockingQueue
* where they are consumed by handler threads. A special "NEED_TO_POLL"
* event is used to signal one consumer to re-poll when all events have
* been consumed.
*/
private class EventHandlerTask implements Runnable {
private Event poll() throws IOException {
try {
for (;;) {
int n;
controlLock.lock();
try {
n = pollsetPoll(pollset, address, MAX_POLL_EVENTS);
} finally {
controlLock.unlock();
}
/*
* 'n' events have been read. Here we map them to their
* corresponding channel in batch and queue n-1 so that
* they can be handled by other handler threads. The last
* event is handled by this thread (and so is not queued).
*/
fdToChannelLock.readLock().lock();
try {
while (n-- > 0) {
long eventAddress = getEvent(address, n);
int fd = getDescriptor(eventAddress);
// To emulate one shot semantic we need to remove
// the file descriptor here.
if (fd != sp[0] && fd != ctlSp[0]) {
synchronized (controlQueue) {
pollsetCtl(pollset, PS_DELETE, fd, 0);
}
}
// wakeup
if (fd == sp[0]) {
if (wakeupCount.decrementAndGet() == 0) {
// no more wakeups so drain pipe
drain1(sp[0]);
}
// queue special event if there are more events
// to handle.
if (n > 0) {
queue.offer(EXECUTE_TASK_OR_SHUTDOWN);
continue;
}
return EXECUTE_TASK_OR_SHUTDOWN;
}
// wakeup to process control event
if (fd == ctlSp[0]) {
synchronized (controlQueue) {
drain1(ctlSp[0]);
processControlQueue();
}
if (n > 0) {
continue;
}
return CONTINUE_AFTER_CTL_EVENT;
}
PollableChannel channel = fdToChannel.get(fd);
if (channel != null) {
int events = getRevents(eventAddress);
Event ev = new Event(channel, events);
// n-1 events are queued; This thread handles
// the last one except for the wakeup
if (n > 0) {
queue.offer(ev);
} else {
return ev;
}
}
}
} finally {
fdToChannelLock.readLock().unlock();
}
}
} finally {
// to ensure that some thread will poll when all events have
// been consumed
queue.offer(NEED_TO_POLL);
}
}
public void run() {
Invoker.GroupAndInvokeCount myGroupAndInvokeCount =
Invoker.getGroupAndInvokeCount();
final boolean isPooledThread = (myGroupAndInvokeCount != null);
boolean replaceMe = false;
Event ev;
try {
for (;;) {
// reset invoke count
if (isPooledThread)
myGroupAndInvokeCount.resetInvokeCount();
try {
replaceMe = false;
ev = queue.take();
// no events and this thread has been "selected" to
// poll for more.
if (ev == NEED_TO_POLL) {
try {
ev = poll();
} catch (IOException x) {
x.printStackTrace();
return;
}
}
} catch (InterruptedException x) {
continue;
}
// contine after we processed a control event
if (ev == CONTINUE_AFTER_CTL_EVENT) {
continue;
}
// handle wakeup to execute task or shutdown
if (ev == EXECUTE_TASK_OR_SHUTDOWN) {
Runnable task = pollTask();
if (task == null) {
// shutdown request
return;
}
// run task (may throw error/exception)
replaceMe = true;
task.run();
continue;
}
// process event
try {
ev.channel().onEvent(ev.events(), isPooledThread);
} catch (Error x) {
replaceMe = true; throw x;
} catch (RuntimeException x) {
replaceMe = true; throw x;
}
}
} finally {
// last handler to exit when shutdown releases resources
int remaining = threadExit(this, replaceMe);
if (remaining == 0 && isShutdown()) {
implClose();
}
}
}
}
/**
* Allocates a poll array to handle up to {@code count} events.
*/
private static long allocatePollArray(int count) {
return unsafe.allocateMemory(count * SIZEOF_POLLFD);
}
/**
* Free a poll array
*/
private static void freePollArray(long address) {
unsafe.freeMemory(address);
}
/**
* Returns event[i];
*/
private static long getEvent(long address, int i) {
return address + (SIZEOF_POLLFD*i);
}
/**
* Returns event->fd
*/
private static int getDescriptor(long eventAddress) {
return unsafe.getInt(eventAddress + OFFSETOF_FD);
}
/**
* Returns event->events
*/
private static int getEvents(long eventAddress) {
return unsafe.getChar(eventAddress + OFFSETOF_EVENTS);
}
/**
* Returns event->revents
*/
private static int getRevents(long eventAddress) {
return unsafe.getChar(eventAddress + OFFSETOF_REVENTS);
}
// -- Native methods --
private static native void init();
private static native int eventSize();
private static native int eventsOffset();
private static native int reventsOffset();
private static native int fdOffset();
private static native int pollsetCreate() throws IOException;
private static native int pollsetCtl(int pollset, int opcode, int fd, int events);
private static native int pollsetPoll(int pollset, long pollAddress, int numfds)
throws IOException;
private static native void pollsetDestroy(int pollset);
private static native void socketpair(int[] sv) throws IOException;
private static native void interrupt(int fd) throws IOException;
private static native void drain1(int fd) throws IOException;
private static native void close0(int fd);
}

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2017, 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.AsynchronousChannelProvider;
/**
* Creates this platform's default AsynchronousChannelProvider
*/
public class DefaultAsynchronousChannelProvider {
/**
* Prevent instantiation.
*/
private DefaultAsynchronousChannelProvider() { }
/**
* Returns the default AsynchronousChannelProvider.
*/
public static AsynchronousChannelProvider create() {
return new AixAsynchronousChannelProvider();
}
}

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2015, 2017, 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 PollSelectorProvider();
}
}

View file

@ -0,0 +1,106 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 SAP SE. 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;
/**
* AIX implementation of FileStore
*/
class AixFileStore
extends UnixFileStore
{
AixFileStore(UnixPath file) throws IOException {
super(file);
}
AixFileStore(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 {
AixFileSystem fs = (AixFileSystem)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");
}
// returns true if extended attributes enabled on file system where given
// file resides, returns false if disabled or unable to determine.
private boolean isExtendedAttributesEnabled(UnixPath path) {
return false;
}
@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
return super.supportsFileAttributeView(type);
}
@Override
public boolean supportsFileAttributeView(String name) {
return super.supportsFileAttributeView(name);
}
}

View file

@ -0,0 +1,94 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 SAP SE. 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.nio.file.attribute.*;
import java.io.IOException;
import java.util.*;
import static sun.nio.fs.AixNativeDispatcher.*;
/**
* AIX implementation of FileSystem
*/
class AixFileSystem extends UnixFileSystem {
AixFileSystem(UnixFileSystemProvider provider, String dir) {
super(provider, dir);
}
@Override
public WatchService newWatchService()
throws IOException
{
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(UnixFileSystem.standardFileAttributeViews());
return Collections.unmodifiableSet(result);
}
}
@Override
public Set<String> supportedFileAttributeViews() {
return SupportedFileFileAttributeViewsHolder.supportedFileAttributeViews;
}
@Override
void copyNonPosixAttributes(int ofd, int nfd) {
// TODO: Implement if needed.
}
/**
* Returns object to iterate over the mount entries returned by mntctl
*/
@Override
Iterable<UnixMountEntry> getMountEntries() {
UnixMountEntry[] entries = null;
try {
entries = getmntctl();
} catch (UnixException x) {
// nothing we can do
}
if (entries == null) {
return Collections.emptyList();
}
return Arrays.asList(entries);
}
@Override
FileStore getFileStore(UnixMountEntry entry) throws IOException {
return new AixFileStore(this, entry);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 SAP SE. 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;
/**
* AIX implementation of FileSystemProvider
*/
public class AixFileSystemProvider extends UnixFileSystemProvider {
public AixFileSystemProvider() {
super();
}
@Override
AixFileSystem newFileSystem(String dir) {
return new AixFileSystem(this, dir);
}
/**
* @see sun.nio.fs.UnixFileSystemProvider#getFileStore(sun.nio.fs.UnixPath)
*/
@Override
AixFileStore getFileStore(UnixPath path) throws IOException {
return new AixFileStore(path);
}
}

View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 SAP SE. 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;
/**
* AIX specific system calls.
*/
class AixNativeDispatcher extends UnixNativeDispatcher {
private AixNativeDispatcher() { }
/**
* Special implementation of 'getextmntent' (see SolarisNativeDispatcher)
* that returns all entries at once.
*/
static native UnixMountEntry[] getmntctl() throws UnixException;
// initialize
private static native void init();
static {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
System.loadLibrary("nio");
return null;
}});
init();
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2017, 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.spi.FileSystemProvider;
/**
* Creates this platform's default FileSystemProvider.
*/
public class DefaultFileSystemProvider {
private DefaultFileSystemProvider() { }
/**
* Returns the default FileSystemProvider.
*/
public static FileSystemProvider create() {
return new AixFileSystemProvider();
}
}

View file

@ -0,0 +1,586 @@
#
#
# Copyright (c) 1994, 2014, 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.
#
#
# Portions Copyright (c) 2014 IBM Corporation
#
# This table describes mappings between AIX time zone IDs and Java time zone
# IDs. Fields are separated by a single TAB ('\t'). Lines must be in the ascending
# order in ASCII. (non-ASCII characters can't be used.)
# NOTE
# This table format is not a public interface of any Java
# platforms. No applications should depend on this file in any form.
# This file has been generated using programs. Do not edit this file manually.
#
# Solaris Java
ACST-9:30ACDT Australia/Adelaide
AST4 America/Curacao
AST4ADT America/Halifax
AST9 Pacific/Gambier
AST9ADT America/Anchorage
AZOREST1 Atlantic/Cape_Verde
AZOREST1AZOREDT Atlantic/Azores
Africa/Abidjan Africa/Abidjan
Africa/Accra Africa/Accra
Africa/Addis_Ababa Africa/Addis_Ababa
Africa/Algiers Africa/Algiers
Africa/Asmera Africa/Asmera
Africa/Bamako GMT
Africa/Bangui Africa/Bangui
Africa/Banjul Africa/Banjul
Africa/Bissau Africa/Bissau
Africa/Blantyre Africa/Blantyre
Africa/Brazzaville Africa/Luanda
Africa/Bujumbura Africa/Bujumbura
Africa/Cairo Africa/Cairo
Africa/Casablanca Africa/Casablanca
Africa/Ceuta Europe/Paris
Africa/Conakry Africa/Conakry
Africa/Dakar Africa/Dakar
Africa/Dar_es_Salaam Africa/Dar_es_Salaam
Africa/Djibouti Africa/Djibouti
Africa/Douala Africa/Douala
Africa/El_Aaiun Africa/Casablanca
Africa/Freetown Africa/Freetown
Africa/Gaborone Africa/Gaborone
Africa/Harare Africa/Harare
Africa/Johannesburg Africa/Johannesburg
Africa/Kampala Africa/Kampala
Africa/Khartoum Africa/Khartoum
Africa/Kigali Africa/Kigali
Africa/Kinshasa Africa/Kinshasa
Africa/Lagos Africa/Lagos
Africa/Libreville Africa/Libreville
Africa/Lome Africa/Lome
Africa/Luanda Africa/Luanda
Africa/Lubumbashi Africa/Lubumbashi
Africa/Lusaka Africa/Lusaka
Africa/Malabo Africa/Malabo
Africa/Maputo Africa/Maputo
Africa/Maseru Africa/Maseru
Africa/Mbabane Africa/Mbabane
Africa/Mogadishu Africa/Mogadishu
Africa/Monrovia Africa/Monrovia
Africa/Nairobi Africa/Nairobi
Africa/Ndjamena Africa/Ndjamena
Africa/Niamey Africa/Niamey
Africa/Nouakchott Africa/Nouakchott
Africa/Ouagadougou Africa/Ouagadougou
Africa/Porto-Novo Africa/Porto-Novo
Africa/Sao_Tome Africa/Sao_Tome
Africa/Timbuktu Africa/Timbuktu
Africa/Tripoli Africa/Tripoli
Africa/Tunis Africa/Tunis
Africa/Windhoek Africa/Windhoek
America/Adak America/Adak
America/Anchorage America/Anchorage
America/Anguilla America/Anguilla
America/Antigua America/Antigua
America/Araguaina America/Sao_Paulo
America/Argentina/Buenos_Aires America/Argentina/Buenos_Aires
America/Argentina/Catamarca America/Argentina/Catamarca
America/Argentina/ComodRivadavia America/Argentina/Catamarca
America/Argentina/Cordoba America/Argentina/Cordoba
America/Argentina/Jujuy America/Argentina/Jujuy
America/Argentina/La_Rioja America/Argentina/La_Rioja
America/Argentina/Mendoza America/Argentina/Mendoza
America/Argentina/Rio_Gallegos America/Argentina/Rio_Gallegos
America/Argentina/Salta America/Argentina/Salta
America/Argentina/San_Juan America/Argentina/San_Juan
America/Argentina/San_Luis America/Argentina/San_Luis
America/Argentina/Tucuman America/Argentina/Tucuman
America/Argentina/Ushuaia America/Argentina/Ushuaia
America/Aruba America/Aruba
America/Asuncion America/Asuncion
America/Atka America/Adak
America/Barbados America/Barbados
America/Belize America/Belize
America/Bogota America/Bogota
America/Boise America/Denver
America/Buenos_Aires America/Argentina/Buenos_Aires
America/Cancun America/Chicago
America/Caracas America/Caracas
America/Catamarca America/Argentina/Catamarca
America/Cayenne America/Cayenne
America/Cayman America/Cayman
America/Chicago America/Chicago
America/Chihuahua America/Denver
America/Coral_Harbour America/Atikokan
America/Cordoba America/Argentina/Cordoba
America/Costa_Rica America/Costa_Rica
America/Cuiaba America/Cuiaba
America/Curacao America/Curacao
America/Dawson America/Los_Angeles
America/Dawson_Creek America/Dawson_Creek
America/Denver America/Denver
America/Detroit America/New_York
America/Dominica America/Dominica
America/Edmonton America/Edmonton
America/El_Salvador America/El_Salvador
America/Ensenada America/Los_Angeles
America/Fort_Wayne America/Indiana/Indianapolis
America/Fortaleza America/Fortaleza
America/Glace_Bay America/Halifax
America/Godthab America/Godthab
America/Goose_Bay America/Thule
America/Grand_Turk America/Grand_Turk
America/Grenada America/Grenada
America/Guadeloupe America/Guadeloupe
America/Guatemala America/Guatemala
America/Guayaquil America/Guayaquil
America/Guyana America/Guyana
America/Halifax America/Halifax
America/Havana America/Havana
America/Indiana/Indianapolis America/Indianapolis
America/Indianapolis America/Indiana/Indianapolis
America/Inuvik America/Denver
America/Iqaluit America/New_York
America/Jamaica America/Jamaica
America/Jujuy America/Argentina/Jujuy
America/Juneau America/Anchorage
America/Knox_IN America/Indiana/Knox
America/La_Paz America/La_Paz
America/Lima America/Lima
America/Los_Angeles America/Los_Angeles
America/Louisville America/Kentucky/Louisville
America/Managua America/Managua
America/Manaus America/Manaus
America/Marigot America/Guadeloupe
America/Martinique America/Martinique
America/Mazatlan America/Mazatlan
America/Mendoza America/Argentina/Mendoza
America/Menominee America/Winnipeg
America/Mexico_City America/Mexico_City
America/Miquelon America/Miquelon
America/Moncton America/Moncton
America/Montevideo America/Montevideo
America/Montreal America/Montreal
America/Montserrat America/Montserrat
America/Nassau America/Nassau
America/New_York America/New_York
America/Nipigon America/New_York
America/Nome America/Anchorage
America/Noronha America/Noronha
America/Panama America/Panama
America/Pangnirtung America/Thule
America/Paramaribo America/Paramaribo
America/Phoenix America/Phoenix
America/Port-au-Prince America/Port-au-Prince
America/Port_of_Spain America/Port_of_Spain
America/Porto_Acre America/Rio_Branco
America/Puerto_Rico America/Puerto_Rico
America/Rainy_River America/Chicago
America/Rankin_Inlet America/Chicago
America/Regina America/Regina
America/Rio_Branco America/Rio_Branco
America/Rosario America/Argentina/Cordoba
America/Santiago America/Santiago
America/Santo_Domingo America/Santo_Domingo
America/Sao_Paulo America/Sao_Paulo
America/Scoresbysund America/Scoresbysund
America/Shiprock America/Denver
America/St_Barthelemy America/Guadeloupe
America/St_Johns America/St_Johns
America/St_Kitts America/St_Kitts
America/St_Lucia America/St_Lucia
America/St_Thomas America/St_Thomas
America/St_Vincent America/St_Vincent
America/Tegucigalpa America/Tegucigalpa
America/Thule America/Thule
America/Thunder_Bay America/New_York
America/Tijuana America/Tijuana
America/Toronto America/Toronto
America/Tortola America/Tortola
America/Vancouver America/Vancouver
America/Virgin America/St_Thomas
America/Whitehorse America/Los_Angeles
America/Winnipeg America/Winnipeg
America/Yakutat America/Anchorage
America/Yellowknife America/Denver
Antarctica/Casey Antarctica/Casey
Antarctica/DumontDUrville Antarctica/DumontDUrville
Antarctica/Mawson Antarctica/Mawson
Antarctica/McMurdo Antarctica/McMurdo
Antarctica/Palmer Antarctica/Palmer
Antarctica/South_Pole Antarctica/McMurdo
Arctic/Longyearbyen Europe/Oslo
Asia/Aden Asia/Aden
Asia/Almaty Asia/Almaty
Asia/Amman Asia/Amman
Asia/Anadyr Asia/Anadyr
Asia/Aqtau Asia/Aqtau
Asia/Aqtobe Asia/Aqtobe
Asia/Ashkhabad Asia/Ashkhabad
Asia/Baghdad Asia/Baghdad
Asia/Bahrain Asia/Bahrain
Asia/Baku Asia/Baku
Asia/Bangkok Asia/Bangkok
Asia/Beirut Asia/Beirut
Asia/Bishkek Asia/Bishkek
Asia/Brunei Asia/Brunei
Asia/Calcutta Asia/Calcutta
Asia/Chungking Asia/Shanghai
Asia/Colombo Asia/Colombo
Asia/Dacca Asia/Dacca
Asia/Damascus Asia/Damascus
Asia/Dhaka Asia/Dhaka
Asia/Dubai Asia/Dubai
Asia/Dushanbe Asia/Dushanbe
Asia/Gaza Asia/Amman
Asia/Harbin Asia/Shanghai
Asia/Hong_Kong Asia/Hong_Kong
Asia/Irkutsk Asia/Irkutsk
Asia/Istanbul Europe/Istanbul
Asia/Jakarta Asia/Jakarta
Asia/Jayapura Asia/Jayapura
Asia/Jerusalem Asia/Jerusalem
Asia/Kabul Asia/Kabul
Asia/Kamchatka Asia/Kamchatka
Asia/Karachi Asia/Karachi
Asia/Kashgar Asia/Shanghai
Asia/Katmandu Asia/Katmandu
Asia/Kolkata Asia/Kolkata
Asia/Krasnoyarsk Asia/Krasnoyarsk
Asia/Kuala_Lumpur Asia/Kuala_Lumpur
Asia/Kuwait Asia/Kuwait
Asia/Macao Asia/Macao
Asia/Magadan Asia/Magadan
Asia/Manila Asia/Manila
Asia/Muscat Asia/Muscat
Asia/Nicosia Asia/Nicosia
Asia/Novosibirsk Asia/Novosibirsk
Asia/Omsk Asia/Novosibirsk
Asia/Phnom_Penh Asia/Phnom_Penh
Asia/Pyongyang Asia/Pyongyang
Asia/Qatar Asia/Qatar
Asia/Rangoon Asia/Rangoon
Asia/Riyadh Asia/Riyadh
Asia/Saigon Asia/Ho_Chi_Minh
Asia/Seoul Asia/Seoul
Asia/Shanghai Asia/Shanghai
Asia/Singapore Asia/Singapore
Asia/Taipei Asia/Taipei
Asia/Tashkent Asia/Tashkent
Asia/Tbilisi Asia/Tbilisi
Asia/Tehran Asia/Tehran
Asia/Tel_Aviv Asia/Jerusalem
Asia/Thimbu Asia/Thimbu
Asia/Tokyo Asia/Tokyo
Asia/Ujung_Pandang Asia/Ujung_Pandang
Asia/Ulan_Bator Asia/Ulaanbaatar
Asia/Urumqi Asia/Shanghai
Asia/Vientiane Asia/Vientiane
Asia/Vladivostok Asia/Vladivostok
Asia/Yakutsk Asia/Yakutsk
Asia/Yekaterinburg Asia/Yekaterinburg
Asia/Yerevan Asia/Yerevan
Atlantic/Azores Atlantic/Azores
Atlantic/Bermuda Atlantic/Bermuda
Atlantic/Canary Atlantic/Canary
Atlantic/Cape_Verde Atlantic/Cape_Verde
Atlantic/Faeroe Atlantic/Faeroe
Atlantic/Jan_Mayen Atlantic/Jan_Mayen
Atlantic/Madeira Europe/London
Atlantic/Reykjavik Atlantic/Reykjavik
Atlantic/South_Georgia Atlantic/South_Georgia
Atlantic/St_Helena Atlantic/St_Helena
Atlantic/Stanley Atlantic/Stanley
Australia/ACT Australia/Sydney
Australia/Adelaide Australia/Adelaide
Australia/Brisbane Australia/Brisbane
Australia/Broken_Hill Australia/Broken_Hill
Australia/Canberra Australia/Sydney
Australia/Darwin Australia/Darwin
Australia/Hobart Australia/Hobart
Australia/LHI Australia/Lord_Howe
Australia/Lord_Howe Australia/Lord_Howe
Australia/Melbourne Australia/Sydney
Australia/NSW Australia/Sydney
Australia/North Australia/Darwin
Australia/Perth Australia/Perth
Australia/Queensland Australia/Brisbane
Australia/South Australia/Adelaide
Australia/Sydney Australia/Sydney
Australia/Tasmania Australia/Hobart
Australia/Victoria Australia/Melbourne
Australia/West Australia/Perth
Australia/Yancowinna Australia/Broken_Hill
BRT3BRST America/Sao_Paulo
BST11 Pacific/Apia
BST11BDT Pacific/Apia
Brazil/Acre America/Rio_Branco
Brazil/DeNoronha America/Noronha
Brazil/East America/Sao_Paulo
Brazil/West America/Manaus
CET Europe/Paris
CET-1CEST Europe/Paris
CET-1CEST-2 Europe/Berlin
CET-1CET-2 Europe/Paris
CST6 America/Costa_Rica
CST6CDT America/Chicago
CUT0 UTC
CUT0GDT Europe/London
Canada/Atlantic America/Halifax
Canada/Central America/Winnipeg
Canada/East-Saskatchewan America/Regina
Canada/Eastern America/Montreal
Canada/Mountain America/Edmonton
Canada/Newfoundland America/St_Johns
Canada/Pacific America/Vancouver
Canada/Saskatchewan America/Regina
Canada/Yukon America/Whitehorse
Chile/Continental America/Santiago
Chile/EasterIsland Pacific/Easter
Cuba America/Havana
EET Europe/Istanbul
EET-10 Australia/Brisbane
EET-10EETDT Australia/Sydney
EST America/Indianapolis
EST5 America/Indianapolis
EST5EDT America/New_York
Egypt Africa/Cairo
Eire Europe/Dublin
Etc/GMT GMT
Etc/GMT0 GMT
Etc/Greenwich GMT
Etc/UCT UTC
Etc/UTC UTC
Etc/Universal UTC
Etc/Zulu UTC
Europe/Amsterdam Europe/Amsterdam
Europe/Andorra Europe/Andorra
Europe/Athens Europe/Athens
Europe/Belfast Europe/London
Europe/Belgrade Europe/Belgrade
Europe/Berlin Europe/Berlin
Europe/Bratislava Europe/Prague
Europe/Brussels Europe/Brussels
Europe/Bucharest Europe/Bucharest
Europe/Budapest Europe/Budapest
Europe/Chisinau Europe/Chisinau
Europe/Copenhagen Europe/Copenhagen
Europe/Dublin Europe/Dublin
Europe/Gibraltar Europe/Gibraltar
Europe/Guernsey Europe/London
Europe/Helsinki Europe/Helsinki
Europe/Isle_of_Man Europe/London
Europe/Istanbul Europe/Istanbul
Europe/Jersey Europe/London
Europe/Kaliningrad Europe/Kaliningrad
Europe/Kiev Europe/Kiev
Europe/Lisbon Europe/Lisbon
Europe/Ljubljana Europe/Belgrade
Europe/London Europe/London
Europe/Luxembourg Europe/Luxembourg
Europe/Madrid Europe/Madrid
Europe/Malta Europe/Malta
Europe/Mariehamn Europe/Helsinki
Europe/Minsk Europe/Minsk
Europe/Monaco Europe/Monaco
Europe/Moscow Europe/Moscow
Europe/Nicosia Asia/Nicosia
Europe/Oslo Europe/Oslo
Europe/Paris Europe/Paris
Europe/Podgorica Europe/Belgrade
Europe/Prague Europe/Prague
Europe/Riga Europe/Riga
Europe/Rome Europe/Rome
Europe/Samara Europe/Samara
Europe/San_Marino Europe/Rome
Europe/Sarajevo Europe/Belgrade
Europe/Simferopol Europe/Simferopol
Europe/Skopje Europe/Belgrade
Europe/Sofia Europe/Sofia
Europe/Stockholm Europe/Stockholm
Europe/Tallinn Europe/Tallinn
Europe/Tirane Europe/Tirane
Europe/Vaduz Europe/Vaduz
Europe/Vatican Europe/Rome
Europe/Vienna Europe/Vienna
Europe/Vilnius Europe/Vilnius
Europe/Warsaw Europe/Warsaw
Europe/Zagreb Europe/Belgrade
Europe/Zurich Europe/Zurich
FALKST2 Atlantic/South_Georgia
FALKST2FALKDT Atlantic/South_Georgia
Factory GMT
GB Europe/London
GB-Eire Europe/London
GMT GMT
GMT0 GMT
GMT0BST Europe/London
GMT0BST-1 Europe/London
GMT0WET Europe/Lisbon
GRNLNDST3 America/Buenos_Aires
GRNLNDST3GRNLNDDT America/Godthab
Greenwich GMT
HST Pacific/Honolulu
HST10 Pacific/Honolulu
HST10HDT America/Adak
Hongkong Asia/Hong_Kong
Iceland Atlantic/Reykjavik
Indian/Antananarivo Indian/Antananarivo
Indian/Chagos Indian/Chagos
Indian/Christmas Indian/Christmas
Indian/Cocos Indian/Cocos
Indian/Comoro Indian/Comoro
Indian/Kerguelen Indian/Kerguelen
Indian/Mahe Indian/Mahe
Indian/Maldives Indian/Maldives
Indian/Mauritius Indian/Mauritius
Indian/Mayotte Indian/Mayotte
Indian/Reunion Indian/Reunion
Iran Asia/Tehran
Israel Asia/Jerusalem
JST-9 Asia/Tokyo
JST-9JSTDT Asia/Tokyo
Jamaica America/Jamaica
Japan Asia/Tokyo
KORST-9 Asia/Seoul
KORST-9KORDT Asia/Seoul
Kwajalein Pacific/Kwajalein
Libya Africa/Tripoli
MEST-2 Europe/Istanbul
MEST-2MEDT Europe/Istanbul
MEST-3 Asia/Riyadh
MEST-3MEDT Europe/Moscow
MET Europe/Paris
MET-11 Pacific/Guadalcanal
MET-11METDT Asia/Magadan
MET-1MEST Europe/Paris
MET-1MST-2 Europe/Berlin
MEZ-1MESZ Europe/Berlin
MEZ-1MESZ-2 Europe/Berlin
MSK-3MSD Europe/Moscow
MST America/Phoenix
MST7 America/Phoenix
MST7MDT America/Denver
Mexico/BajaNorte America/Tijuana
Mexico/BajaSur America/Mazatlan
Mexico/General America/Mexico_City
Mideast/Riyadh87 Asia/Riyadh87
Mideast/Riyadh88 Asia/Riyadh88
Mideast/Riyadh89 Asia/Riyadh89
NFT-1 Africa/Algiers
NFT-1DFT Europe/Paris
NFT-1DST Europe/Paris
NZ Pacific/Auckland
NZ-CHAT Pacific/Chatham
NZST-12 Pacific/Fiji
NZST-12NZDT Pacific/Auckland
Navajo America/Denver
PAKST-5 Asia/Karachi
PAKST-5PAKDT Asia/Yekaterinburg
PRC Asia/Shanghai
PST8 Pacific/Pitcairn
PST8PDT America/Los_Angeles
PST8PDT7 America/Tijuana
Pacific/Apia Pacific/Apia
Pacific/Auckland Pacific/Auckland
Pacific/Chatham Pacific/Chatham
Pacific/Easter Pacific/Easter
Pacific/Efate Pacific/Efate
Pacific/Enderbury Pacific/Enderbury
Pacific/Fakaofo Pacific/Fakaofo
Pacific/Fiji Pacific/Fiji
Pacific/Funafuti Pacific/Funafuti
Pacific/Galapagos Pacific/Galapagos
Pacific/Gambier Pacific/Gambier
Pacific/Guadalcanal Pacific/Guadalcanal
Pacific/Guam Pacific/Guam
Pacific/Honolulu Pacific/Honolulu
Pacific/Kiritimati Pacific/Kiritimati
Pacific/Kosrae Pacific/Kosrae
Pacific/Majuro Pacific/Majuro
Pacific/Marquesas Pacific/Marquesas
Pacific/Nauru Pacific/Nauru
Pacific/Niue Pacific/Niue
Pacific/Norfolk Pacific/Norfolk
Pacific/Noumea Pacific/Noumea
Pacific/Pago_Pago Pacific/Pago_Pago
Pacific/Palau Pacific/Palau
Pacific/Pitcairn Pacific/Pitcairn
Pacific/Ponape Pacific/Ponape
Pacific/Port_Moresby Pacific/Port_Moresby
Pacific/Rarotonga Pacific/Rarotonga
Pacific/Saipan Pacific/Saipan
Pacific/Samoa Pacific/Pago_Pago
Pacific/Tahiti Pacific/Tahiti
Pacific/Tarawa Pacific/Tarawa
Pacific/Tongatapu Pacific/Tongatapu
Pacific/Truk Pacific/Truk
Pacific/Wake Pacific/Wake
Pacific/Wallis Pacific/Wallis
Poland Europe/Warsaw
Portugal Europe/Lisbon
ROC Asia/Taipei
ROK Asia/Seoul
SAUST-3 Asia/Riyadh
SAUST-3SAUDT Europe/Moscow
Singapore Asia/Singapore
SystemV/AST4ADT America/Thule
SystemV/CST6CDT America/Chicago
SystemV/EST5EDT America/New_York
SystemV/MST7MDT America/Denver
SystemV/PST8PDT America/Los_Angeles
SystemV/YST9YDT America/Anchorage
TAIST-8 Asia/Taipei
TAIST-8TAIDT Asia/Irkutsk
TASHST-6 Asia/Dacca
TASHST-6TASHDT Asia/Novosibirsk
THAIST-7 Asia/Bangkok
THAIST-7THAIDT Asia/Krasnoyarsk
Turkey Europe/Istanbul
UCT UTC
US/Alaska America/Anchorage
US/Aleutian America/Adak
US/Arizona America/Phoenix
US/Central America/Chicago
US/East-Indiana America/Indiana/Indianapolis
US/Eastern America/New_York
US/Hawaii Pacific/Honolulu
US/Indiana-Starke America/Indiana/Knox
US/Michigan America/New_York
US/Mountain America/Denver
US/Pacific America/Los_Angeles
US/Pacific-New America/Los_Angeles
US/Samoa Pacific/Pago_Pago
USAST-2 Africa/Johannesburg
USAST-2USADT Europe/Istanbul
UTC UTC
UYT3UYST America/Montevideo
Universal UTC
W-SU Europe/Moscow
WAUST-8 Australia/Perth
WAUST-8WAUDT Australia/Perth
WET WET
WET-2 Africa/Johannesburg
WET-2WET Europe/Helsinki
WST-4 Asia/Dubai
WST-4WDT Europe/Samara
Zulu UTC

View file

@ -0,0 +1,50 @@
/*
* 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.
*/
#include "jni.h"
#include "ProcessHandleImpl_unix.h"
#include <sys/procfs.h>
/*
* Implementation of native ProcessHandleImpl functions for AIX.
* See ProcessHandleImpl_unix.c for more details.
*/
void os_initNative(JNIEnv *env, jclass clazz) {}
jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
jlongArray jparentArray, jlongArray jstimesArray) {
return unix_getChildren(env, jpid, jarray, jparentArray, jstimesArray);
}
pid_t os_getParentPidAndTimings(JNIEnv *env, pid_t pid, jlong *total, jlong *start) {
return unix_getParentPidAndTimings(env, pid, total, start);
}
void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
unix_getCmdlineAndUserInfo(env, jinfo, pid);
}

View file

@ -0,0 +1,85 @@
/*
* Copyright (c) 2016 SAP SE. 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.
*
* 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 <sys/ldr.h>
#include "java_md_aix.h"
static unsigned char dladdr_buffer[0x4000];
static int fill_dll_info(void) {
return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));
}
static int dladdr_dont_reload(void *addr, Dl_info *info) {
const struct ld_info *p = (struct ld_info *)dladdr_buffer;
memset((void *)info, 0, sizeof(Dl_info));
for (;;) {
if (addr >= p->ldinfo_textorg &&
addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
{
info->dli_fname = p->ldinfo_filename;
return 1;
}
if (!p->ldinfo_next) {
break;
}
p = (struct ld_info *)(((char *)p) + p->ldinfo_next);
}
return 0;
}
int dladdr(void *addr, Dl_info *info) {
static int loaded = 0;
int rc = 0;
void *addr0;
if (!addr) {
return rc;
}
if (!loaded) {
if (fill_dll_info() == -1)
return rc;
loaded = 1;
}
// first try with addr on cached data
rc = dladdr_dont_reload(addr, info);
// addr could be an AIX function descriptor, so try dereferenced version
if (rc == 0) {
addr0 = *((void **)addr);
rc = dladdr_dont_reload(addr0, info);
}
// if we had no success until now, maybe loadquery info is outdated.
// refresh and retry
if (rc == 0) {
if (fill_dll_info() == -1)
return rc;
rc = dladdr_dont_reload(addr, info);
if (rc == 0) {
rc = dladdr_dont_reload(addr0, info);
}
}
return rc;
}

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2016 SAP SE. 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.
*
* 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.
*/
#ifndef JAVA_MD_AIX_H
#define JAVA_MD_AIX_H
/*
* Very limited AIX port of dladdr() for libjli.so.
*
* We try to mimick dladdr(3) on Linux (see http://linux.die.net/man/3/dladdr)
* dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
*
* We only support Dl_info.dli_fname here as this is the only thing that is
* used of it by libjli.so. A more comprehensive port of dladdr can be found
* in the hotspot implementation which is not available at this place, though.
*/
typedef struct {
const char *dli_fname; /* file path of loaded library */
void *dli_fbase; /* unsupported */
const char *dli_sname; /* unsupported */
void *dli_saddr; /* unsupported */
} Dl_info;
int dladdr(void *addr, Dl_info *info);
#endif /* JAVA_MD_AIX_H */

View file

@ -0,0 +1,231 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 SAP SE. 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.
*
* 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.
*
*/
/* CopyrightVersion 1.2 */
/* This is a special library that should be loaded before libc &
* libthread to interpose the signal handler installation functions:
* sigaction(), signal(), sigset().
* Used for signal-chaining. See RFE 4381843.
*/
#include <signal.h>
#include <dlfcn.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define bool int
#define true 1
#define false 0
static struct sigaction sact[NSIG]; /* saved signal handlers */
static sigset_t jvmsigs; /* Signals used by jvm. */
/* Used to synchronize the installation of signal handlers. */
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
static pthread_t tid = 0;
typedef void (*sa_handler_t)(int);
typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
// signal_t is already defined on AIX.
typedef sa_handler_t (*signal_like_function_t)(int, sa_handler_t);
typedef int (*sigaction_t)(int, const struct sigaction *, struct sigaction *);
static signal_like_function_t os_signal = 0; /* os's version of signal()/sigset() */
static sigaction_t os_sigaction = 0; /* os's version of sigaction() */
static bool jvm_signal_installing = false;
static bool jvm_signal_installed = false;
static void signal_lock() {
pthread_mutex_lock(&mutex);
/* When the jvm is installing its set of signal handlers, threads
* other than the jvm thread should wait. */
if (jvm_signal_installing) {
if (tid != pthread_self()) {
pthread_cond_wait(&cond, &mutex);
}
}
}
static void signal_unlock() {
pthread_mutex_unlock(&mutex);
}
static sa_handler_t call_os_signal(int sig, sa_handler_t disp,
bool is_sigset) {
if (os_signal == NULL) {
if (!is_sigset) {
// Aix: call functions directly instead of dlsym'ing them.
os_signal = signal;
} else {
// Aix: call functions directly instead of dlsym'ing them.
os_signal = sigset;
}
if (os_signal == NULL) {
printf("%s\n", dlerror());
exit(0);
}
}
return (*os_signal)(sig, disp);
}
static void save_signal_handler(int sig, sa_handler_t disp) {
sigset_t set;
sact[sig].sa_handler = disp;
sigemptyset(&set);
sact[sig].sa_mask = set;
sact[sig].sa_flags = 0;
}
static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) {
sa_handler_t oldhandler;
bool sigused;
signal_lock();
sigused = sigismember(&jvmsigs, sig);
if (jvm_signal_installed && sigused) {
/* jvm has installed its signal handler for this signal. */
/* Save the handler. Don't really install it. */
oldhandler = sact[sig].sa_handler;
save_signal_handler(sig, disp);
signal_unlock();
return oldhandler;
} else if (jvm_signal_installing) {
/* jvm is installing its signal handlers. Install the new
* handlers and save the old ones. jvm uses sigaction().
* Leave the piece here just in case. */
oldhandler = call_os_signal(sig, disp, is_sigset);
save_signal_handler(sig, oldhandler);
/* Record the signals used by jvm */
sigaddset(&jvmsigs, sig);
signal_unlock();
return oldhandler;
} else {
/* jvm has no relation with this signal (yet). Install the
* the handler. */
oldhandler = call_os_signal(sig, disp, is_sigset);
signal_unlock();
return oldhandler;
}
}
sa_handler_t signal(int sig, sa_handler_t disp) {
return set_signal(sig, disp, false);
}
sa_handler_t sigset(int sig, sa_handler_t disp) {
return set_signal(sig, disp, true);
}
static int call_os_sigaction(int sig, const struct sigaction *act,
struct sigaction *oact) {
if (os_sigaction == NULL) {
// Aix: call functions directly instead of dlsym'ing them.
os_sigaction = sigaction;
if (os_sigaction == NULL) {
printf("%s\n", dlerror());
exit(0);
}
}
return (*os_sigaction)(sig, act, oact);
}
int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
int res;
bool sigused;
struct sigaction oldAct;
signal_lock();
sigused = sigismember(&jvmsigs, sig);
if (jvm_signal_installed && sigused) {
/* jvm has installed its signal handler for this signal. */
/* Save the handler. Don't really install it. */
if (oact != NULL) {
*oact = sact[sig];
}
if (act != NULL) {
sact[sig] = *act;
}
signal_unlock();
return 0;
} else if (jvm_signal_installing) {
/* jvm is installing its signal handlers. Install the new
* handlers and save the old ones. */
res = call_os_sigaction(sig, act, &oldAct);
sact[sig] = oldAct;
if (oact != NULL) {
*oact = oldAct;
}
/* Record the signals used by jvm. */
sigaddset(&jvmsigs, sig);
signal_unlock();
return res;
} else {
/* jvm has no relation with this signal (yet). Install the
* the handler. */
res = call_os_sigaction(sig, act, oact);
signal_unlock();
return res;
}
}
/* The three functions for the jvm to call into. */
void JVM_begin_signal_setting() {
signal_lock();
sigemptyset(&jvmsigs);
jvm_signal_installing = true;
tid = pthread_self();
signal_unlock();
}
void JVM_end_signal_setting() {
signal_lock();
jvm_signal_installed = true;
jvm_signal_installing = false;
pthread_cond_broadcast(&cond);
signal_unlock();
}
struct sigaction *JVM_get_signal_action(int sig) {
/* Does race condition make sense here? */
if (sigismember(&jvmsigs, sig)) {
return &sact[sig];
}
return NULL;
}

View file

@ -0,0 +1,552 @@
/*
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, SAP SE 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.
*/
/*
* This file contains implementations of NET_... functions. The NET_.. functions are
* wrappers for common file- and socket functions plus provisions for non-blocking IO.
*
* (basically, the layers remember all file descriptors waiting for a particular fd;
* all threads waiting on a certain fd can be woken up by sending them a signal; this
* is done e.g. when the fd is closed.)
*
* This was originally copied from the linux_close.c implementation.
*
* Side Note: This coding needs initialization. Under Linux this is done
* automatically via __attribute((constructor)), on AIX this is done manually
* (see aix_close_init).
*
*/
/*
AIX needs a workaround for I/O cancellation, see:
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/close.htm
...
The close subroutine is blocked until all subroutines which use the file
descriptor return to usr space. For example, when a thread is calling close
and another thread is calling select with the same file descriptor, the
close subroutine does not return until the select call returns.
...
*/
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <poll.h>
#include "jvm.h"
#include "net_util.h"
/*
* Stack allocated by thread when doing blocking operation
*/
typedef struct threadEntry {
pthread_t thr; /* this thread */
struct threadEntry *next; /* next thread */
int intr; /* interrupted */
} threadEntry_t;
/*
* Heap allocated during initialized - one entry per fd
*/
typedef struct {
pthread_mutex_t lock; /* fd lock */
threadEntry_t *threads; /* threads blocked on fd */
} fdEntry_t;
/*
* Signal to unblock thread
*/
static int sigWakeup = (SIGRTMAX - 1);
/*
* fdTable holds one entry per file descriptor, up to a certain
* maximum.
* Theoretically, the number of possible file descriptors can get
* large, though usually it does not. Entries for small value file
* descriptors are kept in a simple table, which covers most scenarios.
* Entries for large value file descriptors are kept in an overflow
* table, which is organized as a sparse two dimensional array whose
* slabs are allocated on demand. This covers all corner cases while
* keeping memory consumption reasonable.
*/
/* Base table for low value file descriptors */
static fdEntry_t* fdTable = NULL;
/* Maximum size of base table (in number of entries). */
static const int fdTableMaxSize = 0x1000; /* 4K */
/* Actual size of base table (in number of entries) */
static int fdTableLen = 0;
/* Max. theoretical number of file descriptors on system. */
static int fdLimit = 0;
/* Overflow table, should base table not be large enough. Organized as
* an array of n slabs, each holding 64k entries.
*/
static fdEntry_t** fdOverflowTable = NULL;
/* Number of slabs in the overflow table */
static int fdOverflowTableLen = 0;
/* Number of entries in one slab */
static const int fdOverflowTableSlabSize = 0x10000; /* 64k */
pthread_mutex_t fdOverflowTableLock = PTHREAD_MUTEX_INITIALIZER;
/*
* Null signal handler
*/
static void sig_wakeup(int sig) {
}
/*
* Initialization routine (executed when library is loaded)
* Allocate fd tables and sets up signal handler.
*
* On AIX we don't have __attribute((constructor)) so we need to initialize
* manually (from JNI_OnLoad() in 'src/share/native/java/net/net_util.c')
*/
void aix_close_init() {
struct rlimit nbr_files;
sigset_t sigset;
struct sigaction sa;
int i = 0;
/* Determine the maximum number of possible file descriptors. */
if (-1 == getrlimit(RLIMIT_NOFILE, &nbr_files)) {
fprintf(stderr, "library initialization failed - "
"unable to get max # of allocated fds\n");
abort();
}
if (nbr_files.rlim_max != RLIM_INFINITY) {
fdLimit = nbr_files.rlim_max;
} else {
/* We just do not know. */
fdLimit = INT_MAX;
}
/* Allocate table for low value file descriptors. */
fdTableLen = fdLimit < fdTableMaxSize ? fdLimit : fdTableMaxSize;
fdTable = (fdEntry_t*) calloc(fdTableLen, sizeof(fdEntry_t));
if (fdTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor table - out of memory");
abort();
} else {
for (i = 0; i < fdTableLen; i ++) {
pthread_mutex_init(&fdTable[i].lock, NULL);
}
}
/* Allocate overflow table, if needed */
if (fdLimit > fdTableMaxSize) {
fdOverflowTableLen = ((fdLimit - fdTableMaxSize) / fdOverflowTableSlabSize) + 1;
fdOverflowTable = (fdEntry_t**) calloc(fdOverflowTableLen, sizeof(fdEntry_t*));
if (fdOverflowTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor overflow table - out of memory");
abort();
}
}
/*
* Setup the signal handler
*/
sa.sa_handler = sig_wakeup;
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sigaction(sigWakeup, &sa, NULL);
sigemptyset(&sigset);
sigaddset(&sigset, sigWakeup);
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
}
/*
* Return the fd table for this fd.
*/
static inline fdEntry_t *getFdEntry(int fd)
{
fdEntry_t* result = NULL;
if (fd < 0) {
return NULL;
}
/* This should not happen. If it does, our assumption about
* max. fd value was wrong. */
assert(fd < fdLimit);
if (fd < fdTableMaxSize) {
/* fd is in base table. */
assert(fd < fdTableLen);
result = &fdTable[fd];
} else {
/* fd is in overflow table. */
const int indexInOverflowTable = fd - fdTableMaxSize;
const int rootindex = indexInOverflowTable / fdOverflowTableSlabSize;
const int slabindex = indexInOverflowTable % fdOverflowTableSlabSize;
fdEntry_t* slab = NULL;
assert(rootindex < fdOverflowTableLen);
assert(slabindex < fdOverflowTableSlabSize);
pthread_mutex_lock(&fdOverflowTableLock);
/* Allocate new slab in overflow table if needed */
if (fdOverflowTable[rootindex] == NULL) {
fdEntry_t* const newSlab =
(fdEntry_t*)calloc(fdOverflowTableSlabSize, sizeof(fdEntry_t));
if (newSlab == NULL) {
fprintf(stderr, "Unable to allocate file descriptor overflow"
" table slab - out of memory");
pthread_mutex_unlock(&fdOverflowTableLock);
abort();
} else {
int i;
for (i = 0; i < fdOverflowTableSlabSize; i ++) {
pthread_mutex_init(&newSlab[i].lock, NULL);
}
fdOverflowTable[rootindex] = newSlab;
}
}
pthread_mutex_unlock(&fdOverflowTableLock);
slab = fdOverflowTable[rootindex];
result = &slab[slabindex];
}
return result;
}
/*
* Start a blocking operation :-
* Insert thread onto thread list for the fd.
*/
static inline void startOp(fdEntry_t *fdEntry, threadEntry_t *self)
{
self->thr = pthread_self();
self->intr = 0;
pthread_mutex_lock(&(fdEntry->lock));
{
self->next = fdEntry->threads;
fdEntry->threads = self;
}
pthread_mutex_unlock(&(fdEntry->lock));
}
/*
* End a blocking operation :-
* Remove thread from thread list for the fd
* If fd has been interrupted then set errno to EBADF
*/
static inline void endOp
(fdEntry_t *fdEntry, threadEntry_t *self)
{
int orig_errno = errno;
pthread_mutex_lock(&(fdEntry->lock));
{
threadEntry_t *curr, *prev=NULL;
curr = fdEntry->threads;
while (curr != NULL) {
if (curr == self) {
if (curr->intr) {
orig_errno = EBADF;
}
if (prev == NULL) {
fdEntry->threads = curr->next;
} else {
prev->next = curr->next;
}
break;
}
prev = curr;
curr = curr->next;
}
}
pthread_mutex_unlock(&(fdEntry->lock));
errno = orig_errno;
}
/*
* Close or dup2 a file descriptor ensuring that all threads blocked on
* the file descriptor are notified via a wakeup signal.
*
* fd1 < 0 => close(fd2)
* fd1 >= 0 => dup2(fd1, fd2)
*
* Returns -1 with errno set if operation fails.
*/
static int closefd(int fd1, int fd2) {
int rv, orig_errno;
fdEntry_t *fdEntry = getFdEntry(fd2);
if (fdEntry == NULL) {
errno = EBADF;
return -1;
}
/*
* Lock the fd to hold-off additional I/O on this fd.
*/
pthread_mutex_lock(&(fdEntry->lock));
{
/* On fast machines we see that we enter dup2 before the
* accepting thread had a chance to get and process the signal.
* So in case we woke a thread up, give it some time to cope.
* Also see https://bugs.openjdk.java.net/browse/JDK-8006395 */
int num_woken = 0;
/*
* Send a wakeup signal to all threads blocked on this
* file descriptor.
*/
threadEntry_t *curr = fdEntry->threads;
while (curr != NULL) {
curr->intr = 1;
pthread_kill( curr->thr, sigWakeup );
num_woken ++;
curr = curr->next;
}
if (num_woken > 0) {
usleep(num_woken * 50);
}
/*
* And close/dup the file descriptor
* (restart if interrupted by signal)
*/
do {
if (fd1 < 0) {
rv = close(fd2);
} else {
rv = dup2(fd1, fd2);
}
} while (rv == -1 && errno == EINTR);
}
/*
* Unlock without destroying errno
*/
orig_errno = errno;
pthread_mutex_unlock(&(fdEntry->lock));
errno = orig_errno;
return rv;
}
/*
* Wrapper for dup2 - same semantics as dup2 system call except
* that any threads blocked in an I/O system call on fd2 will be
* preempted and return -1/EBADF;
*/
int NET_Dup2(int fd, int fd2) {
if (fd < 0) {
errno = EBADF;
return -1;
}
return closefd(fd, fd2);
}
/*
* Wrapper for close - same semantics as close system call
* except that any threads blocked in an I/O on fd will be
* preempted and the I/O system call will return -1/EBADF.
*/
int NET_SocketClose(int fd) {
return closefd(-1, fd);
}
/************** Basic I/O operations here ***************/
/*
* Macro to perform a blocking IO operation. Restarts
* automatically if interrupted by signal (other than
* our wakeup signal)
*/
#define BLOCKING_IO_RETURN_INT(FD, FUNC) { \
int ret; \
threadEntry_t self; \
fdEntry_t *fdEntry = getFdEntry(FD); \
if (fdEntry == NULL) { \
errno = EBADF; \
return -1; \
} \
do { \
startOp(fdEntry, &self); \
ret = FUNC; \
endOp(fdEntry, &self); \
} while (ret == -1 && errno == EINTR); \
return ret; \
}
int NET_Read(int s, void* buf, size_t len) {
BLOCKING_IO_RETURN_INT( s, recv(s, buf, len, 0) );
}
int NET_NonBlockingRead(int s, void* buf, size_t len) {
BLOCKING_IO_RETURN_INT(s, recv(s, buf, len, MSG_NONBLOCK));
}
int NET_ReadV(int s, const struct iovec * vector, int count) {
BLOCKING_IO_RETURN_INT( s, readv(s, vector, count) );
}
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
struct sockaddr *from, socklen_t *fromlen) {
BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) );
}
int NET_Send(int s, void *msg, int len, unsigned int flags) {
BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) );
}
int NET_WriteV(int s, const struct iovec * vector, int count) {
BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) );
}
int NET_SendTo(int s, const void *msg, int len, unsigned int
flags, const struct sockaddr *to, int tolen) {
BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) );
}
int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) {
BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) );
}
int NET_Connect(int s, struct sockaddr *addr, int addrlen) {
int crc = -1, prc = -1;
threadEntry_t self;
fdEntry_t* fdEntry = getFdEntry(s);
if (fdEntry == NULL) {
errno = EBADF;
return -1;
}
/* On AIX, when the system call connect() is interrupted, the connection
* is not aborted and it will be established asynchronously by the kernel.
* Hence, no need to restart connect() when EINTR is received
*/
startOp(fdEntry, &self);
crc = connect(s, addr, addrlen);
endOp(fdEntry, &self);
if (crc == -1 && errno == EINTR) {
struct pollfd s_pollfd;
int sockopt_arg = 0;
socklen_t len;
s_pollfd.fd = s;
s_pollfd.events = POLLOUT | POLLERR;
/* poll the file descriptor */
do {
startOp(fdEntry, &self);
prc = poll(&s_pollfd, 1, -1);
endOp(fdEntry, &self);
} while (prc == -1 && errno == EINTR);
if (prc < 0)
return prc;
len = sizeof(sockopt_arg);
/* Check whether the connection has been established */
if (getsockopt(s, SOL_SOCKET, SO_ERROR, &sockopt_arg, &len) == -1)
return -1;
if (sockopt_arg != 0 ) {
errno = sockopt_arg;
return -1;
}
} else {
return crc;
}
/* At this point, fd is connected. Set successful return code */
return 0;
}
int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
BLOCKING_IO_RETURN_INT( ufds[0].fd, poll(ufds, nfds, timeout) );
}
/*
* Wrapper for poll(s, timeout).
* Auto restarts with adjusted timeout if interrupted by
* signal other than our wakeup signal.
*/
int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) {
jlong prevNanoTime = nanoTimeStamp;
jlong nanoTimeout = (jlong) timeout * NET_NSEC_PER_MSEC;
fdEntry_t *fdEntry = getFdEntry(s);
/*
* Check that fd hasn't been closed.
*/
if (fdEntry == NULL) {
errno = EBADF;
return -1;
}
for(;;) {
struct pollfd pfd;
int rv;
threadEntry_t self;
/*
* Poll the fd. If interrupted by our wakeup signal
* errno will be set to EBADF.
*/
pfd.fd = s;
pfd.events = POLLIN | POLLERR;
startOp(fdEntry, &self);
rv = poll(&pfd, 1, nanoTimeout / NET_NSEC_PER_MSEC);
endOp(fdEntry, &self);
/*
* If interrupted then adjust timeout. If timeout
* has expired return 0 (indicating timeout expired).
*/
if (rv < 0 && errno == EINTR) {
jlong newNanoTime = JVM_NanoTime(env, 0);
nanoTimeout -= newNanoTime - prevNanoTime;
if (nanoTimeout < NET_NSEC_PER_MSEC) {
return 0;
}
prevNanoTime = newNanoTime;
} else {
return rv;
}
}
}

View file

@ -0,0 +1,175 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 SAP SE. 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 "sun_nio_ch_AixPollPort.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>
#include <sys/pollset.h>
#include <fcntl.h>
#include <stddef.h>
#include <dlfcn.h>
#include <errno.h>
/* Initially copied from src/solaris/native/sun/nio/ch/nio_util.h */
#define RESTARTABLE(_cmd, _result) do { \
do { \
_result = _cmd; \
} while((_result == -1) && (errno == EINTR)); \
} while(0)
typedef pollset_t pollset_create_func(int maxfd);
typedef int pollset_destroy_func(pollset_t ps);
typedef int pollset_ctl_func(pollset_t ps, struct poll_ctl *pollctl_array, int array_length);
typedef int pollset_poll_func(pollset_t ps, struct pollfd *polldata_array, int array_length, int timeout);
static pollset_create_func* _pollset_create = NULL;
static pollset_destroy_func* _pollset_destroy = NULL;
static pollset_ctl_func* _pollset_ctl = NULL;
static pollset_poll_func* _pollset_poll = NULL;
JNIEXPORT void JNICALL
Java_sun_nio_ch_AixPollPort_init(JNIEnv* env, jclass this) {
_pollset_create = (pollset_create_func*) dlsym(RTLD_DEFAULT, "pollset_create");
_pollset_destroy = (pollset_destroy_func*) dlsym(RTLD_DEFAULT, "pollset_destroy");
_pollset_ctl = (pollset_ctl_func*) dlsym(RTLD_DEFAULT, "pollset_ctl");
_pollset_poll = (pollset_poll_func*) dlsym(RTLD_DEFAULT, "pollset_poll");
if (_pollset_create == NULL || _pollset_destroy == NULL ||
_pollset_ctl == NULL || _pollset_poll == NULL) {
JNU_ThrowInternalError(env, "unable to get address of pollset functions");
}
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_eventSize(JNIEnv* env, jclass this) {
return sizeof(struct pollfd);
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_eventsOffset(JNIEnv* env, jclass this) {
return offsetof(struct pollfd, events);
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_reventsOffset(JNIEnv* env, jclass this) {
return offsetof(struct pollfd, revents);
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_fdOffset(JNIEnv* env, jclass this) {
return offsetof(struct pollfd, fd);
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_pollsetCreate(JNIEnv *env, jclass c) {
/* pollset_create can take the maximum number of fds, but we
* cannot predict this number so we leave it at OPEN_MAX. */
pollset_t ps = _pollset_create(-1);
if (ps < 0) {
JNU_ThrowIOExceptionWithLastError(env, "pollset_create failed");
}
return (int)ps;
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_pollsetCtl(JNIEnv *env, jclass c, jint ps,
jint opcode, jint fd, jint events) {
struct poll_ctl event;
int res;
event.cmd = opcode;
event.events = events;
event.fd = fd;
RESTARTABLE(_pollset_ctl((pollset_t)ps, &event, 1 /* length */), res);
return (res == 0) ? 0 : errno;
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_AixPollPort_pollsetPoll(JNIEnv *env, jclass c,
jint ps, jlong address, jint numfds) {
struct pollfd *events = jlong_to_ptr(address);
int res;
RESTARTABLE(_pollset_poll(ps, events, numfds, -1), res);
if (res < 0) {
JNU_ThrowIOExceptionWithLastError(env, "pollset_poll failed");
}
return res;
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_AixPollPort_pollsetDestroy(JNIEnv *env, jclass c, jint ps) {
int res;
RESTARTABLE(_pollset_destroy((pollset_t)ps), res);
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_AixPollPort_socketpair(JNIEnv* env, jclass clazz, jintArray sv) {
int sp[2];
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) == -1) {
JNU_ThrowIOExceptionWithLastError(env, "socketpair failed");
} else {
jint res[2];
res[0] = (jint)sp[0];
res[1] = (jint)sp[1];
(*env)->SetIntArrayRegion(env, sv, 0, 2, &res[0]);
}
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_AixPollPort_interrupt(JNIEnv *env, jclass c, jint fd) {
int res;
int buf[1];
buf[0] = 1;
RESTARTABLE(write(fd, buf, 1), res);
if (res < 0) {
JNU_ThrowIOExceptionWithLastError(env, "write failed");
}
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_AixPollPort_drain1(JNIEnv *env, jclass cl, jint fd) {
int res;
char buf[1];
RESTARTABLE(read(fd, buf, 1), res);
if (res < 0) {
JNU_ThrowIOExceptionWithLastError(env, "drain1 failed");
}
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_AixPollPort_close0(JNIEnv *env, jclass c, jint fd) {
int res;
RESTARTABLE(close(fd), res);
}

View file

@ -0,0 +1,230 @@
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 SAP SE. 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 <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/mntctl.h>
#include "jni.h"
#include "jni_util.h"
#include "sun_nio_fs_AixNativeDispatcher.h"
static jfieldID entry_name;
static jfieldID entry_dir;
static jfieldID entry_fstype;
static jfieldID entry_options;
static jclass entry_cls;
/**
* Call this to throw an internal UnixException when a system/library
* call fails
*/
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);
}
}
/**
* Initialization
*/
JNIEXPORT void JNICALL
Java_sun_nio_fs_AixNativeDispatcher_init(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);
entry_cls = (*env)->NewGlobalRef(env, clazz);
if (entry_cls == NULL) {
JNU_ThrowOutOfMemoryError(env, NULL);
return;
}
}
/**
* Special implementation of getextmntent (see SolarisNativeDispatcher.c)
* that returns all entries at once.
*/
JNIEXPORT jobjectArray JNICALL
Java_sun_nio_fs_AixNativeDispatcher_getmntctl(JNIEnv* env, jclass this)
{
int must_free_buf = 0;
char stack_buf[1024];
char* buffer = stack_buf;
size_t buffer_size = 1024;
int num_entries;
int i;
jobjectArray ret;
struct vmount * vm;
for (i = 0; i < 5; i++) {
num_entries = mntctl(MCTL_QUERY, buffer_size, buffer);
if (num_entries != 0) {
break;
}
if (must_free_buf) {
free(buffer);
}
buffer_size *= 8;
buffer = malloc(buffer_size);
must_free_buf = 1;
}
/* Treat zero entries like errors. */
if (num_entries <= 0) {
if (must_free_buf) {
free(buffer);
}
throwUnixException(env, errno);
return NULL;
}
ret = (*env)->NewObjectArray(env, num_entries, entry_cls, NULL);
if (ret == NULL) {
if (must_free_buf) {
free(buffer);
}
return NULL;
}
vm = (struct vmount*)buffer;
for (i = 0; i < num_entries; i++) {
jsize len;
jbyteArray bytes;
const char* fstype;
/* We set all relevant attributes so there is no need to call constructor. */
jobject entry = (*env)->AllocObject(env, entry_cls);
if (entry == NULL) {
if (must_free_buf) {
free(buffer);
}
return NULL;
}
(*env)->SetObjectArrayElement(env, ret, i, entry);
/* vm->vmt_data[...].vmt_size is 32 bit aligned and also includes NULL byte. */
/* Since we only need the characters, it is necessary to check string size manually. */
len = strlen((char*)vm + vm->vmt_data[VMT_OBJECT].vmt_off);
bytes = (*env)->NewByteArray(env, len);
if (bytes == NULL) {
if (must_free_buf) {
free(buffer);
}
return NULL;
}
(*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)((char *)vm + vm->vmt_data[VMT_OBJECT].vmt_off));
(*env)->SetObjectField(env, entry, entry_name, bytes);
len = strlen((char*)vm + vm->vmt_data[VMT_STUB].vmt_off);
bytes = (*env)->NewByteArray(env, len);
if (bytes == NULL) {
if (must_free_buf) {
free(buffer);
}
return NULL;
}
(*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)((char *)vm + vm->vmt_data[VMT_STUB].vmt_off));
(*env)->SetObjectField(env, entry, entry_dir, bytes);
switch (vm->vmt_gfstype) {
case MNT_J2:
fstype = "jfs2";
break;
case MNT_NAMEFS:
fstype = "namefs";
break;
case MNT_NFS:
fstype = "nfs";
break;
case MNT_JFS:
fstype = "jfs";
break;
case MNT_CDROM:
fstype = "cdrom";
break;
case MNT_PROCFS:
fstype = "procfs";
break;
case MNT_NFS3:
fstype = "nfs3";
break;
case MNT_AUTOFS:
fstype = "autofs";
break;
case MNT_UDF:
fstype = "udfs";
break;
case MNT_NFS4:
fstype = "nfs4";
break;
case MNT_CIFS:
fstype = "smbfs";
break;
default:
fstype = "unknown";
}
len = strlen(fstype);
bytes = (*env)->NewByteArray(env, len);
if (bytes == NULL) {
if (must_free_buf) {
free(buffer);
}
return NULL;
}
(*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
(*env)->SetObjectField(env, entry, entry_fstype, bytes);
len = strlen((char*)vm + vm->vmt_data[VMT_ARGS].vmt_off);
bytes = (*env)->NewByteArray(env, len);
if (bytes == NULL) {
if (must_free_buf) {
free(buffer);
}
return NULL;
}
(*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)((char *)vm + vm->vmt_data[VMT_ARGS].vmt_off));
(*env)->SetObjectField(env, entry, entry_options, bytes);
/* goto the next vmount structure: */
vm = (struct vmount *)((char *)vm + vm->vmt_length);
}
if (must_free_buf) {
free(buffer);
}
return ret;
}