lkml.org 
[lkml]   [1999]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: FD_CLFORK or equivalent?
Date
Argh wrong button. Remind me not to use vi

To continue

> Is there an existing Linux/Unix mechanism to force fds closed
> on fork() that I am unaware of?

They exist only for exec - since within just a fork() the situation
is under your control. It is your fault if you forget to close() it - the
kernel isnt there to baby you - and if you want it to you can write a nice
fork wrapper that asks the library to close handles it is using.

> If not, before I hack one in as a private kernel patch, is
> there any reason to add such a mechanism, perhaps a FD_CLOFORK
> flag, and does anybody have suggestions on where to start?

FD_CLOFORK is the logical way to do it so that it matches FD_CLOEXEC. Think
hard about the semantics for threaded applications where they share the
same file handles when doing this.

Alan


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.035 / U:2.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site