< prev index next >

src/jdk.net/macosx/native/libextnet/MacOSXSocketOptions.c

Print this page

        

@@ -21,10 +21,11 @@
  * 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 <sys/socket.h>
+#include <sys/types.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
 
 #include <jni.h>

@@ -123,10 +124,27 @@
     return optval;
 }
 
 /*
  * Class:     jdk_net_MacOSXSocketOptions
+ * Method:    getSoPeerCred0
+ * Signature: (I[I)I
+ */
+JNIEXPORT void JNICALL Java_jdk_net_MacOSXSocketOptions_getSoPeerCred0
+  (JNIEnv *env, jclass clazz, jint fd, jintArray result) {
+
+    int *rr = (int *)(*env)->GetIntArrayElements(env, result, NULL);
+
+    jint rv;
+    rv = getpeereid(fd, (uid_t *)&rr[0], (gid_t *)&rr[1]);
+    (*env)->ReleaseIntArrayElements(env, result, rr, 0);
+    handleError(env, rv, "get peer eid failed");
+}
+
+
+/*
+ * Class:     jdk_net_MacOSXSocketOptions
  * Method:    getTcpKeepAliveTime0
  * Signature: (I)I;
  */
 JNIEXPORT jint JNICALL Java_jdk_net_MacOSXSocketOptions_getTcpKeepAliveTime0
 (JNIEnv *env, jobject unused, jint fd) {
< prev index next >