src/os/solaris/vm/attachListener_solaris.cpp

Print this page




 319     }
 320 
 321     // create a pair of connected sockets. Store the file descriptor
 322     // for one end in the operation and enqueue the operation. The
 323     // file descriptor for the other end wil be returned to the client.
 324     if (res == 0) {
 325       int s[2];
 326       if (socketpair(PF_UNIX, SOCK_STREAM, 0, s) < 0) {
 327         delete op;
 328         res = (jint)SolarisAttachListener::ATTACH_ERROR_RESOURCE;
 329       } else {
 330         op->set_socket(s[0]);
 331         return_fd = s[1];
 332         SolarisAttachListener::enqueue(op);
 333       }
 334     }
 335 
 336     // Return 0 (success) + file descriptor, or non-0 (error)
 337     if (res == 0) {
 338       door_desc_t desc;
 339       desc.d_attributes = DOOR_DESCRIPTOR;
 340       desc.d_data.d_desc.d_descriptor = return_fd;
 341       door_return((char*)&res, sizeof(res), &desc, 1);
 342     } else {
 343       door_return((char*)&res, sizeof(res), NULL, 0);
 344     }
 345   }
 346 }
 347 
 348 // atexit hook to detach the door and remove the file
 349 extern "C" {
 350   static void listener_cleanup() {
 351     static int cleanup_done;
 352     if (!cleanup_done) {
 353       cleanup_done = 1;
 354       int dd = SolarisAttachListener::door_descriptor();
 355       if (dd >= 0) {
 356         ::close(dd);
 357       }
 358       if (SolarisAttachListener::has_door_path()) {
 359         char* path = SolarisAttachListener::door_path();




 319     }
 320 
 321     // create a pair of connected sockets. Store the file descriptor
 322     // for one end in the operation and enqueue the operation. The
 323     // file descriptor for the other end wil be returned to the client.
 324     if (res == 0) {
 325       int s[2];
 326       if (socketpair(PF_UNIX, SOCK_STREAM, 0, s) < 0) {
 327         delete op;
 328         res = (jint)SolarisAttachListener::ATTACH_ERROR_RESOURCE;
 329       } else {
 330         op->set_socket(s[0]);
 331         return_fd = s[1];
 332         SolarisAttachListener::enqueue(op);
 333       }
 334     }
 335 
 336     // Return 0 (success) + file descriptor, or non-0 (error)
 337     if (res == 0) {
 338       door_desc_t desc;
 339       desc.d_attributes = DOOR_DESCRIPTOR | DOOR_RELEASE;
 340       desc.d_data.d_desc.d_descriptor = return_fd;
 341       door_return((char*)&res, sizeof(res), &desc, 1);
 342     } else {
 343       door_return((char*)&res, sizeof(res), NULL, 0);
 344     }
 345   }
 346 }
 347 
 348 // atexit hook to detach the door and remove the file
 349 extern "C" {
 350   static void listener_cleanup() {
 351     static int cleanup_done;
 352     if (!cleanup_done) {
 353       cleanup_done = 1;
 354       int dd = SolarisAttachListener::door_descriptor();
 355       if (dd >= 0) {
 356         ::close(dd);
 357       }
 358       if (SolarisAttachListener::has_door_path()) {
 359         char* path = SolarisAttachListener::door_path();