You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: os_bsd.go
    path of file: ./repos/sliver/vendor/github.com/ncruces/go-sqlite3/vfs
    
    the code of the file until where you have to start completion: //go:build freebsd || openbsd || netbsd || dragonfly || (darwin && sqlite3_bsd)

package vfs

import (
	"os"
	"time"

	"golang.org/x/sys/unix"
)

func osUnlock(file *os.File, start, len int64) _ErrorCode {
	if start == 0 
    
func osLock(file *os.File, how int, timeout time.Duration, def _ErrorCode) _ErrorCode {
	var err error
	for {
		err = unix.Flock(int(file.Fd()), how)
		if errno, _ := err.(unix.Errno); errno != unix.EAGAIN {
			break
		}
		if timeout < time.Millisecond {
			break
		}
		timeout -= time.Millisecond
		time.Sleep(time.Millisecond)
	}
	return osLockErrorCode(err, def)
}