Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 1999 13:02:22 -0600
From:      Michael Maxwell <drwho@xnet.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: how to die gracefully
Message-ID:  <19990322130222.C4838@drwho.xnet.com>
In-Reply-To: <36F65B11.610DAE9D@tdx.co.uk>; from Karl Pielorz on Mon, Mar 22, 1999 at 03:00:33PM %2B0000
References:  <000501be7472$3bbeb400$064ca8c0@gateway> <36F65B11.610DAE9D@tdx.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 22, 1999 at 03:00:33PM +0000, Karl Pielorz wrote:
> Catch the CTRL-C signal, then perform housekeeping & cleanup (i.e. close
> files, sockets, freeup memory used etc. - all of which your program should
> have tracked etc.), then quit...
> 
> > 2.I like to catch the signal when pushed Ctl^C,and make a handler
> > routine.Would you tell me what signal I can catch when enterring Ctl^C ?
> 
> SIGQUIT I think - check the man pages out (man signal)...

C-c is "SIGINT", but SIGQUIT should be caught too (SIGQUIT is brutal and
causes a coredump).  Note the signals in /usr/include/signal.h.  Also, one
should look into the "sigaction()" and related functions for proper signal
handling...

-- 
    Michael Maxwell <drwho @ xnet.com>  |  http://www.xnet.com/~drwho/
       "American Justice: oxymoron.  William J. Clinton: moron."
                                                    --M. Maxwell (1999)


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990322130222.C4838>