[comp.bugs.sys5] ulimit and what it is useful for

john@frog.UUCP (John Woods) (04/26/89)

Subject: Re: ulimit (was: getty/login for callback)
Newsgroups: alt.flame
References: <180001@mechp10.UUCP> <13853@rpp386.Dallas.TX.US> <797@twwells.uucp> <863@twwells.uucp>

In article <863@twwells.uucp>, bill@twwells.uucp (T. William Wells) writes:
> In article <1295@frog.UUCP> john@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@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu

pat@mslanpar (Pat R. Calhoun) (05/03/89)

I Believe I have figured out why SYS V has a ulimit() implemented, It was
designed to keep this newsgroup active :-)



-- 
"Communism is but a cancer in the fibers of Democracy!" - me

	_^_ |||			Pat "King of the Trenches" Calhoun
       <o o> |			Technical Support Group, Lanpar Technologies
      /\/\/\/\/\	UUCP:   ...!attcan!nebulus!tslanpar!mslanpar
		  DISCLAIMER:   "Read the DAMN manual, I don't need this SHIT!!"