src/solaris/native/java/net/NetworkInterface.c

Print this page




 548     (*env)->ReleaseStringUTFChars(env, name, name_utf);
 549 
 550     close(sock);
 551     return ret;
 552 }
 553 
 554 /*** Private methods definitions ****/
 555 
 556 static int getFlags0(JNIEnv *env, jstring name) {
 557     jboolean isCopy;
 558     int ret, sock;
 559     const char* name_utf;
 560     int flags = 0;
 561 
 562     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
 563 
 564     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
 565         (*env)->ReleaseStringUTFChars(env, name, name_utf);
 566          return -1;
 567     }
 568 
 569     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
 570 
 571     ret = getFlags(sock, name_utf, &flags);
 572 
 573     close(sock);
 574     (*env)->ReleaseStringUTFChars(env, name, name_utf);
 575 
 576     if (ret < 0) {
 577         NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "IOCTL  SIOCGLIFFLAGS failed");
 578         return -1;
 579     }
 580 
 581     return flags;
 582 }
 583 
 584 
 585 
 586 
 587 /*
 588  * Create a NetworkInterface object, populate the name and index, and
 589  * populate the InetAddress array based on the IP addresses for this




 548     (*env)->ReleaseStringUTFChars(env, name, name_utf);
 549 
 550     close(sock);
 551     return ret;
 552 }
 553 
 554 /*** Private methods definitions ****/
 555 
 556 static int getFlags0(JNIEnv *env, jstring name) {
 557     jboolean isCopy;
 558     int ret, sock;
 559     const char* name_utf;
 560     int flags = 0;
 561 
 562     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
 563 
 564     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
 565         (*env)->ReleaseStringUTFChars(env, name, name_utf);
 566         return -1;
 567     }


 568 
 569     ret = getFlags(sock, name_utf, &flags);
 570 
 571     close(sock);
 572     (*env)->ReleaseStringUTFChars(env, name, name_utf);
 573 
 574     if (ret < 0) {
 575         NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "IOCTL  SIOCGLIFFLAGS failed");
 576         return -1;
 577     }
 578 
 579     return flags;
 580 }
 581 
 582 
 583 
 584 
 585 /*
 586  * Create a NetworkInterface object, populate the name and index, and
 587  * populate the InetAddress array based on the IP addresses for this