diff options
| author | Clément Chigot <chigot.c@gmail.com> | 2020-09-14 13:06:40 +0200 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2020-09-14 17:07:47 +0000 |
| commit | 86dbeefe1f2770daad3c8d8b46a8b7f21b2c69e1 (patch) | |
| tree | caffb64077b93f080047faaf5cfd65bdb9108c95 /src/syscall/syscall_aix.go | |
| parent | 4f5cd0c0331943c7ec72df3b827d972584f77833 (diff) | |
| download | go-86dbeefe1f2770daad3c8d8b46a8b7f21b2c69e1.tar.xz | |
syscall: fix fsync for read-only files on aix
AIX fsync syscall doesn't work on read-only files. Using fsync_range
instead allows syscall.Fsync to work on any files.
Fixes #41372
Change-Id: I66d33e847875496af53da60828c1bddf6c2b76b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/254657
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall/syscall_aix.go')
| -rw-r--r-- | src/syscall/syscall_aix.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go index 8bb5fa9ead..8837dd5a7f 100644 --- a/src/syscall/syscall_aix.go +++ b/src/syscall/syscall_aix.go @@ -214,6 +214,11 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, return } +//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range +func Fsync(fd int) error { + return fsyncRange(fd, O_SYNC, 0, 0) +} + /* * Socket */ @@ -600,7 +605,6 @@ func PtraceDetach(pid int) (err error) { return ptrace64(PT_DETACH, int64(pid), //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatfs(fd int, buf *Statfs_t) (err error) //sys Ftruncate(fd int, length int64) (err error) -//sys Fsync(fd int) (err error) //sysnb Getgid() (gid int) //sysnb Getpid() (pid int) //sys Geteuid() (euid int) |
