]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | /* Copyright (C) 1994-2019 Free Software Foundation, Inc. |
478b92f0 UD |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
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. | |
478b92f0 UD |
8 | |
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 | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
478b92f0 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
28f540f4 RM |
17 | |
18 | #include <mach.h> | |
7a8f45e3 | 19 | #include <mach/mig_support.h> |
28f540f4 RM |
20 | #include <hurd/threadvar.h> |
21 | ||
28f540f4 RM |
22 | /* These functions are called by MiG-generated code. */ |
23 | ||
dc33bef3 ST |
24 | mach_port_t __hurd_reply_port0; |
25 | ||
28f540f4 RM |
26 | /* Called by MiG to get a reply port. */ |
27 | mach_port_t | |
28 | __mig_get_reply_port (void) | |
29 | { | |
aa0e4663 JM |
30 | if (__hurd_local_reply_port == MACH_PORT_NULL |
31 | || (&__hurd_local_reply_port != &__hurd_reply_port0 | |
32 | && __hurd_local_reply_port == __hurd_reply_port0)) | |
dc33bef3 | 33 | __hurd_local_reply_port = __mach_reply_port (); |
28f540f4 | 34 | |
dc33bef3 | 35 | return __hurd_local_reply_port; |
28f540f4 RM |
36 | } |
37 | weak_alias (__mig_get_reply_port, mig_get_reply_port) | |
7a8f45e3 | 38 | libc_hidden_def (__mig_get_reply_port) |
28f540f4 RM |
39 | |
40 | /* Called by MiG to deallocate the reply port. */ | |
41 | void | |
42 | __mig_dealloc_reply_port (mach_port_t arg) | |
43 | { | |
dc33bef3 ST |
44 | mach_port_t port = __hurd_local_reply_port; |
45 | __hurd_local_reply_port = MACH_PORT_NULL; /* So the mod_refs RPC won't use it. */ | |
aa0e1b59 MB |
46 | |
47 | if (MACH_PORT_VALID (port)) | |
48 | __mach_port_mod_refs (__mach_task_self (), port, | |
49 | MACH_PORT_RIGHT_RECEIVE, -1); | |
28f540f4 RM |
50 | } |
51 | weak_alias (__mig_dealloc_reply_port, mig_dealloc_reply_port) | |
7a8f45e3 | 52 | libc_hidden_def (__mig_dealloc_reply_port) |
28f540f4 RM |
53 | |
54 | /* Called by mig interfaces when done with a port. Used to provide the | |
55 | same interface as needed when a custom allocator is used. */ | |
56 | void | |
57 | __mig_put_reply_port(mach_port_t port) | |
58 | { | |
59 | /* Do nothing. */ | |
60 | } | |
61 | weak_alias (__mig_put_reply_port, mig_put_reply_port) | |
62 | ||
63 | /* Called at startup with STACK == NULL. When per-thread variables are set | |
64 | up, this is called again with STACK set to the new stack being switched | |
65 | to, where per-thread variables should be set up. */ | |
66 | void | |
67 | __mig_init (void *stack) | |
68 | { | |
dc33bef3 | 69 | /* Do nothing. */ |
28f540f4 RM |
70 | } |
71 | weak_alias (__mig_init, mig_init) | |
7a8f45e3 | 72 | libc_hidden_def (__mig_init) |