From: nick b. <da...@qe...> - 2008-12-21 22:18:27
|
Roland and other strace(1) authors: I was surprised to find -e trace=network didn't flag my sendfile(2) calls, despite the fact that "out_sd must be a socket" according to the manpage. Upon looking into strace's source code, I found that not only did the sendfile(2) system call lack the TN flag in all entries, it was erroneously using the TF flag in some. Clearly the TD flag is meant as opposed to TF; I've converted all declarations of sys_sendfile within linux/ to TD|TN, which I believe to be the optimal setup. Please accept this patch. Thanks for a great tool I've used for years! It's taken against Debian Unstable's 4.5.17+cvs080723. (patch also attached) --rigorously, nick diff -ur strace-4.5.17+cvs080723-orig/linux/alpha/syscallent.h strace-4.5.17+cvs080723/linux/alpha/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/alpha/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/alpha/syscallent.h 2008-12-21 16:35:08.000000000 -0500 @@ -398,7 +398,7 @@ { 2, 0, sys_getcwd, "getcwd" }, /* 367 */ { 2, 0, sys_capget, "capget" }, /* 368 */ { 2, 0, sys_capset, "capset" }, /* 369 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 370 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 370 */ { 3, 0, sys_setresgid, "setresgid" }, /* 371 */ { 3, 0, sys_getresgid, "getresgid" }, /* 372 */ { 4, 0, printargs, "dipc" }, /* 373, not implemented */ diff -ur strace-4.5.17+cvs080723-orig/linux/arm/syscallent.h strace-4.5.17+cvs080723/linux/arm/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/arm/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/arm/syscallent.h 2008-12-21 16:35:28.000000000 -0500 @@ -216,7 +216,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TF, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */ { 0, TP, sys_vfork, "vfork" }, /* 190 */ @@ -269,7 +269,7 @@ { 2, TF, sys_removexattr, "lremovexattr" }, /* 236 */ { 2, 0, sys_fremovexattr, "fremovexattr" }, /* 237 */ { 2, TS, sys_kill, "tkill" }, /* 238 */ - { 4, TF, sys_sendfile64, "sendfile64" }, /* 239 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 239 */ { 6, 0, sys_futex, "futex" }, /* 240 */ { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },/* 241 */ { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },/* 242 */ diff -ur strace-4.5.17+cvs080723-orig/linux/hppa/syscallent.h strace-4.5.17+cvs080723/linux/hppa/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/hppa/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/hppa/syscallent.h 2008-12-21 16:36:50.000000000 -0500 @@ -127,7 +127,7 @@ { 3, 0, sys_madvise, "madvise" }, /* 119 */ { 5, TP, sys_clone, "clone" }, /* 120 */ { 2, 0, sys_setdomainname, "setdomainname" }, /* 121 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 122 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 122 */ { 6, TN, sys_recvfrom, "recvfrom" }, /* 123 */ { 1, 0, sys_adjtimex, "adjtimex" }, /* 124 */ { 3, 0, sys_mprotect, "mprotect" }, /* 125 */ @@ -214,7 +214,7 @@ { 0, 0, printargs, "gettid" }, /* 206 */ { 4, TD, sys_readahead, "readahead" }, /* 207 */ { 2, TS, sys_kill, "tkill" }, /* 208 */ - { 4, TD, sys_sendfile, "sendfile64" }, /* 209 */ + { 4, TD|TN, sys_sendfile, "sendfile64" }, /* 209 */ { 6, 0, sys_futex, "futex" }, /* 210 */ { 3, 0, sys_sched_setaffinity, "sched_setaffinity" }, /* 211 */ { 3, 0, sys_sched_getaffinity, "sched_getaffinity" }, /* 212 */ diff -ur strace-4.5.17+cvs080723-orig/linux/ia64/syscallent.h strace-4.5.17+cvs080723/linux/ia64/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/ia64/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/ia64/syscallent.h 2008-12-21 16:34:36.000000000 -0500 @@ -993,7 +993,7 @@ { 2, TF, sys_getcwd, "getcwd" }, /* 1184 */ { 2, 0, sys_capget, "capget" }, /* 1185 */ { 2, 0, sys_capset, "capset" }, /* 1186 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 1187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 1187 */ { 5, TN, printargs, "getpmsg" }, /* 1188 */ { 5, TN, printargs, "putpmsg" }, /* 1189 */ { 3, TN, sys_socket, "socket" }, /* 1190 */ diff -ur strace-4.5.17+cvs080723-orig/linux/m68k/syscallent.h strace-4.5.17+cvs080723/linux/m68k/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/m68k/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/m68k/syscallent.h 2008-12-21 16:34:25.000000000 -0500 @@ -215,7 +215,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TF, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */ { 0, TP, sys_vfork, "vfork", SYS_vfork }, /* 190 */ diff -ur strace-4.5.17+cvs080723-orig/linux/mips/syscallent.h strace-4.5.17+cvs080723/linux/mips/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/mips/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/mips/syscallent.h 2008-12-21 16:38:24.000000000 -0500 @@ -4209,7 +4209,7 @@ { 2, 0, sys_capget, "capget" }, /* 4204 */ { 2, 0, sys_capset, "capset" }, /* 4205 */ { 2, TS, sys_sigaltstack, "sigaltstatck" }, /* 4206 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 4207 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 4207 */ { 0, 0, printargs, "SYS_4208" }, /* 4208 */ { 0, 0, printargs, "SYS_4209" }, /* 4209 */ { 6, 0, sys_mmap, "mmap" }, /* 4210 */ @@ -4239,7 +4239,7 @@ { 2, TF, sys_removexattr, "lremovexattr" }, /* 4234 */ { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 4235 */ { 2, TS, sys_kill, "tkill" }, /* 4236 */ - { 5, TD, sys_sendfile64, "sendfile64" }, /* 4237 */ + { 5, TD|TN, sys_sendfile64, "sendfile64" }, /* 4237 */ { 6, 0, sys_futex, "futex" }, /* 4238 */ { 3, 0, sys_sched_setaffinity, "sched_setaffinity"}, /* 4239 */ { 3, 0, sys_sched_getaffinity, "sched_getaffinity"}, /* 4240 */ @@ -4560,7 +4560,7 @@ { 2, TF, printargs, "o32_lremovexattr" }, /* 4234 */ { 2, TD, printargs, "o32_fremovexattr" }, /* 4235 */ { 2, TS, printargs, "o32_tkill" }, /* 4236 */ - { 5, TD, printargs, "o32_sendfile64" }, /* 4237 */ + { 5, TD|TN, printargs, "o32_sendfile64" }, /* 4237 */ { 6, 0, printargs, "o32_futex" }, /* 4238 */ { 3, 0, printargs, "o32_sched_setaffinity"}, /* 4239 */ { 3, 0, printargs, "o32_sched_getaffinity"}, /* 4240 */ @@ -5365,7 +5365,7 @@ { 3, 0, sys_setitimer, "setitimer" }, /* 5036 */ { 1, 0, sys_alarm, "alarm" }, /* 5037 */ { 0, 0, sys_getpid, "getpid" }, /* 5038 */ - { 4, TF, sys_sendfile, "sendfile" }, /* 5039 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 5039 */ { 2, 0, sys_socketcall, "socketcall" }, /* 5040 */ { 3, TN, sys_connect, "connect" }, /* 5041 */ { 3, TN, sys_accept, "accept" }, /* 5042 */ @@ -6591,7 +6591,7 @@ { 3, 0, sys_setitimer, "setitimer" }, /* 6036 */ { 1, 0, sys_alarm, "alarm" }, /* 6037 */ { 0, 0, sys_getpid, "getpid" }, /* 6038 */ - { 4, TF, sys_sendfile, "sendfile" }, /* 6039 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 6039 */ { 2, 0, sys_socketcall, "socketcall" }, /* 6040 */ { 3, TN, sys_connect, "connect" }, /* 6041 */ { 3, TN, sys_accept, "accept" }, /* 6042 */ @@ -6771,7 +6771,7 @@ { 0, 0, printargs, "fadvise64" }, /* 6216 */ { 0, 0, printargs, "statfs64" }, /* 6217 */ { 0, 0, printargs, "fstatfs64" }, /* 6218 */ - { 4, 0, printargs, "sendfile64" }, /* 6219 */ + { 4, TD|TN, printargs, "sendfile64" }, /* 6219 */ { 3, 0, printargs, "timer_create" }, /* 6220 */ { 4, 0, printargs, "timer_settime" }, /* 6221 */ { 2, 0, printargs, "timer_gettime" }, /* 6222 */ diff -ur strace-4.5.17+cvs080723-orig/linux/powerpc/syscallent.h strace-4.5.17+cvs080723/linux/powerpc/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/powerpc/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/powerpc/syscallent.h 2008-12-21 16:36:59.000000000 -0500 @@ -214,7 +214,7 @@ { 2, 0, sys_capget, "capget" }, /* 183 */ { 2, 0, sys_capset, "capset" }, /* 184 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 185 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 186 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 186 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 187 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 188 */ { 0, TP, sys_vfork, "vfork" }, /* 189 */ @@ -255,7 +255,7 @@ { 3, 0, sys_sched_getaffinity, "sched_getaffinity" }, /* 223 */ { 5, 0, printargs, "SYS_224" }, /* 224 */ { 5, 0, printargs, "tux" }, /* 225 */ - { 4, TD, sys_sendfile64, "sendfile64" }, /* 226 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 226 */ { 2, 0, sys_io_setup, "io_setup" }, /* 227 */ { 1, 0, sys_io_destroy, "io_destroy" }, /* 228 */ { 5, 0, sys_io_getevents, "io_getevents" }, /* 229 */ diff -ur strace-4.5.17+cvs080723-orig/linux/s390/syscallent.h strace-4.5.17+cvs080723/linux/s390/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/s390/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/s390/syscallent.h 2008-12-21 16:36:21.000000000 -0500 @@ -215,7 +215,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */ { 0, TP, sys_vfork, "vfork" }, /* 190 */ @@ -251,7 +251,7 @@ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */ { 3, TD, sys_fcntl, "fcntl64" }, /* 221 */ { 4, TD, sys_readahead, "readahead" }, /* 222 */ - { 4, TD, sys_sendfile64, "sendfile64" }, /* 223 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 223 */ { 5, TF, sys_setxattr, "setxattr" }, /* 224 */ { 5, TF, sys_setxattr, "lsetxattr" }, /* 225 */ { 5, TD, sys_fsetxattr, "fsetxattr" }, /* 226 */ diff -ur strace-4.5.17+cvs080723-orig/linux/s390x/syscallent.h strace-4.5.17+cvs080723/linux/s390x/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/s390x/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/s390x/syscallent.h 2008-12-21 16:36:15.000000000 -0500 @@ -214,7 +214,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */ { 0, TP, sys_vfork, "vfork" }, /* 190 */ @@ -250,7 +250,7 @@ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */ { -1, 0, printargs, "SYS_221" }, /* 221 */ { 4, TD, sys_readahead, "readahead" }, /* 222 */ - { 4, TD, sys_sendfile64, "sendfile64" }, /* 223 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 223 */ { 5, TF, sys_setxattr, "setxattr" }, /* 224 */ { 5, TF, sys_setxattr, "lsetxattr" }, /* 225 */ { 5, TD, sys_fsetxattr, "fsetxattr" }, /* 226 */ diff -ur strace-4.5.17+cvs080723-orig/linux/sh/syscallent.h strace-4.5.17+cvs080723/linux/sh/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/sh/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/sh/syscallent.h 2008-12-21 16:36:31.000000000 -0500 @@ -218,7 +218,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, printargs, "SYS_188" }, /* 188 */ { 5, 0, printargs, "SYS_189" }, /* 189 */ { 0, TP, sys_vfork, "vfork" }, /* 190 */ @@ -271,7 +271,7 @@ { 2, TF, sys_removexattr, "lremovexattr" }, /* 236 */ { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 237 */ { 2, TD, sys_kill, "tkill" }, /* 238 */ - { 5, TD, sys_sendfile64, "sendfile64" }, /* 239 */ + { 5, TD|TN, sys_sendfile64, "sendfile64" }, /* 239 */ { 6, 0, sys_futex, "futex" }, /* 240 */ { 3, 0, sys_sched_setaffinity, "sched_setaffinity"}, /* 241 */ { 3, 0, sys_sched_getaffinity, "sched_getaffinity"}, /* 242 */ diff -ur strace-4.5.17+cvs080723-orig/linux/sh64/syscallent.h strace-4.5.17+cvs080723/linux/sh64/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/sh64/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/sh64/syscallent.h 2008-12-21 16:33:31.000000000 -0500 @@ -215,7 +215,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, printargs, "SYS_188" }, /* 188 */ { 5, 0, printargs, "SYS_189" }, /* 189 */ { 0, TP, sys_vfork, "vfork" }, /* 190 */ diff -ur strace-4.5.17+cvs080723-orig/linux/sparc/syscallent.h strace-4.5.17+cvs080723/linux/sparc/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/sparc/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/sparc/syscallent.h 2008-12-21 16:35:47.000000000 -0500 @@ -37,7 +37,7 @@ { 0, 0, sys_sync, "sync" }, /* 36 */ { 2, TS, sys_kill, "kill" }, /* 37 */ { 2, TF, sys_stat, "stat" }, /* 38 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 39 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 39 */ { 2, TF, sys_lstat, "lstat" }, /* 40 */ { 2, TD, sys_dup, "dup" }, /* 41 */ { 0, TD, sys_pipe, "pipe" }, /* 42 */ @@ -138,7 +138,7 @@ { 1, TF, sys_rmdir, "rmdir" }, /* 137 */ { 2, TF, sys_utimes, "utimes" }, /* 138 */ { 2, TF, sys_stat64, "stat64" }, /* 139 */ - { 4, TD, sys_sendfile64, "sendfile64" }, /* 140 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 140 */ { 3, TN, sys_getpeername,"getpeername" }, /* 141 */ { 6, 0, sys_futex, "futex" }, /* 142 */ { 0, 0, printargs, "gettid" }, /* 143 */ diff -ur strace-4.5.17+cvs080723-orig/linux/syscallent.h strace-4.5.17+cvs080723/linux/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/syscallent.h 2008-12-21 16:36:04.000000000 -0500 @@ -216,7 +216,7 @@ { 2, 0, sys_capget, "capget" }, /* 184 */ { 2, 0, sys_capset, "capset" }, /* 185 */ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 187 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */ { 0, TP, sys_vfork, "vfork", SYS_vfork }, /* 190 */ @@ -269,7 +269,7 @@ { 2, TF, sys_removexattr, "lremovexattr" }, /* 236 */ { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 237 */ { 2, TS, sys_kill, "tkill" }, /* 238 */ - { 4, TD, sys_sendfile64, "sendfile64" }, /* 239 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 239 */ { 6, 0, sys_futex, "futex" }, /* 240 */ { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },/* 241 */ { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },/* 242 */ diff -ur strace-4.5.17+cvs080723-orig/linux/x86_64/syscallent.h strace-4.5.17+cvs080723/linux/x86_64/syscallent.h --- strace-4.5.17+cvs080723-orig/linux/x86_64/syscallent.h 2008-12-21 16:31:53.000000000 -0500 +++ strace-4.5.17+cvs080723/linux/x86_64/syscallent.h 2008-12-21 16:32:57.000000000 -0500 @@ -38,7 +38,7 @@ { 1, 0, sys_alarm, "alarm" }, /* 37 */ { 3, 0, sys_setitimer, "setitimer" }, /* 38 */ { 0, 0, sys_getpid, "getpid" }, /* 39 */ - { 4, TD, sys_sendfile, "sendfile" }, /* 40 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 40 */ { 3, TN, sys_socket, "socket" }, /* 41 */ { 3, TN, sys_connect, "connect" }, /* 42 */ { 3, TN, sys_accept, "accept" }, /* 43 */ -- nick black <dan...@ac...> Principal Engineer, McAfee Research Grad student, Georgia Tech College of Computing "NP: The class of dashed hopes, and idle dreams" |