Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2d96d030
Commit
2d96d030
authored
Dec 01, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use signal definitions from public header.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e085387
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
61 deletions
+47
-61
except.c
dlls/msvcrt/except.c
+44
-43
exit.c
dlls/msvcrt/exit.c
+3
-2
msvcrt.h
dlls/msvcrt/msvcrt.h
+0
-16
No files found.
dlls/msvcrt/except.c
View file @
2d96d030
...
...
@@ -22,6 +22,7 @@
*/
#include <float.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
...
...
@@ -44,7 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh);
static
MSVCRT_security_error_handler
security_error_handler
;
#endif
static
MSVCRT___sighandler_t
sighandlers
[
MSVCRT_NSIG
]
=
{
MSVCRT_
SIG_DFL
};
static
__sighandler_t
sighandlers
[
NSIG
]
=
{
SIG_DFL
};
static
BOOL
WINAPI
msvcrt_console_handler
(
DWORD
ctrlType
)
{
...
...
@@ -53,10 +54,10 @@ static BOOL WINAPI msvcrt_console_handler(DWORD ctrlType)
switch
(
ctrlType
)
{
case
CTRL_C_EVENT
:
if
(
sighandlers
[
MSVCRT_
SIGINT
])
if
(
sighandlers
[
SIGINT
])
{
if
(
sighandlers
[
MSVCRT_SIGINT
]
!=
MSVCRT_
SIG_IGN
)
sighandlers
[
MSVCRT_SIGINT
](
MSVCRT_
SIGINT
);
if
(
sighandlers
[
SIGINT
]
!=
SIG_IGN
)
sighandlers
[
SIGINT
](
SIGINT
);
ret
=
TRUE
;
}
break
;
...
...
@@ -92,7 +93,7 @@ static const struct
static
LONG
msvcrt_exception_filter
(
struct
_EXCEPTION_POINTERS
*
except
)
{
LONG
ret
=
EXCEPTION_CONTINUE_SEARCH
;
MSVCRT_
__sighandler_t
handler
;
__sighandler_t
handler
;
if
(
!
except
||
!
except
->
ExceptionRecord
)
return
EXCEPTION_CONTINUE_SEARCH
;
...
...
@@ -100,16 +101,16 @@ static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
switch
(
except
->
ExceptionRecord
->
ExceptionCode
)
{
case
EXCEPTION_ACCESS_VIOLATION
:
if
((
handler
=
sighandlers
[
MSVCRT_SIGSEGV
])
!=
MSVCRT_
SIG_DFL
)
if
((
handler
=
sighandlers
[
SIGSEGV
])
!=
SIG_DFL
)
{
if
(
handler
!=
MSVCRT_
SIG_IGN
)
if
(
handler
!=
SIG_IGN
)
{
EXCEPTION_POINTERS
**
ep
=
(
EXCEPTION_POINTERS
**
)
MSVCRT___pxcptinfoptrs
(),
*
old_ep
;
old_ep
=
*
ep
;
*
ep
=
except
;
sighandlers
[
MSVCRT_SIGSEGV
]
=
MSVCRT_
SIG_DFL
;
handler
(
MSVCRT_
SIGSEGV
);
sighandlers
[
SIGSEGV
]
=
SIG_DFL
;
handler
(
SIGSEGV
);
*
ep
=
old_ep
;
}
ret
=
EXCEPTION_CONTINUE_EXECUTION
;
...
...
@@ -126,15 +127,15 @@ static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
case
EXCEPTION_FLT_OVERFLOW
:
case
EXCEPTION_FLT_STACK_CHECK
:
case
EXCEPTION_FLT_UNDERFLOW
:
if
((
handler
=
sighandlers
[
MSVCRT_SIGFPE
])
!=
MSVCRT_
SIG_DFL
)
if
((
handler
=
sighandlers
[
SIGFPE
])
!=
SIG_DFL
)
{
if
(
handler
!=
MSVCRT_
SIG_IGN
)
if
(
handler
!=
SIG_IGN
)
{
EXCEPTION_POINTERS
**
ep
=
(
EXCEPTION_POINTERS
**
)
MSVCRT___pxcptinfoptrs
(),
*
old_ep
;
unsigned
int
i
;
int
float_signal
=
_FPE_INVALID
;
sighandlers
[
MSVCRT_SIGFPE
]
=
MSVCRT_
SIG_DFL
;
sighandlers
[
SIGFPE
]
=
SIG_DFL
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
float_exception_map
);
i
++
)
{
if
(
float_exception_map
[
i
].
status
==
...
...
@@ -147,7 +148,7 @@ static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
old_ep
=
*
ep
;
*
ep
=
except
;
((
float_handler
)
handler
)(
MSVCRT_
SIGFPE
,
float_signal
);
((
float_handler
)
handler
)(
SIGFPE
,
float_signal
);
*
ep
=
old_ep
;
}
ret
=
EXCEPTION_CONTINUE_EXECUTION
;
...
...
@@ -155,16 +156,16 @@ static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
break
;
case
EXCEPTION_ILLEGAL_INSTRUCTION
:
case
EXCEPTION_PRIV_INSTRUCTION
:
if
((
handler
=
sighandlers
[
MSVCRT_SIGILL
])
!=
MSVCRT_
SIG_DFL
)
if
((
handler
=
sighandlers
[
SIGILL
])
!=
SIG_DFL
)
{
if
(
handler
!=
MSVCRT_
SIG_IGN
)
if
(
handler
!=
SIG_IGN
)
{
EXCEPTION_POINTERS
**
ep
=
(
EXCEPTION_POINTERS
**
)
MSVCRT___pxcptinfoptrs
(),
*
old_ep
;
old_ep
=
*
ep
;
*
ep
=
except
;
sighandlers
[
MSVCRT_SIGILL
]
=
MSVCRT_
SIG_DFL
;
handler
(
MSVCRT_
SIGILL
);
sighandlers
[
SIGILL
]
=
SIG_DFL
;
handler
(
SIGILL
);
*
ep
=
old_ep
;
}
ret
=
EXCEPTION_CONTINUE_EXECUTION
;
...
...
@@ -189,31 +190,31 @@ void msvcrt_free_signals(void)
* Some signals may never be generated except through an explicit call to
* raise.
*/
MSVCRT___sighandler_t
CDECL
MSVCRT_signal
(
int
sig
,
MSVCRT_
__sighandler_t
func
)
__sighandler_t
CDECL
MSVCRT_signal
(
int
sig
,
__sighandler_t
func
)
{
MSVCRT___sighandler_t
ret
=
MSVCRT_
SIG_ERR
;
__sighandler_t
ret
=
SIG_ERR
;
TRACE
(
"(%d, %p)
\n
"
,
sig
,
func
);
if
(
func
==
MSVCRT_SIG_ERR
)
return
MSVCRT_
SIG_ERR
;
if
(
func
==
SIG_ERR
)
return
SIG_ERR
;
switch
(
sig
)
{
/* Cases handled internally. Note SIGTERM is never generated by Windows,
* so we effectively mask it.
*/
case
MSVCRT_
SIGABRT
:
case
MSVCRT_
SIGFPE
:
case
MSVCRT_
SIGILL
:
case
MSVCRT_
SIGSEGV
:
case
MSVCRT_
SIGINT
:
case
MSVCRT_
SIGTERM
:
case
MSVCRT_
SIGBREAK
:
case
SIGABRT
:
case
SIGFPE
:
case
SIGILL
:
case
SIGSEGV
:
case
SIGINT
:
case
SIGTERM
:
case
SIGBREAK
:
ret
=
sighandlers
[
sig
];
sighandlers
[
sig
]
=
func
;
break
;
default:
ret
=
MSVCRT_
SIG_ERR
;
ret
=
SIG_ERR
;
}
return
ret
;
}
...
...
@@ -223,41 +224,41 @@ MSVCRT___sighandler_t CDECL MSVCRT_signal(int sig, MSVCRT___sighandler_t func)
*/
int
CDECL
MSVCRT_raise
(
int
sig
)
{
MSVCRT_
__sighandler_t
handler
;
__sighandler_t
handler
;
TRACE
(
"(%d)
\n
"
,
sig
);
switch
(
sig
)
{
case
MSVCRT_
SIGFPE
:
case
MSVCRT_
SIGILL
:
case
MSVCRT_
SIGSEGV
:
case
SIGFPE
:
case
SIGILL
:
case
SIGSEGV
:
handler
=
sighandlers
[
sig
];
if
(
handler
==
MSVCRT_
SIG_DFL
)
MSVCRT__exit
(
3
);
if
(
handler
!=
MSVCRT_
SIG_IGN
)
if
(
handler
==
SIG_DFL
)
MSVCRT__exit
(
3
);
if
(
handler
!=
SIG_IGN
)
{
EXCEPTION_POINTERS
**
ep
=
(
EXCEPTION_POINTERS
**
)
MSVCRT___pxcptinfoptrs
(),
*
old_ep
;
sighandlers
[
sig
]
=
MSVCRT_
SIG_DFL
;
sighandlers
[
sig
]
=
SIG_DFL
;
old_ep
=
*
ep
;
*
ep
=
NULL
;
if
(
sig
==
MSVCRT_
SIGFPE
)
if
(
sig
==
SIGFPE
)
((
float_handler
)
handler
)(
sig
,
_FPE_EXPLICITGEN
);
else
handler
(
sig
);
*
ep
=
old_ep
;
}
break
;
case
MSVCRT_
SIGABRT
:
case
MSVCRT_
SIGINT
:
case
MSVCRT_
SIGTERM
:
case
MSVCRT_
SIGBREAK
:
case
SIGABRT
:
case
SIGINT
:
case
SIGTERM
:
case
SIGBREAK
:
handler
=
sighandlers
[
sig
];
if
(
handler
==
MSVCRT_
SIG_DFL
)
MSVCRT__exit
(
3
);
if
(
handler
!=
MSVCRT_
SIG_IGN
)
if
(
handler
==
SIG_DFL
)
MSVCRT__exit
(
3
);
if
(
handler
!=
SIG_IGN
)
{
sighandlers
[
sig
]
=
MSVCRT_
SIG_DFL
;
sighandlers
[
sig
]
=
SIG_DFL
;
handler
(
sig
);
}
break
;
...
...
dlls/msvcrt/exit.c
View file @
2d96d030
...
...
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <process.h>
#include <signal.h>
#include <stdio.h>
#include "msvcrt.h"
#include "mtdll.h"
...
...
@@ -258,7 +259,7 @@ void CDECL MSVCRT_abort(void)
else
_cputs
(
"
\n
abnormal program termination
\n
"
);
}
MSVCRT_raise
(
MSVCRT_
SIGABRT
);
MSVCRT_raise
(
SIGABRT
);
/* in case raise() returns */
MSVCRT__exit
(
3
);
}
...
...
@@ -297,7 +298,7 @@ void CDECL MSVCRT__wassert(const wchar_t* str, const wchar_t* file, unsigned int
else
MSVCRT_fwprintf
(
MSVCRT_stderr
,
L"Assertion failed: %ls, file %ls, line %d
\n\n
"
,
str
,
file
,
line
);
MSVCRT_raise
(
MSVCRT_
SIGABRT
);
MSVCRT_raise
(
SIGABRT
);
MSVCRT__exit
(
3
);
}
...
...
dlls/msvcrt/msvcrt.h
View file @
2d96d030
...
...
@@ -662,22 +662,6 @@ struct MSVCRT__stat64 {
#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
(
__cdecl
*
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)
#define MSVCRT__TRUNCATE ((size_t)-1)
#define _MAX__TIME64_T (((__time64_t)0x00000007 << 32) | 0x93406FFF)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment