Imports #
"internal/syscall/windows"
"io/fs"
"syscall"
"errors"
"io/fs"
"errors"
"io"
"io/fs"
"math/rand"
"sync"
"syscall"
"time"
"errors"
"io/fs"
"io/fs"
"syscall"
"internal/syscall/windows"
"io/fs"
"syscall"
"errors"
"io/fs"
"errors"
"io"
"io/fs"
"math/rand"
"sync"
"syscall"
"time"
"errors"
"io/fs"
"io/fs"
"syscall"
const allBytes = *ast.UnaryExpr
var inodes = map[File]inode{...}
var locks = map[inode]inodeLock{...}
var mu sync.Mutex
const readLock lockType = syscall.F_RDLCK
const readLock lockType = 0
const readLock = *ast.BinaryExpr
const readLock lockType = syscall.LOCK_SH
const reserved = 0
const writeLock lockType = syscall.F_WRLCK
const writeLock lockType = windows.LOCKFILE_EXCLUSIVE_LOCK
const writeLock
const writeLock lockType = syscall.LOCK_EX
type inode uint64
type lockType uint32
type lockType int16
type lockType int8
type lockType int16
A File provides the minimal set of methods required to lock an open file. File implementations must be usable as map keys. The usual implementation is *os.File.
type File interface {
Name() string
Fd() uintptr
Stat() (fs.FileInfo, error)
}
type inodeLock struct {
owner File
queue []<-chan File
}
IsNotSupported returns a boolean indicating whether the error is known to report that a function is not supported (possibly for a specific input). It is satisfied by errors.ErrUnsupported as well as some syscall errors.
func IsNotSupported(err error) bool
Lock places an advisory write lock on the file, blocking until it can be locked. If Lock returns nil, no other process will be able to place a read or write lock on the file until this process exits, closes f, or calls Unlock on it. If f's descriptor is already read- or write-locked, the behavior of Lock is unspecified. Closing the file may or may not release the lock promptly. Callers should ensure that Unlock is always called when Lock succeeds.
func Lock(f File) error
RLock places an advisory read lock on the file, blocking until it can be locked. If RLock returns nil, no other process will be able to place a write lock on the file until this process exits, closes f, or calls Unlock on it. If f is already read- or write-locked, the behavior of RLock is unspecified. Closing the file may or may not release the lock promptly. Callers should ensure that Unlock is always called if RLock succeeds.
func RLock(f File) error
String returns the name of the function corresponding to lt (Lock, RLock, or Unlock).
func (lt lockType) String() string
Unlock removes an advisory lock placed on f by this process. The caller must not attempt to unlock a file that is not locked.
func Unlock(f File) error
func lock(f File, lt lockType) error
func lock(f File, lt lockType) (err error)
func lock(f File, lt lockType) error
func lock(f File, lt lockType) (err error)
setlkw calls FcntlFlock with F_SETLKW for the entire file indicated by fd.
func setlkw(fd uintptr, lt lockType) error
func unlock(f File) error
func unlock(f File) error
func unlock(f File) error
func unlock(f File) error
Generated with Arrow