Re: [ILUG] amusing hack, keep socket connection open despite segv

From: kevin lyda (kevin at domain suberic.net)
Date: Wed 19 Jul 2000 - 00:52:58 IST


On Tue, Jul 18, 2000 at 05:33:44PM +0200, Caolan McNamara wrote:
> 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.

yes, this is how shells and friends work. even more inticate would
be enlightenments ability to restart itself after it dies. though
i must admit that i was a bit nervous that someone felt the need to
go to that much effort.

be careful doing this in real life as things could get weird if someone
passed fd's over the commandline by hand. also can you call exec from
a signal handler? what functions *can* you safely call from a signal
handler and is there a standard place they're documented? i know there
are functions that are considered unsafe, but why and which?

kevin

-- 
kevin at domain suberic.net       "there's nothing wrong with windows 2000 that
fork()'ed on 37058400    linux can't fix."  -- va linux t-shirt
meatspace place: home    


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:54 GMT