Date: Mon, 10 Sep 2001 20:41:34 +0100 From: David Taylor <davidt@yadt.co.uk> To: Jonathan Lemon <jlemon@flugsvamp.com> Cc: kent@erix.ericsson.se, hackers@freebsd.org Subject: Re: How to force small TCP packets? Message-ID: <20010910204134.A65177@gattaca.yadt.co.uk> In-Reply-To: <200109101817.f8AIH7t11927@prism.flugsvamp.com>; from jlemon@flugsvamp.com on Mon, Sep 10, 2001 at 13:17:07 -0500 References: <local.mail.freebsd-hackers/d2y9nogetm.fsf@erix.ericsson.se>, <local.mail.freebsd-hackers/20010909182745.O2965@elvis.mu.org> <local.mail.freebsd-hackers/d2heubk4p2.fsf@erix.ericsson.se> <200109101817.f8AIH7t11927@prism.flugsvamp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 10 Sep 2001, Jonathan Lemon wrote: > One thing you might want to try doing is to write your own read() > function and link against that. Your modified version could then > replace the nbytes value with something smaller, for debugging purposes. Infact, when I saw this thread I whipped up a simple .so to override the syscalls to test a network program of my own, and it helpfully found a obscure bug where I wasn't correctly using the return value from read().. The main problem with the below code is that it unconditionally reads X bytes at a time. You might want to override socket/close (and maybe dup too, if the code does things like that) so you're only restricting syscalls on sockets. Or make a is_socket() function that does some runtime test I can't think of to figure out what to do... (compile using something like: gcc -fPIC -shared -O2 -g test.c -o test.so; use with something like: LD_PRELOAD=/path/to/test.so /your/program/bin/blah) #define NBYTES 1 ssize_t read(int d, void *buf, size_t nbytes) { return syscall(SYS_read, d, buf, ((nbytes<NBYTES) ? nbytes : NBYTES)); } ssize_t write(int d, const void *buf, size_t nbytes) { return syscall(SYS_write, d, buf, ((nbytes<NBYTES) ? nbytes : NBYTES)); } -- David Taylor davidt@yadt.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010910204134.A65177>