[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT LWIP PATCH 1/7] Fix poll() ret variable type and select() maxfd calculation



Thanks, Mihai!

Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>

On 6/26/19 4:54 AM, Mihai Pogonaru wrote:
> Poll ret variable must be declared as int
> Select must calculate maxfd as the maximum between lwip file descriptors
> 
> Signed-off-by: Mihai Pogonaru <pogonarumihai@xxxxxxxxx>
> ---
>  sockets.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/sockets.c b/sockets.c
> index 77235e9..e95758d 100644
> --- a/sockets.c
> +++ b/sockets.c
> @@ -335,7 +335,8 @@ EXIT:
>  
>  int poll(struct pollfd fds[], nfds_t nfds, int timeout)
>  {
> -     unsigned int i, ret;
> +     int ret;
> +     unsigned int i;
>       struct sock_net_file *file;
>       struct pollfd lwip_fds[nfds];
>  
> @@ -395,7 +396,6 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, 
> fd_set *exceptfds,
>       maxfd = 0;
>       for (i = 0; i < nfds; i++) {
>               if (readfds && FD_ISSET(i, readfds)) {
> -                     maxfd = i;
>                       file = sock_net_file_get(i);
>                       if (PTRISERR(file)) {
>                               LWIP_DEBUGF(SOCKETS_DEBUG,
> @@ -405,11 +405,12 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, 
> fd_set *exceptfds,
>                               SOCK_NET_SET_ERRNO(PTR2ERR(file));
>                               goto EXIT;
>                       }
> +                     if (maxfd < file->sock_fd)
> +                             maxfd = file->sock_fd;
>                       FD_SET(file->sock_fd, &rd);
>                       vfscore_put_file(&file->vfscore_file); /* release 
> refcount */
>               }
>               if (writefds && FD_ISSET(i, writefds)) {
> -                     maxfd = i;
>                       file = sock_net_file_get(i);
>                       if (PTRISERR(file)) {
>                               LWIP_DEBUGF(SOCKETS_DEBUG,
> @@ -419,11 +420,12 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, 
> fd_set *exceptfds,
>                               SOCK_NET_SET_ERRNO(PTR2ERR(file));
>                               goto EXIT;
>                       }
> +                     if (maxfd < file->sock_fd)
> +                             maxfd = file->sock_fd;
>                       FD_SET(file->sock_fd, &wr);
>                       vfscore_put_file(&file->vfscore_file); /* release 
> refcount */
>               }
>               if (exceptfds && FD_ISSET(i, exceptfds)) {
> -                     maxfd = i;
>                       file = sock_net_file_get(i);
>                       if (PTRISERR(file)) {
>                               LWIP_DEBUGF(SOCKETS_DEBUG,
> @@ -433,6 +435,8 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, 
> fd_set *exceptfds,
>                               SOCK_NET_SET_ERRNO(PTR2ERR(file));
>                               goto EXIT;
>                       }
> +                     if (maxfd < file->sock_fd)
> +                             maxfd = file->sock_fd;
>                       FD_SET(file->sock_fd, &xc);
>                       vfscore_put_file(&file->vfscore_file); /* release 
> refcount */
>               }
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.