sync(2) System Calls Manual sync(2) sync, syncfs - C (libc, -lc) #include void sync(void); int syncfs(int fd); glibc (. feature_test_macros(7)): sync(): _XOPEN_SOURCE >= 500 || /* glibc 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _BSD_SOURCE syncfs(): _GNU_SOURCE sync() . syncfs() sync(), , , fd. syncfs() 0. -1, errno . sync() . syncfs() , , : EBADF fd . EIO An error occurred during synchronization. This error may relate to data written to any file on the filesystem, or on metadata related to the filesystem itself. ENOSPC . ENOSPC EDQUOT Data was written to a file on NFS or another filesystem which does not allocate space at the time of a write(2) system call, and some previous write failed due to insufficient storage space. ( POSIX.1-2001), sync() , . Linux - sync() syncfs() fsync() , . sync() POSIX.1-2008. syncfs() Linux. sync() POSIX.1-2001, SVr4, 4.3BSD. syncfs() Linux 2.6.39, glibc 2.14. glibc 2.2.2 Linux- sync() . glibc 2.21 <> sync() 0. In mainline kernel versions prior to Linux 5.8, syncfs() will fail only when passed a bad file descriptor (EBADF). Since Linux 5.8, syncfs() will also report an error if one or more inodes failed to be written back since the last syncfs() call. Before Linux 1.3.20, Linux did not wait for I/O to complete before returning. sync(1), fdatasync(2), fsync(2) () Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 2 2024 . sync(2)