
- Linux System Calls
- Linux System Calls - Home
- A
- accept
- access
- acct
- add_key
- adjtimex
- afs_syscall
- alarm
- alloc_hugepages
- arch_prctl
- B
- bdflush
- bind
- break
- brk
- C
- cacheflush
- chdir
- chmod
- chown
- chroot
- clone2
- clone
- close
- connect
- create_module
- creat
- D
- dup2
- dup
- E
- epoll_create
- epoll_ctl
- epoll_wait
- execve
- exit_group
- _exit
- exit
- _Exit
- F
- faccessat
- fattch
- fchdir
- fchmodat
- fchmod
- fchownat
- fchown
- fcntl
- fdatasync
- fdetach
- flock
- fork
- free_hugepages
- fstatat
- fstatfs
- fstat
- fstatvfs
- fsync
- ftruncate
- futex
- futimesat
- G
- getcontext
- getcwd
- getdents
- getdomainname
- getdtablesize
- getegid
- geteuid
- getgid
- getgroups
- gethostid
- gethostname
- getitimer
- get_kernel_syms
- get_mempolicy
- getmsg
- getpagesize
- getpeername
- getpgid
- getpgrp
- getpid
- getpmsg
- getppid
- getpriority
- getresgid
- getresuid
- getrlimit
- get_robust_list
- getrusage
- getsid
- getsockname
- getsockopt
- get_thread_area
- gettid
- gettimeofday
- getuid
- getunwind
- gtty
- I
- idle
- inb
- inb_p
- init_module
- inl
- inl_p
- inotify_add_watch
- inotify_init
- inotify_rm_watch
- insb
- insl
- insw
- intro
- inw
- inw_p
- io_cancel
- ioctl
- ioctl_list
- io_destroy
- io_getevents
- ioperm
- iopl
- ioprio_get
- ioprio_set
- io_setup
- io_submit
- ipc
- isastream
- K
- kexec_load
- keyctl
- kill
- killpg
- L
- lchown
- linkat
- link
- listen
- _llseek
- llseek
- lock
- lookup_dcookie
- lseek
- lstat
- M
- madvise
- mincore
- mkdirat
- mkdir
- mknodat
- mknod
- mlockall
- mlock
- mmap2
- mmap
- modify_ldt
- mount
- move_pages
- mprotect
- mpx
- mq_getsetattr
- mremap
- msgctl
- msgget
- msgop
- msgrcv
- msgsnd
- msync
- multiplexer
- munlockall
- munlock
- munmap
- N
- nanosleep
- _newselect
- nfsservctl
- nice
- O
- obsolete
- oldfstat
- oldlstat
- oldolduname
- oldstat
- olduname
- openat
- open
- outb
- outb_p
- outl
- outl_p
- outsb
- outsl
- outsw
- outw
- outw_p
- P
- path_resolution
- pause
- perfmonctl
- personality
- pipe
- pivot_root
- poll
- posix_fadvise
- ppoll
- prctl
- pread
- prof
- pselect
- ptrace
- putmsg
- putpmsg
- pwrite
- Q
- query_module
- quotactl
- R
- readahead
- readdir
- read
- readlinkat
- readlink
- readv
- reboot
- recvfrom
- recv
- recvmsg
- remap_file_pages
- renameat
- rename
- request_key
- restart_syscall
- rmdir
- rtas
- rt_sigaction
- rt_sigpending
- rt_sigprocmask
- rt_sigqueueinfo
- rt_sigreturn
- rt_sigsuspend
- rt_sigtimedwait
- S
- sbrk
- sched_getaffinity
- sched_getparam
- sched_get_priority_max
- sched_get_priority_min
- sched_getscheduler
- sched_rr_get_interval
- sched_setaffinity
- sched_setparam
- sched_setscheduler
- sched_yield
- security
- select
- select_tut
- semctl
- semget
- semop
- semtimedop
- sendfile
- send
- sendmsg
- sendto
- setcontext
- setdomainname
- setegid
- seteuid
- setfsgid
- setfsuid
- setgid
- setgroups
- sethostid
- sethostname
- setitimer
- setpgid
- setpgrp
- setpriority
- setregid
- setresgid
- setresuid
- setreuid
- setrlimit
- set_robust_list
- setsid
- setsockopt
- set_thread_area
- set_tid_address
- settimeofday
- setuid
- setup
- sgetmask
- shmat
- shmctl
- shmdt
- shmget
- shmop
- shutdown
- sigaction
- sigaltstack
- signal
- sigpending
- sigprocmask
- sigqueue
- sigreturn
- sigsuspend
- sigtimedwait
- sigwaitinfo
- socketcall
- socket
- socketpair
- splice
- spu_create
- spufs
- spu_run
- ssetmask
- statfs64
- statfs
- stat
- statvfs
- stime
- stty
- swapcontext
- swapoff
- swapon
- symlinkat
- symlink
- sync_file_range
- sync
- _syscall
- syscall
- syscalls
- _sysctl
- sysctl
- sysfs
- sysinfo
- syslog
- T
- tee
- tgkill
- time
- timer_create
- timer_delete
- timer_getoverrun
- timer_gettime
- timer_settime
- times
- tkill
- truncate
- tux
- U
- umask
- umount2
- umount
- uname
- undocumented
- unimplemented
- unlinkat
- unlink
- unshare
- uselib
- ustat
- utime
- utimes
- V
- vfork
- vhangup
- vm86
- vm86old
- vmsplice
- vserver
- W
- wait3
- wait4
- wait
- waitid
- waitpid
- write
- writev
sync() System Call in Linux
NAME
sync - commit buffer cache to diskSYNOPSIS
#include <unistd.h>void sync(void);
DESCRIPTION
sync() first commits inodes to buffers, and then buffers to disk.ERRORS
This function is always successful.CONFORMING TO
SVr4, 4.3BSD, POSIX.1-2001.BUGS
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done. However, since version 1.3.20 Linux does actually wait. (This still does not guarantee data integrity: modern disks have large caches.)NOTES
Since glibc 2.2.2 the Linux prototype is as listed above, following the various standards. In libc4, libc5, and glibc up to 2.2.1 it was "int sync(void)", and sync() always returned 0.SEE ALSO
Advertisements