Revert all changes in ptrace.h, except declaration of ptrace_notify_stop().

The reverted changes in ptrace_init_task() break utrace-ptrace, fixed by
the next patch.

---

 include/linux/ptrace.h |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

--- PU/include/linux/ptrace.h~114_REVERT_PTRACE_INIT_TASK       2009-10-23 
00:23:15.000000000 +0200
+++ PU/include/linux/ptrace.h   2009-10-24 00:31:32.000000000 +0200
@@ -132,6 +132,28 @@ static inline int task_ptrace(struct tas
 }
 
 /**
+ * ptrace_event - possibly stop for a ptrace event notification
+ * @mask:      %PT_* bit to check in @current->ptrace
+ * @event:     %PTRACE_EVENT_* value to report if @mask is set
+ * @message:   value for %PTRACE_GETEVENTMSG to return
+ *
+ * This checks the @mask bit to see if ptrace wants stops for this event.
+ * If so we stop, reporting @event and @message to the ptrace parent.
+ *
+ * Returns nonzero if we did a ptrace notification, zero if not.
+ *
+ * Called without locks.
+ */
+static inline int ptrace_event(int mask, int event, unsigned long message)
+{
+       if (mask && likely(!(current->ptrace & mask)))
+               return 0;
+       current->ptrace_message = message;
+       ptrace_notify((event << 8) | SIGTRAP);
+       return 1;
+}
+
+/**
  * ptrace_init_task - initialize ptrace state for a new child
  * @child:             new child task
  * @ptrace:            true if child should be ptrace'd by parent's tracer
@@ -147,6 +169,10 @@ static inline void ptrace_init_task(stru
        INIT_LIST_HEAD(&child->ptraced);
        child->parent = child->real_parent;
        child->ptrace = 0;
+       if (unlikely(ptrace)) {
+               child->ptrace = current->ptrace;
+               ptrace_link(child, current->parent);
+       }
 }
 
 /**

Reply via email to