Skip to content
Snippets Groups Projects
  1. Dec 25, 2013
  2. Dec 19, 2013
  3. Sep 23, 2013
    • Nadav Har'El's avatar
      Our select() function is emulated using poll(), which is a sensible thing · b53d39ac
      Nadav Har'El authored
      to do. However, it did several things wrong that this patch fixes. Thanks
      to Paolo Bonzini for finding these problems (see issue #35).
      
      1. When poll() returned a bare POLLHUP, without POLLIN, our select() didn't
      return a read event. But nothing in the manpages guarantees that POLLHUP
      is accompanied by POLLIN, and some special file implementations might
      forget it. As an example, in Linux POLLHUP without POLLIN is common.
      But POLLHUP on its own already means that there's nothing more to read,
      so a read() will return immediately without blocking - and therefore
      select() needs to turn on the readable bit for this fd.
      
      2. Similarly, a bare POLLRDHUP should turn on the writable bit: The
      reader on this file hug up, so a write will fail immediately.
      
      3. Our poll() and select() confused what POLLERR means. POLLERR does not
      mean poll() found a bad file descriptor - there is POLLNVAL for that.
      So this patch fixes poll() to set POLLNVAL, not POLLERR, and select()
      to return with errno=EBADF when it sees POLLNVAL, not POLLERR.
      
      4. Rather, POLLERR means the file descriptor is in an error state, so every
      read() or write() will return immediately (with an error). So when we see
      it, we need to turn on both read and write bits in this case.
      
      5. The meaning of "exceptfds" isn't clear in any manual page, and it
      seems there're a lot of opinions on what it might mean. In this patch I
      did what Paolo suggested, which is to set the except bit when POLLPRI.
      (I don't set exceptfds on POLLERR, or any other case).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      b53d39ac
  4. Sep 15, 2013
    • Nadav Har'El's avatar
      Add copyright statement to core/* · 4c0b39f3
      Nadav Har'El authored
      Added Cloudius copyright statement to core/*.
      
      poll.cc already had a BSD copyright statement, I believe this is a mistake
      (I think Guy wrote this code from scratch), but not wanting to rush to a
      conclusion I'm leaving both copyright statements and we should address this
      issue later.
      4c0b39f3
  5. Jun 09, 2013
  6. Jun 04, 2013
  7. May 31, 2013
    • Guy Zana's avatar
      select: implement select() · c5f87a53
      Guy Zana authored
      add simple select() implementation on top of poll(), been tested by
      running netperf/iperf3 which is using select() for waiting for reads
      and setting timeouts.
      
      haven't been thourougly tested.
      c5f87a53
Loading