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: Thu, 02 Oct 2003 16:15:07 -0400
User-agent: Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686; de, address@hidden)

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

Changes by: Michael Koch <address@hidden>
Date: Thu 10/02/2003 at 20:15 (GMT)

            What     | Removed                   | Added
---------------------------------------------------------------------------
         Assigned to | mkoch                     | None
              Status | In Process                | Open




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


Submitted by: archie172               Project: classpath                    
Submitted on: Fri 02/28/2003 at 21:23
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: Fri 02/28/2003 at 21:25       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

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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