diff --git a/mach/sun2/libsys/LIST b/mach/sun2/libsys/LIST index 6597f0c64..8e05850d9 100644 --- a/mach/sun2/libsys/LIST +++ b/mach/sun2/libsys/LIST @@ -138,6 +138,7 @@ sigsetmask.s _sigsetmask.s sigstack.s sigtramp.s +_sigvec.c sigvec.c socket.s socketpair.s @@ -147,6 +148,7 @@ statfs.s swapon.s symlink.s sync.s +_syscall.s syscall.s time.c times.c diff --git a/mach/sun2/libsys/_sigvec.c b/mach/sun2/libsys/_sigvec.c new file mode 100644 index 000000000..0a8225afd --- /dev/null +++ b/mach/sun2/libsys/_sigvec.c @@ -0,0 +1,36 @@ +#include "syscall.h" +#include +struct sigvec { int (*handler)(); int mask,flags; }; +int (*(_sigfunc[32]))(); +extern int _sigtramp(); +extern int errno; + +_sigvec(sig,vec,ovec) + register struct sigvec *vec; + struct sigvec *ovec; +{ + struct sigvec tmp; + int (*old)(); + + if ((unsigned) sig >= 32) { + errno = EINVAL; + return -1; + } + old = _sigfunc[sig]; + if (vec) { + tmp = *vec; + vec = &tmp; + if (vec->handler && vec->handler != (int (*)()) 1) { + _sigfunc[sig] = vec->handler; + vec->handler = _sigtramp; + } + } + if (_syscall(SYS_sigvec,sig,vec,ovec) < 0) { + _sigfunc[sig] = old; + return -1; + } + if (ovec && ovec->handler == _sigtramp) { + ovec->handler = old; + } + return 0; +} diff --git a/mach/sun2/libsys/_syscall.s b/mach/sun2/libsys/_syscall.s new file mode 100644 index 000000000..98fe1f04a --- /dev/null +++ b/mach/sun2/libsys/_syscall.s @@ -0,0 +1,14 @@ +.sect .text +.define __syscall +__syscall: + move.l 4(sp),d0 + move.l (sp),4(sp) + move.l d0,(sp) + trap #0 + bcs 1f + move.l (sp),a0 + jmp (a0) +1: + move.l (sp),a0 + move.l a0,-(sp) + jmp cerror