• Linux中的信号


    以下内容源自Linux 2.6.39内核版本的signal.h(includelinux)文件。记载出便于自己日后查询。

    /*
     * In POSIX a signal is sent either to a specific thread (Linux task)
     * or to the process as a whole (Linux thread group).  How the signal
     * is sent determines whether it's to one thread or the whole group,
     * which determines which signal mask(s) are involved in blocking it
     * from being delivered until later.  When the signal is delivered,
     * either it's caught or ignored by a user handler or it has a default
     * effect that applies to the whole thread group (POSIX process).
     *
     * The possible effects an unblocked signal set to SIG_DFL can have are:
     *   ignore    - Nothing Happens
     *   terminate    - kill the process, i.e. all threads in the group,
     *           similar to exit_group.  The group leader (only) reports
     *          WIFSIGNALED status to its parent.
     *   coredump    - write a core dump file describing all threads using
     *          the same mm and then kill all those threads
     *   stop     - stop all the threads in the group, i.e. TASK_STOPPED state
     *
     * SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
     * Other signals when not blocked and set to SIG_DFL behaves as follows.
     * The job control signals also have other special effects.
     *
     *    +--------------------+------------------+
     *    |  POSIX signal      |  default action  |
     *    +--------------------+------------------+
     *    |  SIGHUP            |  terminate    |
     *    |  SIGINT            |    terminate    |
     *    |  SIGQUIT           |    coredump     |
     *    |  SIGILL            |    coredump     |
     *    |  SIGTRAP           |    coredump     |
     *    |  SIGABRT/SIGIOT    |    coredump     |
     *    |  SIGBUS            |    coredump     |
     *    |  SIGFPE            |    coredump     |
     *    |  SIGKILL           |    terminate(+)    |
     *    |  SIGUSR1           |    terminate    |
     *    |  SIGSEGV           |    coredump     |
     *    |  SIGUSR2           |    terminate    |
     *    |  SIGPIPE           |    terminate    |
     *    |  SIGALRM           |    terminate    |
     *    |  SIGTERM           |    terminate    |
     *    |  SIGCHLD           |    ignore       |
     *    |  SIGCONT           |    ignore(*)    |
     *    |  SIGSTOP           |    stop(*)(+)      |
     *    |  SIGTSTP           |    stop(*)      |
     *    |  SIGTTIN           |    stop(*)      |
     *    |  SIGTTOU           |    stop(*)      |
     *    |  SIGURG            |    ignore       |
     *    |  SIGXCPU           |    coredump     |
     *    |  SIGXFSZ           |    coredump     |
     *    |  SIGVTALRM         |    terminate    |
     *    |  SIGPROF           |    terminate    |
     *    |  SIGPOLL/SIGIO     |    terminate    |
     *    |  SIGSYS/SIGUNUSED  |    coredump     |
     *    |  SIGSTKFLT         |    terminate    |
     *    |  SIGWINCH          |    ignore       |
     *    |  SIGPWR            |    terminate    |
     *    |  SIGRTMIN-SIGRTMAX |    terminate       |
     *    +--------------------+------------------+
     *    |  non-POSIX signal  |  default action  |
     *    +--------------------+------------------+
     *    |  SIGEMT            |  coredump    |
     *    +--------------------+------------------+
     *
     * (+) For SIGKILL and SIGSTOP the action is "always", not just "default".
     * (*) Special job control effects:
     * When SIGCONT is sent, it resumes the process (all threads in the group)
     * from TASK_STOPPED state and also clears any pending/queued stop signals
     * (any of those marked with "stop(*)").  This happens regardless of blocking,
     * catching, or ignoring SIGCONT.  When any stop signal is sent, it clears
     * any pending/queued SIGCONT signals; this happens regardless of blocking,
     * catching, or ignored the stop signal, though (except for SIGSTOP) the
     * default action of stopping the process may happen later or never.
     */

    如下为Linux/i386中的常规信号:

  • 相关阅读:
    Luogu P2391 白雪皑皑 && BZOJ 2054: 疯狂的馒头 并查集
    Luogu P3391 文艺平衡树(Splay or FHQ Treap)
    [笔记] 平衡树合集(Treap,Splay,替罪羊,FHQ Treap)
    P1353_[USACO08JAN]跑步Running 我死了。。。
    Luogu P1436 棋盘分割 暴力DP
    Luogu P1131 [ZJOI2007]时态同步 树形DP
    Luogu P1282 多米诺骨牌 DP。。背包?
    Luogu P1273 有线电视网 树形DP
    Luogu P1272 重建道路 树形DP
    Luogu P1156 垃圾陷阱 DP
  • 原文地址:https://www.cnblogs.com/kunshanpipixia/p/14176554.html
Copyright © 2020-2023  润新知