diff options
author | Per Bothner <bothner@gcc.gnu.org> | 2004-02-29 11:14:20 -0800 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2004-02-29 11:14:20 -0800 |
commit | 881ad9e4055473e2c7f6100833e8dfeb804b621b (patch) | |
tree | a23a9ed058e8310fc0daddc0f10c9b2ecbcbdac1 /libjava/java/lang | |
parent | 3ae1e52c9197131a764d47f4b09fc44a91db3558 (diff) | |
download | gcc-881ad9e4055473e2c7f6100833e8dfeb804b621b.zip gcc-881ad9e4055473e2c7f6100833e8dfeb804b621b.tar.gz gcc-881ad9e4055473e2c7f6100833e8dfeb804b621b.tar.bz2 |
natPosixProcess.cc (startProcess): Implement standard streams using FileChannelImpl, not FileDescriptor.
* java/lang/natPosixProcess.cc (startProcess): Implement standard
streams using FileChannelImpl, not FileDescriptor.
* java/lang/natWin32Process.cc (startProcess): Likewise.
From-SVN: r78664
Diffstat (limited to 'libjava/java/lang')
-rw-r--r-- | libjava/java/lang/natPosixProcess.cc | 9 | ||||
-rw-r--r-- | libjava/java/lang/natWin32Process.cc | 18 |
2 files changed, 18 insertions, 9 deletions
diff --git a/libjava/java/lang/natPosixProcess.cc b/libjava/java/lang/natPosixProcess.cc index a6dfc1a..644c0a1 100644 --- a/libjava/java/lang/natPosixProcess.cc +++ b/libjava/java/lang/natPosixProcess.cc @@ -32,11 +32,14 @@ details. */ #include <java/lang/Thread.h> #include <java/io/File.h> #include <java/io/FileDescriptor.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> #include <java/io/FileInputStream.h> #include <java/io/FileOutputStream.h> #include <java/io/IOException.h> #include <java/lang/OutOfMemoryError.h> +using gnu::java::nio::channels::FileChannelImpl; + extern char **environ; void @@ -187,9 +190,9 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, // We create the streams before forking. Otherwise if we had an // error while creating the streams we would have run the child // with no way to communicate with it. - errorStream = new FileInputStream (new FileDescriptor (errp[0])); - inputStream = new FileInputStream (new FileDescriptor (inp[0])); - outputStream = new FileOutputStream (new FileDescriptor (outp[1])); + errorStream = new FileInputStream (new FileChannelImpl(errp[0], FileChannelImpl::READ)); + inputStream = new FileInputStream (new FileChannelImpl(inp[0], FileChannelImpl::READ)); + outputStream = new FileOutputStream (new FileChannelImpl(outp[0], FileChannelImpl::WRITE)); // We don't use vfork() because that would cause the local // environment to be set by the child. diff --git a/libjava/java/lang/natWin32Process.cc b/libjava/java/lang/natWin32Process.cc index 7337ab3..3c1a4f0 100644 --- a/libjava/java/lang/natWin32Process.cc +++ b/libjava/java/lang/natWin32Process.cc @@ -25,6 +25,9 @@ details. */ #include <java/io/FileOutputStream.h> #include <java/io/IOException.h> #include <java/lang/OutOfMemoryError.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> + +using gnu::java::nio::channels::FileChannelImpl; void java::lang::ConcreteProcess::cleanup (void) @@ -282,12 +285,15 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, ChildProcessPipe aChildStdOut(ChildProcessPipe::OUTPUT); ChildProcessPipe aChildStdErr(ChildProcessPipe::OUTPUT); - outputStream = new FileOutputStream (new FileDescriptor ( - (jint) aChildStdIn.getParentHandle ())); - inputStream = new FileInputStream (new FileDescriptor ( - (jint) aChildStdOut.getParentHandle ())); - errorStream = new FileInputStream (new FileDescriptor ( - (jint) aChildStdErr.getParentHandle ())); + outputStream = new FileOutputStream (new FileChannelImpl ( + (jint) aChildStdIn.getParentHandle (), + FileChannelImpl::WRITE)); + inputStream = new FileInputStream (new FileChannelImpl ( + (jint) aChildStdOut.getParentHandle (), + FileChannelImpl::READ)); + errorStream = new FileInputStream (new FileChannelImpl ( + (jint) aChildStdErr.getParentHandle (), + FileChannelImpl::READ)); // Now create the child process. PROCESS_INFORMATION pi; |