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

Method handleClose

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

handleClose handles the close(2) syscall.

(n *seccomp.Notif, fd int)

Source from the content-addressed store, hash-verified

250
251// handleClose handles the close(2) syscall.
252func (p *Process) handleClose(n *seccomp.Notif, fd int) error {
253 s, ok := p.getDeleteSocket(fd)
254 if !ok {
255 return n.Skip()
256 }
257
258 if errno := s.Close(); errno != 0 {
259 // Failing to close a socket cleanly isn't a fatal error. Moreover, we need
260 // to let the kernel handle the syscall regardless of whether our close
261 // fails because the socket needs to be removed from the process' file
262 // descriptor table.
263 slog.Debug("failed to close socket cleanly", "errno", errno)
264 return n.Skip()
265 }
266
267 // Allow the syscall to proceed so that the process can close its copy of the
268 // socket from its file descriptor table.
269 return n.Skip()
270}
271
272// handleFcntl handles the fcntl(2) syscall.
273func (p *Process) handleFcntl(n *seccomp.Notif, srcFD int, cmd int, arg int) error {

Callers 1

initFunction · 0.80

Calls 3

getDeleteSocketMethod · 0.95
SkipMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected