[PATCH] Add support for decoding sync_file_range

William Manley william.manley at youview.com
Fri Aug 9 17:04:11 UTC 2013


Only tested on mipsel o32.
---
 file.c                      |   35 +++++++++++++++++++++++++++++++++++
 linux/dummy.h               |    2 --
 linux/mips/syscallent-o32.h |    2 +-
 linux/syscall.h             |    2 ++
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/file.c b/file.c
index 9a83287..016fc94 100644
--- a/file.c
+++ b/file.c
@@ -2686,6 +2686,41 @@ sys_fadvise64_64(struct tcb *tcp)
 	return 0;
 }
 
+static const struct xlat sync_file_range_flags[] = {
+	{ SYNC_FILE_RANGE_WAIT_BEFORE,	"SYNC_FILE_RANGE_WAIT_BEFORE"	},
+	{ SYNC_FILE_RANGE_WRITE,	"SYNC_FILE_RANGE_WRITE"		},
+	{ SYNC_FILE_RANGE_WAIT_AFTER,	"SYNC_FILE_RANGE_WAIT_AFTER"	},
+	{ 0,				NULL				}
+};
+
+int
+sys_sync_file_range(struct tcb *tcp)
+{
+	if (entering(tcp)) {
+		int argn;
+		printfd(tcp, tcp->u_arg[0]);
+		argn = printllval(tcp, ", %lld, ", 1);
+		argn = printllval(tcp, "%lld, ", argn);
+		printflags(sync_file_range_flags, tcp->u_arg[argn],
+		           "SYNC_FILE_RANGE_???");
+	}
+	return 0;
+}
+
+int
+sys_sync_file_range2(struct tcb *tcp)
+{
+	if (entering(tcp)) {
+		int argn;
+		printfd(tcp, tcp->u_arg[0]);
+		printflags(sync_file_range_flags, 1,
+		           "SYNC_FILE_RANGE_???");
+		argn = printllval(tcp, ", %lld, ", 2);
+		argn = printllval(tcp, "%lld, ", argn);
+	}
+	return 0;
+}
+
 static const struct xlat inotify_modes[] = {
 	{ 0x00000001,	"IN_ACCESS"	},
 	{ 0x00000002,	"IN_MODIFY"	},
diff --git a/linux/dummy.h b/linux/dummy.h
index 9d33fe1..6af5ec7 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -47,8 +47,6 @@
 #define	sys_name_to_handle_at	printargs
 #define	sys_open_by_handle_at	printargs
 #define	sys_request_key		printargs
-#define	sys_sync_file_range	printargs
-#define	sys_sync_file_range2	printargs
 #define	sys_sysfs		printargs
 #define	sys_vm86old		printargs
 #define	sys_vm86		printargs
diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h
index c23ac14..a154d92 100644
--- a/linux/mips/syscallent-o32.h
+++ b/linux/mips/syscallent-o32.h
@@ -305,7 +305,7 @@
 	{ 5,	TD,	sys_ppoll,		"ppoll"		}, /* 4302 */
 	{ 1,	TP,	sys_unshare,		"unshare"	}, /* 4303 */
 	{ 6,	TD,	sys_splice,		"splice"	}, /* 4304 */
-	{ 6,	TD,	sys_sync_file_range,	"sync_file_range" }, /* 4305 */
+	{ 7,	TD,	sys_sync_file_range,	"sync_file_range" }, /* 4305 */
 	{ 4,	TD,	sys_tee,		"tee"		}, /* 4306 */
 	{ 4,	TD,	sys_vmsplice,		"vmsplice"	}, /* 4307 */
 	{ 6,	TM,	sys_move_pages,		"move_pages"	}, /* 4308 */
diff --git a/linux/syscall.h b/linux/syscall.h
index f6afcac..502e8eb 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -267,6 +267,8 @@ int sys_statfs64();
 int sys_stime();
 int sys_swapon();
 int sys_symlinkat();
+int sys_sync_file_range();
+int sys_sync_file_range2();
 int sys_sysctl();
 int sys_sysinfo();
 int sys_syslog();
-- 
1.7.10.4





More information about the Strace-devel mailing list