< prev index next >
src/java.base/windows/native/libnet/DualStackPlainDatagramSocketImpl.c
Print this page
rev 15720 : 8166850: No runtime error expected after calling NET_MapSocketOption
*** 1,7 ****
/*
! * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 473,489 ****
/*
* Class: java_net_DualStackPlainDatagramSocketImpl
* Method: socketSetIntOption
* Signature: (III)V
*/
! JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketSetIntOption
! (JNIEnv *env, jclass clazz, jint fd , jint cmd, jint value) {
int level = 0, opt = 0;
if (NET_MapSocketOption(cmd, &level, &opt) < 0) {
! JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
! "Invalid option");
return;
}
if (NET_SetSockOpt(fd, level, opt, (char *)&value, sizeof(value)) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "setsockopt");
--- 473,490 ----
/*
* Class: java_net_DualStackPlainDatagramSocketImpl
* Method: socketSetIntOption
* Signature: (III)V
*/
! JNIEXPORT void JNICALL
! Java_java_net_DualStackPlainDatagramSocketImpl_socketSetIntOption
! (JNIEnv *env, jclass clazz, jint fd, jint cmd, jint value)
! {
int level = 0, opt = 0;
if (NET_MapSocketOption(cmd, &level, &opt) < 0) {
! JNU_ThrowByName(env, "java/net/SocketException", "Invalid option");
return;
}
if (NET_SetSockOpt(fd, level, opt, (char *)&value, sizeof(value)) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "setsockopt");
*** 493,510 ****
/*
* Class: java_net_DualStackPlainDatagramSocketImpl
* Method: socketGetIntOption
* Signature: (II)I
*/
! JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketGetIntOption
! (JNIEnv *env, jclass clazz, jint fd, jint cmd) {
! int level = 0, opt = 0, result=0;
int result_len = sizeof(result);
if (NET_MapSocketOption(cmd, &level, &opt) < 0) {
! JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
! "Invalid option");
return -1;
}
if (NET_GetSockOpt(fd, level, opt, (void *)&result, &result_len) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "getsockopt");
--- 494,512 ----
/*
* Class: java_net_DualStackPlainDatagramSocketImpl
* Method: socketGetIntOption
* Signature: (II)I
*/
! JNIEXPORT jint JNICALL
! Java_java_net_DualStackPlainDatagramSocketImpl_socketGetIntOption
! (JNIEnv *env, jclass clazz, jint fd, jint cmd)
! {
! int level = 0, opt = 0, result = 0;
int result_len = sizeof(result);
if (NET_MapSocketOption(cmd, &level, &opt) < 0) {
! JNU_ThrowByName(env, "java/net/SocketException", "Invalid option");
return -1;
}
if (NET_GetSockOpt(fd, level, opt, (void *)&result, &result_len) < 0) {
NET_ThrowNew(env, WSAGetLastError(), "getsockopt");
*** 517,528 ****
/*
* Class: java_net_DualStackPlainDatagramSocketImpl
* Method: dataAvailable
* Signature: ()I
*/
! JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_dataAvailable
! (JNIEnv *env, jobject this) {
SOCKET fd;
int rv = -1;
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
if (!IS_NULL(fdObj)) {
--- 519,532 ----
/*
* Class: java_net_DualStackPlainDatagramSocketImpl
* Method: dataAvailable
* Signature: ()I
*/
! JNIEXPORT jint JNICALL
! Java_java_net_DualStackPlainDatagramSocketImpl_dataAvailable
! (JNIEnv *env, jobject this)
! {
SOCKET fd;
int rv = -1;
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
if (!IS_NULL(fdObj)) {
< prev index next >