x86-64: Align the stack in __tls_get_addr [BZ #21609]
[glibc.git] / hurd / msgportdemux.c
blob05f7117014936f18227e87a22b5db2bd3ffcbaf9
1 /* Demux messages sent on the signal port.
2 Copyright (C) 1991-2017 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 <http://www.gnu.org/licenses/>. */
19 #include <hurd.h>
20 #include <hurd/signal.h>
21 #include <stddef.h>
23 struct demux
25 struct demux *next;
26 boolean_t (*demux) (mach_msg_header_t *inp,
27 mach_msg_header_t *outp);
30 struct demux *_hurd_msgport_demuxers = NULL;
32 extern boolean_t __msg_server (mach_msg_header_t *inp,
33 mach_msg_header_t *outp);
35 static boolean_t
36 msgport_server (mach_msg_header_t *inp,
37 mach_msg_header_t *outp)
39 extern boolean_t _S_msg_server (mach_msg_header_t *inp,
40 mach_msg_header_t *outp);
41 extern boolean_t _S_exc_server (mach_msg_header_t *inp,
42 mach_msg_header_t *outp);
43 struct demux *d;
45 for (d = _hurd_msgport_demuxers; d != NULL; d = d->next)
46 if ((*d->demux) (inp, outp))
47 return 1;
49 return (_S_exc_server (inp, outp) ||
50 _S_msg_server (inp, outp));
53 /* This is the code that the signal thread runs. */
54 void
55 _hurd_msgport_receive (void)
57 /* Get our own sigstate cached so we never again have to take a lock to
58 fetch it. There is much code in hurdsig.c that operates with some
59 sigstate lock held, which will deadlock with _hurd_thread_sigstate.
61 Furthermore, in the cthreads case this is the convenient spot
62 to initialize _hurd_msgport_thread (see hurdsig.c:_hurdsig_init). */
64 _hurd_msgport_thread = _hurd_self_sigstate ()->thread;
66 while (1)
67 (void) __mach_msg_server (msgport_server, __vm_page_size, _hurd_msgport);