summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/mig-reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/mig-reply.c')
-rw-r--r--sysdeps/mach/hurd/mig-reply.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/sysdeps/mach/hurd/mig-reply.c b/sysdeps/mach/hurd/mig-reply.c
index 540b7bd511..abe6d74d5d 100644
--- a/sysdeps/mach/hurd/mig-reply.c
+++ b/sysdeps/mach/hurd/mig-reply.c
@@ -18,26 +18,20 @@
#include <mach.h>
#include <hurd/threadvar.h>
-#define GETPORT \
- mach_port_t *portloc = \
- (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY)
-#define reply_port (*(use_threadvar ? portloc : &global_reply_port))
-
-static int use_threadvar;
-static mach_port_t global_reply_port;
-
/* These functions are called by MiG-generated code. */
+mach_port_t __hurd_reply_port0;
+
/* Called by MiG to get a reply port. */
mach_port_t
__mig_get_reply_port (void)
{
- GETPORT;
-
- if (reply_port == MACH_PORT_NULL)
- reply_port = __mach_reply_port ();
+ 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 ();
- return reply_port;
+ return __hurd_local_reply_port;
}
weak_alias (__mig_get_reply_port, mig_get_reply_port)
@@ -45,12 +39,8 @@ weak_alias (__mig_get_reply_port, mig_get_reply_port)
void
__mig_dealloc_reply_port (mach_port_t arg)
{
- mach_port_t port;
-
- GETPORT;
-
- port = reply_port;
- reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
+ mach_port_t port = __hurd_local_reply_port;
+ __hurd_local_reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
if (MACH_PORT_VALID (port))
__mach_port_mod_refs (__mach_task_self (), port,
@@ -73,15 +63,6 @@ weak_alias (__mig_put_reply_port, mig_put_reply_port)
void
__mig_init (void *stack)
{
- use_threadvar = stack != 0;
-
- if (use_threadvar)
- {
- /* Recycle the reply port used before multithreading was enabled. */
- mach_port_t *portloc = (mach_port_t *)
- __hurd_threadvar_location_from_sp (_HURD_THREADVAR_MIG_REPLY, stack);
- *portloc = global_reply_port;
- global_reply_port = MACH_PORT_NULL;
- }
+ /* Do nothing. */
}
weak_alias (__mig_init, mig_init)