* Brian J. McGovern <[EMAIL PROTECTED]> [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 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/xxx i386
~/tst % find . | wc -l
99470
:)
--
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
"I have the heart of a child; I keep it in a jar on my desk."
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message