From owner-freebsd-questions Sun Feb 4 22:52:12 2001 Delivered-To: freebsd-questions@freebsd.org Received: from akira.lanfear.com (akira.lanfear.com [208.12.11.174]) by hub.freebsd.org (Postfix) with ESMTP id C871A37B401 for ; Sun, 4 Feb 2001 22:51:54 -0800 (PST) Received: from sapporo.lanfear.com (h-64-105-36-216.snvacaid.covad.net [64.105.36.216]) by akira.lanfear.com (8.9.3/8.9.3) with SMTP id WAA77275 for freebsd-questions@freebsd.org; Sun, 4 Feb 2001 22:51:54 -0800 (PST) (envelope-from mwlist@lanfear.com) Date: Sun, 4 Feb 2001 22:51:54 -0800 (PST) From: Marc W Message-Id: <200102050651.WAA77275@akira.lanfear.com> To: freebsd-questions@freebsd.org Subject: Catch-all signal handler? MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Mailer: Kiltdown 0.7 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is kind of a programming question and less a FreeBSD user issue, but i'm doing it under FreeBSD, so this is as good a place as any :-) I've got a program that has some files that aren't always in a fully 'sync'd state on the disk, which of course leads to problems with consistency if my program crashes before i get a chance to flush the buffers fully. What I'd really like to do is be able to install a signal handler for "all the signals that terminate my process" that can just go and flush the file, and then abort as usual. Is there an elegant way of doing this in a system independant way (I'd be happy if it were for POSIX-'compliant' only systems also) or do I really just have to go and do: sigaddset(&act.sa_mask, SIGNAL1); sigaddset(&act.sa_mask, SIGNAL2); ... .. . sigaction(...) any suggestions? thanks! marc. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message