SIGNAL

Section: ¸®´ª½º ÇÁ·Î±×·¡¸Ó ¸Å´º¾ó (2)
Updated: 1996³â 7¿ù 21ÀÏ
Index
Return to Main Contents
 

À̸§

signal - ANSI C ½Ã±×³Î ó¸®  

»ç¿ë¹ý

#include <signal.h>

void (*signal(int signum, void (*handler)(int)))(int);  

¼³¸í

signal ½Ã½ºÅÛ ÄÝÀº signum ¹øÈ£ÀÇ ½Ã±×³Î¿¡ ´ëÇØ »õ·Î¿î ½Ã±×³Î Çڵ鷯¸¦ ¼³Ä¡ÇÑ´Ù. ½Ã±×³Î Çڵ鷯´Â handler·Î ¼³Á¤µÇ°í, »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼öÀ̰ųª ´ÙÀ½ °ÍÁßÀÇ Çϳª°¡ µÉ ¼ö ÀÖ´Ù:
SIG_IGN
½Ã±×³ÎÀ» ¹«½ÃÇÑ´Ù.
SIG_DFL
½Ã±×³ÎÀÇ Ãʱ⠱⺻ µ¿ÀÛÀ» Çϵµ·Ï ÇÑ´Ù.

½Ã±×³Î Çڵ巯 ·çƾ¿¡ ³Ñ°ÜÁö´Â Á¤¼ö ÀÎÀÚ´Â ½Ã±×³Î ¹øÈ£ÀÌ´Ù. ÀÌ´Â ¿©·¯ ½Ã±×³Î¿¡ ´ëÇØ ÇϳªÀÇ ½Ã±×³Î Çڵ鷯¸¦ »ç¿ëÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù.

 

¹Ýȯ°ª

signalÀº ÀÌÀüÀÇ ½Ã±×³Î Çڵ鷯ÀÇ Æ÷ÀÎÅͳª, ¿¡·¯½Ã SIG_ERR¸¦ ¸®ÅÏÇÑ´Ù.

 

ÁÖÀÇ

SIGKILL³ª SIGSTOP¿¡ ½Ã±×³Î Çڵ鷯¸¦ ÁöÁ¤ÇÒ ¼ö ¾ø´Ù.

BSD ½Ã½ºÅÛ°ú ´Þ¸®, ¸®´ª½ºÀÇ ½Ã±×³ÎÀº ½Ã±×³ÎÀÌ ¹ß»ýÇßÀ» ¶§ Ãʱ⠱⺻ µ¿ÀÛÀ¸·Î µÇµ¹¸°´Ù. ±×·¯³ª, <signal.h> ´ë½Å¿¡ <bsd/signal.h>¸¦ Æ÷ÇÔ½ÃÅ°¸é signal Àº __bsd_signal·Î ÀçÁ¤ÀÇµÇ¾î ½Ã±×³ÎÀº BSD¿¡¼­¿Í °°ÀÌ µ¿ÀÛÇÑ´Ù. signalÀÇ µÎ °¡Áö ¹öÀüÀº ¸ðµÎ sigaction(2)À§¿¡ ¸¸µé¾îÁø ¶óÀ̺귯¸® ·çƾÀÌ´Ù.

ÀÌ ¸ÇÆäÀÌÁöÀÇ ÇÁ·ÎÅäŸÀÔÀÌ ÀÌÇصÇÁö ¾Ê´Â´Ù¸é ´ÙÀ½°ú °°ÀÌ ºÐ¸®ÇÏ´Â °ÍÀÌ µµ¿òÀÌ µÉÁöµµ ¸ð¸¥´Ù:

typedef void (*sighandler_t)(int);
sighandler_t signal(int signum, sighandler_t handler);

POSIX¿¡ µû¸£¸é kill()³ª raise() ÇÔ¼ö·Î ¹ß»ý½Ãų ¼ö ¾ø´Â SIGFPE, SIGILL ¶Ç´Â SIGSEGV ½Ã±×³ÎÀ» ¹«½ÃÇÑ ÈÄ ÇÁ·Î¼¼½ºÀÇ µ¿ÀÛÀ» ¾Ë ¼ö ¾ø´Ù. 0À¸·Î ³ª´²Áø Á¤¼ö´Â ¾Ë ¼ö ¾ø´Â °á°ú¸¦ ³½´Ù. ¾î¶² ¾ÆÅ°ÅØÃÄ¿¡¼­´Â SIGFPE ½Ã±×³ÎÀÌ ¹ß»ýÇÑ´Ù. (-1·Î À½ÀÇ Á¤¼ö¸¦ ³ª´©´Â °Íµµ SIGFPE¸¦ ¹ß»ý½ÃŲ´Ù.) ÀÌ ½Ã±×³ÎÀ» ¹«½ÃÇÏ¸é ¹«ÇÑ ·çÇÁ¿¡ ºüÁú ¼öµµ ÀÖ´Ù.

POSIX (B.3.3.1.3)¿¡ µû¸£¸é SIGCHLD¿¡ ´ëÇÑ µ¿ÀÛÀº SIG_IGNÀ¸·Î ¼³Á¤Çؼ­´Â ¾È µÈ´Ù. ¿©±â¼­ BSD¿Í SYSV°¡ ´Ù¸£´Ù. SIGCHLDÀÇ µ¿ÀÛÀ» SIG_IGNÀ¸·Î ¼³Á¤ÇÏ´Â BSD ¼ÒÇÁÆ®¿þ¾î´Â ¸®´ª½º¿¡¼­´Â ½ÇÆÐÇÑ´Ù.

 

ȣȯ

ANSI C

 

°ü·Ã Ç׸ñ

kill(1), kill(2), killpg(2), pause(2), raise(3), sigaction(2), signal(7), sigsetops(3), sigvec(2), alarm(2)  

¿ªÀÚ

ÀÓÁ¾±Õ <hermes44@secsm.org>, 2000³â 4¿ù 20ÀÏ


 

Index

À̸§
»ç¿ë¹ý
¼³¸í
¹Ýȯ°ª
ÁÖÀÇ
ȣȯ
°ü·Ã Ç׸ñ
¿ªÀÚ

This document was created by man2html, using the manual pages.
Time: 08:06:59 GMT, March 25, 2004