]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: provide Renameat as a wrapper around renameat2 on riscv64
authorJoel Sing <joel@sing.id.au>
Sun, 5 Jan 2020 14:48:43 +0000 (01:48 +1100)
committerTobias Klauser <tobias.klauser@gmail.com>
Mon, 6 Jan 2020 09:24:14 +0000 (09:24 +0000)
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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
src/syscall/syscall_linux_riscv64.go
src/syscall/zsyscall_linux_riscv64.go

index 4635490b9c409aaad3983b056629b9c4ca27ad03..61e9c60e70e915f72948ed036bfaae1da8bec71d 100644 (file)
@@ -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)
 }
index afba4167f364c4e780696039baeb00aa2099deaf..7bdb8046d17ecd2ab2a56f5664cdb5b88b275a9d 100644 (file)
@@ -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)
        }