MCPcopy
hub / github.com/firecracker-microvm/firecracker-containerd / findProc

Method findProc

internal/vm/task.go:328–343  ·  view source on GitHub ↗

findProc returns a vmProc if exists. The function itself doesn't lock the manager's mutex. The callers are responsible to lock/unlock since they may mutate the value.

(taskID, execID string)

Source from the content-addressed store, hash-verified

326// findProc returns a vmProc if exists. The function itself doesn't lock the manager's mutex.
327// The callers are responsible to lock/unlock since they may mutate the value.
328func (m *taskManager) findProc(taskID, execID string) (*vmProc, error) {
329 _, ok := m.tasks[taskID]
330 if !ok {
331 return nil, fmt.Errorf("cannot find exec %q from non-existent task %q", execID, taskID)
332 }
333
334 proc, ok := m.tasks[taskID][execID]
335 if !ok {
336 return nil, fmt.Errorf("cannot find non-existent exec %q from task %q", execID, taskID)
337 }
338
339 if proc.proxy == nil {
340 return nil, fmt.Errorf("exec %q and task %q are present, but no proxy", taskID, execID)
341 }
342 return proc, nil
343}
344
345func (m *taskManager) AttachIO(_ context.Context, taskID, execID string, proxy IOProxy) error {
346 m.mu.Lock()

Callers 2

IsProxyOpenMethod · 0.95
AttachIOMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected