Take a look at the manpage for setrlimit (which ulimit uses to implement it's functionality). On my system this says
RLIMIT_FSIZE
The maximum size of files that the process may create. Attempts to extend a file beyond this limit result in delivery of a SIGXFSZ signal. By default, this signal terminates a process, but a process can catch this signal instead, in which case the relevant system call (e.g., write(), truncate()) fails with the error EFBIG.
So in order to prevent your program from terminating you need to catch the SIGXFSZ signal, either by setting local $SIG{XFSZ}=IGNORE or by doing something more fancy, aka
(BTW, jmcnamara's suggestion is a very good one and will also give you more realistic results than using ulimit, because ulimit will fail your process with an EFBIG error, whereas /dev/full returns ENOSPC, just as a full filesystem would).local $SIG{XFSZ}=sub { print STDERR "Caught SIGXFSZ" };
In reply to Re: perl/linux ulimit -f question
by tirwhan
in thread perl/linux ulimit -f question
by egunnar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |