linux_signal.c (158415) | linux_signal.c (161310) |
---|---|
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 --- 13 unchanged lines hidden (view full) --- 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 29#include <sys/cdefs.h> | 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 --- 13 unchanged lines hidden (view full) --- 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 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_signal.c 158415 2006-05-10 20:38:16Z netchild $"); | 30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_signal.c 161310 2006-08-15 12:54:30Z netchild $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/proc.h> 37#include <sys/signalvar.h> 38#include <sys/syscallsubr.h> --- 5 unchanged lines hidden (view full) --- 44#include <machine/../linux32/linux.h> 45#include <machine/../linux32/linux32_proto.h> 46#else 47#include <machine/../linux/linux.h> 48#include <machine/../linux/linux_proto.h> 49#endif 50#include <compat/linux/linux_signal.h> 51#include <compat/linux/linux_util.h> | 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/proc.h> 37#include <sys/signalvar.h> 38#include <sys/syscallsubr.h> --- 5 unchanged lines hidden (view full) --- 44#include <machine/../linux32/linux.h> 45#include <machine/../linux32/linux32_proto.h> 46#else 47#include <machine/../linux/linux.h> 48#include <machine/../linux/linux_proto.h> 49#endif 50#include <compat/linux/linux_signal.h> 51#include <compat/linux/linux_util.h> |
52#include <compat/linux/linux_emul.h> |
|
52 | 53 |
54extern struct sx emul_shared_lock; 55extern struct sx emul_lock; 56 |
|
53void 54linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss) 55{ 56 int b, l; 57 58 SIGEMPTYSET(*bss); 59 bss->__bits[0] = lss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1); 60 bss->__bits[1] = lss->__bits[1]; --- 381 unchanged lines hidden (view full) --- 442 if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ) 443 tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)]; 444 else 445 tmp.signum = args->signum; 446 447 tmp.pid = args->pid; 448 return (kill(td, &tmp)); 449} | 57void 58linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss) 59{ 60 int b, l; 61 62 SIGEMPTYSET(*bss); 63 bss->__bits[0] = lss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1); 64 bss->__bits[1] = lss->__bits[1]; --- 381 unchanged lines hidden (view full) --- 446 if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ) 447 tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)]; 448 else 449 tmp.signum = args->signum; 450 451 tmp.pid = args->pid; 452 return (kill(td, &tmp)); 453} |
454 455int 456linux_tgkill(struct thread *td, struct linux_tgkill_args *args) 457{ 458 struct linux_emuldata *em; 459 struct linux_kill_args ka; 460 struct proc *p; 461 462#ifdef DEBUG 463 if (ldebug(tgkill)) 464 printf(ARGS(tgkill, "%d, %d, %d"), args->tgid, args->pid, args->sig); 465#endif 466 467 ka.pid = args->pid; 468 ka.signum = args->sig; 469 470 if (args->tgid == -1) 471 return linux_kill(td, &ka); 472 473 if ((p = pfind(args->pid)) == NULL) 474 return ESRCH; 475 476 if (p->p_sysent != &elf_linux_sysvec) 477 return ESRCH; 478 479 PROC_UNLOCK(p); 480 481 em = em_find(p, EMUL_UNLOCKED); 482 483 if (em == NULL) { 484#ifdef DEBUG 485 printf("emuldata not found in tgkill.\n"); 486#endif 487 return ESRCH; 488 } 489 490 if (em->shared->group_pid != args->tgid) 491 return ESRCH; 492 493 EMUL_UNLOCK(&emul_lock); 494 495 return linux_kill(td, &ka); 496} 497 498int 499linux_tkill(struct thread *td, struct linux_tkill_args *args) 500{ 501#ifdef DEBUG 502 if (ldebug(tkill)) 503 printf(ARGS(tkill, "%i, %i"), args->tid, args->sig); 504#endif 505 506 return (linux_kill(td, (struct linux_kill_args *) args)); 507} |
|