Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / include / linux / ptrace.h
index 5438afe..6e9012f 100644 (file)
@@ -16,8 +16,8 @@
 #define PTRACE_KILL               8
 #define PTRACE_SINGLESTEP         9
 
-#define PTRACE_ATTACH          0x10
-#define PTRACE_DETACH          0x11
+#define PTRACE_ATTACH            16
+#define PTRACE_DETACH            17
 
 #define PTRACE_SYSCALL           24
 
 #include <asm/ptrace.h>
 
 #ifdef __KERNEL__
-#include <linux/compiler.h>
+#include <linux/compiler.h>            /* For unlikely.  */
+#include <linux/sched.h>               /* For struct task_struct.  */
 #include <linux/types.h>
-struct task_struct;
+#include <linux/errno.h>
 struct siginfo;
 struct rusage;
 
 
 extern int ptrace_may_attach(struct task_struct *task);
-extern int __ptrace_may_attach(struct task_struct *task);
 
 
 #ifdef CONFIG_PTRACE
@@ -80,30 +80,30 @@ struct utrace_regset_view;
  * and sets *retval to the value--which might have any bit pattern at all,
  * including one that looks like -ENOSYS or another error code.
  */
-extern fastcall int arch_ptrace(long *request, struct task_struct *child,
-                               struct utrace_attached_engine *engine,
-                               unsigned long addr, unsigned long data,
-                               long *retval);
+extern int arch_ptrace(long *request, struct task_struct *child,
+                      struct utrace_attached_engine *engine,
+                      unsigned long addr, unsigned long data,
+                      long *retval);
 #ifdef CONFIG_COMPAT
 #include <linux/compat.h>
 
-extern fastcall int arch_compat_ptrace(compat_long_t *request,
-                                      struct task_struct *child,
-                                      struct utrace_attached_engine *engine,
-                                      compat_ulong_t a, compat_ulong_t d,
-                                      compat_long_t *retval);
+extern int arch_compat_ptrace(compat_long_t *request,
+                             struct task_struct *child,
+                             struct utrace_attached_engine *engine,
+                             compat_ulong_t a, compat_ulong_t d,
+                             compat_long_t *retval);
 #endif
 
 /*
  * Convenience function doing access to a single utrace_regset for ptrace.
  * The offset and size are in bytes, giving the location in the regset data.
  */
-extern fastcall int ptrace_regset_access(struct task_struct *child,
-                                        struct utrace_attached_engine *engine,
-                                        const struct utrace_regset_view *view,
-                                        int setno, unsigned long offset,
-                                        unsigned int size, void __user *data,
-                                        int write);
+extern int ptrace_regset_access(struct task_struct *child,
+                               struct utrace_attached_engine *engine,
+                               const struct utrace_regset_view *view,
+                               int setno, unsigned long offset,
+                               unsigned int size, void __user *data,
+                               int write);
 
 /*
  * Convenience wrapper for doing access to a whole utrace_regset for ptrace.
@@ -121,11 +121,11 @@ static inline int ptrace_whole_regset(struct task_struct *child,
  * The regno value gives a slot number plus regset->bias.
  * The value accessed is regset->size bytes long.
  */
-extern fastcall int ptrace_onereg_access(struct task_struct *child,
-                                        struct utrace_attached_engine *engine,
-                                        const struct utrace_regset_view *view,
-                                        int setno, unsigned long regno,
-                                        void __user *data, int write);
+extern int ptrace_onereg_access(struct task_struct *child,
+                               struct utrace_attached_engine *engine,
+                               const struct utrace_regset_view *view,
+                               int setno, unsigned long regno,
+                               void __user *data, int write);
 
 
 /*
@@ -135,7 +135,9 @@ extern fastcall int ptrace_onereg_access(struct task_struct *child,
  * An element describes the range [.start, .end) of struct user offsets,
  * measured in bytes; it maps to the regset in the view's regsets array
  * at the index given by .regset, at .offset bytes into that regset's data.
- * If .regset is -1, then the [.start, .end) range reads as zero.
+ * If .regset is -1, then the [.start, .end) range reads as zero
+ * if .offset is zero, and is skipped on read (user's buffer unchanged)
+ * if .offset is -1.
  */
 struct ptrace_layout_segment {
        unsigned int start, end, regset, offset;
@@ -145,12 +147,12 @@ struct ptrace_layout_segment {
  * Convenience function for doing access to a ptrace compatibility layout.
  * The offset and size are in bytes.
  */
-extern fastcall int ptrace_layout_access(
-       struct task_struct *child, struct utrace_attached_engine *engine,
-       const struct utrace_regset_view *view,
-       const struct ptrace_layout_segment layout[],
-       unsigned long offset, unsigned int size,
-       void __user *data, void *kdata, int write);
+extern int ptrace_layout_access(struct task_struct *child,
+                               struct utrace_attached_engine *engine,
+                               const struct utrace_regset_view *view,
+                               const struct ptrace_layout_segment layout[],
+                               unsigned long offset, unsigned int size,
+                               void __user *data, void *kdata, int write);
 
 
 /* Convenience wrapper for the common PTRACE_PEEKUSR implementation.  */
@@ -201,6 +203,14 @@ static inline int ptrace_compat_pokeusr(
 #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.
  */
@@ -218,6 +228,7 @@ 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,