aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/Win32Process.java
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2003-02-10 23:52:56 +0000
committerTom Tromey <tromey@gcc.gnu.org>2003-02-10 23:52:56 +0000
commitd6a2d36ee72dd89c72dbd05720fd4bc81e4b20e2 (patch)
treed76d0682ab2c7f55130f40b4332a102e90d49551 /libjava/java/lang/Win32Process.java
parent17e39e5c61a230520688ee9b5173e89aa3b772aa (diff)
downloadgcc-d6a2d36ee72dd89c72dbd05720fd4bc81e4b20e2.zip
gcc-d6a2d36ee72dd89c72dbd05720fd4bc81e4b20e2.tar.gz
gcc-d6a2d36ee72dd89c72dbd05720fd4bc81e4b20e2.tar.bz2
Win32Process.java (destroy): Declare as native.
2003-02-10 Ranjit Mathew <rmathew@hotmail.com> * java/lang/Win32Process.java (destroy): Declare as native. (hasExited): New native method. (exitValue): Define. (getErrorStream): Likewise. (getInputStream): Likewise. (getOutputStream): Likewise. (waitFor): Declare as native. (startProcess): New native method. (cleanup): Likewise. (ConcreteProcess): Define. (outputStream, inputStream, errorStream): New members. (procHandle, exitCode): Likewise. * java/lang/natWin32Process.cc (java::lang::ConcreteProcess::cleanup): Define. (java::lang::ConcreteProcess::destroy): Likewise. (java::lang::ConcreteProcess::hasExited): Likewise. (java::lang::ConcreteProcess::waitFor): Likewise. (new_string): Likewise. (java::lang::ConcreteProcess::startProcess): Likewise. From-SVN: r62657
Diffstat (limited to 'libjava/java/lang/Win32Process.java')
-rw-r--r--libjava/java/lang/Win32Process.java52
1 files changed, 32 insertions, 20 deletions
diff --git a/libjava/java/lang/Win32Process.java b/libjava/java/lang/Win32Process.java
index 72911d2..b1c7e02 100644
--- a/libjava/java/lang/Win32Process.java
+++ b/libjava/java/lang/Win32Process.java
@@ -1,6 +1,6 @@
// Win32Process.java - Subclass of Process for Win32 systems.
-/* Copyright (C) 2002 Free Software Foundation
+/* Copyright (C) 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -22,51 +22,63 @@ import java.io.IOException;
// This is entirely internal to our implementation.
-// NOTE: when this is implemented, we'll need to add
-// HANDLE_FLAG_INHERIT in FileDescriptor and other places, to make
-// sure that file descriptors aren't inherited by the child process.
-// See _Jv_platform_close_on_exec.
-
// This file is copied to `ConcreteProcess.java' before compilation.
// Hence the class name apparently does not match the file name.
final class ConcreteProcess extends Process
{
- public void destroy ()
- {
- throw new Error("not implemented");
- }
-
+ public native void destroy ();
+
+ public native boolean hasExited ();
+
public int exitValue ()
{
- throw new Error("not implemented");
+ if (! hasExited ())
+ throw new IllegalThreadStateException ("Process has not exited");
+
+ return exitCode;
}
public InputStream getErrorStream ()
{
- throw new Error("not implemented");
+ return errorStream;
}
public InputStream getInputStream ()
{
- throw new Error("not implemented");
+ return inputStream;
}
public OutputStream getOutputStream ()
{
- throw new Error("not implemented");
+ return outputStream;
}
- public int waitFor () throws InterruptedException
- {
- throw new Error("not implemented");
- }
+ public native int waitFor () throws InterruptedException;
+
+ public native void startProcess (String[] progarray,
+ String[] envp,
+ File dir)
+ throws IOException;
+
+ public native void cleanup ();
public ConcreteProcess (String[] progarray,
String[] envp,
File dir)
throws IOException
{
- throw new IOException("not implemented");
+ startProcess (progarray, envp, dir);
}
+ // The standard streams (stdin, stdout and stderr, respectively)
+ // of the child as seen by the parent process.
+ private OutputStream outputStream;
+ private InputStream inputStream;
+ private InputStream errorStream;
+
+ // Handle to the child process - cast to HANDLE before use.
+ private int procHandle;
+
+ // Exit code of the child if it has exited.
+ private int exitCode;
}