ia64/xen-unstable

changeset 17232:312053c2da89

stubdom: Add support for select() call with NULL arguments.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 18 11:26:43 2008 +0000 (2008-03-18)
parents 1eae3adc5bf7
children 3d6d042144d7
files extras/mini-os/lib/sys.c
line diff
     1.1 --- a/extras/mini-os/lib/sys.c	Tue Mar 18 11:26:21 2008 +0000
     1.2 +++ b/extras/mini-os/lib/sys.c	Tue Mar 18 11:26:43 2008 +0000
     1.3 @@ -837,9 +837,19 @@ int select(int nfds, fd_set *readfds, fd
     1.4      add_waiter(w4, xenbus_watch_queue);
     1.5      add_waiter(w5, kbdfront_queue);
     1.6  
     1.7 -    myread = *readfds;
     1.8 -    mywrite = *writefds;
     1.9 -    myexcept = *exceptfds;
    1.10 +    if (readfds)
    1.11 +        myread = *readfds;
    1.12 +    else
    1.13 +        FD_ZERO(&myread);
    1.14 +    if (writefds)
    1.15 +        mywrite = *writefds;
    1.16 +    else
    1.17 +        FD_ZERO(&mywrite);
    1.18 +    if (exceptfds)
    1.19 +        myexcept = *exceptfds;
    1.20 +    else
    1.21 +        FD_ZERO(&myexcept);
    1.22 +
    1.23      DEBUG("polling ");
    1.24      dump_set(nfds, &myread, &mywrite, &myexcept, timeout);
    1.25      DEBUG("\n");
    1.26 @@ -878,9 +888,19 @@ int select(int nfds, fd_set *readfds, fd
    1.27  	thread->wakeup_time = stop;
    1.28      schedule();
    1.29  
    1.30 -    myread = *readfds;
    1.31 -    mywrite = *writefds;
    1.32 -    myexcept = *exceptfds;
    1.33 +    if (readfds)
    1.34 +        myread = *readfds;
    1.35 +    else
    1.36 +        FD_ZERO(&myread);
    1.37 +    if (writefds)
    1.38 +        mywrite = *writefds;
    1.39 +    else
    1.40 +        FD_ZERO(&mywrite);
    1.41 +    if (exceptfds)
    1.42 +        myexcept = *exceptfds;
    1.43 +    else
    1.44 +        FD_ZERO(&myexcept);
    1.45 +
    1.46      n = select_poll(nfds, &myread, &mywrite, &myexcept);
    1.47  
    1.48      if (n) {