faccessat_solaris.mx raw

   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  	"syscall"
   9  	"unsafe"
  10  )
  11  
  12  //go:linkname procFaccessat libc_faccessat
  13  
  14  var procFaccessat uintptr
  15  
  16  func faccessat(dirfd int, path string, mode uint32, flags int) error {
  17  	p, err := syscall.BytePtrFromString(path)
  18  	if err != nil {
  19  		return err
  20  	}
  21  
  22  	_, _, errno := syscall6(uintptr(unsafe.Pointer(&procFaccessat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(p)), uintptr(mode), uintptr(flags), 0, 0)
  23  	if errno != 0 {
  24  		return errno
  25  	}
  26  
  27  	return nil
  28  }
  29