ReactOS 0.4.15-dev-7897-g78dc504
signal.c File Reference
#include <precomp.h>
#include "include/internal/wine/msvcrt.h"
Include dependency graph for signal.c:

Go to the source code of this file.

Functions

__p_sig_fn_t signal (int sig, __p_sig_fn_t func)
 
int raise (int sig)
 
void _default_handler (int sig)
 

Variables

static sig_element signal_list []
 

Function Documentation

◆ _default_handler()

void _default_handler ( int  sig)

Definition at line 120 of file signal.c.

121{
122 _exit(3);
123}
void _exit(int exitcode)
Definition: _exit.c:25

Referenced by raise().

◆ raise()

int raise ( int  sig)

Definition at line 71 of file signal.c.

72{
74 unsigned int i;
75
76 switch (sig)
77 {
78 case SIGINT:
79 case SIGILL:
80 case SIGFPE:
81 case SIGSEGV:
82 case SIGTERM:
83 case SIGBREAK:
84 case SIGABRT:
85 break;
86
87 default:
88 //FIXME: set last err?
89 return -1;
90 }
91
92
93 // if(sig <= 0)
94 // return -1;
95 // if(sig > SIGMAX)
96 // return -1;
97
98 for(i=0;i<sizeof(signal_list)/sizeof(signal_list[0]);i++)
99 {
100 if ( signal_list[i].signal == sig )
101 {
103 break;
104 }
105 }
106
107 if(temp == SIG_IGN)// || (sig == SIGQUIT && temp == (_p_sig_fn_t)SIG_DFL))
108 return 0; /* Ignore it */
109
110 if(temp == SIG_DFL)
111 _default_handler(sig); /* this does not return */
112 else
113 temp(sig);
114
115 return 0;
116}
#define SIG_DFL
Definition: signal.h:47
#define SIGINT
Definition: signal.h:23
#define SIGILL
Definition: signal.h:25
void(* __p_sig_fn_t)(int)
Definition: signal.h:45
#define SIGTERM
Definition: signal.h:39
#define SIGFPE
Definition: signal.h:30
#define SIGABRT
Definition: signal.h:28
#define SIG_IGN
Definition: signal.h:48
#define SIGSEGV
Definition: signal.h:33
#define SIGBREAK
Definition: signal.h:40
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
static sig_element signal_list[]
Definition: signal.c:4
void _default_handler(int sig)
Definition: signal.c:120
int signal
Definition: except.c:82
__p_sig_fn_t handler
Definition: msvcrt.h:148

Referenced by _CrtHandleDbgReport(), abort(), getline(), test___pxcptinfoptrs(), and test_signal().

◆ signal()

__p_sig_fn_t signal ( int  sig,
__p_sig_fn_t  func 
)

Definition at line 23 of file signal.c.

24{
26 unsigned int i;
27
28 switch (sig)
29 {
30 case SIGINT:
31 case SIGILL:
32 case SIGFPE:
33 case SIGSEGV:
34 case SIGTERM:
35 case SIGBREAK:
36 case SIGABRT:
37 break;
38
39 default:
41 return SIG_ERR;
42 }
43
44 // check with IsBadCodePtr
45 if ( (uintptr_t)func < 4096 && func != SIG_DFL && func != SIG_IGN)
46 {
48 return SIG_ERR;
49 }
50
51 for(i=0; i < sizeof(signal_list)/sizeof(signal_list[0]); i++)
52 {
53 if ( signal_list[i].signal == sig )
54 {
57 return temp;
58 }
59 }
60
61 /* should be impossible to get here */
63 return SIG_ERR;
64}
#define EINVAL
Definition: acclib.h:90
#define SIG_ERR
Definition: signal.h:52
unsigned int uintptr_t
Definition: crtdefs.h:321
GLenum func
Definition: glext.h:6028
errno_t __cdecl _set_errno(_In_ int _Value)

Variable Documentation

◆ signal_list

sig_element signal_list[]
static
Initial value:
=
{
{ SIGINT, "CTRL+C",SIG_DFL },
{ SIGILL, "Illegal instruction",SIG_DFL },
{ SIGFPE, "Floating-point exception",SIG_DFL },
{ SIGSEGV, "Illegal storage access",SIG_DFL },
{ SIGTERM, "Termination request",SIG_DFL },
{ SIGBREAK, "CTRL+BREAK",SIG_DFL },
{ SIGABRT, "Abnormal termination",SIG_DFL }
}

Definition at line 4 of file signal.c.

Referenced by raise(), and signal().