Files
lch b0fe8dea8b posixtest: fix test FcntlFlockSetLk
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
2024-05-15 10:12:19 +00:00

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)
}