patch-2.4.0-prerelease linux/arch/sh/kernel/ptrace.c

Next file: linux/arch/sh/kernel/setup.c
Previous file: linux/arch/sh/kernel/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test12/linux/arch/sh/kernel/ptrace.c linux/arch/sh/kernel/ptrace.c
@@ -366,7 +366,7 @@
 		ret = -EIO;
 		if ((unsigned long) data > _NSIG)
 			break;
-		child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
+		child->ptrace = 0;
 		child->exit_code = data;
 		write_lock_irq(&tasklist_lock);
 		REMOVE_LINKS(child);
@@ -378,6 +378,15 @@
 		break;
 	}
 
+	case PTRACE_SETOPTIONS: {
+		if (data & PTRACE_O_TRACESYSGOOD)
+			child->ptrace |= PT_TRACESYSGOOD;
+		else
+			child->ptrace &= ~PT_TRACESYSGOOD;
+		ret = 0;
+		break;
+	}
+
 	default:
 		ret = -EIO;
 		break;
@@ -396,7 +405,10 @@
 	if ((tsk->ptrace & (PT_PTRACED|PT_TRACESYS))
 	    != (PT_PTRACED|PT_TRACESYS))
 		return;
-	tsk->exit_code = SIGTRAP;
+	/* the 0x80 provides a way for the tracing parent to distinguish
+	   between a syscall stop and SIGTRAP delivery */
+	tsk->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+				    ? 0x80 : 0);
 	tsk->state = TASK_STOPPED;
 	notify_parent(tsk, SIGCHLD);
 	schedule();

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)