func (s *Supervisor) updateProcess(t *UpdateProcessTask) error { i, ok := s.containers[t.ID] if !ok { return ErrContainerNotFound } processes, err := i.container.Processes() if err != nil { return err } var process runtime.Process for _, p := range processes { if p.ID() == t.PID { process = p break } } if process == nil { return ErrProcessNotFound } if t.CloseStdin { if err := process.CloseStdin(); err != nil { return err } } if t.Width > 0 || t.Height > 0 { if err := process.Resize(t.Width, t.Height); err != nil { return err } } return nil }
func (m *Monitor) Monitor(p runtime.Process) error { m.m.Lock() defer m.m.Unlock() fd := p.ExitFD() event := syscall.EpollEvent{ Fd: int32(fd), Events: syscall.EPOLLHUP, } if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil { return err } EpollFdCounter.Inc(1) m.receivers[fd] = p return nil }