Source file src/syscall/syscall_illumos.go

     1  // Copyright 2020 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 illumos
     6  
     7  // Illumos system calls not present on Solaris.
     8  
     9  package syscall
    10  
    11  import "unsafe"
    12  
    13  //go:cgo_import_dynamic libc_flock flock "libc.so"
    14  
    15  //go:linkname procFlock libc_flock
    16  
    17  var procFlock libcFunc
    18  
    19  func Flock(fd int, how int) error {
    20  	_, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procFlock)), 2, uintptr(fd), uintptr(how), 0, 0, 0, 0)
    21  	if errno != 0 {
    22  		return errno
    23  	}
    24  	return nil
    25  }
    26  

View as plain text