< prev index next >

test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/libInheritedChannel.c

Print this page
rev 59383 : [mq]: final


 118         return;
 119     }
 120 
 121     for (i=0; i<cmdlen; i++) {
 122         jstring str = (*env)->GetObjectArrayElement(env, cmdarray, i);
 123         cmdv[i] = (char *) getString8859_1Chars(env, str);
 124         if (cmdv[i] == NULL) {
 125             return;
 126         }
 127     }
 128 
 129     /*
 130      * Command array must have NULL as the last entry
 131      */
 132     cmdv[cmdlen] = NULL;
 133 
 134     /*
 135      * Launch the program. As this isn't a complete inetd or Runtime.exec
 136      * implementation we don't have a reaper to pick up child exit status.
 137      */
 138 #ifdef __solaris__
 139     pid = fork1();
 140 #else
 141     pid = fork();
 142 #endif
 143     if (pid != 0) {
 144         if (pid < 0) {
 145             ThrowException(env, "java/io/IOException", "fork failed");
 146         }
 147         return;
 148     }
 149 
 150     /*
 151      * We need to close all file descriptors except for serviceFd. To
 152      * get the list of open file descriptos we read through /proc/self/fd (/dev/fd)
 153      * but to open this requires a file descriptor. We could use a specific
 154      * file descriptor and fdopendir but Linux doesn't seem to support
 155      * fdopendir. Instead we use opendir and make an assumption on the
 156      * file descriptor that is used (by opening & closing a file).
 157      */
 158     thisFd = open("/dev/fd", O_RDONLY);
 159     if (thisFd < 0) {
 160         _exit(-1);
 161     }
 162 




 118         return;
 119     }
 120 
 121     for (i=0; i<cmdlen; i++) {
 122         jstring str = (*env)->GetObjectArrayElement(env, cmdarray, i);
 123         cmdv[i] = (char *) getString8859_1Chars(env, str);
 124         if (cmdv[i] == NULL) {
 125             return;
 126         }
 127     }
 128 
 129     /*
 130      * Command array must have NULL as the last entry
 131      */
 132     cmdv[cmdlen] = NULL;
 133 
 134     /*
 135      * Launch the program. As this isn't a complete inetd or Runtime.exec
 136      * implementation we don't have a reaper to pick up child exit status.
 137      */



 138     pid = fork();

 139     if (pid != 0) {
 140         if (pid < 0) {
 141             ThrowException(env, "java/io/IOException", "fork failed");
 142         }
 143         return;
 144     }
 145 
 146     /*
 147      * We need to close all file descriptors except for serviceFd. To
 148      * get the list of open file descriptos we read through /proc/self/fd (/dev/fd)
 149      * but to open this requires a file descriptor. We could use a specific
 150      * file descriptor and fdopendir but Linux doesn't seem to support
 151      * fdopendir. Instead we use opendir and make an assumption on the
 152      * file descriptor that is used (by opening & closing a file).
 153      */
 154     thisFd = open("/dev/fd", O_RDONLY);
 155     if (thisFd < 0) {
 156         _exit(-1);
 157     }
 158 


< prev index next >