main f2d166b

captureexe.go RawHistoryFolder

1package wayland
2
3import (
4	"os"
5	"runtime"
6
7	"github.com/bnema/neferwl/internal/adapters/peerexe"
8)
9
10// peerExe names the executable behind a client connection, in two steps so a
11// caller can keep the pidfd and resolve the executable again at each
12// decision.
13type peerExe interface {
14	// Pidfd returns a pidfd of the peer of the connected unix socket sockFD
15	// (SO_PEERPIDFD). It pins the peer process: its pid cannot be recycled
16	// while the file is open. peerexe.ErrNoPidfd means the kernel cannot give
17	// one.
18	Pidfd(sockFD int) (*os.File, error)
19	// Exe returns the path of the executable running as the process behind
20	// pidfd, and its pid. A deleted executable, or a process that has
21	// exited, is an error.
22	Exe(pidfd *os.File) (exe string, pid int, err error)
23}
24
25// linuxPeerExe resolves the peer through a pidfd (SO_PEERPIDFD, Linux 6.5+),
26// with the proof of peerexe.ExeOfPidfd. There is no fallback to the
27// SO_PEERCRED pid: it has no such proof, so a kernel without SO_PEERPIDFD
28// identifies nobody.
29type linuxPeerExe struct {
30	// noPidfd simulates a kernel without SO_PEERPIDFD (tests).
31	noPidfd bool
32}
33
34func (l linuxPeerExe) Pidfd(sockFD int) (*os.File, error) {
35	if l.noPidfd {
36		return nil, peerexe.ErrNoPidfd
37	}
38	return peerexe.Pidfd(sockFD)
39}
40
41func (linuxPeerExe) Exe(pidfd *os.File) (string, int, error) {
42	defer runtime.KeepAlive(pidfd)
43	return peerexe.ExeOfPidfd(int(pidfd.Fd()))
44}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 25

Tags 10

↑↓ moveenter openesc close