Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b662579e authored by Neil Fuller's avatar Neil Fuller Committed by Android Git Automerger
Browse files

am 3ecbca50: am 886630c0: Merge "Switch shutdownInput / shutdownOutput to using Os.shutdown."

* commit '3ecbca50':
  Switch shutdownInput / shutdownOutput to using Os.shutdown.
parents 37b894c9 3ecbca50
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -201,7 +201,6 @@ class LocalSocketImpl
            int namespace) throws IOException;
    private native void bindLocal(FileDescriptor fd, String name, int namespace)
            throws IOException;
    private native void shutdown(FileDescriptor fd, boolean shutdownInput);
    private native Credentials getPeerCredentials_native(
            FileDescriptor fd) throws IOException;

@@ -405,7 +404,11 @@ class LocalSocketImpl
            throw new IOException("socket not created");
        }

        shutdown(fd, true);
        try {
            Os.shutdown(fd, OsConstants.SHUT_RD);
        } catch (ErrnoException e) {
            throw e.rethrowAsIOException();
        }
    }

    /**
@@ -419,7 +422,11 @@ class LocalSocketImpl
            throw new IOException("socket not created");
        }

        shutdown(fd, false);
        try {
            Os.shutdown(fd, OsConstants.SHUT_WR);
        } catch (ErrnoException e) {
            throw e.rethrowAsIOException();
        }
    }

    protected FileDescriptor getFileDescriptor()
+0 −24
Original line number Diff line number Diff line
@@ -112,29 +112,6 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor,
    }
}

/* private native void shutdown(FileDescriptor fd, boolean shutdownInput) */

static void
socket_shutdown (JNIEnv *env, jobject object, jobject fileDescriptor,
                    jboolean shutdownInput)
{
    int ret;
    int fd;

    fd = jniGetFDFromFileDescriptor(env, fileDescriptor);

    if (env->ExceptionCheck()) {
        return;
    }

    ret = shutdown(fd, shutdownInput ? SHUT_RD : SHUT_WR);

    if (ret < 0) {
        jniThrowIOException(env, errno);
        return;
    }
}

/**
 * Processes ancillary data, handling only
 * SCM_RIGHTS. Creates appropriate objects and sets appropriate
@@ -523,7 +500,6 @@ static JNINativeMethod gMethods[] = {
    {"connectLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V",
                                                (void*)socket_connect_local},
    {"bindLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V", (void*)socket_bind_local},
    {"shutdown", "(Ljava/io/FileDescriptor;Z)V", (void*)socket_shutdown},
    {"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
    {"readba_native", "([BIILjava/io/FileDescriptor;)I", (void*) socket_readba},
    {"writeba_native", "([BIILjava/io/FileDescriptor;)V", (void*) socket_writeba},