From: Dave Airlie (David.Airlie at domain ul.ie)
Date: Tue 18 Jul 2000 - 23:41:08 IST
Now I know what will happen when SO 5.3 comes out ...
Dave.
On Tue, 18 Jul 2000, Caolan McNamara wrote:
> Funny how you get blind spots about various things, was discussing
> file descriptors and have been assuming for ages that a newly execed
> program got a completely new set of such resources. But on reading the
> sun man page I was enlightened.
>
> After a fork both parent and child have the same fds, after an exec
> the new process *still* has the same open fds (as long as fcntl with ,
> FD_CLOEXEC to close them on exec isnt set). Enter crash tolerant stuff...
>
> sockets to server, server crashes, its segv handler writes out the fd
> numbers to disk or passes them on command line, and forks and execs a new
> instance of itself whereupon the new one just uses the preexisting fd
> numbers and keeps on trucking. All the dodgy original image is jettisoned
> and you move on with a virgin copy but your connections remain open,
> amusing I thought. I thought I'd share.
>
> C.
> p.s. titchy demo at
> http://www.csn.ul.ie/~caolan/publink/ForkExec/CunningForkExecSegvHandler.c
>
>
>
-- David Airlie, Software Engineer http://www.skynet.ie/~airlied / airlied at domain skynet.ie pam_smb / Linux DecStation / Linux VAX / ILUG person
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:54 GMT