1 /* $OpenBSD: hpux_sig2.c,v 1.2 2004/09/28 11:00:22 miod Exp $ */ 2 /* $NetBSD: hpux_sig.c,v 1.16 1997/04/01 19:59:02 scottr Exp $ */ 3 4 /* 5 * Copyright (c) 1988 University of Utah. 6 * Copyright (c) 1990, 1993 7 * The Regents of the University of California. All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * the Systems Programming Group of the University of Utah Computer 11 * Science Department. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution. 21 * 3. Neither the name of the University nor the names of its contributors 22 * may be used to endorse or promote products derived from this software 23 * without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * from: Utah $Hdr: hpux_sig.c 1.4 92/01/20$ 38 * 39 * @(#)hpux_sig.c 8.2 (Berkeley) 9/23/93 40 */ 41 42 /* 43 * Signal related HPUX compatibility routines 44 */ 45 46 #include <sys/param.h> 47 #include <sys/systm.h> 48 #include <sys/kernel.h> 49 #include <sys/mount.h> 50 #include <sys/proc.h> 51 #include <sys/signalvar.h> 52 #include <sys/syscallargs.h> 53 54 #include <compat/hpux/hpux.h> 55 #include <compat/hpux/hpux_sig.h> 56 #include <compat/hpux/m68k/hpux_syscallargs.h> 57 58 int 59 hpux_sys_ssig_6x(p, v, retval) 60 struct proc *p; 61 void *v; 62 register_t *retval; 63 { 64 struct hpux_sys_ssig_6x_args /* { 65 syscallarg(int) signo; 66 syscallarg(sig_t) fun; 67 } */ *uap = v; 68 int a; 69 struct sigaction vec; 70 struct sigaction *sa = &vec; 71 72 a = hpuxtobsdsig(SCARG(uap, signo)); 73 sa->sa_handler = SCARG(uap, fun); 74 /* 75 * Kill processes trying to use job control facilities 76 * (this'll help us find any vestiges of the old stuff). 77 */ 78 if ((a &~ 0377) || 79 (sa->sa_handler != SIG_DFL && sa->sa_handler != SIG_IGN && 80 ((int)sa->sa_handler) & 1)) { 81 psignal(p, SIGSYS); 82 return (0); 83 } 84 if (a <= 0 || a >= NSIG || a == SIGKILL || a == SIGSTOP || 85 (a == SIGCONT && sa->sa_handler == SIG_IGN)) 86 return (EINVAL); 87 sa->sa_mask = 0; 88 sa->sa_flags = 0; 89 *retval = (int)p->p_sigacts->ps_sigact[a]; 90 setsigvec(p, a, sa); 91 #if 0 92 p->p_flag |= SOUSIG; /* mark as simulating old stuff */ 93 #endif 94 return (0); 95 }