Re: [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication

2018-08-13 Thread Samuel Thibault
Joan Lledó, le sam. 11 août 2018 18:17:08 +0200, a ecrit:
> * lwip/main.c (lwip_demuxer): Refactored.

Applied, thanks!

> ---
>  lwip/main.c | 42 +++---
>  1 file changed, 11 insertions(+), 31 deletions(-)
> 
> diff --git a/lwip/main.c b/lwip/main.c
> index 9f7eb9b2..4dfbe143 100644
> --- a/lwip/main.c
> +++ b/lwip/main.c
> @@ -99,6 +99,7 @@ int
>  lwip_demuxer (mach_msg_header_t * inp, mach_msg_header_t * outp)
>  {
>struct port_info *pi;
> +  mig_routine_t routine = NULL;
>  
>/* Clear errno to prevent raising previous errors again */
>errno = 0;
> @@ -116,40 +117,19 @@ lwip_demuxer (mach_msg_header_t * inp, 
> mach_msg_header_t * outp)
>if (pi)
>  {
>ports_port_deref (pi);
> -
> -  mig_routine_t routine;
> -  if ((routine = lwip_io_server_routine (inp)) ||
> -   (routine = lwip_socket_server_routine (inp)) ||
> -   (routine = lwip_pfinet_server_routine (inp)) ||
> -   (routine = lwip_iioctl_server_routine (inp)) ||
> -   (routine = NULL, trivfs_demuxer (inp, outp)) ||
> -   (routine = lwip_startup_notify_server_routine (inp)))
> - {
> -   if (routine)
> - (*routine) (inp, outp);
> -   return TRUE;
> - }
> -  else
> - return FALSE;
> +  routine = lwip_io_server_routine (inp);
>  }
> -  else
> +
> +  if (routine || (routine = lwip_socket_server_routine (inp)) ||
> +  (routine = lwip_pfinet_server_routine (inp)) ||
> +  (routine = lwip_iioctl_server_routine (inp)) ||
> +  (routine = lwip_startup_notify_server_routine (inp)))
>  {
> -  mig_routine_t routine;
> -  if ((routine = lwip_socket_server_routine (inp)) ||
> -   (routine = lwip_pfinet_server_routine (inp)) ||
> -   (routine = lwip_iioctl_server_routine (inp)) ||
> -   (routine = NULL, trivfs_demuxer (inp, outp)) ||
> -   (routine = lwip_startup_notify_server_routine (inp)))
> - {
> -   if (routine)
> - (*routine) (inp, outp);
> -   return TRUE;
> - }
> -  else
> - return FALSE;
> +  (*routine) (inp, outp);
> +  return TRUE;
>  }
> -
> -  return 0;
> +  else
> +return trivfs_demuxer (inp, outp);
>  }
>  
>  void
> -- 
> 2.11.0
> 
> 

-- 
Samuel
 T'as pas de portable ?
 J'ai un nokia, dans le bassin d'arcachon



Re: [PATCH 3/4] lwip: return EINTR when a select() IPC thread is cancelled

2018-08-13 Thread Samuel Thibault
Joan Lledó, le sam. 11 août 2018 18:17:09 +0200, a ecrit:
> Needed to properly support poll in glibc (_hurd_select).
> 
> * lwip/io-ops.c (lwip_io_select_common): Detect when the
> current RPC is cancelled by checking the reply port.

Applied, thanks!

> ---
>  lwip/io-ops.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lwip/io-ops.c b/lwip/io-ops.c
> index 1429bc55..72e08e26 100644
> --- a/lwip/io-ops.c
> +++ b/lwip/io-ops.c
> @@ -198,6 +198,8 @@ lwip_io_select_common (struct sock_user *user,
>int timeout;
>struct pollfd fdp;
>nfds_t nfds;
> +  mach_port_type_t type;
> +  error_t err;
>  
>if (!user)
>  return EOPNOTSUPP;
> @@ -227,6 +229,12 @@ lwip_io_select_common (struct sock_user *user,
>timeout = tv ? tv->tv_sec * 1000 + tv->tv_nsec / 100 : -1;
>ret = lwip_poll (&fdp, nfds, timeout);
>  
> +  err = mach_port_type (mach_task_self (), reply, &type);
> +  if (err || (type & MACH_PORT_TYPE_DEAD_NAME))
> +/* The reply port is dead, we were cancelled */
> +return EINTR;
> +
> +
>if (ret > 0)
>  {
>if (fdp.revents & POLLERR)
> -- 
> 2.11.0
> 
> 

-- 
Samuel
 l'autre jour j'ai eu un type qu'est venu me demander « J'ai installé le
logiciel comme indiqué sur le site. Puis quand je le lance ça plante et ça me
marque “Voulez-vous envoyez un rapport d'erreur ?”. Je fais quoi ?! »
  -+- ... -+-



Re: [PATCH 1/4] lwip: poll(): return EIO when POLLERR is set

2018-08-13 Thread Samuel Thibault
Joan Lledó, le sam. 11 août 2018 18:17:07 +0200, a ecrit:
> Needed to properly support poll in glibc (_hurd_select).

Applied, thanks!

> * lwip/io-ops.c (lwip_io_select_common):
> If POLLERR is set, return EIO.
> ---
>  lwip/io-ops.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lwip/io-ops.c b/lwip/io-ops.c
> index 636c26f7..1429bc55 100644
> --- a/lwip/io-ops.c
> +++ b/lwip/io-ops.c
> @@ -229,6 +229,9 @@ lwip_io_select_common (struct sock_user *user,
>  
>if (ret > 0)
>  {
> +  if (fdp.revents & POLLERR)
> + return EIO;
> +
>if (fdp.revents & POLLIN)
>   *select_type |= SELECT_READ;
>  
> -- 
> 2.11.0
> 
> 

-- 
Samuel
 l'alim je sais où elle est, elle est juste à côté de la dame qui dort
 B: clairement faut revoir les priorités dans la vie
 B: une dame ça se retrouve, un uptime...