From f9813515c02ac49d350cd3736f8e44cdd5786070 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Mon, 6 Jan 2020 01:48:43 +1100 Subject: [PATCH] syscall: provide Renameat as a wrapper around renameat2 on riscv64 linux/riscv64 does not provide a renameat syscall and there is no SYS_RENAMEAT defined in the syscall package. Provide Renameat as a wrapper around renameat2 instead. Updates #27532 Change-Id: I4864bdf0055e4272920583dcfb0efe2fd40adcbc Reviewed-on: https://go-review.googlesource.com/c/go/+/212762 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Tobias Klauser --- src/syscall/syscall_linux_riscv64.go | 6 +++++- src/syscall/zsyscall_linux_riscv64.go | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/syscall/syscall_linux_riscv64.go b/src/syscall/syscall_linux_riscv64.go index 4635490b9c..61e9c60e70 100644 --- a/src/syscall/syscall_linux_riscv64.go +++ b/src/syscall/syscall_linux_riscv64.go @@ -33,7 +33,7 @@ func EpollCreate(size int) (fd int, err error) { //sys Listen(s int, n int) (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 -//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) +//sys renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys Setfsgid(gid int) (err error) @@ -46,6 +46,10 @@ func EpollCreate(size int) (fd int, err error) { //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + return renameat2(olddirfd, oldpath, newdirfd, newpath, 0) +} + func Stat(path string, stat *Stat_t) (err error) { return Fstatat(_AT_FDCWD, path, stat, 0) } diff --git a/src/syscall/zsyscall_linux_riscv64.go b/src/syscall/zsyscall_linux_riscv64.go index afba4167f3..7bdb8046d1 100644 --- a/src/syscall/zsyscall_linux_riscv64.go +++ b/src/syscall/zsyscall_linux_riscv64.go @@ -1220,7 +1220,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { +func renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { @@ -1231,7 +1231,7 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e if err != nil { return } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := Syscall6(SYS_RENAMEAT2, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } -- 2.48.1