ulimit and what it is useful for
John Woods
john at frog.UUCP
Wed Apr 26 09:53:00 AEST 1989
Subject: Re: ulimit (was: getty/login for callback)
Newsgroups: alt.flame
References: <180001 at mechp10.UUCP> <13853 at rpp386.Dallas.TX.US> <797 at twwells.uucp> <863 at twwells.uucp>
In article <863 at twwells.uucp>, bill at twwells.uucp (T. William Wells) writes:
> In article <1295 at frog.UUCP> john at frog.UUCP (SuperUser) writes:
> : However, using ulimit() to test that makes it harder to discover that your
> : application recovers from that by creating another file and logging a message
> : to it.
> Huh? If ulimit causes a failure, one can always create or extend
> another file, so long as that file is smaller than the ulimit.
That was my point. ulimit() is useless in general for testing the
full-filesystem condition because it is a per-file OFFSET limit.
If your application recovers from an out-of-space condition by logging
a message to another file, it had better watch out for another out-of-space
condition -- and ulimit() is NOT a convenient way to test that.
(ulimit() gripe number two:
f = creat("foo", 0666);
lseek(f, 12*1024*1024, 0);
write(f, "bar", 3);
close(f);
The preceeding sequence creates a file occupying one data block plus
2 indirect blocks. Why does a 1Mb ulimit() prevent it from working?
Answer: ulimit() was badly thought out).
> : If you aren't going to buy enough hardware to properly test your software,
> : why bother with testing at all?
>
> Don't be silly. All test environments are deficient in some way or
> another. It's called cost. And practicality. It is wholly useless to
> argue that one should have extra hardware to test an error condition
> when it is entirely possible and extremely easy to simulate the error
> condition using software.
>
An easy way to test the out-of-space condition is to make a small disk
partition and fill it quickly, on a development machine where no-one will
complain that you have filled a disk partition. A wrong way to test
it is to use ulimit().
I apologize for the perceived tone of my posting. But the statement that
ulimit() is useful for testing filesystem-full conditions is plainly false.
ulimit() is solely useful for testing the ulimit-exceeded condition.
--
John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu
More information about the Comp.bugs.sys5
mailing list