vserver 2.0-rc4
[linux-2.6.git] / kernel / vserver / signal.c
index 5824ad5..963cc06 100644 (file)
@@ -23,21 +23,15 @@ int vc_ctx_kill(uint32_t id, void __user *data)
 {
        int retval, count=0;
        struct vcmd_ctx_kill_v0 vc_data;
-       struct siginfo info;
        struct task_struct *p;
        struct vx_info *vxi;
+       unsigned long priv = 0;
 
        if (!vx_check(0, VX_ADMIN))
                return -ENOSYS;
        if (copy_from_user (&vc_data, data, sizeof(vc_data)))
                return -EFAULT;
 
-       info.si_signo = vc_data.sig;
-       info.si_errno = 0;
-       info.si_code = SI_USER;
-       info.si_pid = current->pid;
-       info.si_uid = current->uid;
-
        vxi = locate_vx_info(id);
        if (!vxi)
                return -ESRCH;
@@ -46,17 +40,16 @@ int vc_ctx_kill(uint32_t id, void __user *data)
        read_lock(&tasklist_lock);
        switch (vc_data.pid) {
        case  0:
-               info.si_code = SI_KERNEL;
+               priv = 1;
        case -1:
                for_each_process(p) {
                        int err = 0;
 
                        if (vx_task_xid(p) != id || p->pid <= 1 ||
-                               (vc_data.pid && vxi->vx_initpid == p->pid) ||
-                               !thread_group_leader(p))
+                               (vc_data.pid && vxi->vx_initpid == p->pid))
                                continue;
 
-                       err = send_sig_info(vc_data.sig, &info, p);
+                       err = group_send_sig_info(vc_data.sig, (void*)priv, p);
                        ++count;
                        if (err != -EPERM)
                                retval = err;
@@ -66,21 +59,15 @@ int vc_ctx_kill(uint32_t id, void __user *data)
        case 1:
                if (vxi->vx_initpid) {
                        vc_data.pid = vxi->vx_initpid;
-                       info.si_code = SI_KERNEL;
+                       priv = 1;
                }
                /* fallthrough */
        default:
                p = find_task_by_real_pid(vc_data.pid);
                if (p) {
-                       if (!thread_group_leader(p)) {
-                               struct task_struct *tg;
-
-                               tg = find_task_by_real_pid(p->tgid);
-                               if (tg)
-                                       p = tg;
-                       }
                        if ((id == -1) || (vx_task_xid(p) == id))
-                               retval = send_sig_info(vc_data.sig, &info, p);
+                               retval = group_send_sig_info(vc_data.sig,
+                                       (void*)priv, p);
                }
                break;
        }
@@ -118,7 +105,6 @@ out:
 
 int vc_wait_exit(uint32_t id, void __user *data)
 {
-//     struct vcmd_wait_exit_v0 vc_data;
        struct vx_info *vxi;
        int ret;