Commit f9813515 authored by Joel Sing's avatar Joel Sing Committed by Tobias Klauser

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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
parent fc5eee3c
......@@ -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)
}
......
......@@ -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)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment