Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Feb 2001 22:51:54 -0800 (PST)
From:      Marc W <mwlist@lanfear.com>
To:        freebsd-questions@freebsd.org
Subject:   Catch-all signal handler?
Message-ID:  <200102050651.WAA77275@akira.lanfear.com>

next in thread | raw e-mail | index | archive | help
    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




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