Harden Harness runtime, persistence and execution for Hand
This commit is contained in:
1 parent
09c30fe2d5
commit
0972eed3ea
164 files changed
+15912
-506
No files matched your search
@@ -0,0 +1,20 @@
|
||||
//go:build unix
|
||||
|
||||
package process
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func lockArtifact(f *os.File, nonblocking bool) error {
|
||||
flags := syscall.LOCK_EX
|
||||
if nonblocking {
|
||||
flags |= syscall.LOCK_NB
|
||||
}
|
||||
return syscall.Flock(int(f.Fd()), flags)
|
||||
}
|
||||
func artifactBusy(err error) bool { return errors.Is(err, syscall.EWOULDBLOCK) }
|
||||
|
||||
func artifactReadFlags() int { return os.O_RDONLY | syscall.O_NONBLOCK | syscall.O_NOFOLLOW }
|
||||
Reference in new issue
Block a user