wine/dlls/msvcrt except.c msvcrt.h tests/headers.c
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Dec 1 06:01:51 CST 2005
ChangeSet ID: 21596
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/12/01 06:01:51
Modified files:
dlls/msvcrt : except.c msvcrt.h
dlls/msvcrt/tests: headers.c
Log message:
Prefix signal definitions with MSVCRT_ to avoid conflicts with system
headers.
Patch: http://cvs.winehq.org/patch.py?id=21596
Old revision New revision Changes Path
1.37 1.38 +24 -25 wine/dlls/msvcrt/except.c
1.39 1.40 +16 -0 wine/dlls/msvcrt/msvcrt.h
1.9 1.10 +10 -0 wine/dlls/msvcrt/tests/headers.c
Index: wine/dlls/msvcrt/except.c
diff -u -p wine/dlls/msvcrt/except.c:1.37 wine/dlls/msvcrt/except.c:1.38
--- wine/dlls/msvcrt/except.c:1.37 1 Dec 2005 12: 1:51 -0000
+++ wine/dlls/msvcrt/except.c 1 Dec 2005 12: 1:51 -0000
@@ -40,7 +40,6 @@
#include "excpt.h"
#include "wincon.h"
#include "msvcrt/float.h"
-#include "msvcrt/signal.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
@@ -380,7 +379,7 @@ void __stdcall _seh_longjmp_unwind(struc
}
#endif /* i386 */
-static __sighandler_t sighandlers[NSIG] = { SIG_DFL };
+static MSVCRT___sighandler_t sighandlers[MSVCRT_NSIG] = { MSVCRT_SIG_DFL };
static BOOL WINAPI msvcrt_console_handler(DWORD ctrlType)
{
@@ -389,10 +388,10 @@ static BOOL WINAPI msvcrt_console_handle
switch (ctrlType)
{
case CTRL_C_EVENT:
- if (sighandlers[SIGINT])
+ if (sighandlers[MSVCRT_SIGINT])
{
- if (sighandlers[SIGINT] != SIG_IGN)
- sighandlers[SIGINT](SIGINT);
+ if (sighandlers[MSVCRT_SIGINT] != MSVCRT_SIG_IGN)
+ sighandlers[MSVCRT_SIGINT](MSVCRT_SIGINT);
ret = TRUE;
}
break;
@@ -427,10 +426,10 @@ static LONG WINAPI msvcrt_exception_filt
switch (except->ExceptionRecord->ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
- if (sighandlers[SIGSEGV])
+ if (sighandlers[MSVCRT_SIGSEGV])
{
- if (sighandlers[SIGSEGV] != SIG_IGN)
- sighandlers[SIGSEGV](SIGSEGV);
+ if (sighandlers[MSVCRT_SIGSEGV] != MSVCRT_SIG_IGN)
+ sighandlers[MSVCRT_SIGSEGV](MSVCRT_SIGSEGV);
ret = EXCEPTION_CONTINUE_EXECUTION;
}
break;
@@ -446,13 +445,13 @@ static LONG WINAPI msvcrt_exception_filt
case EXCEPTION_FLT_OVERFLOW:
case EXCEPTION_FLT_STACK_CHECK:
case EXCEPTION_FLT_UNDERFLOW:
- if (sighandlers[SIGFPE])
+ if (sighandlers[MSVCRT_SIGFPE])
{
- if (sighandlers[SIGFPE] != SIG_IGN)
+ if (sighandlers[MSVCRT_SIGFPE] != MSVCRT_SIG_IGN)
{
int i, float_signal = _FPE_INVALID;
- float_handler handler = (float_handler)sighandlers[SIGFPE];
+ float_handler handler = (float_handler)sighandlers[MSVCRT_SIGFPE];
for (i = 0; i < sizeof(float_exception_map) /
sizeof(float_exception_map[0]); i++)
if (float_exception_map[i].status ==
@@ -461,16 +460,16 @@ static LONG WINAPI msvcrt_exception_filt
float_signal = float_exception_map[i].signal;
break;
}
- handler(SIGFPE, float_signal);
+ handler(MSVCRT_SIGFPE, float_signal);
}
ret = EXCEPTION_CONTINUE_EXECUTION;
}
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
- if (sighandlers[SIGILL])
+ if (sighandlers[MSVCRT_SIGILL])
{
- if (sighandlers[SIGILL] != SIG_IGN)
- sighandlers[SIGILL](SIGILL);
+ if (sighandlers[MSVCRT_SIGILL] != MSVCRT_SIG_IGN)
+ sighandlers[MSVCRT_SIGILL](MSVCRT_SIGILL);
ret = EXCEPTION_CONTINUE_EXECUTION;
}
break;
@@ -497,30 +496,30 @@ void msvcrt_free_signals(void)
* Some signals may never be generated except through an explicit call to
* raise.
*/
-__sighandler_t MSVCRT_signal(int sig, __sighandler_t func)
+MSVCRT___sighandler_t MSVCRT_signal(int sig, MSVCRT___sighandler_t func)
{
- __sighandler_t ret = SIG_ERR;
+ MSVCRT___sighandler_t ret = MSVCRT_SIG_ERR;
TRACE("(%d, %p)\n", sig, func);
- if (func == SIG_ERR) return SIG_ERR;
+ if (func == MSVCRT_SIG_ERR) return MSVCRT_SIG_ERR;
switch (sig)
{
/* Cases handled internally. Note SIGTERM is never generated by Windows,
* so we effectively mask it.
*/
- case SIGABRT:
- case SIGFPE:
- case SIGILL:
- case SIGSEGV:
- case SIGINT:
- case SIGTERM:
+ case MSVCRT_SIGABRT:
+ case MSVCRT_SIGFPE:
+ case MSVCRT_SIGILL:
+ case MSVCRT_SIGSEGV:
+ case MSVCRT_SIGINT:
+ case MSVCRT_SIGTERM:
ret = sighandlers[sig];
sighandlers[sig] = func;
break;
default:
- ret = SIG_ERR;
+ ret = MSVCRT_SIG_ERR;
}
return ret;
}
Index: wine/dlls/msvcrt/msvcrt.h
diff -u -p wine/dlls/msvcrt/msvcrt.h:1.39 wine/dlls/msvcrt/msvcrt.h:1.40
--- wine/dlls/msvcrt/msvcrt.h:1.39 1 Dec 2005 12: 1:51 -0000
+++ wine/dlls/msvcrt/msvcrt.h 1 Dec 2005 12: 1:51 -0000
@@ -555,6 +555,22 @@ struct MSVCRT__stati64 {
#define MSVCRT_CLOCKS_PER_SEC 1000
+/* signals */
+#define MSVCRT_SIGINT 2
+#define MSVCRT_SIGILL 4
+#define MSVCRT_SIGFPE 8
+#define MSVCRT_SIGSEGV 11
+#define MSVCRT_SIGTERM 15
+#define MSVCRT_SIGBREAK 21
+#define MSVCRT_SIGABRT 22
+#define MSVCRT_NSIG (MSVCRT_SIGABRT + 1)
+
+typedef void (*MSVCRT___sighandler_t)(int);
+
+#define MSVCRT_SIG_DFL ((MSVCRT___sighandler_t)0)
+#define MSVCRT_SIG_IGN ((MSVCRT___sighandler_t)1)
+#define MSVCRT_SIG_ERR ((MSVCRT___sighandler_t)-1)
+
void MSVCRT_free(void*);
void* MSVCRT_malloc(MSVCRT_size_t);
void* MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
Index: wine/dlls/msvcrt/tests/headers.c
diff -u -p wine/dlls/msvcrt/tests/headers.c:1.9 wine/dlls/msvcrt/tests/headers.c:1.10
--- wine/dlls/msvcrt/tests/headers.c:1.9 1 Dec 2005 12: 1:51 -0000
+++ wine/dlls/msvcrt/tests/headers.c 1 Dec 2005 12: 1:51 -0000
@@ -48,6 +48,7 @@
#include "conio.h"
#include "process.h"
#include "string.h"
+#include "signal.h"
#include "time.h"
#include "locale.h"
#include "setjmp.h"
@@ -96,6 +97,7 @@ static void test_types(void)
CHECK_TYPE(_se_translator_function);
CHECK_TYPE(_beginthread_start_routine_t);
CHECK_TYPE(_onexit_t);
+ CHECK_TYPE(__sighandler_t);
}
/************* Checking structs ***************/
@@ -437,6 +439,14 @@ static void test_defines(void)
CHECK_DEF("_FPCLASS_PD", _FPCLASS_PD, MSVCRT__FPCLASS_PD);
CHECK_DEF("_FPCLASS_PN", _FPCLASS_PN, MSVCRT__FPCLASS_PN);
CHECK_DEF("_FPCLASS_PINF", _FPCLASS_PINF, MSVCRT__FPCLASS_PINF);
+ CHECK_DEF("SIGINT", SIGINT, MSVCRT_SIGINT);
+ CHECK_DEF("SIGILL", SIGILL, MSVCRT_SIGILL);
+ CHECK_DEF("SIGFPE", SIGFPE, MSVCRT_SIGFPE);
+ CHECK_DEF("SIGSEGV", SIGSEGV, MSVCRT_SIGSEGV);
+ CHECK_DEF("SIGTERM", SIGTERM, MSVCRT_SIGTERM);
+ CHECK_DEF("SIGBREAK", SIGBREAK, MSVCRT_SIGBREAK);
+ CHECK_DEF("SIGABRT", SIGABRT, MSVCRT_SIGABRT);
+ CHECK_DEF("NSIG", NSIG, MSVCRT_NSIG);
#ifdef __i386__
CHECK_DEF("_EM_INVALID", _EM_INVALID, MSVCRT__EM_INVALID);
CHECK_DEF("_EM_DENORMAL", _EM_DENORMAL, MSVCRT__EM_DENORMAL);
More information about the wine-cvs
mailing list