linux_signal.c (97748) | linux_signal.c (102814) |
---|---|
1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/compat/linux/linux_signal.c 97748 2002-06-02 20:05:59Z schweikh $ | 28 * $FreeBSD: head/sys/compat/linux/linux_signal.c 102814 2002-09-01 22:30:27Z iedowse $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/lock.h> 34#include <sys/mutex.h> 35#include <sys/proc.h> 36#include <sys/signalvar.h> | 29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/lock.h> 34#include <sys/mutex.h> 35#include <sys/proc.h> 36#include <sys/signalvar.h> |
37#include <sys/syscallsubr.h> |
|
37#include <sys/sysproto.h> 38 39#include <machine/../linux/linux.h> 40#include <machine/../linux/linux_proto.h> 41#include <compat/linux/linux_signal.h> 42#include <compat/linux/linux_util.h> 43 44void --- 84 unchanged lines hidden (view full) --- 129 if (bsa->sa_flags & SA_NODEFER) 130 lsa->lsa_flags |= LINUX_SA_NOMASK; 131} 132 133int 134linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa, 135 l_sigaction_t *linux_osa) 136{ | 38#include <sys/sysproto.h> 39 40#include <machine/../linux/linux.h> 41#include <machine/../linux/linux_proto.h> 42#include <compat/linux/linux_signal.h> 43#include <compat/linux/linux_util.h> 44 45void --- 84 unchanged lines hidden (view full) --- 130 if (bsa->sa_flags & SA_NODEFER) 131 lsa->lsa_flags |= LINUX_SA_NOMASK; 132} 133 134int 135linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa, 136 l_sigaction_t *linux_osa) 137{ |
137 struct sigaction *nsa, *osa; 138 struct sigaction_args sa_args; 139 int error; 140 caddr_t sg = stackgap_init(); | 138 struct sigaction act, oact, *nsa, *osa; 139 int error, sig; |
141 142 if (linux_sig <= 0 || linux_sig > LINUX_NSIG) 143 return (EINVAL); 144 | 140 141 if (linux_sig <= 0 || linux_sig > LINUX_NSIG) 142 return (EINVAL); 143 |
145 if (linux_osa != NULL) 146 osa = stackgap_alloc(&sg, sizeof(struct sigaction)); 147 else 148 osa = NULL; 149 | 144 osa = (linux_osa != NULL) ? &oact : NULL; |
150 if (linux_nsa != NULL) { | 145 if (linux_nsa != NULL) { |
151 nsa = stackgap_alloc(&sg, sizeof(struct sigaction)); | 146 nsa = &act; |
152 linux_to_bsd_sigaction(linux_nsa, nsa); | 147 linux_to_bsd_sigaction(linux_nsa, nsa); |
153 } 154 else | 148 } else |
155 nsa = NULL; 156 157#ifndef __alpha__ 158 if (linux_sig <= LINUX_SIGTBLSZ) | 149 nsa = NULL; 150 151#ifndef __alpha__ 152 if (linux_sig <= LINUX_SIGTBLSZ) |
159 sa_args.sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)]; | 153 sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)]; |
160 else 161#endif | 154 else 155#endif |
162 sa_args.sig = linux_sig; | 156 sig = linux_sig; |
163 | 157 |
164 sa_args.act = nsa; 165 sa_args.oact = osa; 166 error = sigaction(td, &sa_args); | 158 error = kern_sigaction(td, sig, nsa, osa, 0); |
167 if (error) 168 return (error); 169 170 if (linux_osa != NULL) 171 bsd_to_linux_sigaction(osa, linux_osa); 172 173 return (0); 174} --- 264 unchanged lines hidden --- | 159 if (error) 160 return (error); 161 162 if (linux_osa != NULL) 163 bsd_to_linux_sigaction(osa, linux_osa); 164 165 return (0); 166} --- 264 unchanged lines hidden --- |