[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 20] ptrace_set_options: use PTRACE_O_ instead of PT_



Roland McGrath wrote:
>
> IMHO the traditional PT_* bit assignments are useless.
> We should just store and use the PTRACE_O_* bits directly.

Agreed!

---

 kernel/ptrace.c |   28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

--- PU/kernel/ptrace.c~20_DONt_USE_PT_XXX	2009-09-04 17:08:49.000000000 +0200
+++ PU/kernel/ptrace.c	2009-09-04 18:01:09.000000000 +0200
@@ -28,8 +28,8 @@ struct ptrace_context {
 	int options;
 };
 
-static inline
-struct ptrace_context *ptrace_context(struct utrace_engine *engine)
+static inline struct ptrace_context *
+ptrace_context(struct utrace_engine *engine)
 {
 	return engine->data;
 }
@@ -507,7 +507,7 @@ static inline int __ptrace_set_options(s
 			       UTRACE_EVENT(EXEC) | UTRACE_EVENT_SIGNAL_ALL;
 
 	context->options = options;
-	if (options & PT_TRACE_EXIT)
+	if (options & PTRACE_O_TRACEEXIT)
 		events |= UTRACE_EVENT(EXIT);
 
 	return utrace_set_events(target, engine, events);
@@ -905,33 +905,11 @@ static int ptrace_setoptions(struct task
 static int ptrace_set_options(struct task_struct *child, long data)
 {
 	struct utrace_engine *engine;
-	int options = 0;
-
-	if (data & PTRACE_O_TRACESYSGOOD)
-		options |= PT_TRACESYSGOOD;
-
-	if (data & PTRACE_O_TRACEFORK)
-		options |= PT_TRACE_FORK;
-
-	if (data & PTRACE_O_TRACEVFORK)
-		options |= PT_TRACE_VFORK;
-
-	if (data & PTRACE_O_TRACECLONE)
-		options |= PT_TRACE_CLONE;
-
-	if (data & PTRACE_O_TRACEEXEC)
-		options |= PT_TRACE_EXEC;
-
-	if (data & PTRACE_O_TRACEVFORKDONE)
-		options |= PT_TRACE_VFORK_DONE;
-
-	if (data & PTRACE_O_TRACEEXIT)
-		options |= PT_TRACE_EXIT;
 
 	engine = utrace_attach_task(child, UTRACE_ATTACH_MATCH_OPS,
 					&ptrace_utrace_ops, NULL);
 	if (likely(!IS_ERR(engine))) {
-		__ptrace_set_options(child, engine, options);
+		__ptrace_set_options(child, engine, data & PTRACE_O_MASK);
 		utrace_engine_put(engine);
 	}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]