00001 #ifndef CLASSLIB_SYSAPI_SIGNAL_H
00002 # define CLASSLIB_SYSAPI_SIGNAL_H
00003
00004
00005
00006 # include "classlib/sysapi/system.h"
00007 # include <cstdio>
00008 # include <cstdlib>
00009 # include <cerrno>
00010
00011 # ifdef _WIN32
00012 # include <windows.h>
00013 # else
00014 # include <unistd.h>
00015 # include <sys/stat.h>
00016 # include <ucontext.h>
00017 # endif
00018
00019
00020
00021
00022 # ifndef SA_SIGINFO
00023 # define SA_SIGINFO 0
00024 # endif
00025
00026
00027 # if !HAVE_SIGINFO_SI_UTIME // darwin
00028 # define si_utime si_signo ? 0 : 0
00029 # define si_stime si_signo ? 0 : 0
00030 # endif
00031 # if !HAVE_SIGINFO_SI_INT
00032 # if HAVE_SIGINFO_SI_VALUE // darwin
00033 # define si_int si_value.sigval_int
00034 # define si_ptr si_value.sigval_ptr
00035 # else // (none known)
00036 # define si_int si_signo ? 0 : 0
00037 # define si_ptr si_signo ? (void *) 0 : (void *) 0
00038 # endif
00039 # endif
00040
00041
00042 # ifdef _WIN32
00043 # define STDERR_HANDLE GetStdHandle (STD_ERROR_HANDLE)
00044 # else
00045 # define STDERR_HANDLE STDERR_FILENO
00046 # endif
00047
00048
00049
00050
00051 # ifdef _WIN32
00052 # define MYWRITE(fd,data,n) do { DWORD written; WriteFile(fd,data,n,\
00053 &written,0); } while (0)
00054 # else
00055 # define MYWRITE(fd,data,n) write(fd,data,n)
00056 # endif
00057
00058
00059
00064 static const int SIGNAL_MESSAGE_BUFSIZE = 256;
00065
00066
00067
00068
00069
00070 #if HAVE_RAISE && !HAVE_RAISE_DECL
00071
00072
00073 extern "C" int raise (int signalnr);
00074 #endif
00075
00076 #if HAVE_STRSIGNAL && !HAVE_STRSIGNAL_DECL
00077
00078
00079 extern "C" char *strsignal (int signalnr);
00080 #endif
00081
00082
00083
00084
00085
00086 #endif // CLASSLIB_SYSAPI_SIGNAL_H