Date: Thu, 11 Jan 2001 15:26:19 -0500 From: "Brian J. McGovern" <bmcgover@cisco.com> To: Alfred Perlstein <bright@wintelcom.net> Cc: "Brian J. McGovern" <bmcgover@cisco.com>, hackers@FreeBSD.ORG Subject: Re: Question about 'open' files.... Message-ID: <200101112026.f0BKQJ406592@bmcgover-pc.cisco.com> In-Reply-To: Your message of "Thu, 11 Jan 2001 12:21:47 PST." <20010111122147.E7240@fw.wintelcom.net>
index | next in thread | previous in thread | raw e-mail
Just for chuckles, try them in the same directory. That will emulate what
I've been doing here when having problems.
-Brian
> * 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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101112026.f0BKQJ406592>
