GCC 4.x fixes for Hurdy bits (4/5)
Neal H. Walfield
neal@walfield.org
Fri Jun 10 13:54:00 GMT 2005
> -#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)
More information about the Libc-alpha
mailing list