/[classpath]/classpath/vm/reference/java/lang/VMProcess.java
ViewVC logotype

Diff of /classpath/vm/reference/java/lang/VMProcess.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.1 by gnu_andrew, Fri Jan 14 10:24:18 2005 UTC revision 1.2.2.2 by gnu_andrew, Sun Jan 16 15:15:15 2005 UTC
# Line 1  Line 1 
1  /* java.lang.VMProcess -- VM implementation of java.lang.Process  /* java.lang.VMProcess -- VM implementation of java.lang.Process
2     Copyright (C) 2004 Free Software Foundation, Inc.     Copyright (C) 2004, 2005 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 73  final class VMProcess extends Process Line 73  final class VMProcess extends Process
73    private static final int TERMINATED = 2;    private static final int TERMINATED = 2;
74    
75    // Dedicated thread that does all the fork()'ing and wait()'ing.    // Dedicated thread that does all the fork()'ing and wait()'ing.
76    private static Thread processThread;    static Thread processThread;
77    
78    // New processes waiting to be spawned by processThread.    // New processes waiting to be spawned by processThread.
79    private static final LinkedList workList = new LinkedList();    static final LinkedList workList = new LinkedList();
80    
81    // Return values set by nativeReap() when a child is reaped.    // Return values set by nativeReap() when a child is reaped.
82    // These are only accessed by processThread so no locking required.    // These are only accessed by processThread so no locking required.
83    private static long reapedPid;    static long reapedPid;
84    private static int reapedExitValue;    static int reapedExitValue;
85    
86    // Information about this process    // Information about this process
87    private int state;                           // current state of process    int state;                                   // current state of process
88    private final String[] cmd;                  // copied from Runtime.exec()    final String[] cmd;                          // copied from Runtime.exec()
89    private final String[] env;                  // copied from Runtime.exec()    final String[] env;                          // copied from Runtime.exec()
90    private final File dir;                      // copied from Runtime.exec()    final File dir;                              // copied from Runtime.exec()
91    private Throwable exception;                 // if process failed to start    Throwable exception;                         // if process failed to start
92    private long pid;                            // process id    long pid;                                    // process id
93    private OutputStream stdin;                  // process input stream    OutputStream stdin;                          // process input stream
94    private InputStream stdout;                  // process output stream    InputStream stdout;                          // process output stream
95    private InputStream stderr;                  // process error stream    InputStream stderr;                          // process error stream
96    private int exitValue;                       // process exit value    int exitValue;                               // process exit value
97    
98    //    //
99    // Dedicated thread that does all the fork()'ing and wait()'ing    // Dedicated thread that does all the fork()'ing and wait()'ing
# Line 115  final class VMProcess extends Process Line 115  final class VMProcess extends Process
115      // constructor will be private, which means the compiler will have      // constructor will be private, which means the compiler will have
116      // to generate a second package-private constructor, which is      // to generate a second package-private constructor, which is
117      // bogus.      // bogus.
118      public ProcessThread ()      ProcessThread ()
119      {      {
120      }      }
121    
# Line 202  final class VMProcess extends Process Line 202  final class VMProcess extends Process
202                process.state = RUNNING;                process.state = RUNNING;
203                activeMap.put(new Long(process.pid), process);                activeMap.put(new Long(process.pid), process);
204              }              }
205              catch (ThreadDeath death)
206                {
207                  throw death;
208                }
209            catch (Throwable t)            catch (Throwable t)
210              {              {
211                process.state = TERMINATED;                process.state = TERMINATED;
# Line 345  final class VMProcess extends Process Line 349  final class VMProcess extends Process
349     *     *
350     * @throws IOException if the O/S process could not be created.     * @throws IOException if the O/S process could not be created.
351     */     */
352    private native void nativeSpawn(String[] cmd, String[] env, File dir)    native void nativeSpawn(String[] cmd, String[] env, File dir)
353      throws IOException;      throws IOException;
354    
355    /**    /**
# Line 356  final class VMProcess extends Process Line 360  final class VMProcess extends Process
360     *     *
361     * @return true if a child was reaped, otherwise false     * @return true if a child was reaped, otherwise false
362     */     */
363    private static native boolean nativeReap();    // This is not private as it is called from an inner class.
364      static native boolean nativeReap();
365    
366    /**    /**
367     * Kill a process. This sends it a fatal signal but does not reap it.     * Kill a process. This sends it a fatal signal but does not reap it.

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26