From owner-freebsd-hackers Thu Jan 11 12:26:49 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from funnel.cisco.com (funnel.cisco.com [161.44.131.24]) by hub.freebsd.org (Postfix) with ESMTP id 0AFF237B6A0 for ; Thu, 11 Jan 2001 12:26:27 -0800 (PST) Received: from bmcgover-pc.cisco.com (bmcgover-pc.cisco.com [161.44.133.25]) by funnel.cisco.com (8.8.5-Cisco.1/8.6.5) with ESMTP id PAA20639; Thu, 11 Jan 2001 15:26:21 -0500 (EST) Received: from bmcgover-pc.cisco.com (localhost [127.0.0.1]) by bmcgover-pc.cisco.com (8.11.1/8.11.1) with ESMTP id f0BKQJ406592; Thu, 11 Jan 2001 15:26:20 -0500 (EST) (envelope-from bmcgover@bmcgover-pc.cisco.com) Message-Id: <200101112026.f0BKQJ406592@bmcgover-pc.cisco.com> To: Alfred Perlstein Cc: "Brian J. McGovern" , hackers@FreeBSD.ORG Subject: Re: Question about 'open' files.... In-reply-to: Your message of "Thu, 11 Jan 2001 12:21:47 PST." <20010111122147.E7240@fw.wintelcom.net> Date: Thu, 11 Jan 2001 15:26:19 -0500 From: "Brian J. McGovern" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 [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 > 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