From: Lennert B. <bu...@gn...> - 2003-04-11 14:29:00
|
(Please CC on replies, I'm not on the list.) SIOCOUTQ is an ioctl that, when called on a socket, returns the number of bytes currently in that socket's send buffer. It writes this value as an int to the memory location indicated by the third argument of ioctl(2). Below is a trvial patch that implements support for this ioctl, and corrects some text in README_MISSING_SYSCALL_OR_IOCTL. diff -urN valgrind-1.9.5-orig/README_MISSING_SYSCALL_OR_IOCTL valgrind-1.9.5/README_MISSING_SYSCALL_OR_IOCTL --- valgrind-1.9.5-orig/README_MISSING_SYSCALL_OR_IOCTL Fri Mar 22 02:29:21 2002 +++ valgrind-1.9.5/README_MISSING_SYSCALL_OR_IOCTL Fri Apr 11 16:10:39 2003 @@ -12,7 +12,7 @@ there's not a lot of need to distinguish them (at least conceptually) in the discussion that follows. -All this machinery is in vg_syscall_mem.c. +All this machinery is in coregrind/vg_syscalls.c. What are syscall/ioctl wrappers? What do they do? @@ -141,12 +141,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Is pretty much the same as writing syscall wrappers. -If you can't be bothered, do a cheap hack: add it (the ioctl number -emitted in Valgrind's panic-message) to the long list of IOCTLs which -are noted but not fully handled by Valgrind (search for the text -"noted but unhandled ioctl" in vg_syscall_mem.c). This will get you -going immediately, at the risk of giving you spurious value errors. - As above, please do send me the resulting patch. diff -urN valgrind-1.9.5-orig/coregrind/vg_syscalls.c valgrind-1.9.5/coregrind/vg_syscalls.c --- valgrind-1.9.5-orig/coregrind/vg_syscalls.c Fri Apr 4 00:44:27 2003 +++ valgrind-1.9.5/coregrind/vg_syscalls.c Fri Apr 11 16:13:41 2003 @@ -2010,7 +2010,7 @@ arg3, sizeof(int) ); KERNEL_DO_SYSCALL(tid,res); break; - case FIONREAD: + case FIONREAD: /* identical to SIOCINQ */ SYSCALL_TRACK( pre_mem_write, tst, "ioctl(FIONREAD)", arg3, sizeof(int) ); KERNEL_DO_SYSCALL(tid,res); @@ -2152,6 +2152,13 @@ if (!VG_(is_kerror)(res) && res == 0) VG_TRACK( post_mem_write,arg3, sizeof(struct timeval)); break; + case SIOCOUTQ: + SYSCALL_TRACK( pre_mem_write,tst, "ioctl(SIOCOUTQ)", arg3, + sizeof(int)); + KERNEL_DO_SYSCALL(tid,res); + if (!VG_(is_kerror)(res) && res == 0) + VG_TRACK( post_mem_write,arg3, sizeof(int)); + break; case SIOCGRARP: /* get RARP table entry */ case SIOCGARP: /* get ARP table entry */ SYSCALL_TRACK( pre_mem_write,tst, "ioctl(SIOCGARP)", arg3, diff -urN valgrind-1.9.5-orig/coregrind/vg_unsafe.h valgrind-1.9.5/coregrind/vg_unsafe.h --- valgrind-1.9.5-orig/coregrind/vg_unsafe.h Sat Oct 5 17:18:27 2002 +++ valgrind-1.9.5/coregrind/vg_unsafe.h Fri Apr 11 16:13:58 2003 @@ -41,6 +41,7 @@ #include <sys/resource.h> /* for struct rlimit */ #include <linux/shm.h> /* for struct shmid_ds & struct ipc_perm */ #include <sys/socket.h> /* for struct msghdr */ +#include <linux/sockios.h> /* for SIOCOUTQ */ #include <sys/un.h> /* for sockaddr_un */ #include <net/if.h> /* for struct ifreq et al */ #include <net/if_arp.h> /* for struct arpreq */ |