From owner-freebsd-questions Mon Mar 22 22:40: 8 1999 Delivered-To: freebsd-questions@freebsd.org Received: from drwho.xnet.com (drwho.xnet.com [205.243.140.183]) by hub.freebsd.org (Postfix) with ESMTP id 63E4315356 for ; Mon, 22 Mar 1999 22:39:51 -0800 (PST) (envelope-from drwho@drwho.xnet.com) Received: (from drwho@localhost) by drwho.xnet.com (8.9.2/8.9.2) id NAA04957 for freebsd-questions@FreeBSD.ORG; Mon, 22 Mar 1999 13:02:23 -0600 (CST) (envelope-from drwho) Date: Mon, 22 Mar 1999 13:02:22 -0600 From: Michael Maxwell To: freebsd-questions@FreeBSD.ORG Subject: Re: how to die gracefully Message-ID: <19990322130222.C4838@drwho.xnet.com> Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: <000501be7472$3bbeb400$064ca8c0@gateway> <36F65B11.610DAE9D@tdx.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <36F65B11.610DAE9D@tdx.co.uk>; from Karl Pielorz on Mon, Mar 22, 1999 at 03:00:33PM +0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 | 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