* commit '26e58f09d9c040b8abaa5184a16ec52e5f401b4c': Move listen() over to using android.system.Os
This commit is contained in:
@@ -201,8 +201,6 @@ class LocalSocketImpl
|
|||||||
int namespace) throws IOException;
|
int namespace) throws IOException;
|
||||||
private native void bindLocal(FileDescriptor fd, String name, int namespace)
|
private native void bindLocal(FileDescriptor fd, String name, int namespace)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
private native void listen_native(FileDescriptor fd, int backlog)
|
|
||||||
throws IOException;
|
|
||||||
private native void shutdown(FileDescriptor fd, boolean shutdownInput);
|
private native void shutdown(FileDescriptor fd, boolean shutdownInput);
|
||||||
private native Credentials getPeerCredentials_native(
|
private native Credentials getPeerCredentials_native(
|
||||||
FileDescriptor fd) throws IOException;
|
FileDescriptor fd) throws IOException;
|
||||||
@@ -326,8 +324,11 @@ class LocalSocketImpl
|
|||||||
if (fd == null) {
|
if (fd == null) {
|
||||||
throw new IOException("socket not created");
|
throw new IOException("socket not created");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
listen_native(fd, backlog);
|
Os.listen(fd, backlog);
|
||||||
|
} catch (ErrnoException e) {
|
||||||
|
throw e.rethrowAsIOException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -112,27 +112,6 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private native void listen_native(int fd, int backlog) throws IOException; */
|
|
||||||
static void
|
|
||||||
socket_listen (JNIEnv *env, jobject object, jobject fileDescriptor, jint backlog)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
|
|
||||||
|
|
||||||
if (env->ExceptionCheck()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = listen(fd, backlog);
|
|
||||||
|
|
||||||
if (ret < 0) {
|
|
||||||
jniThrowIOException(env, errno);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* private native FileDescriptor
|
/* private native FileDescriptor
|
||||||
** accept (FileDescriptor fd, LocalSocketImpl s)
|
** accept (FileDescriptor fd, LocalSocketImpl s)
|
||||||
** throws IOException;
|
** throws IOException;
|
||||||
@@ -587,7 +566,6 @@ static JNINativeMethod gMethods[] = {
|
|||||||
{"connectLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V",
|
{"connectLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V",
|
||||||
(void*)socket_connect_local},
|
(void*)socket_connect_local},
|
||||||
{"bindLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V", (void*)socket_bind_local},
|
{"bindLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V", (void*)socket_bind_local},
|
||||||
{"listen_native", "(Ljava/io/FileDescriptor;I)V", (void*)socket_listen},
|
|
||||||
{"accept", "(Ljava/io/FileDescriptor;Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;", (void*)socket_accept},
|
{"accept", "(Ljava/io/FileDescriptor;Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;", (void*)socket_accept},
|
||||||
{"shutdown", "(Ljava/io/FileDescriptor;Z)V", (void*)socket_shutdown},
|
{"shutdown", "(Ljava/io/FileDescriptor;Z)V", (void*)socket_shutdown},
|
||||||
{"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
|
{"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
|
||||||
|
|||||||
Reference in New Issue
Block a user