Fix stringop-overflow warning in test-strncat.
[glibc.git] / mach / mig-reply.c
blobce2059bf064e13023c3530563b63a9cba7ba5b48
1 /* Copyright (C) 1992-2023 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, see
16 <https://www.gnu.org/licenses/>. */
18 #include <mach.h>
20 /* These functions are called by MiG-generated code. */
22 static mach_port_t reply_port;
24 /* Called by MiG to get a reply port. */
25 mach_port_t
26 __mig_get_reply_port (void)
28 if (reply_port == MACH_PORT_NULL)
29 reply_port = __mach_reply_port ();
31 return reply_port;
34 /* Called by MiG to deallocate the reply port. */
35 void
36 __mig_dealloc_reply_port (void)
38 mach_port_t port = reply_port;
39 reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */
40 __mach_port_mod_refs (__mach_task_self (), port,
41 MACH_PORT_RIGHT_RECEIVE, -1);
45 /* Called at startup with CPROC == NULL. cthreads has a different version
46 of this function that is sometimes called with a `cproc_t' pointer. */
47 void
48 __mig_init (void *cproc)
50 if (cproc == 0)
51 reply_port = MACH_PORT_NULL;