[ltt-dev] [PATCH] Add pipe tracepoint
Francis Giraldeau
francis.giraldeau at gmail.com
Thu May 19 16:38:04 EDT 2011
This patch provides instrumentation for pipe system call. It records the fd
read and write ends of the pipe if the operation succeeed. This is required to
recover from the trace the full list of file descriptor of a process.
Signed-off-by: Francis Giraldeau <francis.giraldeau at gmail.com>
---
fs/pipe.c | 5 +++++
include/trace/fs.h | 3 +++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/fs/pipe.c b/fs/pipe.c
index da42f7d..72ab52a 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -20,10 +20,13 @@
#include <linux/audit.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
+#include <trace/fs.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
+DEFINE_TRACE(fs_pipe);
+
/*
* The max size that a non-root user is allowed to grow the pipe. Can
* be set by root in /proc/sys/fs/pipe-max-size
@@ -1110,6 +1113,8 @@ SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
sys_close(fd[0]);
sys_close(fd[1]);
error = -EFAULT;
+ } else {
+ trace_fs_pipe(fd[0], fd[1]);
}
}
return error;
diff --git a/include/trace/fs.h b/include/trace/fs.h
index 7712331..75f48c0 100644
--- a/include/trace/fs.h
+++ b/include/trace/fs.h
@@ -66,4 +66,7 @@ DECLARE_TRACE(fs_poll,
DECLARE_TRACE(fs_dup,
TP_PROTO(unsigned int oldfd, unsigned int newfd),
TP_ARGS(oldfd, newfd));
+DECLARE_TRACE(fs_pipe,
+ TP_PROTO(int readfd, int writefd),
+ TP_ARGS(readfd, writefd));
#endif
--
1.7.1
More information about the lttng-dev
mailing list