equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package sun.nio.ch; |
26 package sun.nio.ch; |
27 |
27 |
28 import java.io.FileDescriptor; |
28 import java.io.FileDescriptor; |
29 import java.io.IOException; |
29 import java.io.IOException; |
30 |
30 |
|
31 import jdk.internal.misc.JavaIOFileDescriptorAccess; |
|
32 import jdk.internal.misc.SharedSecrets; |
|
33 |
31 class FileDispatcherImpl extends FileDispatcher { |
34 class FileDispatcherImpl extends FileDispatcher { |
32 |
35 |
33 static { |
36 static { |
34 IOUtil.load(); |
37 IOUtil.load(); |
35 init(); |
38 init(); |
36 } |
39 } |
|
40 |
|
41 private static final JavaIOFileDescriptorAccess fdAccess = |
|
42 SharedSecrets.getJavaIOFileDescriptorAccess(); |
37 |
43 |
38 FileDispatcherImpl() { |
44 FileDispatcherImpl() { |
39 } |
45 } |
40 |
46 |
41 int read(FileDescriptor fd, long address, int len) throws IOException { |
47 int read(FileDescriptor fd, long address, int len) throws IOException { |
93 void release(FileDescriptor fd, long pos, long size) throws IOException { |
99 void release(FileDescriptor fd, long pos, long size) throws IOException { |
94 release0(fd, pos, size); |
100 release0(fd, pos, size); |
95 } |
101 } |
96 |
102 |
97 void close(FileDescriptor fd) throws IOException { |
103 void close(FileDescriptor fd) throws IOException { |
98 close0(fd); |
104 fdAccess.close(fd); |
99 } |
105 } |
100 |
106 |
101 void preClose(FileDescriptor fd) throws IOException { |
107 void preClose(FileDescriptor fd) throws IOException { |
102 preClose0(fd); |
108 preClose0(fd); |
103 } |
109 } |
151 long size, boolean shared) throws IOException; |
157 long size, boolean shared) throws IOException; |
152 |
158 |
153 static native void release0(FileDescriptor fd, long pos, long size) |
159 static native void release0(FileDescriptor fd, long pos, long size) |
154 throws IOException; |
160 throws IOException; |
155 |
161 |
|
162 // Shared with SocketDispatcher and DatagramDispatcher but |
|
163 // NOT used by FileDispatcherImpl |
156 static native void close0(FileDescriptor fd) throws IOException; |
164 static native void close0(FileDescriptor fd) throws IOException; |
157 |
165 |
158 static native void preClose0(FileDescriptor fd) throws IOException; |
166 static native void preClose0(FileDescriptor fd) throws IOException; |
159 |
167 |
160 static native void closeIntFD(int fd) throws IOException; |
168 static native void closeIntFD(int fd) throws IOException; |