System V function calls to signal()
Joe Duval - Entomology
duvalj at bionette.cgrb.orst.edu
Thu Nov 16 09:58:01 AEST 1989
Hi,
I would like some help using the signal function on a SYSV machine. I am
using an AT&T 3b2. Here is what I want to do.
I want to catch the action previously defined for a signal, lets say
SIGINT, so I can reset that action later. After I catch the previous
action, I want to do something else and then call signal again to reset
the previous action. Redundant, huh?
I have tried signal and ssignal both with no luck. I am sure that is
in my logic.
Any help will be appreciated. I have included two pieces of code; one uses
signal and the next uses ssignal.
Here is my (attempt at) code USES SIGNAL:
#include <signal.h>
static Foo()
{
static int (*sigint)();
int catch_int();
/* First I want to catch the action previously established for that
* signal type */
sigint = signal (SIGINT, catch_int); /* An invalid pointer combination
error occurs here. */
/* Then I want to do something else, go kill a process in this case */
kill(getpid(), SIGINT);
/* Now I want to return to the previous action to that signal type */
signal (SIGINT, sigint); } static catch_int(n) {
}
Here is my attempt at the code USING SSIGNAL:
#include <signal.h>
static Foo()
{
static int (*sigint)();
int catch_int();
/* In <signal.h> ssignal is defined like this
int (*ssignal (sig, action))()
int sig, (*action)();
*/
sigint = (*)ssignal (SIGINT, catch_int);
kill(getpid(), SIGINT);
signal (SIGINT, sigint);
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
duvalj at bionette.cgrb.orst.edu.UUCP | Life is a tragedy for those that feel
jozo at aes.orst.edu.UUCP | and a comedy for those that think!
Phone: (503) 757-1297 |
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
duvalj at bionette.cgrb.orst.edu.UUCP | Life is a tragedy for those that feel
jozo at aes.orst.edu.UUCP | and a comedy for those that think!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
More information about the Comp.lang.c
mailing list