]>
Commit | Line | Data |
---|---|---|
28f540f4 | 1 | /* Demux messages sent on the signal port. |
dff8da6b | 2 | Copyright (C) 1991-2024 Free Software Foundation, Inc. |
c84142e8 | 3 | This file is part of the GNU C Library. |
28f540f4 | 4 | |
c84142e8 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 9 | |
c84142e8 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
28f540f4 | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 16 | License along with the GNU C Library; if not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
28f540f4 RM |
18 | |
19 | #include <hurd.h> | |
20 | #include <hurd/signal.h> | |
21 | #include <stddef.h> | |
22 | ||
28f540f4 RM |
23 | static boolean_t |
24 | msgport_server (mach_msg_header_t *inp, | |
25 | mach_msg_header_t *outp) | |
26 | { | |
27 | extern boolean_t _S_msg_server (mach_msg_header_t *inp, | |
28 | mach_msg_header_t *outp); | |
29 | extern boolean_t _S_exc_server (mach_msg_header_t *inp, | |
30 | mach_msg_header_t *outp); | |
28f540f4 | 31 | |
34a5a146 JM |
32 | return (_S_exc_server (inp, outp) |
33 | || _S_msg_server (inp, outp)); | |
28f540f4 RM |
34 | } |
35 | ||
36 | /* This is the code that the signal thread runs. */ | |
9446e02b ST |
37 | void * |
38 | _hurd_msgport_receive (void *arg) | |
28f540f4 RM |
39 | { |
40 | /* Get our own sigstate cached so we never again have to take a lock to | |
41 | fetch it. There is much code in hurdsig.c that operates with some | |
72e1a750 RM |
42 | sigstate lock held, which will deadlock with _hurd_thread_sigstate. |
43 | ||
9446e02b | 44 | Furthermore, in the pthread case this is the convenient spot |
72e1a750 RM |
45 | to initialize _hurd_msgport_thread (see hurdsig.c:_hurdsig_init). */ |
46 | ||
47 | _hurd_msgport_thread = _hurd_self_sigstate ()->thread; | |
28f540f4 RM |
48 | |
49 | while (1) | |
50 | (void) __mach_msg_server (msgport_server, __vm_page_size, _hurd_msgport); | |
51 | } |