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

Method handleConnect

cmd/run/engine/process/handle.go:372–391  ·  view source on GitHub ↗

handleConnect handles the connect(2) syscall.

(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int)

Source from the content-addressed store, hash-verified

370
371// handleConnect handles the connect(2) syscall.
372func (p *Process) handleConnect(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int) error {
373 s, ok := p.getSocket(fd)
374 if !ok {
375 return n.Skip()
376 }
377
378 peer, errno, err := p.vmReadSockaddr(n, addrPtr, addrSize)
379 if err != nil {
380 return fmt.Errorf("read peer addr: %w", err)
381 }
382 if errno != 0 {
383 return n.Return(0, errno)
384 }
385
386 errno, err = s.Connect(peer)
387 if err != nil {
388 return fmt.Errorf("connect socket: %w", err)
389 }
390 return n.Return(0, errno)
391}
392
393// handleListen handles the listen(2) syscall.
394func (p *Process) handleListen(n *seccomp.Notif, fd int, backlog int) error {

Callers 1

initFunction · 0.80

Calls 5

getSocketMethod · 0.95
vmReadSockaddrMethod · 0.95
SkipMethod · 0.80
ReturnMethod · 0.80
ConnectMethod · 0.45

Tested by

no test coverage detected