diff options
author | jkh <jkh@FreeBSD.org> | 1997-01-17 15:58:58 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-01-17 15:58:58 +0000 |
commit | 36e3910a7d4d2443addb87b2ec5a93aa0a3c0a5a (patch) | |
tree | c617ad8c4cac1b6a32599d587298596325e5b0f1 /usr.sbin/sade/system.c | |
parent | b293f5b41ca45894135a41fd164567da1f639444 (diff) | |
download | FreeBSD-src-36e3910a7d4d2443addb87b2ec5a93aa0a3c0a5a.zip FreeBSD-src-36e3910a7d4d2443addb87b2ec5a93aa0a3c0a5a.tar.gz |
Add timeout support to sysinstall's general media handling,
allow SIGINT to stand for "time out now!" in certain cases.
Diffstat (limited to 'usr.sbin/sade/system.c')
-rw-r--r-- | usr.sbin/sade/system.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 354f805..1fc4696 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -47,6 +47,35 @@ handle_intr(int sig) restorescr(save); } +/* Public variable for ease of use - handler should set it if interested */ +Boolean AlarmWentOff; + +/* Simple alarm interface */ +void +alarm_set(int delay, void (*handler)(int sig)) +{ + struct sigaction act; + + act.sa_handler = handler; + act.sa_flags = 0; + act.sa_mask = 0; + sigaction(SIGALRM, &act, NULL); + AlarmWentOff = FALSE; + alarm(delay); +} + +void +alarm_clear(void) +{ + struct sigaction act; + + alarm(0); + act.sa_handler = SIG_DFL; + act.sa_flags = 0; + act.sa_mask = 0; + sigaction(SIGALRM, &act, NULL); +} + /* Expand a file into a convenient location, nuking it each time */ static char * expand(char *fname) |