[Melbourne-pm] Error checks without packages

Sam Watkins sam at nipl.net
Wed Jul 27 19:14:47 PDT 2011

Tim Hogard wrote:
> cant print out 0 No space left on device

I think stdio will lose data if there is an IO error on write, which is not
good.  Or does it stay in the (opaque) buffer?  If so, perhaps freopen could
save the data.  I think perl has access to freopen via open() or something.

It 'should' be possible to copy off the existing file somewhere else, then
retry writing the stdio buffer.

Two processes writing at the same time will stuff up that plan.  I suggest use
a single 'logging' process which manages this complexity, if you really want to
do it, and get your other processes to log through it.

If you really want reliable write, I suggest writing to several remote systems
on the network which will both save the data.  Bonus: ack is faster than sync,
and can be handled asynchronously!

Write / find a perl module to 'portably' check for low disk space condition?

It might be nice if 'disk full' caused a process to stop and wait for help
rather than to die.


More information about the Melbourne-pm mailing list