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

View as plain text