I am working with a program that uses qdbm to store a repository of key values (qdbm is associated with the program). In some cases, the process places the value in the qdbm database and then restarts by calling an external init script (via system ()). It seems that sometimes the value written to the qdbm database is not actually stored, and I wonder if this could be due to the fact that the data is not cleared to disk before the process is killed through SIGTERM.
Since qdbm writes using the write () system call (for example, the library function fwrite ()), I think the Linux kernel should know in order to ultimately flush everything to disk (the system does not restart, just a process). In addition, close () is called on FD before the process is killed.
So, is my understanding correct, or do I need to add some fdatasync () or similar calls somewhere there? References to authoritative references to semantics would also be appreciated.
source share