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

Method ImportInode

cmd/run/engine/process/process.go:141–160  ·  view source on GitHub ↗
(targetFD int, inode *socket.Inode)

Source from the content-addressed store, hash-verified

139}
140
141func (p *Process) ImportInode(targetFD int, inode *socket.Inode) error {
142 fd, errno := p.getFD(targetFD)
143 if errno != 0 {
144 return fmt.Errorf("get fd: %w", errno)
145 }
146 defer fd.DecRef()
147
148 p.mu.Lock()
149 defer p.mu.Unlock()
150
151 if old, ok := p.sockets[targetFD]; ok {
152 return fmt.Errorf("import socket: targetFD=%d already exists: %s", targetFD, old.LogValue().String())
153 }
154
155 sock := socket.NewSocket(p.global, p.getEventTemplate().Copy(), inode, fd)
156 p.sockets[targetFD] = sock
157
158 slog.Debug("imported inode", "proc", p, "inode", inode, "sock", sock)
159 return nil
160}
161
162func (p *Process) getSocket(fd int) (*socket.Socket, bool) {
163 p.mu.RLock()

Callers 1

importInodesMethod · 0.80

Calls 8

getFDMethod · 0.95
getEventTemplateMethod · 0.95
NewSocketFunction · 0.92
DecRefMethod · 0.80
LockMethod · 0.80
CopyMethod · 0.80
StringMethod · 0.45
LogValueMethod · 0.45

Tested by

no test coverage detected