at_fstatat.mx raw
1 // Copyright 2018 The Go 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
5 //go:build dragonfly || (linux && !(loong64 || mips64 || mips64le)) || netbsd || (openbsd && mips64)
6
7 package unix
8
9 import (
10 "syscall"
11 "unsafe"
12 )
13
14 func Fstatat(dirfd int, path string, stat *syscall.Stat_t, flags int) error {
15 var p *byte
16 p, err := syscall.BytePtrFromString(path)
17 if err != nil {
18 return err
19 }
20
21 _, _, errno := syscall.Syscall6(fstatatTrap, uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
22 if errno != 0 {
23 return errno
24 }
25
26 return nil
27 }
28