[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-bug
Subject:    Re: Confusing definitions and declarations of mig_dealloc_reply_port()
From:       Pino Toscano <toscano.pino () tiscali ! it>
Date:       2015-11-05 9:43:10
Message-ID: 3524086.lSnLIuF5U3 () pendragon ! usersys ! redhat ! com
[Download RAW message or body]

On Thursday 05 November 2015 10:30:27 Svante Signell wrote:
> I agree, the #if 1 part was not OK. What about rewriting
> __mig_get_reply_port() too to be more readable?
> 
> Please tell me if this patch is faulty in some way, I'm still on the
> learning curve.
> 
> Index: glibc-2.19/sysdeps/mach/hurd/mig-reply.c
> ===================================================================
> --- glibc-2.19.orig/sysdeps/mach/hurd/mig-reply.c
> +++ glibc-2.19/sysdeps/mach/hurd/mig-reply.c
> @@ -26,12 +26,13 @@ mach_port_t __hurd_reply_port0;
>  mach_port_t
>  __mig_get_reply_port (void)
>  {
> -  if (__hurd_local_reply_port == MACH_PORT_NULL ||
> -      (&__hurd_local_reply_port != &__hurd_reply_port0
> -       && __hurd_local_reply_port == __hurd_reply_port0))
> -    __hurd_local_reply_port = __mach_reply_port ();
> +  mach_port_t port = __hurd_local_reply_port;
> +  if (port == MACH_PORT_NULL ||
> +      (&__hurd_local_reply_port != &__hurd_reply_port0 &&
> +       port == __hurd_reply_port0))
> +    port = __mach_reply_port ();
>  
> -  return __hurd_local_reply_port;
> +  return port;
>  }

The current version may change __hurd_local_reply_port, while your
proposed version does not.

>  weak_alias (__mig_get_reply_port, mig_get_reply_port)
>  
> @@ -40,6 +41,7 @@ void
>  __mig_dealloc_reply_port (mach_port_t arg)
>  {
>    mach_port_t port = __hurd_local_reply_port;
> +  assert (port == arg || arg == MACH_PORT_NULL);
>    __hurd_local_reply_port = MACH_PORT_NULL;	/* So the mod_refs
> RPC won't use it.  */
>  
>    if (MACH_PORT_VALID (port))
> 
> Samuel: Regarding your previous comment:
> >> Additionally, any strong reason to not change mig??
> > 
> > Having to deal with the introduced incompatibility.
> 
> Incompatibility with what, older versions of glibc/hurd/mach/mig, which
> ones?

If your suggestion is to remove the argument from
__mig_dealloc_reply_port, that isn't an option, as it would be an ABI
break in libc.

-- 
Pino Toscano

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic