...

Source file src/syscall/flock.go

Documentation: syscall

		 1  //go:build linux || freebsd || openbsd || netbsd || dragonfly
		 2  // +build linux freebsd openbsd netbsd dragonfly
		 3  
		 4  // Copyright 2014 The Go Authors. All rights reserved.
		 5  // Use of this source code is governed by a BSD-style
		 6  // license that can be found in the LICENSE file.
		 7  
		 8  package syscall
		 9  
		10  import "unsafe"
		11  
		12  // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
		13  // systems by flock_linux_32bit.go to be SYS_FCNTL64.
		14  var fcntl64Syscall uintptr = SYS_FCNTL
		15  
		16  // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
		17  func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
		18  	_, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
		19  	if errno == 0 {
		20  		return nil
		21  	}
		22  	return errno
		23  }
		24  

View as plain text