Source file src/internal/syscall/unix/faccessat_openbsd.go

     1  // Copyright 2024 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  package unix
     6  
     7  import (
     8  	"internal/abi"
     9  	"syscall"
    10  	"unsafe"
    11  )
    12  
    13  //go:linkname syscall_syscall6 syscall.syscall6
    14  func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
    15  
    16  func libc_faccessat_trampoline()
    17  
    18  //go:cgo_import_dynamic libc_faccessat faccessat "libc.so"
    19  
    20  func faccessat(dirfd int, path string, mode uint32, flags int) error {
    21  	p, err := syscall.BytePtrFromString(path)
    22  	if err != nil {
    23  		return err
    24  	}
    25  	_, _, errno := syscall_syscall6(abi.FuncPCABI0(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(mode), uintptr(flags), 0, 0)
    26  	if errno != 0 {
    27  		return errno
    28  	}
    29  	return nil
    30  }
    31  

View as plain text