// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd

package unix

import 

// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
// systems by fcntl_linux_32bit.go to be SYS_FCNTL64.
var fcntl64Syscall uintptr = SYS_FCNTL

func fcntl( int, ,  int) (int, error) {
	, ,  := Syscall(fcntl64Syscall, uintptr(), uintptr(), uintptr())
	var  error
	if  != 0 {
		 = 
	}
	return int(), 
}

// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
func ( uintptr, ,  int) (int, error) {
	return fcntl(int(), , )
}

// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
func ( uintptr,  int,  *Flock_t) error {
	, ,  := Syscall(fcntl64Syscall, , uintptr(), uintptr(unsafe.Pointer()))
	if  == 0 {
		return nil
	}
	return 
}