commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug #2684] Set close-on-exec flag on all file descriptors


From: nobody
Subject: [Bug #2684] Set close-on-exec flag on all file descriptors
Date: Fri, 28 Feb 2003 16:25:34 -0500

=================== BUG #2684: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=2684&group_id=85

Changes by: Archie Cobbs <address@hidden>
Date:  (GMT)

------------------ Additional Follow-up Comments ----------------------------
An alternate more hacky approach would be to do something
like this right after calling fork()..

  for (i = 3; i < 9999; i++)
      (void)close(i);





=================== BUG #2684: FULL BUG SNAPSHOT ===================


Submitted by: archie172               Project: classpath                    
Submitted on: 
Severity:  5 - Major                  Resolution:  None                     
Assigned to:  None                    Status:  Open                         
Platform Version:  None               

Summary:  Set close-on-exec flag on all file descriptors

Original Submission:  The Java facilities for fork()'ing and exec()'ing
separate processes are more limited than general UNIX.
Only file descriptors 0, 1, and 2 can be meaningfully
inherited by a child process.

Therefore, all file descriptors opened in native code
should have "fcntl(fd, F_SETFD, 1)" called on them to
set the close-on-exec flag. Otherwise, the child process
might muck up the Java file descriptor by moving a file
pointer, etc.

This includes both java.io file descriptors as well
as java.net socket file descriptors. The latter are perhaps
more important because a child process can e.g. keep a TCP
connection open indefinitely even though the Java process
has closed it.


Follow-up Comments
*******************

-------------------------------------------------------
Date:                               By: archie172
An alternate more hacky approach would be to do something
like this right after calling fork()..

  for (i = 3; i < 9999; i++)
      (void)close(i);




CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=2684&group_id=85




reply via email to

[Prev in Thread] Current Thread [Next in Thread]