Fix grouping and reuse other locales in various locales
[glibc.git] / hurd / msgportdemux.c
blob53229bf97869ee6ecd4c9b09fb4f09be0bd358d9
1 /* Demux messages sent on the signal port.
2 Copyright (C) 1991,92,94,95,97,99 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #include <hurd.h>
21 #include <hurd/signal.h>
22 #include <stddef.h>
24 struct demux
26 struct demux *next;
27 boolean_t (*demux) (mach_msg_header_t *inp,
28 mach_msg_header_t *outp);
31 struct demux *_hurd_msgport_demuxers = NULL;
33 extern boolean_t __msg_server (mach_msg_header_t *inp,
34 mach_msg_header_t *outp);
36 static boolean_t
37 msgport_server (mach_msg_header_t *inp,
38 mach_msg_header_t *outp)
40 extern boolean_t _S_msg_server (mach_msg_header_t *inp,
41 mach_msg_header_t *outp);
42 extern boolean_t _S_exc_server (mach_msg_header_t *inp,
43 mach_msg_header_t *outp);
44 struct demux *d;
46 for (d = _hurd_msgport_demuxers; d != NULL; d = d->next)
47 if ((*d->demux) (inp, outp))
48 return 1;
50 return (_S_exc_server (inp, outp) ||
51 _S_msg_server (inp, outp));
54 /* This is the code that the signal thread runs. */
55 void
56 _hurd_msgport_receive (void)
58 /* Get our own sigstate cached so we never again have to take a lock to
59 fetch it. There is much code in hurdsig.c that operates with some
60 sigstate lock held, which will deadlock with _hurd_thread_sigstate.
62 Furthermore, in the cthreads case this is the convenient spot
63 to initialize _hurd_msgport_thread (see hurdsig.c:_hurdsig_init). */
65 _hurd_msgport_thread = _hurd_self_sigstate ()->thread;
67 while (1)
68 (void) __mach_msg_server (msgport_server, __vm_page_size, _hurd_msgport);