This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: GCC 4.x fixes for Hurdy bits (4/5)
- From: "Neal H. Walfield" <neal at walfield dot org>
- To: "Alfred M. Szmidt" <ams at gnu dot org>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 10 Jun 2005 14:53:56 +0100
- Subject: Re: GCC 4.x fixes for Hurdy bits (4/5)
- References: <E1DgdBv-0004RG-TA@fencepost.gnu.org>
> -#define reply_port (use_threadvar ? *portloc : global_reply_port)
>
> static int use_threadvar;
> static mach_port_t global_reply_port;
>
> +static mach_port_t
> +_reply_port (mach_port_t *portloc)
> +{
> + return (use_threadvar ? *portloc : global_reply_port);
> +}
> +#define reply_port() _reply_port (portloc)
> +
> /* These functions are called by MiG-generated code. */
...
> GETPORT;
> + mach_port_t rp = reply_port ();
>
> - port = reply_port;
> - reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
> + port = rp;
> + rp = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
Is seems to me that the intention was to overwrite the global/tls
variable, not the local one. Maybe doing something like would be
better:
static mach_port_t*
_reply_port (mach_port_t *portloc)
{
return (use_threadvar ? portloc : &global_reply_port);
}
#define reply_port() *_reply_port (portloc)