Source file
src/internal/poll/fd_fsync_darwin.go
1
2
3
4
5 package poll
6
7 import (
8 "errors"
9 "internal/syscall/unix"
10 "syscall"
11 )
12
13
14
15
16 func (fd *FD) Fsync() error {
17 if err := fd.incref(); err != nil {
18 return err
19 }
20 defer fd.decref()
21 return ignoringEINTR(func() error {
22 _, err := unix.Fcntl(fd.Sysfd, syscall.F_FULLFSYNC, 0)
23
24
25
26
27 if err != nil && errors.Is(err, syscall.ENOTSUP) {
28 err = syscall.Fsync(fd.Sysfd)
29 }
30 return err
31 })
32 }
33
View as plain text