MCPcopy Index your code
hub / github.com/subtrace/subtrace / New

Function New

cmd/run/engine/process/process.go:42–61  ·  view source on GitHub ↗

New creates a new process with the given PID.

(global *global.Global, itab *socket.InodeTable, pid int)

Source from the content-addressed store, hash-verified

40
41// New creates a new process with the given PID.
42func New(global *global.Global, itab *socket.InodeTable, pid int) (*Process, error) {
43 ret, _, errno := unix.Syscall(unix.SYS_PIDFD_OPEN, uintptr(pid), 0, 0)
44 if errno != 0 {
45 return nil, fmt.Errorf("pidfd_open %d: %w", pid, errno)
46 }
47
48 pidfd := fd.NewFD(int(ret))
49 defer pidfd.DecRef()
50
51 return &Process{
52 global: global,
53 itab: itab,
54
55 PID: pid,
56 Exited: make(chan struct{}),
57
58 pidfd: pidfd,
59 sockets: make(map[int]*socket.Socket),
60 }, nil
61}
62
63func (p *Process) getEventTemplate() *event.Event {
64 if tmpl := p.tmpl.Load(); tmpl != nil {

Callers 2

entrypointParentMethod · 0.92
ensureProcessLockedMethod · 0.92

Calls 2

DecRefMethod · 0.95
NewFDFunction · 0.92

Tested by

no test coverage detected