carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1//go:build !windows
2
3package host
4
5import (
6 "os"
7 "syscall"
8)
9
10// lockFileEx takes an exclusive advisory lock on f, and unlockFile drops it.
11// syscall.Flock is available on both linux and darwin, which covers every
12// platform that runs a restart pass.
13func lockFileEx(f *os.File) error { return syscall.Flock(int(f.Fd()), syscall.LOCK_EX) }
14
15func unlockFile(f *os.File) { syscall.Flock(int(f.Fd()), syscall.LOCK_UN) } //nolint:errcheck
16