2010-11-09 4 views
1

J'ai du code qui doit compiler pour plusieurs plates-formes. Ce qui suit fera la compilation de code, mais je veux savoir où le symbole SIGUNUSED est effectivement défini:Où SIGUNUSED est-il exactement défini dans les fichiers d'en-tête?

Code du travail

#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; 
} 

...

J'ai cherché SIGUNUSED dans/usr/include sans hits. Ce n'est pas dans signal.h. D'où vient-il?

Mise à jour:

Je ne pensais pas à la définition du signal serait en dehors de signal.h que la réponse a indiqué une recherche récursive n'a pas trouvé la définition:

[email protected]:/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 

Merci!

Répondre

2

je le vois défini dans bits/signum.h, qui est inclus à partir signal.h:

#define SIGUNUSED 31 

Peut-être que vous avez oublié de grep récursive?

Questions connexes