0

I learned that O_APPEND is atomic, and from this question I knew that O_APPEND is atomic when size below PIPE_BUF.

But, why? Before write append, the current file offset must be updated to the end of file, how to graduate the two operation is atomic?

Thanks for your answer.

jfxu
  • 690
  • 1
  • 5
  • 15
  • 1
    Ultimately using locks or similar mutual exclusion facilities. Basically the write in append mode is submitted as a single operation to the kernel which then provides the necessary interlocks to insure that the operation on the same file are indivisible. Beware that the atomicity is more of a best-effort service and may fail for network file-systems and the like. – doynax Jul 24 '17 at 11:45
  • @doynax Thanks a lot ! – jfxu Jul 24 '17 at 11:58

0 Answers0