On Thu, Mar 10, 2011 at 13:46:13 +0000, Daniel P. Berrange wrote:
On Wed, Mar 09, 2011 at 05:02:24PM +0100, Jiri Denemark wrote:
> > @@ -447,7 +459,13 @@ static int lxcControllerMain(int monitor,
> > ++numActive;
> > }
> > } else if (epollEvent.events & EPOLLHUP) {
> > - VIR_DEBUG("EPOLLHUP from fd %d",
epollEvent.data.fd);
> > + if (lxcPidGone(container))
> > + goto cleanup;
> > + curFdOff = epollEvent.data.fd == appPty ? 0 : 1;
> > + if (fdArray[curFdOff].active) {
> > + fdArray[curFdOff].active = 0;
> > + --numActive;
> > + }
> > continue;
>
> Heh, thanks for the opportunity to learn about epoll. This might be a trivial
> question but... what if we get EPOLLIN event immediately followed by EPOLLHUP
> on the same fd? Do we end up leaving the data unread until another EPOLLIN
> arrives? Although it shouldn't be a big deal since we will just read the data
> from init after the console gets reopened by mingetty.
The previous branch in this 'if' will have handled the EPOLLIN event
so we shouldn't delay data.
Ah, right, I misread the long if statement and somehow thought we are first
reading out all the event and only when there are none are we actually copying
data over.
Jirka