libc_musl_linux_arm64.go 946 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2023 The Libc Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package libc // import "modernc.org/libc"
  5. import (
  6. "golang.org/x/sys/unix"
  7. )
  8. type long = int64
  9. type ulong = uint64
  10. // RawMem represents the biggest byte array the runtime can handle
  11. type RawMem [1<<50 - 1]byte
  12. // int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags);
  13. func Xrenameat2(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr, flags int32) int32 {
  14. if __ccgo_strace {
  15. trc("t=%v olddirfd=%v oldpath=%v newdirfd=%v newpath=%v flags=%v, (%v:)", t, olddirfd, oldpath, newdirfd, newpath, flags, origin(2))
  16. }
  17. if _, _, err := unix.Syscall6(unix.SYS_RENAMEAT2, uintptr(olddirfd), oldpath, uintptr(newdirfd), newpath, uintptr(flags), 0); err != 0 {
  18. t.setErrno(int32(err))
  19. return -1
  20. }
  21. return 0
  22. }