[lkml]   [1999]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: FD_CLFORK or equivalent?
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.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:51    [W:0.041 / U:5.168 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site