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:
parent
b29bb8325b
commit
0c1fcb02b1
@ -1,3 +1,17 @@
|
||||
2002-03-10 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2002-03-09 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* verify.cc (state::NO_STACK): New constant.
|
||||
|
@ -28,13 +28,17 @@ details. */
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <gcj/cni.h>
|
||||
|
||||
extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
extern jlong _Jv_platform_gettimeofday ();
|
||||
extern void _Jv_platform_initialize (void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline void
|
||||
_Jv_platform_close_on_exec (jint fd)
|
||||
{
|
||||
// Ignore errors.
|
||||
fcntl (fd, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
@ -21,4 +21,9 @@ details. */
|
||||
extern void _Jv_platform_initialize (void);
|
||||
extern jlong _Jv_platform_gettimeofday ();
|
||||
|
||||
void _Jv_platform_close_on_exec (jint)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
#endif /* __JV_WIN32_H__ */
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user