Subject: sigaction(2), sigsetops(3), and more missing in 2.11BSD (#386 - 2 of 4) Index: sys/kern_sig.c,libc/pdp/sys,... 2.11BSD Description: Sigaction(2), sigsetops(3) (sigaddset, sigdelset, ...), sigsuspend(2), sigpending(2), sigprocmask(2), ... are missing from 2.11BSD A couple programs were incorrectly specifying a 16bit mask to sigblock(2). creat(2), gethostid(2), sethostid(2) are system calls which duplicate newer means of accomplishing the same actions. The kernel still had a reference to 'gldav', a system call which was obsoleted a long time ago and which nothing in the system uses. Repeat-By: 1) Attempt to compile and run a program which contains any or all of the following: sigemptyset(&sigt); sigaddset(&sigt, SIGALRM); sigdelset(&sigt, SIGINT); sigaction(SIGALRM, &set, &oset); sigpending(&sigt); sigsuspend(&sigt); sigaltstack(&ss, &oss); less(1), sail(6) and hunt(6) used "sigblock(0)" instead of "sigblock(0L)". "open(name, O_CREAT|O_TRUNC|O_WRONLY, mode)" has been the correct way to create a file for some time now. Sysctl(2) can set and get the hostid. Thus there is no need for 3 extra system calls (creat, sethostid, gethostid). gldav(2) has been gone for a long time - it is time for the last vestiges in the kernel to go away also. 2) Observation. ;) Fix: This is update #386 and is part 2 of 4. Make sure you have parts 1, 3 and 4 (updates 385, 387 and 388) before beginning to install anything. This (#386) portion of the kit contains a shar archive of new files that are being added to the system. NOTE: Be certain to read the directions in part 1 (#385) about what MUST be done before unshar'ing the file below! -------------------------------cut here------------------------------------ #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # /usr/src/sys/sys/kern_sig2.c # /usr/src/sys/h/signalvar.h # /usr/src/lib/libc/gen/siginterrupt.c # /usr/src/lib/libc/gen/signal.c # /usr/src/lib/libc/gen/sigsetops.c # /usr/src/lib/libc/gen/abort.c # /usr/src/lib/libc/pdp/sys/sigaction.s # /usr/src/lib/libc/compat-43 # /usr/src/man/man2/sigaction.2 # /usr/src/man/man2/sigaltstack.2 # /usr/src/man/man2/sigpending.2 # /usr/src/man/man2/sigprocmask.2 # /usr/src/man/man2/sigsuspend.2 # /usr/src/man/man3/sigsetops.3 # This archive created: Fri Sep 12 22:39:22 1997 export PATH; PATH=/bin:/usr/bin:$PATH if test -f '/usr/src/sys/sys/kern_sig2.c' then echo shar: "will not over-write existing file '/usr/src/sys/sys/kern_sig2.c'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/sys/sys/kern_sig2.c' Z/* Z * Copyright (c) 1982, 1986, 1989, 1991, 1993 Z * The Regents of the University of California. All rights reserved. Z * (c) UNIX System Laboratories, Inc. Z * All or some portions of this file are derived from material licensed Z * to the University of California by American Telephone and Telegraph Z * Co. or Unix System Laboratories, Inc. and are reproduced herein with Z * the permission of UNIX System Laboratories, Inc. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z * Z * @(#)kern_sig.c 8.14.1 (2.11BSD) 1997/9/11 Z */ Z Z/* Z * This module is a hacked down version of kern_sig.c from 4.4BSD. The Z * original signal handling code is still present in 2.11's kern_sig.c. This Z * was done because large modules are very hard to fit into the kernel's Z * overlay structure. A smaller kern_sig2.c fits more easily into an overlaid Z * kernel. Z*/ Z Z#define SIGPROP /* include signal properties table */ Z#include Z#include Z#include Z#include Z#include Z#include Z#include Z#include Z#include Z#include Z#include /* for coredump */ Z Zstatic void stop(); Z Zint Zsigaction() Z{ Z register struct a { Z int (*sigtramp)(); Z int signum; Z struct sigaction *nsa; Z struct sigaction *osa; Z } *uap = (struct a *)u.u_ap; Z struct sigaction vec; Z register struct sigaction *sa; Z register int signum; Z u_long bit; Z int error = 0; Z Z u.u_pcb.pcb_sigc = uap->sigtramp; /* save trampoline address */ Z Z signum = uap->signum; Z if (signum <= 0 || signum >= NSIG) Z { Z error = EINVAL; Z goto out; Z } Z if (uap->nsa && (signum == SIGKILL || signum == SIGSTOP)) Z { Z error = EINVAL; Z goto out; Z } Z sa = &vec; Z if (uap->osa) { Z sa->sa_handler = u.u_signal[signum]; Z sa->sa_mask = u.u_sigmask[signum]; Z bit = sigmask(signum); Z sa->sa_flags = 0; Z if ((u.u_sigonstack & bit) != 0) Z sa->sa_flags |= SA_ONSTACK; Z if ((u.u_sigintr & bit) == 0) Z sa->sa_flags |= SA_RESTART; Z if (u.u_procp->p_flag & P_NOCLDSTOP) Z sa->sa_flags |= SA_NOCLDSTOP; Z if ((error = copyout(sa, uap->osa, sizeof(vec))) != 0) Z goto out; Z } Z if (uap->nsa) { Z if ((error = copyin(uap->nsa, sa, sizeof(vec))) != 0) Z goto out; Z setsigvec(signum, sa); Z } Zout: Z return(u.u_error = error); Z} Z Zvoid Zsetsigvec(signum, sa) Z int signum; Z register struct sigaction *sa; Z{ Z unsigned long bit; Z register struct proc *p = u.u_procp; Z Z bit = sigmask(signum); Z /* Z * Change setting atomically. Z */ Z (void) splhigh(); Z u.u_signal[signum] = sa->sa_handler; Z u.u_sigmask[signum] = sa->sa_mask &~ sigcantmask; Z if ((sa->sa_flags & SA_RESTART) == 0) Z u.u_sigintr |= bit; Z else Z u.u_sigintr &= ~bit; Z if (sa->sa_flags & SA_ONSTACK) Z u.u_sigonstack |= bit; Z else Z u.u_sigonstack &= ~bit; Z if (signum == SIGCHLD) { Z if (sa->sa_flags & SA_NOCLDSTOP) Z p->p_flag |= P_NOCLDSTOP; Z else Z p->p_flag &= ~P_NOCLDSTOP; Z } Z /* Z * Set bit in p_sigignore for signals that are set to SIG_IGN, Z * and for signals set to SIG_DFL where the default is to ignore. Z * However, don't put SIGCONT in p_sigignore, Z * as we have to restart the process. Z */ Z if (sa->sa_handler == SIG_IGN || Z (sigprop[signum] & SA_IGNORE && sa->sa_handler == SIG_DFL)) { Z p->p_sig &= ~bit; /* never to be seen again */ Z if (signum != SIGCONT) Z p->p_sigignore |= bit; /* easier in psignal */ Z p->p_sigcatch &= ~bit; Z } else { Z p->p_sigignore &= ~bit; Z if (sa->sa_handler == SIG_DFL) Z p->p_sigcatch &= ~bit; Z else Z p->p_sigcatch |= bit; Z } Z (void) spl0(); Z} Z Z/* Z * Kill current process with the specified signal in an uncatchable manner; Z * used when process is too confused to continue, or we are unable to Z * reconstruct the process state safely. Z */ Zvoid Zfatalsig(signum) Z int signum; Z{ Z unsigned long mask; Z register struct proc *p = u.u_procp; Z Z u.u_signal[signum] = SIG_DFL; Z mask = sigmask(signum); Z p->p_sigignore &= ~mask; Z p->p_sigcatch &= ~mask; Z p->p_sigmask &= ~mask; Z psignal(p, signum); Z} Z Z/* Z * Initialize signal state for process 0; Z * set to ignore signals that are ignored by default. Z */ Zvoid Zsiginit(p) Z register struct proc *p; Z{ Z register int i; Z Z for (i = 0; i < NSIG; i++) Z if (sigprop[i] & SA_IGNORE && i != SIGCONT) Z p->p_sigignore |= sigmask(i); Z} Z Z/* Z * Manipulate signal mask. Z * Unlike 4.4BSD we do not receive a pointer to the new and old mask areas and Z * do a copyin/copyout instead of storing indirectly thru a 'retval' parameter. Z * This is because we have to return both an error indication (which is 16 bits) Z * _AND_ the new mask (which is 32 bits). Can't do both at the same time with Z * the 2BSD syscall return mechanism. Z */ Zint Zsigprocmask() Z{ Z register struct a { Z int how; Z sigset_t *set; Z sigset_t *oset; Z } *uap = (struct a *)u.u_ap; Z int error = 0; Z sigset_t oldmask, newmask; Z register struct proc *p = u.u_procp; Z Z oldmask = p->p_sigmask; Z if (!uap->set) /* No new mask, go possibly return old mask */ Z goto out; Z if (error = copyin(uap->set, &newmask, sizeof (newmask))) Z goto out; Z (void) splhigh(); Z Z switch (uap->how) { Z case SIG_BLOCK: Z p->p_sigmask |= (newmask &~ sigcantmask); Z break; Z case SIG_UNBLOCK: Z p->p_sigmask &= ~newmask; Z break; Z case SIG_SETMASK: Z p->p_sigmask = newmask &~ sigcantmask; Z break; Z default: Z error = EINVAL; Z break; Z } Z (void) spl0(); Zout: Z if (error == 0 && uap->oset) Z error = copyout(&oldmask, uap->oset, sizeof (oldmask)); Z return (u.u_error = error); Z} Z Z/* Z * sigpending and sigsuspend use the standard calling sequence unlike 4.4 which Z * used a nonstandard (mask instead of pointer) calling convention. Z*/ Z Zint Zsigpending() Z { Z register struct a Z { Z struct sigset_t *set; Z } *uap = (struct a *)u.u_ap; Z register int error = 0; Z struct proc *p = u.u_procp; Z Z if (uap->set) Z error = copyout((caddr_t)&p->p_sig, (caddr_t)uap->set, Z sizeof (p->p_sig)); Z else Z error = EINVAL; Z return(u.u_error = error); Z } Z Z/* Z * sigsuspend is supposed to always return EINTR so we ignore errors on the Z * copyin by assuming a mask of 0. Z*/ Z Zint Zsigsuspend() Z { Z register struct a Z { Z struct sigset_t *set; Z } *uap = (struct a *)u.u_ap; Z sigset_t nmask; Z struct proc *p = u.u_procp; Z int error; Z Z if (uap->set && (error = copyin(uap->set, &nmask, sizeof (nmask)))) Z nmask = 0; Z/* Z * When returning from sigsuspend, we want the old mask to be restored Z * after the signal handler has finished. Thus, we save it here and set Z * a flag to indicate this. Z*/ Z u.u_oldmask = p->p_sigmask; Z u.u_psflags |= SAS_OLDMASK; Z p->p_sigmask = nmask &~ sigcantmask; Z for (;;) Z sleep((caddr_t)&u, PSLEP); Z /* NOTREACHED */ Z } Z Zint Zsigaltstack() Z{ Z register struct a { Z struct sigaltstack * nss; Z struct sigaltstack * oss; Z } *uap = (struct a *)u.u_ap; Z struct sigaltstack ss; Z int error = 0; Z Z if ((u.u_psflags & SAS_ALTSTACK) == 0) Z u.u_sigstk.ss_flags |= SA_DISABLE; Z if (uap->oss && (error = copyout((caddr_t)&u.u_sigstk, Z (caddr_t)uap->oss, sizeof (struct sigaltstack)))) Z goto out; Z if (uap->nss == 0) Z goto out; Z if ((error = copyin(uap->nss, &ss, sizeof(ss))) != 0) Z goto out; Z if (ss.ss_flags & SA_DISABLE) { Z if (u.u_sigstk.ss_flags & SA_ONSTACK) Z { Z error = EINVAL; Z goto out; Z } Z u.u_psflags &= ~SAS_ALTSTACK; Z u.u_sigstk.ss_flags = ss.ss_flags; Z goto out; Z } Z if (ss.ss_size < MINSIGSTKSZ) Z { Z error = ENOMEM; Z goto out; Z } Z u.u_psflags |= SAS_ALTSTACK; Z u.u_sigstk = ss; Zout: Z return(u.u_error = error); Z} SHAR_EOF chmod 644 '/usr/src/sys/sys/kern_sig2.c' fi if test -f '/usr/src/sys/h/signalvar.h' then echo shar: "will not over-write existing file '/usr/src/sys/h/signalvar.h'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/sys/h/signalvar.h' Z/* Z * Copyright (c) 1991, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z * Z * @(#)signalvar.h 8.6.1 (Berkeley) 1997/8/28 Z */ Z Z#ifndef _SYS_SIGNALVAR_H_ /* tmp for user.h */ Z#define _SYS_SIGNALVAR_H_ Z Z/* Z * Kernel signal definitions and data structures, Z * not exported to user programs. Z * Z * For 2BSD the parts that did not apply were cut out. Z */ Z Z/* signal flags */ Z#define SAS_OLDMASK 0x01 /* need to restore mask before pause */ Z#define SAS_ALTSTACK 0x02 /* have alternate signal stack */ Z Z/* additional signal action values, used only temporarily/internally */ Z#define SIG_CATCH (int (*)())2 Z#define SIG_HOLD (int (*)())3 Z Z/* Z * Signal properties and actions. Z * The array below categorizes the signals and their default actions Z * according to the following properties: Z */ Z#define SA_KILL 0x01 /* terminates process by default */ Z#define SA_CORE 0x02 /* ditto and coredumps */ Z#define SA_STOP 0x04 /* suspend process */ Z#define SA_TTYSTOP 0x08 /* ditto, from tty */ Z#define SA_IGNORE 0x10 /* ignore by default */ Z#define SA_CONT 0x20 /* continue if suspended */ Z Z#ifdef SIGPROP Zchar sigprop[NSIG + 1] = { Z 0, /* unused */ Z SA_KILL, /* SIGHUP */ Z SA_KILL, /* SIGINT */ Z SA_KILL|SA_CORE, /* SIGQUIT */ Z SA_KILL|SA_CORE, /* SIGILL */ Z SA_KILL|SA_CORE, /* SIGTRAP */ Z SA_KILL|SA_CORE, /* SIGABRT */ Z SA_KILL|SA_CORE, /* SIGEMT */ Z SA_KILL|SA_CORE, /* SIGFPE */ Z SA_KILL, /* SIGKILL */ Z SA_KILL|SA_CORE, /* SIGBUS */ Z SA_KILL|SA_CORE, /* SIGSEGV */ Z SA_KILL|SA_CORE, /* SIGSYS */ Z SA_KILL, /* SIGPIPE */ Z SA_KILL, /* SIGALRM */ Z SA_KILL, /* SIGTERM */ Z SA_IGNORE, /* SIGURG */ Z SA_STOP, /* SIGSTOP */ Z SA_STOP|SA_TTYSTOP, /* SIGTSTP */ Z SA_IGNORE|SA_CONT, /* SIGCONT */ Z SA_IGNORE, /* SIGCHLD */ Z SA_STOP|SA_TTYSTOP, /* SIGTTIN */ Z SA_STOP|SA_TTYSTOP, /* SIGTTOU */ Z SA_IGNORE, /* SIGIO */ Z SA_KILL, /* SIGXCPU */ Z SA_KILL, /* SIGXFSZ */ Z SA_KILL, /* SIGVTALRM */ Z SA_KILL, /* SIGPROF */ Z SA_IGNORE, /* SIGWINCH */ Z SA_IGNORE, /* SIGINFO */ Z SA_KILL, /* SIGUSR1 */ Z SA_KILL, /* SIGUSR2 */ Z}; Z#endif /* SIGPROP */ Z Z#ifdef KERNEL Z#define contsigmask (sigmask(SIGCONT)) Z#define stopsigmask (sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ Z sigmask(SIGTTIN) | sigmask(SIGTTOU)) Z#define sigcantmask (sigmask(SIGKILL) | sigmask(SIGSTOP)) Z#endif Z#endif /* !_SYS_SIGNALVAR_H_ */ SHAR_EOF chmod 644 '/usr/src/sys/h/signalvar.h' fi if test -f '/usr/src/lib/libc/gen/siginterrupt.c' then echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/siginterrupt.c'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/lib/libc/gen/siginterrupt.c' Z/* Z * Copyright (c) 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)siginterrupt.c 8.1 (Berkeley) 6/4/93"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z Z/* Z * Set signal state to prevent restart of system calls Z * after an instance of the indicated signal. Z */ Zsiginterrupt(sig, flag) Z int sig, flag; Z{ Z extern sigset_t _sigintr; Z struct sigaction sa; Z int ret; Z Z if ((ret = sigaction(sig, (struct sigaction *)0, &sa)) < 0) Z return (ret); Z if (flag) { Z sigaddset(&_sigintr, sig); Z sa.sa_flags &= ~SA_RESTART; Z } else { Z sigdelset(&_sigintr, sig); Z sa.sa_flags |= SA_RESTART; Z } Z return (sigaction(sig, &sa, (struct sigaction *)0)); Z} SHAR_EOF chmod 644 '/usr/src/lib/libc/gen/siginterrupt.c' fi if test -f '/usr/src/lib/libc/gen/signal.c' then echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/signal.c'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/lib/libc/gen/signal.c' Z/* Z * Copyright (c) 1985, 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)signal.c 8.1 (Berkeley) 6/4/93"; Z#endif /* LIBC_SCCS and not lint */ Z Z/* Z * Almost backwards compatible signal. Z */ Z#include Z Zsigset_t _sigintr; /* shared with siginterrupt */ Z Zsig_t Zsignal(s, a) Z int s; Z sig_t a; Z{ Z struct sigaction sa, osa; Z Z sa.sa_handler = a; Z sigemptyset(&sa.sa_mask); Z sa.sa_flags = 0; Z if (!sigismember(&_sigintr, s)) Z sa.sa_flags |= SA_RESTART; Z if (sigaction(s, &sa, &osa) < 0) Z return (SIG_ERR); Z return (osa.sa_handler); Z} SHAR_EOF chmod 644 '/usr/src/lib/libc/gen/signal.c' fi if test -f '/usr/src/lib/libc/gen/sigsetops.c' then echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/sigsetops.c'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/lib/libc/gen/sigsetops.c' Z/*- Z * Copyright (c) 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)sigsetops.c 8.1.1 (2.11BSD) 1997/8/28"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z Z#undef sigemptyset Z#undef sigfillset Z#undef sigaddset Z#undef sigdelset Z#undef sigismember Z Zsigemptyset(set) Z sigset_t *set; Z{ Z *set = 0; Z return (0); Z} Z Zsigfillset(set) Z sigset_t *set; Z{ Z *set = ~(sigset_t)0; Z return (0); Z} Z Zsigaddset(set, signo) Z sigset_t *set; Z int signo; Z{ Z *set |= sigmask(signo); Z return (0); Z} Z Zsigdelset(set, signo) Z sigset_t *set; Z int signo; Z{ Z *set &= ~sigmask(signo); Z return (0); Z} Z Zsigismember(set, signo) Z sigset_t *set; Z int signo; Z{ Z return ((*set & ~sigmask(signo)) != 0); Z} SHAR_EOF chmod 644 '/usr/src/lib/libc/gen/sigsetops.c' fi if test -f '/usr/src/lib/libc/gen/abort.c' then echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/abort.c'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/lib/libc/gen/abort.c' Z/* Z * Copyright (c) 1985, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)abort.c 8.1.1 (2.11BSD) 1997/9/9"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z#include Z#include Z Zvoid Zabort() Z{ Z sigset_t mask; Z Z sigfillset(&mask); Z /* Z * don't block SIGABRT to give any handler a chance; we ignore Z * any errors -- X311J doesn't allow abort to return anyway. Z */ Z sigdelset(&mask, SIGABRT); Z (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); Z (void)kill(getpid(), SIGABRT); Z Z /* Z * if SIGABRT ignored, or caught and the handler returns, do Z * it again, only harder. Z */ Z (void)signal(SIGABRT, SIG_DFL); Z (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); Z (void)kill(getpid(), SIGABRT); Z exit(1); Z} SHAR_EOF chmod 444 '/usr/src/lib/libc/gen/abort.c' fi if test -f '/usr/src/lib/libc/pdp/sys/sigaction.s' then echo shar: "will not over-write existing file '/usr/src/lib/libc/pdp/sys/sigaction.s'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/lib/libc/pdp/sys/sigaction.s' Z/* Z * Copyright (c) 1987 Regents of the University of California. Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z */ Z Z#ifdef SYSLIBC_SCCS Z_sccsid: <@(#)sigaction.s 1.0 (2.11BSD) 1997/8/23\0> Z .even Z#endif SYSLIBC_SCCS Z Z/* Z * error = sigaction(sig, vec, ovec) Z * int error, sig; Z * struct sigaction *vec, *ovec; Z * Z * Sigaction, or more apropriately, sigaction's helper function sigtramp below, Z * must be loaded in the base segment of overlaid objects. Z * Z * We pass one additional parameter to the sigaction sys call: the address of Z * the "Trampoline Code", sigtramp - the code that handles saving and restoring Z * register context and so on for signals. On the VAX-11 under BSD4.3 it isn't Z * necessary to pass this address since the trampoline code is stored in the Z * user structure in u.u_pcb.pcb_sigc at a known address in user space. It Z * really doesn't introduce much extra overhead, so our method for doing it on Z * a PDP-11 is alright too. Z */ Z#include "SYS.h" Z ZENTRY(sigaction) Z mov (sp),-(sp) / push return address down one place Z mov $sigtramp,2(sp) / to leave a space for the address of Z SYS(sigaction) / sigtramp Z mov (sp)+,(sp) / (clean up stack) Z bcc 1f Z jmp x_error Z1: Z rts pc Z Z/* Z * sigtramp - Signal "Trampoline Code" Z * Z * This code is transfered to by the kernel when a signal is delivered to a Z * process. In general, the idea is that sigtramp saves the process' register Z * context and then vectors on to the real signal action routine. Upon return Z * from the signal action routine sigtramp restores the process' register Z * context and performs a sigreturn. Z * Z * In the case of the PDP-11, the kernel will have already saved r0 and r1 for Z * sigtramp in a sigcontext structure it passes to us. Sigtramp vectors onto Z * the signal action routine whose address has been left in r0 by the kernel Z * (sigtramp assumes the signal action routine will save any other registers Z * it uses (as all C routines will)). Upon return from the signal action Z * routine, sigtramp will execute a sigreturn with the sigcontext structure Z * given to us by the kernel. Z * Z * When the kernel transfers control to sigtramp the stack looks like: Z * Z * ------------------------- Z * | sigcontext structure | SIG_SC = sp + 6. Z * |-----------------------| Z * | pointer to sigcontext | Z * |-----------------------| Z * | code | Z * |-----------------------| Z *sp -> | signal number | Z * ------------------------- Z * Z * The important features of this as far as sigtramp is concerned are: Z * 1. The fact that the signal number, signal code, and signal context Z * pointer are already set up as parameters to the signal action Z * routine. Z * 2. There's no need to save r0 & r1 because the kernel's already saved Z * them for us in the sigcontext structure (C routines save all Z * registers except r0 & r1 automatically). Z * Z * Note that the stack offset SIG_SC will NOT have to be recomputed if the Z * sigcontext structure changes. Z */ ZSIG_SC = 6. / stack offset of sigcontext structure Z Ziot = 4 Z Z.globl _sigreturn / sigreturn sys call Zsigtramp: Z jsr pc,(r0) / transfer to signal action routine Z mov sp,r0 / compute address of sigcontext Z add $SIG_SC,r0 / (can't use "mov sp,-(sp)") Z mov r0,-(sp) Z jsr pc,_sigreturn / and perform a sigreturn Z iot / die if the sigreturn fails ... SHAR_EOF chmod 644 '/usr/src/lib/libc/pdp/sys/sigaction.s' fi if test ! -d '/usr/src/lib/libc/compat-43' then mkdir '/usr/src/lib/libc/compat-43' fi cd '/usr/src/lib/libc/compat-43' if test -f 'sigcompat.c' then echo shar: "will not over-write existing file 'sigcompat.c'" else sed 's/^Z//' << \SHAR_EOF > 'sigcompat.c' Z/* Z * Copyright (c) 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)sigcompat.c 8.1.1 (2.11BSD) 1997/8/28"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z#include Z Zsigvec(signo, sv, osv) Z int signo; Z register struct sigvec *sv, *osv; Z{ Z int ret; Z Z if (sv) Z sv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ Z ret = sigaction(signo, (struct sigaction *)sv, (struct sigaction *)osv); Z if (ret == 0 && osv) Z osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ Z return(ret); Z} Z Zlong Zsigsetmask(mask) Z long mask; Z{ Z long omask; Z int n; Z Z n = sigprocmask(SIG_SETMASK, (sigset_t *) &mask, (sigset_t *) &omask); Z if (n) Z return((long)n); Z return(omask); Z} Z Zlong Zsigblock(mask) Z long mask; Z{ Z long omask; Z int n; Z Z n = sigprocmask(SIG_BLOCK, (sigset_t *) &mask, (sigset_t *) &omask); Z if (n) Z return((long)n); Z return(omask); Z} Z Zsigpause(mask) Z long mask; Z{ Z return(sigsuspend((sigset_t *)&mask)); Z} SHAR_EOF chmod 644 'sigcompat.c' fi if test -f 'creat.c' then echo shar: "will not over-write existing file 'creat.c'" else sed 's/^Z//' << \SHAR_EOF > 'creat.c' Z/* Z * Copyright (c) 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)creat.c 8.1.1 (2.11BSD) 1997/8/28"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z Zcreat(path, mode) Z char *path; Z mode_t mode; Z{ Z return(open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)); Z} SHAR_EOF chmod 644 'creat.c' fi if test -f 'gethostid.c' then echo shar: "will not over-write existing file 'gethostid.c'" else sed 's/^Z//' << \SHAR_EOF > 'gethostid.c' Z/* Z * Copyright (c) 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)gethostid.c 8.1.1 (2.11BSD) 1997/8/28"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z#include Z Zu_long Zgethostid() Z{ Z int mib[2]; Z size_t size; Z u_long value; Z Z mib[0] = CTL_KERN; Z mib[1] = KERN_HOSTID; Z size = sizeof value; Z if (sysctl(mib, 2, &value, &size, NULL, 0) == -1) Z return (-1); Z return (value); Z} SHAR_EOF chmod 644 'gethostid.c' fi if test -f 'sethostid.c' then echo shar: "will not over-write existing file 'sethostid.c'" else sed 's/^Z//' << \SHAR_EOF > 'sethostid.c' Z/* Z * Copyright (c) 1989, 1993 Z * The Regents of the University of California. All rights reserved. Z * Z * Redistribution and use in source and binary forms, with or without Z * modification, are permitted provided that the following conditions Z * are met: Z * 1. Redistributions of source code must retain the above copyright Z * notice, this list of conditions and the following disclaimer. Z * 2. Redistributions in binary form must reproduce the above copyright Z * notice, this list of conditions and the following disclaimer in the Z * documentation and/or other materials provided with the distribution. Z * 3. All advertising materials mentioning features or use of this software Z * must display the following acknowledgement: Z * This product includes software developed by the University of Z * California, Berkeley and its contributors. Z * 4. Neither the name of the University nor the names of its contributors Z * may be used to endorse or promote products derived from this software Z * without specific prior written permission. Z * Z * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z */ Z Z#if defined(LIBC_SCCS) && !defined(lint) Zstatic char sccsid[] = "@(#)sethostid.c 8.1.1 (2.11BSD) 1997/8/28"; Z#endif /* LIBC_SCCS and not lint */ Z Z#include Z#include Z Zu_long Zsethostid(hostid) Z u_long hostid; Z{ Z int mib[2]; Z Z mib[0] = CTL_KERN; Z mib[1] = KERN_HOSTID; Z if (sysctl(mib, 2, NULL, NULL, &hostid, sizeof hostid) == -1) Z return (-1); Z return (0); Z} SHAR_EOF chmod 644 'sethostid.c' fi if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else sed 's/^Z//' << \SHAR_EOF > 'Makefile' Z# Z# Public domain 1997/8/28 Z# Z# @(#)Makefile 1.0 (2.11BSD) 1997/8/28 Z# ZCFLAGS= -O ${DEFS} ZSRCS= creat.c gethostid.c sethostid.c sigcompat.c ZOBJS= creat.o gethostid.o sethostid.o sigcompat.o Z Z.c.o: Z ${CC} -p ${CFLAGS} -c $*.c Z -ld -X -r $*.o Z mv a.out profiled/$*.o Z ${CC} ${CFLAGS} -c $*.c Z -ld -x -r $*.o Z mv a.out $*.o Z Zall: compat-43lib compat-43lib_p Z Zcompat-43lib compat-43lib_p: ${OBJS} Z @echo "building profiled compat-43lib" Z @cd profiled; ar cru ../compat-43lib_p ${OBJS} Z @echo "buiding normal compat-43lib" Z @ar cru compat-43lib ${OBJS} Z Zclean: Z rm -f compat-43lib compat-43lib_p *.o profiled/*.o Makefile.bak tags Z Zdepend: ${SRCS} Z mkdep ${CFLAGS} ${SRCS} Z Ztags: Z cwd=`pwd`; \ Z for i in ${SRCS}; do \ Z ctags -a -f ${TAGSFILE} $$cwd/$$i; \ Z done Z Z# DO NOT DELETE THIS LINE -- make depend uses it SHAR_EOF chmod 644 'Makefile' fi if test ! -d 'profiled' then mkdir 'profiled' fi cd 'profiled' chmod 755 . cd .. chmod 755 . cd .. if test -f '/usr/src/man/man2/sigaction.2' then echo shar: "will not over-write existing file '/usr/src/man/man2/sigaction.2'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/man/man2/sigaction.2' Z.\" Copyright (c) 1980, 1990, 1993 Z.\" The Regents of the University of California. All rights reserved. Z.\" Z.\" Redistribution and use in source and binary forms, with or without Z.\" modification, are permitted provided that the following conditions Z.\" are met: Z.\" 1. Redistributions of source code must retain the above copyright Z.\" notice, this list of conditions and the following disclaimer. Z.\" 2. Redistributions in binary form must reproduce the above copyright Z.\" notice, this list of conditions and the following disclaimer in the Z.\" documentation and/or other materials provided with the distribution. Z.\" 3. All advertising materials mentioning features or use of this software Z.\" must display the following acknowledgement: Z.\" This product includes software developed by the University of Z.\" California, Berkeley and its contributors. Z.\" 4. Neither the name of the University nor the names of its contributors Z.\" may be used to endorse or promote products derived from this software Z.\" without specific prior written permission. Z.\" Z.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z.\" SUCH DAMAGE. Z.\" Z.\" @(#)sigaction.2 8.2.1 (2.11BSD) 1997/9/3 Z.\" Z.TH SIGACTION 2 "September 3, 1997" Z.UC 7 Z.SH NAME Z\fBsigaction\fP \- software signal facilities Z.SH SYNOPSIS Z.B #include Z.sp Z.nf Zstruct sigaction { Z int (*sa_handler)(); Z sigset_t sa_mask; Z int sa_flags; Z}; Z.fi Z.sp Z\fBsigaction\fP(sig, act, oact) Z.br Z.I int sig; Z.br Z.I struct sigaction *act; Z.br Z.I struct sigaction *oact; Z.SH DESCRIPTION ZThe system defines a set of signals that may be delivered to a process. ZSignal delivery resembles the occurrence of a hardware interrupt: Zthe signal is blocked from further occurrence, the current process Zcontext is saved, and a new one is built. A process may specify a Z.I handler Zto which a signal is delivered, or specify that a signal is to be Z.IR ignored . ZA process may also specify that a default action is to be taken Zby the system when a signal occurs. ZA signal may also be Z.IR blocked , Zin which case its delivery is postponed until it is Z.IR unblocked . ZThe action to be taken on delivery is determined at the time Zof delivery. ZNormally, signal handlers execute on the current stack Zof the process. This may be changed, on a per-handler basis, Zso that signals are taken on a special Z.IR "signal stack" . Z.PP ZSignal routines execute with the signal that caused their Zinvocation Z.IR blocked , Zbut other signals may yet occur. ZA global Z.IR "signal mask" Zdefines the set of signals currently blocked from delivery Zto a process. The signal mask for a process is initialized Zfrom that of its parent (normally empty). It Zmay be changed with a Z.BR sigprocmask (2) Zcall, or when a signal is delivered to the process. Z.PP ZWhen a signal Zcondition arises for a process, the signal is added to a set of Zsignals pending for the process. ZIf the signal is not currently Z.I blocked Zby the process then it is delivered to the process. ZSignals may be delivered any time a process enters the operating system Z(e.g., during a system call, page fault or trap, or clock interrupt). ZIf multiple signals are ready to be delivered at the same time, Zany signals that could be caused by traps are delivered first. ZAdditional signals may be processed at the same time, with each Zappearing to interrupt the handlers for the previous signals Zbefore their first instructions. ZThe set of pending signals is returned by the Z.BR sigpending (2) Zfunction. ZWhen a caught signal Zis delivered, the current state of the process is saved, Za new signal mask is calculated (as described below), Zand the signal handler is invoked. The call to the handler Zis arranged so that if the signal handling routine returns Znormally the process will resume execution in the context Zfrom before the signal's delivery. ZIf the process wishes to resume in a different context, then it Zmust arrange to restore the previous context itself. Z.PP ZWhen a signal is delivered to a process a new signal mask is Zinstalled for the duration of the process' signal handler Z(or until a Z.B sigprocmask Zcall is made). ZThis mask is formed by taking the union of the current signal mask set, Zthe signal to be delivered, and Zthe signal mask associated with the handler to be invoked. Z.PP Z.B Sigaction Zassigns an action for a specific signal. ZIf Z.I act Zis non-zero, it Zspecifies an action Z(SIG_DFL, ZSIG_IGN, Zor a handler routine) and mask Zto be used when delivering the specified signal. ZIf Z.I oact Zis non-zero, the previous handling information for the signal Zis returned to the user. Z.PP ZOnce a signal handler is installed, it remains installed Zuntil another Z.B sigaction Zcall is made, or an Z.BR execve (2) Zis performed. ZA signal-specific default action may be reset by Zsetting Z.I sa_handler Zto ZSIG_DFL. ZThe defaults are process termination, possibly with core dump; Zno action; stopping the process; or continuing the process. ZSee the signal list below for each signal's default action. ZIf Z.I sa_handler Zis ZSIG_DFL, Zthe default action for the signal is to discard the signal, Zand if a signal is pending, Zthe pending signal is discarded even if the signal is masked. ZIf Z.I sa_handler Zis set to ZSIG_IGN Zcurrent and pending instances Zof the signal are ignored and discarded. Z.PP ZOptions may be specified by setting Z.IR sa_flags . ZIf the ZSA_NOCLDSTOP Zbit is set when installing a catching function Zfor the ZSIGCHLD Zsignal, Zthe ZSIGCHLD Zsignal will be generated only when a child process exits, Znot when a child process stops. ZFurther, if the ZSA_ONSTACK Zbit is set in Z.IR sa_flags , Zthe system will deliver the signal to the process on a Z.IR "signal stack" , Zspecified with Z.BR sigstack (2). Z.PP ZIf a signal is caught during the system calls listed below, Zthe call may be forced to terminate Zwith the error ZEINTR, Zthe call may return with a data transfer shorter than requested, Zor the call may be restarted. ZRestart of pending calls is requested Zby setting the ZSA_RESTART Zbit in Z.IR sa_flags . ZThe affected system calls include Z.BR open (2), Z.BR read (2), Z.BR write (2), Z.BR sendto (2), Z.BR recvfrom (2), Z.BR sendmsg (2) Zand Z.BR recvmsg (2) Zon a communications channel or a slow device (such as a terminal, Zbut not a regular file) Zand during a Z.BR wait (2) Zor Z.BR ioctl (2). ZHowever, calls that have already committed are not restarted, Zbut instead return a partial success (for example, a short read count). Z.PP ZAfter a Z.BR fork (2) Zor Z.BR vfork (2) Zall signals, the signal mask, the signal stack, Zand the restart/interrupt flags are inherited by the child. Z.PP Z.BR Execve (2) Zreinstates the default Zaction for all signals which were caught and Zresets all signals to be caught on the user stack. ZIgnored signals remain ignored; Zthe signal mask remains the same; Zsignals that restart pending system calls continue to do so. Z.PP ZThe following is a list of all signals Zwith names as in the include file Z.RI < signal.h >: Z.LP Z.in +0.5i Z.\" BE VERY VERY CAREFUL (and do not cut/paste in an xterm) below. There are Z.\" embedded tabs present. Z.ta \w'SIGVTALRMxx'u +\w'terminatexxx'u ZNAME Action Description Z.br ZSIGHUP terminate terminal line hangup Z.br ZSIGINT terminate interrupt program Z.br ZSIGQUIT core quit program Z.br ZSIGILL core illegal instruction Z.br ZSIGTRAP core trace trap Z.br ZSIGIOT core abort(2) call (same as SIGABRT) Z.br ZSIGEMT core emulate instruction executed Z.br ZSIGFPE core floating-point exception Z.br ZSIGKILL terminate kill program Z.br ZSIGBUS core bus error Z.br ZSIGSEGV core segmentation violation Z.br ZSIGSYS core system call given invalid argument Z.br ZSIGPIPE terminate write on a pipe with no reader Z.br ZSIGALRM terminate real-time timer expired Z.br ZSIGTERM terminate software termination signal Z.br ZSIGURG discard urgent condition present on socket Z.br ZSIGSTOP stop stop (cannot be caught or ignored) Z.br ZSIGTSTP stop stop generated from keyboard Z.br ZSIGCONT discard continue after stop Z.br ZSIGCHLD discard child status has changed Z.br ZSIGTTIN stop background read attempted on control terminal Z.br ZSIGTTOU stop background write attemped to control terminal Z.br ZSIGIO discard I/O is possible on a descriptor (see fcntl(2)) Z.br ZSIGXCPU terminate cpu time limit exceeded (see setrlimit(2)) Z.br ZSIGXFSZ terminate file size limit exceeded (see setrlimit(2)) Z.br ZSIGVTALRM terminate virtual time alarm (see setitimer(2)) Z.br ZSIGPROF terminate profiling timer alarm (see setitimer(2)) Z.br ZSIGWINCH discard Window size change Z.br ZSIGINFO discard status request from keyboard Z.br ZSIGUSR1 terminate User defined signal 1 Z.br ZSIGUSR2 terminate User defined signal 2 Z.br Z.in -0.5i Z.SH NOTE ZThe mask specified in Z.I act Zis not allowed to block ZSIGKILL Zor ZSIGSTOP. ZThis is done silently by the system. Z.SH RETURN VALUES ZA 0 value indicated that the call succeeded. A \-1 return value Zindicates an error occurred and Z.I errno Zis set to indicated the reason. Z.SH EXAMPLE ZThe handler routine can be declared: Z.sp Z.nf Zint handler(sig, code, scp) Zint sig, code; Zstruct sigcontext *scp; Z.fi Z.PP ZHere Z.I sig Zis the signal number, into which the hardware faults and traps are Zmapped. Z.I Code Zis a parameter that is either a constant Zor the code provided by Zthe hardware. Z.I Scp Zis a pointer to the Z.I sigcontext Zstructure (defined in Z.RI < signal.h >, Zused to restore the context from before the signal. Z.SH ERRORS Z.B Sigaction Zwill fail and no new signal handler will be installed if one Zof the following occurs: Z.TP 20 ZEFAULT ZEither Z.I act Zor Z.I oact Zpoints to memory that is not a valid part of the process Zaddress space. Z.TP 20 ZEINVAL Z.I Sig Zis not a valid signal number. Z.TP 20 ZEINVAL ZAn attempt is made to ignore or supply a handler for ZSIGKILL Zor ZSIGSTOP. Z.SH STANDARDS ZThe Z.B sigaction Zfunction is defined by ZIEEE Std1003.1-1988 (``POSIX''). ZThe ZSA_ONSTACK Zand ZSA_RESTART Zflags are Berkeley extensions, Zas are the signals, ZSIGTRAP, ZSIGEMT, ZSIGBUS, ZSIGSYS, ZSIGURG, ZSIGIO, ZSIGXCPU, ZSIGXFSZ, ZSIGVTALRM, ZSIGPROF, ZSIGWINCH, Zand ZSIGINFO. ZThose signals are available on most ZBSD\-derived Zsystems. Z.SH BUGS ZThe networking related syscalls are not properly restarted in 2.11BSD. The ZSIGINFO signal is not implemented in 2.11BSD. Z.SH SEE ALSO Zkill(1), Zfcntl(2), Zptrace(2), Zkill(2), Zsetitimer(2), Zsetrlimit(2), Zsigaction(2), Zsigprocmask(2), Zsigsuspend(2), Zsigblock(2), Zsigsetmask(2), Zsigpause(2), Zsigstack(2), Zsigvec(2), Zsetjmp(3), Zsiginterrupt(3), Zsigsetops(3), Ztty(4) SHAR_EOF chmod 644 '/usr/src/man/man2/sigaction.2' fi if test -f '/usr/src/man/man2/sigaltstack.2' then echo shar: "will not over-write existing file '/usr/src/man/man2/sigaltstack.2'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/man/man2/sigaltstack.2' Z.\" Copyright (c) 1983, 1991, 1992, 1993 Z.\" The Regents of the University of California. All rights reserved. Z.\" Z.\" Redistribution and use in source and binary forms, with or without Z.\" modification, are permitted provided that the following conditions Z.\" are met: Z.\" 1. Redistributions of source code must retain the above copyright Z.\" notice, this list of conditions and the following disclaimer. Z.\" 2. Redistributions in binary form must reproduce the above copyright Z.\" notice, this list of conditions and the following disclaimer in the Z.\" documentation and/or other materials provided with the distribution. Z.\" 3. All advertising materials mentioning features or use of this software Z.\" must display the following acknowledgement: Z.\" This product includes software developed by the University of Z.\" California, Berkeley and its contributors. Z.\" 4. Neither the name of the University nor the names of its contributors Z.\" may be used to endorse or promote products derived from this software Z.\" without specific prior written permission. Z.\" Z.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z.\" SUCH DAMAGE. Z.\" Z.\" @(#)sigaltstack.2 8.2.1 (2.11BSD) 1997/9/3 Z.\" Z.TH SIGALTSTACK 2 "September 3, 1997" Z.UC 7 Z.SH NAME Z\fBsigaltstack\fP \- set and/or get signal stack context Z.SH SYNOPSIS Z.B #include Z.br Z.B #include Z.sp Z.nf Zstruct sigaltstack { Z caddr_t ss_base; Z int ss_size; Z int ss_flags; Z}; Z.fi Z.sp Z.I int Z.br Z\fBsigaltstack\fP(ss, oss) Z.br Z.I struct sigaltstack *ss; Z.br Z.I struct sigaltstack *oss; Z.SH DESCRIPTION Z.B Sigaltstack Zallows users to define an alternate stack on which signals Zare to be processed. ZIf Z.I ss Zis non-zero, Zit specifies a pointer to and the size of a Z.I "signal stack" Zon which to deliver signals, Zand tells the system if the process is currently executing Zon that stack. ZWhen a signal's action indicates its handler Zshould execute on the signal stack (specified with a Z.BR sigaction (2) Zcall), the system checks to see Zif the process is currently executing on that stack. ZIf the process is not currently executing on the signal stack, Zthe system arranges a switch to the signal stack for the Zduration of the signal handler's execution. Z.PP ZIf ZSA_DISABLE Zis set in Z.IR ss_flags , Z.IR ss_base Zand Z.IR ss_size Zare ignored and the signal stack will be disabled. ZTrying to disable an active stack will cause Z.B sigaltstack Zto return -1 with Z.I errno Zset to ZEINVAL. ZA disabled stack will cause all signals to be Ztaken on the regular user stack. ZIf the stack is later re-enabled then all signals that were specified Zto be processed on an alternate stack will resume doing so. Z.PP ZIf Z.I oss Zis non-zero, the current signal stack state is returned. ZThe Z.I ss_flags Zfield will contain the value ZSA_ONSTACK Zif the process is currently on a signal stack and ZSA_DISABLE Zif the signal stack is currently disabled. Z.SH NOTES ZThe value ZSIGSTKSZ Zis defined to be the number of bytes/chars that would be used to cover Zthe usual case when allocating an alternate stack area. ZThe following code fragment is typically used to allocate an alternate stack. Z.sp Z.nf Zif ((sigstk.ss_base = malloc(SIGSTKSZ)) == NULL) Z /* error return */ Zsigstk.ss_size = SIGSTKSZ; Zsigstk.ss_flags = 0; Zif (sigaltstack(&sigstk,0) < 0) Z perror("sigaltstack"); Z.fi Z.sp ZAn alternative approach is provided for programs with signal handlers Zthat require a specific amount of stack space other than the default size. ZThe value ZMINSIGSTKSZ Zis defined to be the number of bytes/chars that is required by Zthe operating system to implement the alternate stack feature. ZIn computing an alternate stack size, Zprograms should add ZMINSIGSTKSZ Zto their stack requirements to allow for the operating system overhead. Z.PP ZSignal stacks are automatically adjusted for the direction of stack Zgrowth and alignment requirements. ZSignal stacks may or may not be protected by the hardware and Zare not ``grown'' automatically as is done for the normal stack. ZIf the stack overflows and this space is not protected Zunpredictable results may occur. Z.SH RETURN VALUES ZUpon successful completion, a value of 0 is returned. ZOtherwise, a value of -1 is returned and Z.I errno Zis set to indicate the error. Z.SH ERRORS Z.B Sigaltstack Zwill fail and the signal stack context will remain unchanged Zif one of the following occurs. Z.TP 20 ZEFAULT ZEither Z.I ss Zor Z.I oss Zpoints to memory that is not a valid part of the process Zaddress space. Z.TP 20 ZEINVAL ZAn attempt was made to disable an active stack. Z.TP 20 ZENOMEM ZSize of alternate stack area is less than or equal to ZMINSIGSTKSZ . Z.SH SEE ALSO Zsigaction(2), setjmp(3) Z.SH HISTORY ZThe predecessor to Z.BR sigaltstack , Zthe Z.B sigstack Zsystem call, appeared in 4.2BSD. SHAR_EOF chmod 644 '/usr/src/man/man2/sigaltstack.2' fi if test -f '/usr/src/man/man2/sigpending.2' then echo shar: "will not over-write existing file '/usr/src/man/man2/sigpending.2'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/man/man2/sigpending.2' Z.\" Copyright (c) 1993 Z.\" The Regents of the University of California. All rights reserved. Z.\" Z.\" This code is derived from software contributed to Berkeley by Z.\" Berkeley Software Design, Inc. Z.\" Z.\" Redistribution and use in source and binary forms, with or without Z.\" modification, are permitted provided that the following conditions Z.\" are met: Z.\" 1. Redistributions of source code must retain the above copyright Z.\" notice, this list of conditions and the following disclaimer. Z.\" 2. Redistributions in binary form must reproduce the above copyright Z.\" notice, this list of conditions and the following disclaimer in the Z.\" documentation and/or other materials provided with the distribution. Z.\" 3. All advertising materials mentioning features or use of this software Z.\" must display the following acknowledgement: Z.\" This product includes software developed by the University of Z.\" California, Berkeley and its contributors. Z.\" 4. Neither the name of the University nor the names of its contributors Z.\" may be used to endorse or promote products derived from this software Z.\" without specific prior written permission. Z.\" Z.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z.\" SUCH DAMAGE. Z.\" Z.\" @(#)sigpending.2 8.3.1 (2.11BSD) 1997/9/3 Z.\" Z.TH SIGPENDING 2 "September 3, 1997" Z.UC 7 Z.SH NAME Z\fBsigpending\fP \- get pending signals Z.SH SYNOPSIS Z.B #include Z.sp Z.I int Z.br Z\fBsigpending\fP(set) Z.br Z.I sigset_t *set; Z.SH DESCRIPTION ZThe Z.B sigpending Zfunction returns a mask of the signals pending for delivery Zto the calling process in the location indicated by Z.IR set . ZSignals may be pending because they are currently masked, Zor transiently before delivery (although the latter case is not Znormally detectable). Z.SH RETURN VALUES ZA 0 value indicated that the call succeeded. A \-1 return value Zindicates an error occurred and Z.I errno Zis set to indicated the reason. Z.SH ERRORS ZIf Z.B sigpending Zfails then \fIerrno\fP will contain one of the following: Z.sp Z.TP 20 Z[EFAULT] Z.I set Zcontains an invalid address. Z.SH SEE ALSO Zsigaction(2), sigprocmask(2) Z.SH STANDARDS ZThe Z.B sigpending Zfunction is defined by ZIEEE Std1003.1-1988 (``POSIX''). SHAR_EOF chmod 644 '/usr/src/man/man2/sigpending.2' fi if test -f '/usr/src/man/man2/sigprocmask.2' then echo shar: "will not over-write existing file '/usr/src/man/man2/sigprocmask.2'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/man/man2/sigprocmask.2' Z.\" Copyright (c) 1983, 1991, 1993 Z.\" The Regents of the University of California. All rights reserved. Z.\" Z.\" Redistribution and use in source and binary forms, with or without Z.\" modification, are permitted provided that the following conditions Z.\" are met: Z.\" 1. Redistributions of source code must retain the above copyright Z.\" notice, this list of conditions and the following disclaimer. Z.\" 2. Redistributions in binary form must reproduce the above copyright Z.\" notice, this list of conditions and the following disclaimer in the Z.\" documentation and/or other materials provided with the distribution. Z.\" 3. All advertising materials mentioning features or use of this software Z.\" must display the following acknowledgement: Z.\" This product includes software developed by the University of Z.\" California, Berkeley and its contributors. Z.\" 4. Neither the name of the University nor the names of its contributors Z.\" may be used to endorse or promote products derived from this software Z.\" without specific prior written permission. Z.\" Z.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z.\" SUCH DAMAGE. Z.\" Z.\" @(#)sigprocmask.2 8.1.1 (2.11BSD) 1997/9/3 Z.\" Z.TH SIGPROCMASK 2 "September 3, 1997" Z.UC 7 Z.SH NAME Z\fBsigprocmask\fP \- manipulate current signal mask Z.SH SYNOPSIS Z.B #include Z.sp Z.I int Z.br Z\fBsigprocmask\fP(how, set, oset) Z.br Z.I int how; Z.br Z.I sigset_t *set; Z.br Z.I sigset_t *oset; Z.sp Z.I sigset_t Z.br Z\fBsigmask\fP(signum) Z.br Z.I int signum; Z.SH DESCRIPTION ZThe Z.B sigprocmask Zfunction examines and/or changes the current signal mask (those signals Zthat are blocked from delivery). ZSignals are blocked if they are members of the current signal mask set. Z.PP ZIf Z.I set Zis not null, the action of Z.B sigprocmask Zdepends on the value of the parameter Z.IR how . ZThe signal mask is changed as a function of the specified Z.I set Zand the current mask. ZThe function is specified by Z.I how Zusing one of the following values from Z.RI < signal.h >: Z.TP 20 ZSIG_BLOCK ZThe new mask is the union of the current mask and the specified Z.IR set . Z.TP 20 ZSIG_UNBLOCK ZThe new mask is the intersection of the current mask Zand the complement of the specified Z.IR set . Z.TP 20 ZSIG_SETMASK ZThe current mask is replaced by the specified Z.IR set . Z.PP ZIf Z.I oset Zis not null, it is set to Zthe previous value of the signal mask. ZWhen Z.I set Zis null, Zthe value of Z.I how Zis insignificant and the mask remains unset Zproviding a way to examine the signal mask without modification. Z.PP ZThe system Zquietly disallows ZSIGKILL Zor ZSIGSTOP Zto be blocked. Z.SH RETURN VALUES ZA 0 value indicated that the call succeeded. A -1 return value Zindicates an error occurred and Z.I errno Zis set to indicated the reason. Z.SH ERRORS ZThe Z.B sigprocmask Zcall will fail and the signal mask will be unchanged if one Zof the following occurs: Z.TP 20 ZEINVAL Z.I how Zhas a value other than those listed here. Z.TP 20 ZEFAULT Z.I set Zor Z.I oset Zcontain an invalid address. Z.SH SEE ALSO Zkill(2), sigaction(2), sigsetops(3), sigsuspend(2) Z.SH STANDARDS ZThe Z.B sigprocmask Zfunction call is expected to Zconform to ZIEEE Std1003.1-1988 (``POSIX''). SHAR_EOF chmod 644 '/usr/src/man/man2/sigprocmask.2' fi if test -f '/usr/src/man/man2/sigsuspend.2' then echo shar: "will not over-write existing file '/usr/src/man/man2/sigsuspend.2'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/man/man2/sigsuspend.2' Z.\" Copyright (c) 1983, 1991, 1993 Z.\" The Regents of the University of California. All rights reserved. Z.\" Z.\" Redistribution and use in source and binary forms, with or without Z.\" modification, are permitted provided that the following conditions Z.\" are met: Z.\" 1. Redistributions of source code must retain the above copyright Z.\" notice, this list of conditions and the following disclaimer. Z.\" 2. Redistributions in binary form must reproduce the above copyright Z.\" notice, this list of conditions and the following disclaimer in the Z.\" documentation and/or other materials provided with the distribution. Z.\" 3. All advertising materials mentioning features or use of this software Z.\" must display the following acknowledgement: Z.\" This product includes software developed by the University of Z.\" California, Berkeley and its contributors. Z.\" 4. Neither the name of the University nor the names of its contributors Z.\" may be used to endorse or promote products derived from this software Z.\" without specific prior written permission. Z.\" Z.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z.\" SUCH DAMAGE. Z.\" Z.\" @(#)sigsuspend.2 8.2.1 (2.11BSD) 1995/9/3 Z.\" Z.TH SIGSUSPEND 2 "September 3, 1997" Z.UC 7 Z.SH NAME Z\fBsigsuspend\fP \- atomically release blocked signals and wait for interrupt Z.SH SYNOPSIS Z.B #include Z.sp Z.I int Z.br Z\fBsigsuspend\fP(sigmask) Z.br Z.I sigset_t *sigmask Z.SH DESCRIPTION Z.BR Sigsuspend () Ztemporarily changes the blocked signal mask to the set to which Z.I sigmask Zpoints, Zand then waits for a signal to arrive; Zon return the previous set of masked signals is restored. ZThe signal mask set Zis usually empty to indicate that all Zsignals are to be unblocked for the duration of the call. Z.PP ZIn normal usage, a signal is blocked using Z.BR sigprocmask (2) Zto begin a critical section, variables modified on the occurrence Zof the signal are examined to determine that there is no work Zto be done, and the process pauses awaiting work by using Z.B sigsuspend Zwith the previous mask returned by Z.BR sigprocmask . Z.SH RETURN VALUES ZThe Z.B sigsuspend Zfunction Zalways terminates by being interrupted, returning -1 with Z.I errno Zset to ZEINTR. If EFAULT is set in \fIerrno\fP then \fIset\fP contains an invalid Zaddress. Z.SH SEE ALSO Zsigprocmask(2), sigaction(2), sigsetops(3) Z.SH STANDARDS ZThe Z.B sigsuspend Zfunction call Zconforms to ZIEEE Std1003.1-1988 (``POSIX''). SHAR_EOF chmod 644 '/usr/src/man/man2/sigsuspend.2' fi if test -f '/usr/src/man/man3/sigsetops.3' then echo shar: "will not over-write existing file '/usr/src/man/man3/sigsetops.3'" else sed 's/^Z//' << \SHAR_EOF > '/usr/src/man/man3/sigsetops.3' Z.\" Copyright (c) 1983, 1991, 1993 Z.\" The Regents of the University of California. All rights reserved. Z.\" Z.\" Redistribution and use in source and binary forms, with or without Z.\" modification, are permitted provided that the following conditions Z.\" are met: Z.\" 1. Redistributions of source code must retain the above copyright Z.\" notice, this list of conditions and the following disclaimer. Z.\" 2. Redistributions in binary form must reproduce the above copyright Z.\" notice, this list of conditions and the following disclaimer in the Z.\" documentation and/or other materials provided with the distribution. Z.\" 3. All advertising materials mentioning features or use of this software Z.\" must display the following acknowledgement: Z.\" This product includes software developed by the University of Z.\" California, Berkeley and its contributors. Z.\" 4. Neither the name of the University nor the names of its contributors Z.\" may be used to endorse or promote products derived from this software Z.\" without specific prior written permission. Z.\" Z.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND Z.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Z.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Z.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE Z.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Z.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Z.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Z.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Z.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Z.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z.\" SUCH DAMAGE. Z.\" Z.\" @(#)sigsetops.3 8.1.1 (2.11BSD) 1997/9/3 Z.\" Z.TH SIGSETOPS 3 "September 3, 1997" Z.UC 7 Z.SH NAME Z.BR sigemptyset , Z.BR sigfillset , Z.BR sigaddset , Z.BR sigdelset , Z.BR sigismember Z\- manipulate signal sets Z.SH SYNOPSIS Z.B #include Z.sp Z\fBsigemptyset\fP(set) Z.br Z.I sigset_t *set; Z.sp Z\fBsigfillset\fP(set) Z.br Z.I sigset_t *set; Z.sp Z\fBsigaddset\fP(set, signo) Z.br Z.I sigset_t *set; Z.br Z.I int signo; Z.sp Z\fBsigdelset\fP(set, signo) Z.br Z.I sigset_t *set; Z.br Z.I int signo; Z.sp Z\fBsigismember\fP(set, signo) Z.br Z.I sigset_t *set; Z.br Z.I int signo; Z.SH DESCRIPTION ZThese functions manipulate signal sets stored in a Z.I sigset_t . ZEither Z.B sigemptyset Zor Z.B sigfillset Zmust be called for every object of type Z.I sigset_t Zbefore any other use of the object. Z.PP ZThe Z.B sigemptyset Zfunction initializes a signal set to be empty. Z.PP ZThe Z.B sigfillset Zfunction initializes a signal set to contain all signals. Z.PP ZThe Z.B sigaddset Zfunction adds the specified signal Z.I signo Zto the signal set. Z.PP ZThe Z.B sigdelset Zfunction deletes the specified signal Z.I signo Zfrom the signal set. Z.PP ZThe Z.B sigismember Zfunction returns whether a specified signal Z.I signo Zis contained in the signal set. Z.PP ZThese functions Zare provided as macros in the include file Z.RI < signal.h >. ZActual functions are available Zif their names are undefined (with #undef Z\fBname\fP). Z.SH RETURN VALUES ZThe Z.B sigismember Zfunction returns 1 Zif the signal is a member of the set, Z0 otherwise. ZThe other functions return 0. Z.SH ERRORS ZCurrently no errors are detected. Z.SH SEE ALSO Zkill(2), sigaction(2), sigsuspend(2) Z.SH STANDARDS ZThese functions are defined by ZIEEE Std1003.1-1988 (``POSIX''). SHAR_EOF chmod 644 '/usr/src/man/man3/sigsetops.3' fi exit 0 # End of shell archive