c - SIGUNUSED 在头文件中的确切定义在哪里?

标签 c linux signals

我有一些代码必须针对多个平台进行编译。以下将使代码编译,但我想知道 SIGUNUSED 符号的实际定义位置:

工作代码

#ifdef LINUX
#define SIGEMT SIGUNUSED
#endif

...

void set_sig_trap()
{
   signal( SIGHUP, Signal );       /* floating point exception            */
   signal( SIGINT , Signal );      /* Interrupt                           */
   signal( SIGQUIT, Signal );      /* quit                                */
   signal( SIGILL, Signal );       /* Illegal instruction                 */
   signal( SIGTRAP, Signal );      /* trace trap                          */
   signal( SIGABRT, Signal );      /* Process abort signal                */
   signal( SIGEMT, Signal );       /* EMT instruction                     */
   signal( SIGFPE, Signal );       /* Floating point exception            */
   signal( SIGBUS, Signal );       /* bus error                           */
   signal( SIGSEGV, Signal );      /* Segmentation violation              */
   signal( SIGSYS, Signal );       /* bad argument to system call         */
   signal( SIGPIPE, Signal );      /* write on a pipe - no one to read it */
   signal( SIGTERM, Signal );      /* Software termination sig. from kill */
   signal( SIGALRM, Signal );      /* alarm clock                         */
   return;
}

...

我在/usr/include 中寻找 SIGUNUSED,但没有找到。它不在 signal.h 中。它来自哪里?

更新:

我认为信号定义不会在 signal.h 之外,因为响应表明递归搜索确实找到了定义:

me@mymachine.:/usr/include $ grep -d recurse SIGUNUSED *
asm/signal.h:#define    SIGUNUSED       31
asm-arm/signal.h:#define        SIGUNUSED       31
asm-ia64/signal.h:/* signal 31 is no longer "unused", but the SIGUNUSED macro remains for backwards compatibility */
asm-ia64/signal.h:#define       SIGUNUSED       31
asm-parisc/signal.h:#define     SIGUNUSED       31
asm-parisc/signal.h:#define SIGRESERVE  SIGUNUSED
asm-powerpc/signal.h:#define    SIGUNUSED       31
asm-s390/signal.h:#define SIGUNUSED       31
asm-x86/signal.h:#define        SIGUNUSED       31
bits/signum.h:#define SIGUNUSED 31

谢谢!

最佳答案

我看到它在 bits/signum.h 中定义,它包含在 signal.h 中:

#define SIGUNUSED 31

也许你忘了递归地 grep?

关于c - SIGUNUSED 在头文件中的确切定义在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4136939/

相关文章:

c - sigkill 不会终止 C 程序

android - 使用NDK编译非本地文件,链接器错误

c - 需要解释输出

ruby - 执行不带 .rb 扩展名的 ruby​​ 脚本?

c - C 信号处理程序中的竞争条件

c - 对 SIGCHLD 使用 sigaction 来了解 child 何时终止但无法判断 child 何时 SIGSEV

c++ - 为什么在定义宏 ## 操作时有 2 层间接寻址

c - 在整数数组上实现 qsort 时遇到问题,无法处理超过 6 个数字的数组

linux - 在/etc/apt/sources.list.d/中创建一个文件

c - 在内核中使用 rdtsc 测量执行时间