in reply to (tye)Re: Those fork()ing flock()ers...
in thread Those fork()ing flock()ers...
So, syswrite() and/or the underlying "write" system call is/are atomic?
Isn't it possible for syswrite() to write less than the whole data it's told to write? If so, then how is this different than using auto-flush and writing with a print() call to the filehandle?
(at some level, aren't you going to run into a size limitation which prevents write() from completing the write atomically due to hardware buffering or something? Or is that sort of like saying, "eventually it'll fail when the earth falls into the sun"?)
Thanks. This might be just the solution I was looking for, but I don't think I understand syswrite() and the write() system call well enough to know for sure :)
Alan
Update:
Looking in Programming Perl, I think this doesn't totally solve the problem. It gives me control in cases where a full write can't be done, but it doesn't prevent this from happening:
You must be prepared to handle the problems that standard I/O normally handles for you, such as partial writes.
(if it Happens To Work with syswrite, that may only be for the same reason it Happens To Work when I use stdio and no locking...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re2: Those fork()ing flock()ers...
by tye (Sage) on Dec 05, 2001 at 02:53 UTC | |
by ferrency (Deacon) on Dec 05, 2001 at 19:26 UTC |