initial import
[glibc.git] / sysdeps / generic / mig-reply.c
blob54712a85fc002df98f9180b16b2c19ffd4ca5d86
1 /* Copyright (C) 1992 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
19 #include <mach.h>
21 /* These functions are called by MiG-generated code. */
23 static mach_port_t reply_port;
25 /* Called by MiG to get a reply port. */
26 mach_port_t
27 __mig_get_reply_port (void)
29 if (reply_port == MACH_PORT_NULL)
30 reply_port = __mach_reply_port ();
32 return reply_port;
35 /* Called by MiG to deallocate the reply port. */
36 void
37 __mig_dealloc_reply_port (void)
39 mach_port_t port = reply_port;
40 reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
41 __mach_port_mod_refs (__mach_task_self (), port,
42 MACH_PORT_RIGHT_RECEIVE, -1);
46 /* Called at startup with CPROC == NULL. cthreads has a different version
47 of this function that is sometimes called with a `cproc_t' pointer. */
48 void
49 __mig_init (void *cproc)
51 if (cproc == 0)
52 reply_port = MACH_PORT_NULL;