src/solaris/classes/java/lang/UNIXProcess.java.solaris

Print this page

        

*** 46,57 **** private InputStream stderr_stream; /* this is for the reaping thread */ private native int waitForProcessExit(int pid); /** ! * Create a process using fork(2) and exec(2). * * @param std_fds array of file descriptors. Indexes 0, 1, and * 2 correspond to standard input, standard output and * standard error, respectively. On input, a value of -1 * means to create a pipe to connect child and parent --- 46,69 ---- private InputStream stderr_stream; /* this is for the reaping thread */ private native int waitForProcessExit(int pid); + private static String javahome; + + static { + javahome = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction<String>() { public String run() { + return System.getProperty ("java.home"); + }} + ); + } + /** ! * Create a process using posix_spawn(2). A small helper is spawned ! * which cleans up the inherited file descriptors and (if required) ! * changes directory to the new WD, and then spawns the real target. * * @param std_fds array of file descriptors. Indexes 0, 1, and * 2 correspond to standard input, standard output and * standard error, respectively. On input, a value of -1 * means to create a pipe to connect child and parent
*** 59,84 **** * parent pipe fd corresponding to the pipe which has * been created. An element of this array is -1 on input * if and only if it is <em>not</em> -1 on output. * @return the pid of the subprocess */ ! private native int forkAndExec(byte[] prog, byte[] argBlock, int argc, byte[] envBlock, int envc, byte[] dir, int[] std_fds, boolean redirectErrorStream) throws IOException; UNIXProcess(final byte[] prog, final byte[] argBlock, int argc, final byte[] envBlock, int envc, final byte[] dir, final int[] std_fds, final boolean redirectErrorStream) throws IOException { ! pid = forkAndExec(prog, argBlock, argc, envBlock, envc, dir, std_fds, redirectErrorStream); --- 71,111 ---- * parent pipe fd corresponding to the pipe which has * been created. An element of this array is -1 on input * if and only if it is <em>not</em> -1 on output. * @return the pid of the subprocess */ ! private int spawn (byte[] prog, byte[] argBlock, int argc, byte[] envBlock, int envc, byte[] dir, int[] std_fds, boolean redirectErrorStream) + throws IOException + { + return forkAndExec ( + prog, argBlock, argc, envBlock, envc, dir, std_fds, + javahome + "/bin/processhelper", redirectErrorStream + ); + } + + private native int forkAndExec (byte[] prog, + byte[] argBlock, int argc, + byte[] envBlock, int envc, + byte[] dir, + int[] std_fds, + String helper, + boolean redirectErrorStream) throws IOException; UNIXProcess(final byte[] prog, final byte[] argBlock, int argc, final byte[] envBlock, int envc, final byte[] dir, final int[] std_fds, final boolean redirectErrorStream) throws IOException { ! pid = spawn(prog, argBlock, argc, envBlock, envc, dir, std_fds, redirectErrorStream);