]> sourceware.org Git - glibc.git/blame - sysdeps/stub/exc2signal.c
[HAVE_UNISTD_H]: Include unistd.h so it can declare sys_siglist.
[glibc.git] / sysdeps / stub / exc2signal.c
CommitLineData
28f540f4
RM
1/* Translate Mach exception codes into signal numbers. Stub version.
2Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
3This file is part of the GNU C Library.
4
5The GNU C Library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Library General Public License as
7published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later version.
9
10The GNU C Library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Library General Public License for more details.
14
15You should have received a copy of the GNU Library General Public
16License along with the GNU C Library; see the file COPYING.LIB. If
17not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18Cambridge, MA 02139, USA. */
19
20#include <hurd.h>
21
22/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
23 into a signal number and signal subcode. */
24
25void
26_hurd_exception2signal (int exception, int code, int subcode,
27 int *signo, int *sigcode, int *error)
28{
29 *error = 0;
30
31 switch (exception)
32 {
33 default:
34 *signo = SIGIOT;
35 *sigcode = exception;
36 break;
37
38 case EXC_BAD_ACCESS:
39 if (code == KERN_PROTECTION_FAILURE)
40 *signo = SIGSEGV;
41 else
42 *signo = SIGBUS;
43 *sigcode = subcode;
44 *error = code;
45 break;
46
47 case EXC_BAD_INSTRUCTION:
48 *signo = SIGILL;
49 *sigcode = 0;
50 break;
51
52 case EXC_ARITHMETIC:
53 *signo = SIGFPE;
54 *sigcode = 0;
55 break;
56
57 case EXC_EMULATION:
58 case EXC_SOFTWARE:
59 *signo = SIGEMT;
60 *sigcode = 0;
61 break;
62
63 case EXC_BREAKPOINT:
64 *signo = SIGTRAP;
65 *sigcode = 0;
66 break;
67 }
68}
This page took 0.035601 seconds and 5 git commands to generate.