+#ifdef CONFIG_COMPAT
+/* Convenience wrapper for the common PTRACE_PEEKUSR implementation. */
+static inline int ptrace_compat_peekusr(
+ struct task_struct *child, struct utrace_attached_engine *engine,
+ const struct ptrace_layout_segment layout[],
+ compat_ulong_t addr, compat_ulong_t data)
+{
+ compat_ulong_t *udata = (compat_ulong_t __user *) (unsigned long) data;
+ return ptrace_layout_access(child, engine, utrace_native_view(current),
+ layout, addr, sizeof(compat_ulong_t),
+ udata, NULL, 0);
+}
+
+/* Convenience wrapper for the common PTRACE_PEEKUSR implementation. */
+static inline int ptrace_compat_pokeusr(
+ struct task_struct *child, struct utrace_attached_engine *engine,
+ const struct ptrace_layout_segment layout[],
+ compat_ulong_t addr, compat_ulong_t data)
+{
+ return ptrace_layout_access(child, engine, utrace_native_view(current),
+ layout, addr, sizeof(compat_ulong_t),
+ NULL, &data, 1);
+}
+#endif
+
+
+/*
+ * Called in copy_process.
+ */
+static inline void ptrace_init_task(struct task_struct *tsk)
+{
+ INIT_LIST_HEAD(&tsk->ptracees);
+}
+
+/*
+ * Called in do_exit, after setting PF_EXITING, no locks are held.
+ */
+void ptrace_exit(struct task_struct *tsk);
+
+/*
+ * Called in do_wait, with tasklist_lock held for reading.
+ * This reports any ptrace-child that is ready as do_wait would a normal child.
+ * If there are no ptrace children, returns -ECHILD.
+ * If there are some ptrace children but none reporting now, returns 0.
+ * In those cases the tasklist_lock is still held so next_thread(tsk) works.
+ * For any other return value, tasklist_lock is released before return.
+ */
+int ptrace_do_wait(struct task_struct *tsk,
+ pid_t pid, int options, struct siginfo __user *infop,
+ int __user *stat_addr, struct rusage __user *rusagep);
+#else
+static inline void ptrace_init_task(struct task_struct *tsk) { }
+static inline void ptrace_exit(struct task_struct *tsk) { }
+static inline int ptrace_do_wait(struct task_struct *tsk,
+ pid_t pid, int options,
+ struct siginfo __user *infop,
+ int __user *stat_addr,
+ struct rusage __user *rusagep)
+{
+ return -ECHILD;
+}
+#endif
+