mirror of
https://github.com/hanzoai/go-fuse.git
synced 2026-10-30 14:46:18 +00:00
This test case is going to test whether the file lock works well on the system. It firstly adds a lock and then get the lock through syscalls. It uses F_OFD_GETLK command of fcntl(2) to get the lock info on an opened file description[1], which is not defined on the FreeBSD. This commit seperate the process of getting the information of lock for different OSes, and mimic the behaviour of F_OFD_GETLK on FreeBSD. [1]: https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html Change-Id: I8abae0e7040fc667143eea028731e341be9b1baf
12 lines
193 B
Go
12 lines
193 B
Go
package posixtest
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func sysFcntlFlockGetOFDLock(fd uintptr, lk *syscall.Flock_t) error {
|
|
return syscall.FcntlFlock(fd, unix.F_OFD_GETLK, lk)
|
|
}
|