unsigned int mask;
__group_complete_signal(int sig, struct task_struct *p){	unsigned int mask;	struct task_struct *t;	/*	 * Don't bother traced and stopped tasks (but	 * SIGKILL will punch through that).	 */	mask = TASK_STOPPED | TASK_TRACED;	if (sig == SIGKILL)		mask = 0;	/*	 * Now find a thread we can wake up to take the signal off the queue.	 *	 * If the main thread wants the signal, it gets first crack.	 * Probably the least surprising to the average bear.	 */	if (wants_signal(sig, p, mask))		t = p;	else if (thread_group_empty(p))		/*		 * There is just one thread and it does not need to be woken.		 * It will dequeue unblocked signals before it runs again.		 */		return;	else {		/*		 * Otherwise try to find a suitable thread.		 */		t = p->signal->curr_target;		if (t == NULL)			/* restart balancing at this thread */			t = p->signal->curr_target = p;		BUG_ON(t->tgid != p->tgid);		while (!wants_signal(sig, t, mask)) {			t = next_thread(t);			if (t == p->signal->curr_target)				/*				 * No thread needs to be woken.				 * Any eligible threads will see				 * the signal in the queue soon.				 */				return;		}		p->signal->curr_target = t;	}	/*	 * Found a killable thread.  If the signal will be fatal,	 * then start taking the whole group down immediately.	 */	if (sig_fatal(p, sig) && !(p->signal->flags & SIGNAL_GROUP_EXIT) &&	    !sigismember(&t->real_blocked, sig) &&	    (sig == SIGKILL || !(t->ptrace & PT_PTRACED))) {		/*		 * This signal will be fatal to the whole group.		 */		if (!sig_kernel_coredump(sig)) {			/*			 * Start a group exit and wake everybody up.			 * This way we don't have other threads			 * running and doing things after a slower			 * thread has the fatal signal pending.			 */			p->signal->flags = SIGNAL_GROUP_EXIT;			p->signal->group_exit_code = sig;			p->signal->group_stop_count = 0;			t = p;			do {				sigaddset(&t->pending.signal, SIGKILL);				signal_wake_up(t, 1);				t = next_thread(t);			} while (t != p);			return;		}		/*		 * There will be a core dump.  We make all threads other		 * than the chosen one go into a group stop so that nothing		 * happens until it gets scheduled, takes the signal off		 * the shared queue, and does the core dump.  This is a		 * little more complicated than strictly necessary, but it		 * keeps the signal state that winds up in the core dump		 * unchanged from the death state, e.g. which thread had		 * the core-dump signal unblocked.		 */		rm_from_queue(SIG_KERNEL_STOP_MASK, &t->pending);		rm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending);		p->signal->group_stop_count = 0;		p->signal->group_exit_task = t;		t = p;		do {			p->signal->group_stop_count++;			signal_wake_up(t, 0);			t = next_thread(t);		} while (t != p);		wake_up_process(p->signal->group_exit_task);		return;	}	/*	 * The signal is already in the shared-pending queue.	 * Tell the chosen thread to wake up and dequeue it.	 */	signal_wake_up(t, sig == SIGKILL);	return;}