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

From: Paul Jakma (paul at domain clubi.ie)
Date: Wed 19 Jul 2000 - 02:18:49 IST


On Wed, 19 Jul 2000, kevin lyda wrote:

> 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.
>

ins't there a mechanism in modern unix to even pass fd's between
/arbitary/ processes at run time (not exec)? can't remember how it
works though.

> 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?

i'd guess the reason why is very very similar to why some functions
are not thread safe, ie global state/can't identify different
contexts. and i'd further guess that thread safe functions are also
sig safe. (ie most of glibc should be thread/sig safe, i think). i
guess if you use a non-thread safe function

then again, sig handlers might be run from funny places and cause
other probs.

methinks APUE is the best place to look:

'exec'utive summary[1]

POSIX.1 specifies a list of functions that are guaranteed to be
reentrant, (includes execve/execle), SVR4 specifies 4 additional
guaranteed reentrant functions.

global variables such as errno can be affected by the sig handler, so
should be saved/restored at beginning/end of sig handler.
---------------------------------------------------------------

lots lots more. i'll bring the book in if you want a gander at it.

>
> kevin
>
>

regards,

-- 
Paul Jakma	paul at domain clubi.ie
PGP5 key: http://www.clubi.ie/jakma/publickey.txt
-------------------------------------------
Fortune:
My problem lies in reconciling my gross habits with my net income.
		-- Errol Flynn
Any man who has $10,000 left when he dies is a failure.
		-- Errol Flynn
[1]. chortle chortle


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