Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Code

392 commit(s) on main

Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys keenan · 55m ago 4b8c9e1d
history blame raw 915 B
1//go:build unix
2
3package cache
4
5import (
6 "os"
7 "syscall"
8)
9
10// lockFile takes the lock f names. A shared lock is what a job holds while it has
11// the namespace mounted; exclusive is what eviction takes. wait=false asks rather
12// than waits: the caller has other namespaces it can try.
13//
14// A signal can interrupt the wait and the lock is not held when it does, so the
15// call asks again rather than reporting a failure the caller cannot act on.
16func lockFile(f *os.File, exclusive, wait bool) (func(), bool, error) {
17 how := syscall.LOCK_SH
18 if exclusive {
19 how = syscall.LOCK_EX
20 }
21 if !wait {
22 how |= syscall.LOCK_NB
23 }
24 for {
25 err := syscall.Flock(int(f.Fd()), how)
26 switch err {
27 case nil:
28 return func() { _ = syscall.Flock(int(f.Fd()), syscall.LOCK_UN) }, true, nil
29 case syscall.EINTR:
30 continue
31 case syscall.EWOULDBLOCK:
32 return nil, false, nil
33 default:
34 return nil, false, err
35 }
36 }
37}
38