2007-03-14 20:24:57 +00:00
|
|
|
#include <precomp.h>
|
2008-05-28 21:08:23 +00:00
|
|
|
#include "include/internal/wine/msvcrt.h"
|
2007-03-14 20:24:57 +00:00
|
|
|
|
|
|
|
static sig_element signal_list[] =
|
|
|
|
{
|
|
|
|
{ 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 }
|
|
|
|
};
|
|
|
|
|
|
|
|
//int nsignal = 21;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
//void ( *signal( int sig, void (__cdecl *func) ( int sig [, int subcode ] )) ) ( int sig );
|
|
|
|
|
|
|
|
|
|
|
|
__p_sig_fn_t signal(int sig, __p_sig_fn_t func)
|
|
|
|
{
|
|
|
|
__p_sig_fn_t temp;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case SIGINT:
|
|
|
|
case SIGILL:
|
|
|
|
case SIGFPE:
|
|
|
|
case SIGSEGV:
|
|
|
|
case SIGTERM:
|
|
|
|
case SIGBREAK:
|
|
|
|
case SIGABRT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
_set_errno(EINVAL);
|
2007-03-14 20:24:57 +00:00
|
|
|
return SIG_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
// check with IsBadCodePtr
|
2010-05-31 01:50:09 +00:00
|
|
|
if ( (uintptr_t)func < 4096 && func != SIG_DFL && func != SIG_IGN)
|
2007-03-14 20:24:57 +00:00
|
|
|
{
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
_set_errno(EINVAL);
|
2007-03-14 20:24:57 +00:00
|
|
|
return SIG_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0; i < sizeof(signal_list)/sizeof(signal_list[0]); i++)
|
|
|
|
{
|
|
|
|
if ( signal_list[i].signal == sig )
|
|
|
|
{
|
|
|
|
temp = signal_list[i].handler;
|
|
|
|
signal_list[i].handler = func;
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* should be impossible to get here */
|
[CRT]
- Update file.c to recent wine. (now with locking!)
- implement/enable __wcserror, __wcserror_s, _access_s, _ctime32_s, _ctime64_s,
_cwprintf, _fseeki64, _ftelli64, _get_osplatform, _get_output_format,
_get_pgmptr, _get_wpgmptr, _get_terminate, _get_tzname, _get_unexpected,
_gmtime64_s, _i64toa_s, _i64tow_s, _initterm_e, _itoa_s, _itow_s,
_localtime32_s, _localtime64_s, _ltoa_s, _ltow_s, _putwch, _searchenv_s,
_sopen_s, _ui64toa_s, _ui64tow_s, _vcwprintf, _vsprintf_p, _waccess_s,
_wcserror, _wcserror_s, _wfopen_s, _wsopen_s, fopen_s, fprintf_s, fwprintf_s,
printf_s, strerror_s, strncpy_s, strtok_s, vfprintf_s, vfwprintf_s, vprintf_s,
vwprintf_s, wcscat_s, wcsncat_s, wcstok_s, wprintf_s. Most code comes from
wine.
- Fix __set_errno -> _set_errno and export it.
- Remove unneeded files.
[CRT_HEADERS]
- add threadmbcinfo struct.
- update some sec_api headers from mingw64 due to missing or incorrect
functions.
Patch by Samuel Serapion.
Changes to msvcrt spec by me due to winebuild.
CRLF/LF fixes.
svn path=/trunk/; revision=54651
2011-12-14 22:09:24 +00:00
|
|
|
_set_errno(EINVAL);
|
2007-03-14 20:24:57 +00:00
|
|
|
return SIG_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
raise(int sig)
|
|
|
|
{
|
|
|
|
__p_sig_fn_t temp = 0;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
switch (sig)
|
|
|
|
{
|
|
|
|
case SIGINT:
|
|
|
|
case SIGILL:
|
|
|
|
case SIGFPE:
|
|
|
|
case SIGSEGV:
|
|
|
|
case SIGTERM:
|
|
|
|
case SIGBREAK:
|
|
|
|
case SIGABRT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
//FIXME: set last err?
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if(sig <= 0)
|
|
|
|
// return -1;
|
|
|
|
// if(sig > SIGMAX)
|
|
|
|
// return -1;
|
|
|
|
|
|
|
|
for(i=0;i<sizeof(signal_list)/sizeof(signal_list[0]);i++)
|
|
|
|
{
|
|
|
|
if ( signal_list[i].signal == sig )
|
|
|
|
{
|
|
|
|
temp = signal_list[i].handler;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(temp == SIG_IGN)// || (sig == SIGQUIT && temp == (_p_sig_fn_t)SIG_DFL))
|
|
|
|
return 0; /* Ignore it */
|
|
|
|
|
|
|
|
if(temp == SIG_DFL)
|
|
|
|
_default_handler(sig); /* this does not return */
|
|
|
|
else
|
|
|
|
temp(sig);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _default_handler(int sig)
|
|
|
|
{
|
|
|
|
_exit(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-28 21:08:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|