malloc: Decorate malloc maps
[glibc.git] / hurd / msgportdemux.c
blob676e2e5008ab36ee60fec055a5d2df769238718a
1 /* Demux messages sent on the signal port.
2 Copyright (C) 1991-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
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.
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
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <hurd.h>
20 #include <hurd/signal.h>
21 #include <stddef.h>
23 static boolean_t
24 msgport_server (mach_msg_header_t *inp,
25 mach_msg_header_t *outp)
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);
32 return (_S_exc_server (inp, outp)
33 || _S_msg_server (inp, outp));
36 /* This is the code that the signal thread runs. */
37 void *
38 _hurd_msgport_receive (void *arg)
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
42 sigstate lock held, which will deadlock with _hurd_thread_sigstate.
44 Furthermore, in the pthread case this is the convenient spot
45 to initialize _hurd_msgport_thread (see hurdsig.c:_hurdsig_init). */
47 _hurd_msgport_thread = _hurd_self_sigstate ()->thread;
49 while (1)
50 (void) __mach_msg_server (msgport_server, __vm_page_size, _hurd_msgport);