Implement UTRACE_ATTACH_MATCH_CHECK. With this flag utrace_attach_task(data)
"data" is the function pointer which checks engine->data instead of simple
comparison.

Todo: comment + rename.

---

 include/linux/utrace.h |    1 +
 kernel/utrace.c        |    5 +++++
 2 files changed, 6 insertions(+)

--- PU/include/linux/utrace.h~77_UTRACE_MATCH_FILTER    2009-10-09 
18:51:56.000000000 +0200
+++ PU/include/linux/utrace.h   2009-10-09 19:02:34.000000000 +0200
@@ -303,6 +303,7 @@ static inline enum utrace_syscall_action
 #define UTRACE_ATTACH_EXCLUSIVE                0x0020 /* Refuse if existing 
match.  */
 #define UTRACE_ATTACH_MATCH_OPS                0x0001 /* Match engines on ops. 
 */
 #define UTRACE_ATTACH_MATCH_DATA       0x0002 /* Match engines on data.  */
+#define UTRACE_ATTACH_MATCH_CHECK      0x0004 /* Match engines on ????.  */
 #define UTRACE_ATTACH_MATCH_MASK       0x000f
 
 /**
--- PU/kernel/utrace.c~77_UTRACE_MATCH_FILTER   2009-10-09 18:51:56.000000000 
+0200
+++ PU/kernel/utrace.c  2009-10-09 19:04:05.000000000 +0200
@@ -92,6 +92,11 @@ static bool engine_matches(struct utrace
                return false;
        if ((flags & UTRACE_ATTACH_MATCH_DATA) && engine->data != data)
                return false;
+       if (flags & UTRACE_ATTACH_MATCH_CHECK) {
+               bool (*check)(void*) = data;
+               if (!check(engine->data))
+                       return false;
+       }
        return engine->ops && engine->ops != &utrace_detached_ops;
 }
 

Reply via email to