亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? winsig.c

?? C標準庫源代碼,能提高對C的理解,不錯的哦
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***
*winsig.c - C signal support
*
*       Copyright (c) 1991-1997, Microsoft Corporation. All rights reserved
*
*Purpose:
*       Defines signal(), raise() and supporting functions.
*
*******************************************************************************/


#include <cruntime.h>
#include <errno.h>
#include <float.h>
#include <malloc.h>
#include <mtdll.h>
#include <oscalls.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <dbgint.h>

/*
 * look up the first entry in the exception-action table corresponding to
 * the given signal
 */
#ifdef _MT
static struct _XCPT_ACTION * __cdecl siglookup(int, struct _XCPT_ACTION *);
#else  /* _MT */
static struct _XCPT_ACTION * __cdecl siglookup(int);
#endif  /* _MT */

/*
 * variables holding action codes (and code pointers) for SIGINT, SIGBRK,
 * SIGABRT and SIGTERM.
 *
 * note that the disposition (i.e., action to be taken upon receipt) of
 * these signals is defined on a per-process basis (not per-thread)!!
 */

static _PHNDLR ctrlc_action       = SIG_DFL;    /* SIGINT   */
static _PHNDLR ctrlbreak_action   = SIG_DFL;    /* SIGBREAK */
static _PHNDLR abort_action       = SIG_DFL;    /* SIGABRT  */
static _PHNDLR term_action        = SIG_DFL;    /* SIGTERM  */

/*
 * flag indicated whether or not a handler has been installed to capture
 * ^C and ^Break events.
 */
static int ConsoleCtrlHandler_Installed = 0;


/***
*static BOOL WINAPI ctrlevent_capture(DWORD CtrlType) - capture ^C and ^Break events
*
*Purpose:
*       Capture ^C and ^Break events from the console and dispose of them
*       according the values in ctrlc_action and ctrlbreak_action, resp.
*       This is the routine that evokes the user-defined action for SIGINT
*       (^C) or SIGBREAK (^Break) installed by a call to signal().
*
*Entry:
*       DWORD CtrlType  - indicates type of event, two values:
*                               CTRL_C_EVENT
*                               CTRL_BREAK_EVENT
*
*Exit:
*       Returns TRUE to indicate the event (signal) has been handled.
*       Otherwise, returns FALSE.
*
*Exceptions:
*
*******************************************************************************/

static BOOL WINAPI ctrlevent_capture (
        DWORD CtrlType
        )
{
        _PHNDLR ctrl_action;
        _PHNDLR *pctrl_action;
        int sigcode;

        _mlock(_SIGNAL_LOCK);

        /*
         * Identify the type of event and fetch the corresponding action
         * description.
         */

        if ( CtrlType == CTRL_C_EVENT ) {
                ctrl_action = *(pctrl_action = &ctrlc_action);
                sigcode = SIGINT;
        }
        else {
                ctrl_action = *(pctrl_action = &ctrlbreak_action);
                sigcode = SIGBREAK;
        }

        if ( ctrl_action == SIG_DFL ) {
                /*
                 * return FALSE, indicating the event has NOT been handled
                 */
                _munlock(_SIGNAL_LOCK);
                return FALSE;
        }

        if ( ctrl_action != SIG_IGN ) {
                /*
                 * Reset the action to be SIG_DFL and call the user's handler.
                 */
                *pctrl_action = SIG_DFL;
                _munlock(_SIGNAL_LOCK);
                (*ctrl_action)(sigcode);
        }
        else
                /*
                 * SIG_IGN - nothing special to do except release the lock
                 */
                _munlock(_SIGNAL_LOCK);

        /*
         * Return TRUE, indicating the event has been handled (which may
         * mean it's being ignored)
         */
        return TRUE;
}



/***
*_PHNDLR signal(signum, sigact) - Define a signal handler
*
*Purpose:
*       The signal routine allows the user to define what action should
*       be taken when various signals occur. The Win32/Dosx32 implementation
*       supports seven signals, divided up into three general groups
*
*       1. Signals corresponding to OS exceptions. These are:
*                       SIGFPE
*                       SIGILL
*                       SIGSEGV
*          Signal actions for these signals are installed by altering the
*          XcptAction and SigAction fields for the appropriate entry in the
*          exception-action table (XcptActTab[]).
*
*       2. Signals corresponding to ^C and ^Break. These are:
*                       SIGINT
*                       SIGBREAK
*          Signal actions for these signals are installed by altering the
*          _ctrlc_action and _ctrlbreak_action variables.
*
*       3. Signals which are implemented only in the runtime. That is, they
*          occur only as the result of a call to raise().
*                       SIGABRT
*                       SIGTERM
*
*
*Entry:
*       int signum      signal type. recognized signal types are:
*
*                       SIGABRT         (ANSI)
*                       SIGBREAK
*                       SIGFPE          (ANSI)
*                       SIGILL          (ANSI)
*                       SIGINT          (ANSI)
*                       SIGSEGV         (ANSI)
*                       SIGTERM         (ANSI)
*
*       _PHNDLR sigact  signal handling function or action code. the action
*                       codes are:
*
*                       SIG_DFL - take the default action, whatever that may
*                       be, upon receipt of this type type of signal.
*
*                       SIG_DIE - *** ILLEGAL ***
*                       special code used in the XcptAction field of an
*                       XcptActTab[] entry to indicate that the runtime is
*                       to terminate the process upon receipt of the exception.
*                       not accepted as a value for sigact.
*
*                       SIG_IGN - ignore this type of signal
*
*                       [function address] - transfer control to this address
*                       when a signal of this type occurs.
*
*Exit:
*       Good return:
*       Signal returns the previous value of the signal handling function
*       (e.g., SIG_DFL, SIG_IGN, etc., or [function address]). This value is
*       returned in DX:AX.
*
*       Error return:
*       Signal returns -1 and errno is set to EINVAL. The error return is
*       generally taken if the user submits bogus input values.
*
*Exceptions:
*       None.
*
*******************************************************************************/

_PHNDLR __cdecl signal(
        int signum,
        _PHNDLR sigact
        )
{
        struct _XCPT_ACTION *pxcptact;
        _PHNDLR oldsigact;
#ifdef _MT
        _ptiddata ptd;
#endif  /* _MT */

        /*
         * Check for values of sigact supported on other platforms but not
         * on this one. Also, make sure sigact is not SIG_DIE
         */
        if ( (sigact == SIG_ACK) || (sigact == SIG_SGE) )
                goto sigreterror;

        /*
         * Take care of all signals which do not correspond to exceptions
         * in the host OS. Those are:
         *
         *                      SIGINT
         *                      SIGBREAK
         *                      SIGABRT
         *                      SIGTERM
         *
         */
        if ( (signum == SIGINT) || (signum == SIGBREAK) || (signum == SIGABRT)
            || (signum == SIGTERM) ) {

                _mlock(_SIGNAL_LOCK);

                /*
                 * if SIGINT or SIGBREAK, make sure the handler is installed
                 * to capture ^C and ^Break events.
                 */
                if ( ((signum == SIGINT) || (signum == SIGBREAK)) &&
                    !ConsoleCtrlHandler_Installed )
                        if ( SetConsoleCtrlHandler(ctrlevent_capture, TRUE)
                            == TRUE )
                                ConsoleCtrlHandler_Installed = TRUE;
                        else {
                                _doserrno = GetLastError();
                                _munlock(_SIGNAL_LOCK);
                                goto sigreterror;
                        }

                switch (signum) {

                        case SIGINT:
                                oldsigact = ctrlc_action;
                                ctrlc_action = sigact;
                                break;

                        case SIGBREAK:
                                oldsigact = ctrlbreak_action;
                                ctrlbreak_action = sigact;
                                break;

                        case SIGABRT:
                                oldsigact = abort_action;
                                abort_action = sigact;
                                break;

                        case SIGTERM:
                                oldsigact = term_action;
                                term_action = sigact;
                                break;
                }

                _munlock(_SIGNAL_LOCK);
                goto sigretok;
        }

        /*
         * If we reach here, signum is supposed to be one the signals which
         * correspond to exceptions in the host OS. Those are:
         *
         *                      SIGFPE
         *                      SIGILL
         *                      SIGSEGV
         */

        /*
         * Make sure signum is one of the remaining supported signals.
         */
        if ( (signum != SIGFPE) && (signum != SIGILL) && (signum != SIGSEGV) )
                goto sigreterror;


#ifdef _MT
        /*
         * Fetch the tid data table entry for this thread
         */
        ptd = _getptd();

        /*
         * Check that there a per-thread instance of the exception-action
         * table for this thread. if there isn't, create one.
         */
        if ( ptd->_pxcptacttab == _XcptActTab )
                /*
                 * allocate space for an exception-action table
                 */
                if ( (ptd->_pxcptacttab = _malloc_crt(_XcptActTabSize)) != NULL )
                        /*
                         * initialize the table by copying over the contents
                         * of _XcptActTab[]
                         */
                        (void) memcpy(ptd->_pxcptacttab, _XcptActTab,
                            _XcptActTabSize);
                else
                        /*
                         * cannot create exception-action table, return
                         * error to caller
                         */
                        goto sigreterror;

#endif  /* _MT */

        /*
         * look up the proper entry in the exception-action table. note that
         * if several exceptions are mapped to the same signal, this returns
         * the pointer to first such entry in the exception action table. it
         * is assumed that the other entries immediately follow this one.
         */
#ifdef _MT
        if ( (pxcptact = siglookup(signum, ptd->_pxcptacttab)) == NULL )
#else  /* _MT */
        if ( (pxcptact = siglookup(signum)) == NULL )
#endif  /* _MT */
                goto sigreterror;

        /*
         * SIGSEGV, SIGILL and SIGFPE all have more than one exception mapped
         * to them. the code below depends on the exceptions corresponding to
         * the same signal being grouped together in the exception-action
         * table.
         */

        /*
         * store old signal action code for return value
         */
        oldsigact = pxcptact->XcptAction;

        /*
         * loop through all entries corresponding to the
         * given signal and update the SigAction and XcptAction
         * fields as appropriate
         */
        while ( pxcptact->SigNum == signum ) {
                /*
                 * take care of the SIG_IGN and SIG_DFL action
                 * codes
                 */
                pxcptact->XcptAction = sigact;

                /*
                 * make sure we don't run off the end of the table
                 */
#ifdef _MT

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜乳av一区二区三区| 亚洲动漫第一页| 亚洲欧美成aⅴ人在线观看| 一区二区三区在线观看网站| 麻豆一区二区三| 成人精品一区二区三区四区 | 亚洲人成人一区二区在线观看| 亚洲一级片在线观看| 韩国v欧美v亚洲v日本v| 91在线你懂得| 91精品麻豆日日躁夜夜躁| 国产精品三级视频| 国产一区亚洲一区| 制服丝袜亚洲色图| 亚洲图片有声小说| 日本韩国欧美三级| 亚洲国产高清不卡| 国产精品亚洲一区二区三区妖精| 日本精品一级二级| 国产精品毛片久久久久久久| 国产一区二区三区免费看| 日韩一级高清毛片| 亚洲中国最大av网站| 91毛片在线观看| 国产精品理论片| 国产91清纯白嫩初高中在线观看| 精品国产一区二区三区久久影院| 五月婷婷久久综合| 91麻豆精品国产91久久久使用方法| 亚洲综合丁香婷婷六月香| 色视频一区二区| 亚洲美女免费视频| 欧美在线免费观看视频| 亚洲综合一区在线| 在线精品视频小说1| 亚洲成人一区二区| 欧美日韩三级一区| 青青草原综合久久大伊人精品| 欧美日韩在线观看一区二区 | 91精品国产色综合久久久蜜香臀| 午夜精品在线看| 欧美一区二区日韩| 看国产成人h片视频| 欧美精品一区二区精品网| 老司机午夜精品| 久久精品一区二区| 成人中文字幕在线| **欧美大码日韩| 91色porny在线视频| 亚洲一区二区三区四区的| 欧美色视频一区| 亚洲国产精品影院| 在线播放欧美女士性生活| 久久国产人妖系列| 欧美国产综合色视频| 99国内精品久久| 亚洲大片精品永久免费| 欧美日韩精品专区| 视频在线观看一区二区三区| 欧美一区二区三区四区高清| 久久国产日韩欧美精品| 成人欧美一区二区三区1314| 91免费在线看| 亚洲午夜精品久久久久久久久| 日韩免费观看高清完整版在线观看| 国产一区二区看久久| 国产精品久久久久久久久搜平片| 久久免费美女视频| 色哟哟在线观看一区二区三区| 五月婷婷色综合| 久久婷婷成人综合色| 色88888久久久久久影院按摩| 亚洲网友自拍偷拍| 欧美大尺度电影在线| 91香蕉视频mp4| 亚洲午夜精品一区二区三区他趣| 在线播放中文一区| 国产成人在线视频网址| 一区二区三区精品| 国产精品美日韩| 日韩免费成人网| 欧美午夜片在线观看| 国产成人午夜99999| 天堂一区二区在线免费观看| 国产精品网站在线| 欧美成人一级视频| 欧美日韩电影在线播放| 99vv1com这只有精品| 国内精品久久久久影院薰衣草| 亚洲成av人**亚洲成av**| 国产精品卡一卡二| 久久精品综合网| 精品精品国产高清一毛片一天堂| 色婷婷av一区| 97se亚洲国产综合自在线不卡| 韩国三级在线一区| 免费人成网站在线观看欧美高清| 一区二区三区小说| 成人欧美一区二区三区白人| 日本一区二区在线不卡| 精品国产三级电影在线观看| 欧美精品第1页| 欧美理论电影在线| 欧美日韩久久一区| 在线观看日产精品| 欧美亚洲精品一区| 欧美性生活一区| 欧美中文字幕亚洲一区二区va在线| 不卡电影一区二区三区| thepron国产精品| 99亚偷拍自图区亚洲| 成人性生交大片免费看视频在线| 国产黄色成人av| www.亚洲在线| 欧美日韩美女一区二区| 欧美日韩一区二区三区在线看| 91老司机福利 在线| 色综合久久99| 在线国产亚洲欧美| 51久久夜色精品国产麻豆| 欧美女孩性生活视频| 欧美一区二区视频观看视频| 日韩午夜精品视频| 久久欧美中文字幕| 国产精品免费丝袜| 一区二区三区日本| 日韩精品91亚洲二区在线观看| 91精品国产综合久久久久久久| 欧美一区二区三区四区久久| 精品成人一区二区| 中文字幕在线观看不卡视频| 中国色在线观看另类| 亚洲视频一二区| 婷婷综合五月天| 久久国内精品自在自线400部| 国产老肥熟一区二区三区| 成人v精品蜜桃久久一区| 97国产一区二区| 欧美日韩一二区| 欧美xxxxxxxx| 亚洲三级久久久| 日本欧美在线看| 国产大陆a不卡| 在线观看国产日韩| 精品欧美一区二区久久| 国产一区二区三区香蕉| 精品写真视频在线观看| 风流少妇一区二区| aaa欧美大片| 91成人免费在线| 欧美图区在线视频| 欧美一区二区日韩| 欧美国产日产图区| 一区二区三区免费| 日本在线不卡一区| 国产精品白丝av| 色噜噜狠狠色综合欧洲selulu| 爽好久久久欧美精品| 韩国一区二区三区| 成人av免费在线播放| 91精品免费观看| 国产精品午夜免费| 亚洲成av人在线观看| 裸体一区二区三区| www.欧美日韩| 国产精品久久福利| 亚洲午夜在线电影| 国产精品原创巨作av| 69堂精品视频| 亚洲欧洲中文日韩久久av乱码| 偷拍自拍另类欧美| 99精品久久只有精品| 在线播放中文字幕一区| 中文字幕一区二区三区在线观看 | 色呦呦网站一区| 日韩欧美国产电影| 午夜久久久久久久久久一区二区| av在线播放不卡| 久久久久久久久久久久电影 | 久久亚洲精品小早川怜子| 亚洲一区国产视频| 91在线观看视频| 日本一区二区免费在线观看视频| 亚洲国产精品天堂| 欧美视频一区在线| 国产精品久久久久9999吃药| 九九**精品视频免费播放| 3d动漫精品啪啪一区二区竹菊 | 国产伦精一区二区三区| 欧美一卡二卡在线| 日韩二区三区四区| 制服.丝袜.亚洲.另类.中文| 亚洲图片激情小说| 99国产精品久久久久久久久久久| 国产精品美日韩| 国产成人福利片| 国产日韩精品一区二区浪潮av| 国产一区二区三区黄视频| 欧美tk—视频vk| 国产一区二区三区久久久|