我有一些代码必须针对多个平台进行编译。以下将使代码编译,但我想知道 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/