...

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

Documentation: internal/syscall/unix

     1  // Copyright 2023 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 || freebsd || netbsd || (openbsd && mips64)
     6  
     7  package unix
     8  
     9  import (
    10  	"syscall"
    11  	"unsafe"
    12  )
    13  
    14  func faccessat(dirfd int, path string, mode uint32, flags int) error {
    15  	p, err := syscall.BytePtrFromString(path)
    16  	if err != nil {
    17  		return err
    18  	}
    19  	_, _, errno := syscall.Syscall6(syscall.SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(mode), uintptr(flags), 0, 0)
    20  	if errno != 0 {
    21  		return errno
    22  	}
    23  	return err
    24  }
    25  
    26  func Eaccess(path string, mode uint32) error {
    27  	return faccessat(AT_FDCWD, path, mode, AT_EACCESS)
    28  }
    29  

View as plain text