Date: Thu, 11 Jan 2001 12:21:47 -0800 From: Alfred Perlstein <bright@wintelcom.net> To: "Brian J. McGovern" <bmcgover@cisco.com> Cc: hackers@FreeBSD.ORG Subject: Re: Question about 'open' files.... Message-ID: <20010111122147.E7240@fw.wintelcom.net> In-Reply-To: <200101112005.f0BK5T406464@bmcgover-pc.cisco.com>; from bmcgover@cisco.com on Thu, Jan 11, 2001 at 03:05:29PM -0500 References: <200101112005.f0BK5T406464@bmcgover-pc.cisco.com>
next in thread | previous in thread | raw e-mail | index | archive | help
* Brian J. McGovern <bmcgover@cisco.com> [010111 12:06] wrote: > I'm doing some tests for Greg on vinum (trying to crash it), and I've run > across a problem that is not particular to vinum. I'm hoping someone can > explain it to me and/or tell me how to work around it. > > Using the code fragment (note: The code I'm using is actually more complex, > and checks for errors in opening, writing, etc, but I'm keeping it basic > for the discussion): > > for (counter = 0; counter < 20000; counter++) > { > x = open(filename,O_CREAT | O_WRONLY); > write(x, buffer, size); > close(x); > } ok, I tried this: ~/tst % cat t.c #include <fcntl.h> int main(int argc, char **argv) { int x, i, counter; char buf[200]; char buffer[2048]; memset(buffer, '%', sizeof(buffer)); for (counter = 0; counter < 20000; counter++) { sprintf(buf, "%s/%d", argv[1], counter); x = open(buf,O_CREAT | O_WRONLY); if (x == -1) { perror("open"); exit(1); } write(x, buffer, sizeof(buffer)); close(x); } return 0; } mkdir a b c d e f g h for i in a b c d e f g h ; do ./a.out $i & ; done ~/tst % find . | wc -l 74246 Looks like your test program has a bug. Can you try to reduce it down to a reproduceable case? FreeBSD xxx.wintelcom.net 4.2-STABLE FreeBSD 4.2-STABLE #0: Wed Jan 10 19:58:03 PST 2001 bright@xxx.wintelcom.net:/usr/obj/usr/src/sys/xxx i386 ~/tst % find . | wc -l 99470 :) -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." 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?20010111122147.E7240>