feat: add deployment foundation and cross-device handoff
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//go:build linux
|
||||
|
||||
package state
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func lockExclusive(f *os.File) error {
|
||||
err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
|
||||
if errors.Is(err, syscall.EWOULDBLOCK) || errors.Is(err, syscall.EAGAIN) {
|
||||
return ErrBusy
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func syncDirectory(r *os.Root) error {
|
||||
f, err := r.Open(".")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
return f.Sync()
|
||||
}
|
||||
Reference in New Issue
Block a user