author | simonis |
Tue, 26 Nov 2013 16:40:31 +0100 | |
changeset 22597 | 7515a991bb37 |
permissions | -rw-r--r-- |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
1 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
2 |
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
3 |
* Copyright 2012 SAP AG. All rights reserved. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
5 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. Oracle designates this |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
9 |
* particular file as subject to the "Classpath" exception as provided |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
10 |
* by Oracle in the LICENSE file that accompanied this code. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
11 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
12 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
14 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
15 |
* version 2 for more details (a copy is included in the LICENSE file that |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
16 |
* accompanied this code). |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
17 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License version |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
19 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
20 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
21 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
22 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
23 |
* or visit www.oracle.com if you need additional information or have any |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
24 |
* questions. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
25 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
26 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
27 |
#include "jni.h" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
28 |
#include "jni_util.h" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
29 |
#include "jvm.h" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
30 |
#include "jlong.h" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
31 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
32 |
#include "sun_nio_ch_AixPollPort.h" |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
33 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
34 |
#include <unistd.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
35 |
#include <sys/types.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
36 |
#include <sys/socket.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
37 |
#include <sys/poll.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
38 |
#include <sys/pollset.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
39 |
#include <fcntl.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
40 |
#include <stddef.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
41 |
#include <dlfcn.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
42 |
#include <errno.h> |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
43 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
44 |
/* Initially copied from src/solaris/native/sun/nio/ch/nio_util.h */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
45 |
#define RESTARTABLE(_cmd, _result) do { \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
46 |
do { \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
47 |
_result = _cmd; \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
48 |
} while((_result == -1) && (errno == EINTR)); \ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
49 |
} while(0) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
50 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
51 |
typedef pollset_t pollset_create_func(int maxfd); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
52 |
typedef int pollset_destroy_func(pollset_t ps); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
53 |
typedef int pollset_ctl_func(pollset_t ps, struct poll_ctl *pollctl_array, int array_length); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
54 |
typedef int pollset_poll_func(pollset_t ps, struct pollfd *polldata_array, int array_length, int timeout); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
55 |
static pollset_create_func* _pollset_create = NULL; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
56 |
static pollset_destroy_func* _pollset_destroy = NULL; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
57 |
static pollset_ctl_func* _pollset_ctl = NULL; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
58 |
static pollset_poll_func* _pollset_poll = NULL; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
59 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
60 |
JNIEXPORT void JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
61 |
Java_sun_nio_ch_AixPollPort_init(JNIEnv* env, jclass this) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
62 |
_pollset_create = (pollset_create_func*) dlsym(RTLD_DEFAULT, "pollset_create"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
63 |
_pollset_destroy = (pollset_destroy_func*) dlsym(RTLD_DEFAULT, "pollset_destroy"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
64 |
_pollset_ctl = (pollset_ctl_func*) dlsym(RTLD_DEFAULT, "pollset_ctl"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
65 |
_pollset_poll = (pollset_poll_func*) dlsym(RTLD_DEFAULT, "pollset_poll"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
66 |
if (_pollset_create == NULL || _pollset_destroy == NULL || |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
67 |
_pollset_ctl == NULL || _pollset_poll == NULL) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
68 |
JNU_ThrowInternalError(env, "unable to get address of pollset functions"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
69 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
70 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
71 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
72 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
73 |
Java_sun_nio_ch_AixPollPort_eventSize(JNIEnv* env, jclass this) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
74 |
return sizeof(struct pollfd); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
75 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
76 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
77 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
78 |
Java_sun_nio_ch_AixPollPort_eventsOffset(JNIEnv* env, jclass this) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
79 |
return offsetof(struct pollfd, events); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
80 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
81 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
82 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
83 |
Java_sun_nio_ch_AixPollPort_reventsOffset(JNIEnv* env, jclass this) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
84 |
return offsetof(struct pollfd, revents); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
85 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
86 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
87 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
88 |
Java_sun_nio_ch_AixPollPort_fdOffset(JNIEnv* env, jclass this) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
89 |
return offsetof(struct pollfd, fd); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
90 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
91 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
92 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
93 |
Java_sun_nio_ch_AixPollPort_pollsetCreate(JNIEnv *env, jclass c) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
94 |
/* pollset_create can take the maximum number of fds, but we |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
95 |
* cannot predict this number so we leave it at OPEN_MAX. */ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
96 |
pollset_t ps = _pollset_create(-1); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
97 |
if (ps < 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
98 |
JNU_ThrowIOExceptionWithLastError(env, "pollset_create failed"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
99 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
100 |
return (int)ps; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
101 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
102 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
103 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
104 |
Java_sun_nio_ch_AixPollPort_pollsetCtl(JNIEnv *env, jclass c, jint ps, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
105 |
jint opcode, jint fd, jint events) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
106 |
struct poll_ctl event; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
107 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
108 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
109 |
event.cmd = opcode; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
110 |
event.events = events; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
111 |
event.fd = fd; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
112 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
113 |
RESTARTABLE(_pollset_ctl((pollset_t)ps, &event, 1 /* length */), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
114 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
115 |
return (res == 0) ? 0 : errno; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
116 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
117 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
118 |
JNIEXPORT jint JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
119 |
Java_sun_nio_ch_AixPollPort_pollsetPoll(JNIEnv *env, jclass c, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
120 |
jint ps, jlong address, jint numfds) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
121 |
struct pollfd *events = jlong_to_ptr(address); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
122 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
123 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
124 |
RESTARTABLE(_pollset_poll(ps, events, numfds, -1), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
125 |
if (res < 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
126 |
JNU_ThrowIOExceptionWithLastError(env, "pollset_poll failed"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
127 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
128 |
return res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
129 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
130 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
131 |
JNIEXPORT void JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
132 |
Java_sun_nio_ch_AixPollPort_pollsetDestroy(JNIEnv *env, jclass c, jint ps) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
133 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
134 |
RESTARTABLE(_pollset_destroy((pollset_t)ps), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
135 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
136 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
137 |
JNIEXPORT void JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
138 |
Java_sun_nio_ch_AixPollPort_socketpair(JNIEnv* env, jclass clazz, jintArray sv) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
139 |
int sp[2]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
140 |
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) == -1) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
141 |
JNU_ThrowIOExceptionWithLastError(env, "socketpair failed"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
142 |
} else { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
143 |
jint res[2]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
144 |
res[0] = (jint)sp[0]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
145 |
res[1] = (jint)sp[1]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
146 |
(*env)->SetIntArrayRegion(env, sv, 0, 2, &res[0]); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
147 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
148 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
149 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
150 |
JNIEXPORT void JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
151 |
Java_sun_nio_ch_AixPollPort_interrupt(JNIEnv *env, jclass c, jint fd) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
152 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
153 |
int buf[1]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
154 |
buf[0] = 1; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
155 |
RESTARTABLE(write(fd, buf, 1), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
156 |
if (res < 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
157 |
JNU_ThrowIOExceptionWithLastError(env, "write failed"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
158 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
159 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
160 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
161 |
JNIEXPORT void JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
162 |
Java_sun_nio_ch_AixPollPort_drain1(JNIEnv *env, jclass cl, jint fd) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
163 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
164 |
char buf[1]; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
165 |
RESTARTABLE(read(fd, buf, 1), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
166 |
if (res < 0) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
167 |
JNU_ThrowIOExceptionWithLastError(env, "drain1 failed"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
168 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
169 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
170 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
171 |
JNIEXPORT void JNICALL |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
172 |
Java_sun_nio_ch_AixPollPort_close0(JNIEnv *env, jclass c, jint fd) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
173 |
int res; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
174 |
RESTARTABLE(close(fd), res); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
175 |
} |