signal now deals with void functions

This commit is contained in:
ceriel 1993-11-17 16:53:43 +00:00
parent 1ac5aa547d
commit e3e19a7a0d
4 changed files with 13 additions and 13 deletions

View file

@ -4,7 +4,7 @@
static jmp_buf setjmpbuf; static jmp_buf setjmpbuf;
static static void
alfun(){ alfun(){
longjmp(setjmpbuf, 1); longjmp(setjmpbuf, 1);
} /* used with sleep() below */ } /* used with sleep() below */
@ -14,7 +14,7 @@ sleep(n)
{ {
/* sleep(n) pauses for 'n' seconds by scheduling an alarm interrupt. */ /* sleep(n) pauses for 'n' seconds by scheduling an alarm interrupt. */
unsigned oldalarm; unsigned oldalarm;
int (*oldsig)(); void (*oldsig)();
if (n <= 0) return; if (n <= 0) return;
if (setjmp(setjmpbuf)) { if (setjmp(setjmpbuf)) {

View file

@ -1,7 +1,7 @@
/* $Header$ */ /* $Header$ */
#include <signal.h> #include <signal.h>
typedef int (*callvec)() ; typedef void (*callvec)() ;
static callvec vector[16] = { static callvec vector[16] = {
SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL, SIG_DFL,

View file

@ -1,11 +1,11 @@
static long masks[32]; static long masks[32];
static long flags[32]; static long flags[32];
int (* void (*
signal(sig,handler))() signal(sig,handler))()
int (*handler)(); void (*handler)();
{ {
struct { struct {
int (*sv_handler)(); void (*sv_handler)();
long sv_mask; long sv_mask;
long sv_flags; long sv_flags;
} v, ov; } v, ov;
@ -13,13 +13,13 @@ signal(sig,handler))()
v.sv_handler = handler; v.sv_handler = handler;
v.sv_mask = masks[sig]; v.sv_mask = masks[sig];
v.sv_flags = flags[sig]; v.sv_flags = flags[sig];
if (sigvec(sig,&v, &ov) < 0) return (int (*)()) -1; if (sigvec(sig,&v, &ov) < 0) return (void (*)()) -1;
if (v.sv_mask != ov.sv_mask || v.sv_flags != ov.sv_flags) { if (v.sv_mask != ov.sv_mask || v.sv_flags != ov.sv_flags) {
v.sv_mask = ov.sv_mask; v.sv_mask = ov.sv_mask;
masks[sig] = ov.sv_mask; masks[sig] = ov.sv_mask;
v.sv_flags = ov.sv_flags; v.sv_flags = ov.sv_flags;
flags[sig] = ov.sv_flags; flags[sig] = ov.sv_flags;
if (sigvec(sig,&v,(char *) 0) < 0) return (int (*)()) -1; if (sigvec(sig,&v,(char *) 0) < 0) return (void (*)()) -1;
} }
return ov.sv_handler; return ov.sv_handler;
} }

View file

@ -1,11 +1,11 @@
static long masks[32]; static long masks[32];
static long flags[32]; static long flags[32];
int (* void (*
signal(sig,handler))() signal(sig,handler))()
int (*handler)(); void (*handler)();
{ {
struct { struct {
int (*sv_handler)(); void (*sv_handler)();
long sv_mask; long sv_mask;
long sv_flags; long sv_flags;
} v, ov; } v, ov;
@ -13,13 +13,13 @@ signal(sig,handler))()
v.sv_handler = handler; v.sv_handler = handler;
v.sv_mask = masks[sig]; v.sv_mask = masks[sig];
v.sv_flags = flags[sig]; v.sv_flags = flags[sig];
if (_sigvec(sig,&v, &ov) < 0) return (int (*)()) -1; if (_sigvec(sig,&v, &ov) < 0) return (void (*)()) -1;
if (v.sv_mask != ov.sv_mask || v.sv_flags != ov.sv_flags) { if (v.sv_mask != ov.sv_mask || v.sv_flags != ov.sv_flags) {
v.sv_mask = ov.sv_mask; v.sv_mask = ov.sv_mask;
masks[sig] = ov.sv_mask; masks[sig] = ov.sv_mask;
v.sv_flags = ov.sv_flags; v.sv_flags = ov.sv_flags;
flags[sig] = ov.sv_flags; flags[sig] = ov.sv_flags;
if (_sigvec(sig,&v,(char *) 0) < 0) return (int (*)()) -1; if (_sigvec(sig,&v,(char *) 0) < 0) return (void (*)()) -1;
} }
return ov.sv_handler; return ov.sv_handler;
} }