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

Method handleBind

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

handleConnect handles the bind(2) syscall.

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

Source from the content-addressed store, hash-verified

348
349// handleConnect handles the bind(2) syscall.
350func (p *Process) handleBind(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int) error {
351 s, ok := p.getSocket(fd)
352 if !ok {
353 return n.Skip()
354 }
355
356 bind, errno, err := p.vmReadSockaddr(n, addrPtr, addrSize)
357 if err != nil {
358 return fmt.Errorf("read bind addr: %w", err)
359 }
360 if errno != 0 {
361 return n.Return(0, errno)
362 }
363
364 errno, err = s.Bind(bind)
365 if err != nil {
366 return fmt.Errorf("bind socket: %w", err)
367 }
368 return n.Return(0, errno)
369}
370
371// handleConnect handles the connect(2) syscall.
372func (p *Process) handleConnect(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int) error {

Callers 1

initFunction · 0.80

Calls 5

getSocketMethod · 0.95
vmReadSockaddrMethod · 0.95
SkipMethod · 0.80
ReturnMethod · 0.80
BindMethod · 0.80

Tested by

no test coverage detected