patch-1.3.96 linux/kernel/exit.c

Next file: linux/kernel/sched.c
Previous file: linux/ipc/shm.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.95/linux/kernel/exit.c linux/kernel/exit.c
@@ -49,6 +49,26 @@
 		wake_up_process(p);
 }
 
+/*
+ * Force a signal that the process can't ignore: if necessary
+ * we unblock the signal and change any SIG_IGN to SIG_DFL.
+ */
+void force_sig(unsigned long sig, struct task_struct * p)
+{
+	sig--;
+	if (p->sig) {
+		unsigned long mask = 1UL << sig;
+		struct sigaction *sa = p->sig->action + sig;
+		p->signal |= mask;
+		p->blocked &= ~mask;
+		if (sa->sa_handler == SIG_IGN)
+			sa->sa_handler = SIG_DFL;
+		if (p->state == TASK_INTERRUPTIBLE)
+			wake_up_process(p);
+	}
+}
+		
+
 int send_sig(unsigned long sig,struct task_struct * p,int priv)
 {
 	if (!p || sig > 32)
@@ -428,17 +448,17 @@
 	__exit_sighand(tsk);
 }
 
-static inline void exit_mm(void)
+static inline void __exit_mm(struct task_struct * tsk)
 {
-	struct mm_struct * mm = current->mm;
+	struct mm_struct * mm = tsk->mm;
 
 	/* Set us up to use the kernel mm state */
 	if (mm != &init_mm) {
 		flush_cache_mm(mm);
 		flush_tlb_mm(mm);
-		current->mm = &init_mm;
-		current->swappable = 0;
-		SET_PAGE_DIR(current, swapper_pg_dir);
+		tsk->mm = &init_mm;
+		tsk->swappable = 0;
+		SET_PAGE_DIR(tsk, swapper_pg_dir);
 
 		/* free the old state - not used any more */
 		if (!--mm->count) {
@@ -449,6 +469,11 @@
 	}
 }
 
+void exit_mm(struct task_struct *tsk)
+{
+	__exit_mm(tsk);
+}
+
 /* 
  * Send signals to all our closest relatives so that they know
  * to properly mourn us..
@@ -528,7 +553,7 @@
 	del_timer(&current->real_timer);
 	sem_exit();
 	kerneld_exit();
-	exit_mm();
+	__exit_mm(current);
 	__exit_files(current);
 	__exit_fs(current);
 	__exit_sighand(current);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this