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

     1  // Copyright 2026 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 Fchmodat(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(fchmodatTrap,
    20  		uintptr(dirfd),
    21  		uintptr(unsafe.Pointer(p)),
    22  		uintptr(mode),
    23  		uintptr(flags),
    24  		0, 0)
    25  	if errno != 0 {
    26  		return errno
    27  	}
    28  	return nil
    29  }
    30  

View as plain text