亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
精品国产成人系列| 亚洲一区电影777| 夜夜揉揉日日人人青青一国产精品| 亚洲综合色区另类av| 国产成人日日夜夜| 欧美一区二区三区小说| 中文字幕佐山爱一区二区免费| 蜜臀av一区二区三区| 在线免费不卡电影| 亚洲欧洲韩国日本视频| 国产一区二区三区免费播放 | 欧美性猛片aaaaaaa做受| 久久这里只有精品6| 日本不卡一二三| 在线国产亚洲欧美| 亚洲卡通动漫在线| 成人高清免费在线播放| 精品久久久久久无| 美女网站视频久久| 91精品国产色综合久久不卡电影 | 欧美精品 国产精品| 亚洲色图欧美在线| 91免费观看视频在线| 国产精品久久久久久久久图文区| 老鸭窝一区二区久久精品| 91麻豆精品国产91久久久使用方法| 亚洲综合男人的天堂| 欧美在线免费观看视频| 伊人色综合久久天天| 日本黄色一区二区| 亚洲高清视频在线| 9191精品国产综合久久久久久| 五月天一区二区三区| 久久99国内精品| 色激情天天射综合网| 最新不卡av在线| 91色porny| 亚洲一区在线观看免费观看电影高清| 99久久er热在这里只有精品66| 国产精品免费免费| 在线免费观看不卡av| 日韩专区一卡二卡| 日韩三级高清在线| 国产精品123| 成人免费小视频| 欧美性大战xxxxx久久久| 日本伊人午夜精品| 精品88久久久久88久久久| 国产精品影视天天线| 国产精品美女久久久久高潮| 色av一区二区| 九九九久久久精品| 国产精品麻豆网站| 欧美三级视频在线| 久久国产日韩欧美精品| 欧美激情一区三区| 97精品国产露脸对白| 午夜精品久久久久久久久久久 | 精品一区二区在线免费观看| 26uuu国产一区二区三区| 不卡欧美aaaaa| 午夜视频在线观看一区二区三区| 欧美日韩日日夜夜| 国产精品一区二区黑丝| 亚洲人成精品久久久久| 欧美日韩亚洲丝袜制服| 国产成人综合网| 亚洲色图.com| 日韩一区二区三区视频在线| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 爽爽淫人综合网网站| 精品人伦一区二区色婷婷| 成人午夜av影视| 亚洲国产日韩av| 久久蜜桃av一区精品变态类天堂| 一本色道综合亚洲| 狂野欧美性猛交blacked| 亚洲女爱视频在线| 精品国产一区二区精华 | 蜜桃av一区二区三区| 中文字幕一区二区三区精华液 | 国产成人在线色| 午夜久久久影院| 中文字幕一区二区三中文字幕| 欧美日韩一区不卡| 国产不卡视频在线播放| 日本午夜一区二区| 综合久久综合久久| 精品欧美乱码久久久久久| 精品视频在线免费| 国产99久久久国产精品| 日韩国产一区二| 一区二区三区小说| 中文字幕制服丝袜成人av| 欧美va在线播放| 91精品国产色综合久久不卡蜜臀| 色狠狠一区二区三区香蕉| 成人黄色大片在线观看| 国产毛片精品国产一区二区三区| 日韩成人一区二区| 香蕉乱码成人久久天堂爱免费| 亚洲美女免费在线| 亚洲欧美国产77777| 中文字幕欧美国产| 国产精品嫩草久久久久| 欧美国产一区视频在线观看| 久久新电视剧免费观看| 精品国产91亚洲一区二区三区婷婷| 欧美日本不卡视频| 欧美日本在线播放| 久久久精品日韩欧美| 国产偷国产偷亚洲高清人白洁| 日韩一区二区在线播放| 欧美va天堂va视频va在线| 7777精品伊人久久久大香线蕉 | 91免费在线看| 99久久精品国产网站| 91色婷婷久久久久合中文| 91小宝寻花一区二区三区| av在线一区二区三区| 色综合久久九月婷婷色综合| 91污片在线观看| 在线免费精品视频| 欧美福利一区二区| 日韩免费看的电影| 久久久久久久综合狠狠综合| 国产性色一区二区| 中文字幕一区二区三区色视频| 亚洲欧美日韩人成在线播放| 一区二区日韩电影| 日韩精品一二三| 国产精品一品二品| 波多野洁衣一区| 欧美亚洲精品一区| 日韩欧美成人午夜| 中文字幕av一区二区三区| ...av二区三区久久精品| 亚洲一区精品在线| 久久草av在线| 91丝袜呻吟高潮美腿白嫩在线观看| 一本一道久久a久久精品| 4438x亚洲最大成人网| 精品99一区二区| 亚洲女子a中天字幕| 蜜臂av日日欢夜夜爽一区| 国内欧美视频一区二区| av高清久久久| 欧美一级高清片在线观看| 国产午夜精品理论片a级大结局 | 中文字幕欧美一| 五月天激情综合| 岛国一区二区在线观看| 91成人在线免费观看| 精品乱人伦小说| 亚洲精品日韩综合观看成人91| 日本美女视频一区二区| 成人av在线观| 欧美一二三区在线| 18涩涩午夜精品.www| 久久精品国产一区二区三区免费看 | 久久网站最新地址| 亚洲综合免费观看高清完整版在线 | 91精品蜜臀在线一区尤物| 久久精品亚洲麻豆av一区二区| 亚洲一区二区影院| 成人午夜又粗又硬又大| 91麻豆精品91久久久久同性| 国产精品国产三级国产aⅴ入口| 免费在线看一区| 色屁屁一区二区| 国产嫩草影院久久久久| 日韩国产高清影视| 色哟哟精品一区| 国产午夜精品久久久久久久| 三级不卡在线观看| 色婷婷综合久色| 国产欧美日韩视频在线观看| 日本女人一区二区三区| 欧美视频精品在线观看| 亚洲视频你懂的| av一区二区三区黑人| 日本一区二区三区四区在线视频| 青草av.久久免费一区| 欧美二区三区91| 亚洲风情在线资源站| 日本韩国欧美在线| 日韩一区中文字幕| 成人激情动漫在线观看| 国产日产欧产精品推荐色| 激情图片小说一区| 日韩欧美国产1| 久久97超碰国产精品超碰| 91精品蜜臀在线一区尤物| 日本三级亚洲精品| 56国语精品自产拍在线观看| 亚洲高清视频在线| 欧美一区二区网站| 免费成人小视频| 欧美精品一区二区三区很污很色的| 美女精品一区二区|