Win32Process.java: Added comment.

* java/lang/Win32Process.java: Added comment.
	* include/posix.h (_Jv_platform_close_on_exec): New function.
	Include fcntl.h.
	* include/win32.h (_Jv_platform_close_on_exec): New function.
	* java/net/natPlainSocketImpl.cc (create): Set close-on-exec
	flag.
	(accept): Likewise.
	* java/net/natPlainDatagramSocketImpl.cc (create): Set
	close-on-exec flag.
	* java/io/natFileDescriptorPosix.cc (open): Set close-on-exec
	flag.

From-SVN: r50536
This commit is contained in:
Tom Tromey
2002-03-10 17:59:23 +00:00
committed by Tom Tromey
parent b29bb8325b
commit 0c1fcb02b1
7 changed files with 45 additions and 6 deletions
+3 -1
View File
@@ -17,7 +17,6 @@ details. */
#include <string.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
#ifdef HAVE_SYS_IOCTL_H
#define BSD_COMP /* Get FIONREAD on Solaris2. */
@@ -122,6 +121,9 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
sprintf (msg, "%s (%s)", buf, strerror (errno));
throw new FileNotFoundException (JvNewStringLatin1 (msg));
}
_Jv_platform_close_on_exec (fd);
return fd;
}
+5
View File
@@ -21,6 +21,11 @@ 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
@@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000 Free Software Foundation
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -185,6 +185,9 @@ java::net::PlainDatagramSocketImpl::create ()
char* strerr = strerror (errno);
throw new java::net::SocketException (JvNewStringUTF (strerr));
}
_Jv_platform_close_on_exec (sock);
fnum = sock;
fd = new java::io::FileDescriptor (sock);
}
+6
View File
@@ -232,6 +232,9 @@ java::net::PlainSocketImpl::create (jboolean stream)
char* strerr = strerror (errno);
throw new java::io::IOException (JvNewStringUTF (strerr));
}
_Jv_platform_close_on_exec (sock);
fnum = sock;
fd = new java::io::FileDescriptor (sock);
}
@@ -374,6 +377,9 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
new_socket = _Jv_accept (fnum, (sockaddr*) &u, &addrlen);
if (new_socket < 0)
goto error;
_Jv_platform_close_on_exec (new_socket);
jbyteArray raddr;
jint rport;
if (u.address.sin_family == AF_INET)