src/share/transport/socket/socketTransport.c

Print this page
rev 8975 : 8031581: PPC64: Addons and fixes for AIX to pass the jdk regression tests


 489 }
 490 
 491 static jboolean JNICALL
 492 socketTransport_isOpen(jdwpTransportEnv* env)
 493 {
 494     if (socketFD >= 0) {
 495         return JNI_TRUE;
 496     } else {
 497         return JNI_FALSE;
 498     }
 499 }
 500 
 501 static jdwpTransportError JNICALL
 502 socketTransport_close(jdwpTransportEnv* env)
 503 {
 504     int fd = socketFD;
 505     socketFD = -1;
 506     if (fd < 0) {
 507         return JDWPTRANSPORT_ERROR_NONE;
 508     }













 509     if (dbgsysSocketClose(fd) < 0) {
 510         /*
 511          * close failed - it's pointless to restore socketFD here because
 512          * any subsequent close will likely fail as well.
 513          */
 514         RETURN_IO_ERROR("close failed");
 515     }
 516     return JDWPTRANSPORT_ERROR_NONE;
 517 }
 518 
 519 static jdwpTransportError JNICALL
 520 socketTransport_writePacket(jdwpTransportEnv* env, const jdwpPacket *packet)
 521 {
 522     jint len, data_len, id;
 523     /*
 524      * room for header and up to MAX_DATA_SIZE data bytes
 525      */
 526     char header[HEADER_SIZE + MAX_DATA_SIZE];
 527     jbyte *data;
 528 




 489 }
 490 
 491 static jboolean JNICALL
 492 socketTransport_isOpen(jdwpTransportEnv* env)
 493 {
 494     if (socketFD >= 0) {
 495         return JNI_TRUE;
 496     } else {
 497         return JNI_FALSE;
 498     }
 499 }
 500 
 501 static jdwpTransportError JNICALL
 502 socketTransport_close(jdwpTransportEnv* env)
 503 {
 504     int fd = socketFD;
 505     socketFD = -1;
 506     if (fd < 0) {
 507         return JDWPTRANSPORT_ERROR_NONE;
 508     }
 509 #ifdef _AIX
 510     /*
 511       AIX needs a workaround for I/O cancellation, see:
 512       http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/close.htm
 513       ...
 514       The close subroutine is blocked until all subroutines which use the file
 515       descriptor return to usr space. For example, when a thread is calling close
 516       and another thread is calling select with the same file descriptor, the
 517       close subroutine does not return until the select call returns.
 518       ...
 519     */
 520     shutdown(fd, 2);
 521 #endif
 522     if (dbgsysSocketClose(fd) < 0) {
 523         /*
 524          * close failed - it's pointless to restore socketFD here because
 525          * any subsequent close will likely fail as well.
 526          */
 527         RETURN_IO_ERROR("close failed");
 528     }
 529     return JDWPTRANSPORT_ERROR_NONE;
 530 }
 531 
 532 static jdwpTransportError JNICALL
 533 socketTransport_writePacket(jdwpTransportEnv* env, const jdwpPacket *packet)
 534 {
 535     jint len, data_len, id;
 536     /*
 537      * room for header and up to MAX_DATA_SIZE data bytes
 538      */
 539     char header[HEADER_SIZE + MAX_DATA_SIZE];
 540     jbyte *data;
 541