0N/A * A simple launcher to launch a program as if it was launched by inetd. 0N/A * Throws the exception of the given class name and detail message 0N/A * Convert a jstring to an ISO 8859_1 encoded C string 0N/A * Argument 0 of the command array is the program name. 0N/A * Here we just extract the program name and any arguments into 0N/A * a command array suitable for use with execvp. 0N/A "command array must at least include the program name");
0N/A * Command array must have NULL as the last entry 0N/A * Launch the program. As this isn't a complete inetd or Runtime.exec 0N/A * implementation we don't have a reaper to pick up child exit status. 0N/A * We need to close all file descriptors except for serviceFd. To 0N/A * get the list of open file descriptos we read through /proc/self/fd 0N/A * but to open this requires a file descriptor. We could use a specific 0N/A * file descriptor and fdopendir but Linux doesn't seem to support 0N/A * fdopendir. Instead we use opendir and make an assumption on the 0N/A * file descriptor that is used (by opening & closing a file). 0N/A * At this point all file descriptors are closed except for 0N/A * serviceFd. We not dup 0,1,2 to this file descriptor and 0N/A * close serviceFd. This should leave us with only 0,1,2 0N/A * open and all connected to the same socket.