News for hackers. Stuff that matters.
Re:Working with Files Is Hard (2019) by Joker_vD on Thursday January 23, 2025 @02:59PM (#42807465)
> Most applications can get by with file-level atomicity--make whole file read/writes atomic with a copy-on-write model, and you can eliminate whole classes of filesystem bugs pretty quickly.

    int fd = open(".config", O_RDWR | O_CREAT | O_SYNC_ON_CLOSE, 0o666);

    // effects of calls to write(2)/etc. are invisible through any other file description
    // until the close(2) is called on all descriptors to this file description.

    close(fd);
So now you can watch for e.g. either IN_MODIFY or IN_CLOSE_WRITE (and you don't need to balance it with IN_OPEN), it doesn't matter, you'll never see partial updates... would be nice!
Re:Working with Files Is Hard (2019) by BobbyTables2 on Thursday January 23, 2025 @07:46PM (#42809513)
Surely this can’t always be true?

What happens when a lot of data is written and exceeds the dirty threshold?

Re:Working with Files Is Hard (2019) by Joker_vD on Thursday January 23, 2025 @10:25PM (#42810189)
It gets written on the disk but into different inodes, I imagine.