func (f Fcntl) ReadLock(fd uintptr, start, len int64) error { return f.fcntl(syscall.F_RDLCK, fd, start, len) } func (f Fcntl) WriteLock(fd uintptr, start, len int64) error { return f.fcntl(syscall.F_WRLCK, fd, start, len) } func (f Fcntl) UnLock(fd uintptr, start, len int64) error { return f.fcntl(syscall.F_UNLCK, fd, start, len) } func (f Fcntl) fcntl(typ int16, fd uintptr, start, len int64) error { return syscall.FcntlFlock(fd, F_OFD_SETLKW, &syscall.Flock_t{ Start: start, Len: len, Type: typ, Whence: io.SeekStart, }) } Command for working with open file description locks Exclusive lock Shared lock