Quantcast
Channel: how standard specify atomic write to regular file(not pipe or fifo)? - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by jtchitty for how standard specify atomic write to regular file(not...

One way to interleave them safely would be to have all writers lock the file, write, and unlock.Functions that can be used for locking are flock(), lockf(), and fcntl().Beware that ALL writers must...

View Article



Answer by Santeri Paavolainen for how standard specify atomic write to...

Quote from http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm (Single UNIX Specification, Version 4, 2010 Edition):This volume of POSIX.1-2008 does not specify behavior of concurrent writes to a...

View Article

Answer by Lyle Malik for how standard specify atomic write to regular...

I think this is useful to you: "the data written by writev() is written as a single block that is not intermingled with output from writes in other processes", so you can use writev

View Article

Answer by Wes Miller for how standard specify atomic write to regular...

There is the ultimate solut8ion to all questions of atomicity; a mutex. Wrap your writes to the log file in a mutex and all will be done atomically. A simpler solution might be to use the GLOG...

View Article

Answer by AProgrammer for how standard specify atomic write to regular...

Several writers to a file may mix up things. But files opened with O_APPEND are appended atomically per write access.If you want to keep to the C stdio interface instead of the lower level one, fopene...

View Article


how standard specify atomic write to regular file(not pipe or fifo)?

The posix standard specified that when write less than PIPE_BUF bytes to pipe or FIFO are granted atomic, that is, our write doesn't mix with other processes'. But I failed to find out how standard...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images