
/* added by chad to find out where signals are coming from */
char logged_signals[32] = {
	0x01, 0x01, 0x01, 0x01, 0x01,
	0x01, 0x01, 0x01, 0x01, 0x01,		/* 10 */
	0x01, 0x01, 0x01, 0x01, 0x01,
	0x01, 0x01, 0x01, 0x01, 0x01,		/* 20 */
	0x01, 0x01, 0x01, 0x01, 0x01,
	0x01, 0x01, 0x01, 0x01, 0x01,		/* 30 */
	0x01, 0x01 };

asmlinkage int
sys_siglog(int sig, int log)
{
	/* only allow uid 0 to change what get's logged. */
	if (current->uid && current->euid) {
		return(-1);
	}

	sig = sig & 0x1F;

	if (log) {
		logged_signals[sig] = 0x01;

	} else {
		logged_signals[sig] = 0x00;

	}

	return(0);
}
/* end of chad 's additions */

asmlinkage int
sys_kill(int pid, int sig)
{
	struct siginfo info;

	/* added by chad to find out where signals are coming from */
	struct task_struct *tsk_p;
	int sig_num;

	sig_num = sig;
	sig_num = sig_num & 0x1F;	/* mask to < 32 */


	if (logged_signals[sig_num]) {
		tsk_p = find_task_by_pid(pid);

		if (tsk_p) {
			printk(KERN_DEBUG "Sig: %d from pid: %d (%s) to pid: %d (%s)\n",
				sig, current->pid, current->comm, pid, tsk_p->comm);
		}
		else {
			printk(KERN_DEBUG "Sig: %d from pid: %d (%s) to pid: %d\n",
				sig, current->pid, current->comm, pid);
		}
	}

	/* end of chad 's additions */

	info.si_signo = sig;
	info.si_errno = 0;
	info.si_code = SI_USER;
	info.si_pid = current->pid;
	info.si_uid = current->uid;

	return kill_something_info(sig, &info, pid);
}


