This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.x fixes for Hurdy bits (4/5)


> -#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)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]