3 ms·
> - Unit file updates are not needed because of (complex non-portable workaround for atomic file replacement). I agree with all your points except this. What
by daurnimator 10y ago
> - Unit file updates are not needed because of (complex non-portable workaround for atomic file replacement).
I agree with all your points except this.
What is wrong with creating the file somewhere else and using rename() to atomically overwrite?
- FooBarWidget 10y agoBecause that is not portable and/or has performance problems. I'm not kidding you. I know the conventional wisdom is that a rename is enough. It is not. Depending on the filesystem, you may have to fsync() the directory entry too, or fsync the parent directory entry too. Or on other filesystems, don't do these because doing these may cause problems. And do all this in the right order, because if you get it slightly wrong then it doesn't do what you want in the event of a crash. The problem is maddening. There is an article out there that explains all this in much more detail. I think it is this one but I don't quite remember whether it is the same as the one I read: http://blog.httrack.com/blog/2013/11/15/everything-you-always-wanted-to-know-about-fsync/ http://blog.httrack.com/blog/2013/11/15/everything-you-alway... The performance problem comes from the fact that you need two fscyncs.