2 * linux/kernel/vserver/signal.c
4 * Virtual Server: Signal Support
6 * Copyright (C) 2003-2004 Herbert Pƶtzl
8 * V0.01 broken out from vcontext V0.05
12 #include <linux/config.h>
13 #include <linux/sched.h>
15 #include <asm/errno.h>
16 #include <asm/uaccess.h>
18 #include <linux/vinline.h>
19 #include <linux/vserver/signal.h>
22 int vc_ctx_kill(uint32_t id, void __user *data)
25 struct vcmd_ctx_kill_v0 vc_data;
27 struct task_struct *p;
30 if (!vx_check(0, VX_ADMIN))
32 if (copy_from_user (&vc_data, data, sizeof(vc_data)))
35 info.si_signo = vc_data.sig;
37 info.si_code = SI_USER;
38 info.si_pid = current->pid;
39 info.si_uid = current->uid;
41 vxi = find_vx_info(id);
46 read_lock(&tasklist_lock);
47 switch (vc_data.pid) {
53 if (vx_task_xid(p) != id || p->pid <= 1 ||
54 (vc_data.pid && vxi->vx_initpid == p->pid) ||
55 !thread_group_leader(p))
58 err = send_sig_info(vc_data.sig, &info, p);
66 p = find_task_by_pid(vc_data.pid);
68 if (!thread_group_leader(p)) {
69 struct task_struct *tg;
71 tg = find_task_by_pid(p->tgid);
75 if ((id == -1) || (vx_task_xid(p) == id))
76 retval = send_sig_info(vc_data.sig, &info, p);
80 read_unlock(&tasklist_lock);