Updated to fedora-glibc-20080613T1601
[glibc.git] / mach / mig-reply.c
blob3b02028858232bb681fb7cc25afd448a9430cecb
1 /* Copyright (C) 1992, 1997 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 Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the 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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 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;