Rechercher une page de manuel
kill
Langue: ja
Version: 2004-06-24 (openSuse - 09/10/07)
Section: 2 (Appels système)
̾Á°
kill - ¥×¥í¥»¥¹¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤ë½ñ¼°
#include <sys/types.h>
#include <signal.h> int kill(pid_t pid, int sig);
ÀâÌÀ
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î kill() ¤Ï¡¢Ç¤°Õ¤Î¥×¥í¥»¥¹¡¦¥°¥ë¡¼¥×¤â¤·¤¯¤Ï¥×¥í¥»¥¹¤Ë¥·¥°¥Ê¥ë¤ò Á÷¤ë¤Î¤Ë»È¤ï¤ì¤ë¡£pid ¤ËÀµ¤ÎÃͤò»ØÄꤷ¤¿¾ì¹ç¡¢ sig ¤Ç»ØÄꤷ¤¿¥·¥°¥Ê¥ë¤¬ pid ¤Î¥×¥í¥»¥¹¤ËÁ÷¤é¤ì¤ë¡£
pid ¤Ë 0 ¤ò»ØÄꤷ¤¿¾ì¹ç¡¢ sig ¤Ç»ØÄꤷ¤¿¥·¥°¥Ê¥ë¤¬ Á÷¤í¤¦¤È¤·¤¿¥×¥í¥»¥¹¤ÈƱ¤¸¥×¥í¥»¥¹¡¦¥°¥ë¡¼¥×¤Ë°¤¹¤ë¤¹¤Ù¤Æ¤Î ¥×¥í¥»¥¹¤ËÁ÷¤é¤ì¤ë¡£
pid ¤Ë -1 ¤ò»ØÄꤷ¤¿¾ì¹ç¡¢ sig ¤Ç»ØÄꤷ¤¿¥·¥°¥Ê¥ë¤¬¡¢ ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤¬¥·¥°¥Ê¥ë¤òÁ÷¤ëµö²Ä¤ò»ý¤ÄÁ´¤Æ¤Î¥×¥í¥»¥¹¤Ë Á÷¤é¤ì¤ë¡£Ã¢¤·¡¢¥×¥í¥»¥¹ÈÖ¹æ 1 (init) ¤Ø¤Ï¥·¥°¥Ê¥ë¤ÏÁ÷¤é¤ì¤Ê¤¤¡£ °Ê²¼¤Î´ØÏ¢Éôʬ¤â»²¾È¤Î¤³¤È¡£
pid ¤Ë -1 ¤è¤ê¾®¤µ¤ÊÃͤò»ØÄꤷ¤¿¾ì¹ç¡¢ -pid ¤Î ¥×¥í¥»¥¹¡¦¥°¥ë¡¼¥×¤Ë°¤¹¤ë¤¹¤Ù¤Æ¤Î¥×¥í¥»¥¹¤Ë sig ¤Ç »ØÄꤷ¤¿¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¤ë¡£
sig ¤Ë 0 ¤ò»ØÄꤷ¤¿¾ì¹ç¡¢¥·¥°¥Ê¥ë¤ÏÁ÷¤é¤ì¤Ê¤¤¤¬¡¢ ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯¤Ï¹Ô¤ï¤ì¤ë¡£
¤¢¤ë¥×¥í¥»¥¹¤¬¥·¥°¥Ê¥ë¤òÁ÷¤ëµö²Ä¤ò»ý¤Ä¤Ë¤Ï¡¢ ¤½¤Î¥×¥í¥»¥¹¤¬Æø¢ (Linux ¤Ç¤Ï CAP_KILL ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£) ¤ò»ý¤Ä¥×¥í¥»¥¹¤Ç¤¢¤ë¤«¡¢¥·¥°¥Ê¥ë¤òÁ÷¤ë¦¤Î¥×¥í¥»¥¹¤Î ¼ÂUID ¤«¼Â¸úUID ¤¬¼õ¤±¤ë¦¤Î¥×¥í¥»¥¹¤Î¼Â set-UID ¤«Êݸ (saved) set-UID ¤¬°ìÃפ·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ SIGCONT ¤Î¾ì¹ç¤Ï¡¢¥·¥°¥Ê¥ë¤òÁ÷¿®¤¹¤ë¥×¥í¥»¥¹¤È¼õ¿®¤¹¤ë¥×¥í¥»¥¹¤¬ Ʊ¤¸¥»¥Ã¥·¥ç¥ó¤Ë½ê°¤·¤Æ¤¤¤ì¤Ð½½Ê¬¤Ç¤¢¤ë¡£
ÊÖ¤êÃÍ
À®¸ù¤·¤¿¾ì¹ç (¾¯¤Ê¤¯¤È¤â°ì¤Ä¤Î¥·¥°¥Ê¥ë¤¬Á÷¿®¤µ¤ì¤¿¾ì¹ç)¡¢ 0 ¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç -1 ¤¬ÊÖ¤µ¤ì¡¢ errno ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£¥¨¥é¡¼
- EINVAL
- ̵¸ú¤Ê¥·¥°¥Ê¥ë¤ò»ØÄꤷ¤¿¡£
- EPERM
- ¥×¥í¥»¥¹¤¬¡¢¼õ¿®¤¹¤ë¥×¥í¥»¥¹¤Î¤¤¤º¤ì¤ËÂФ·¤Æ¤â ¥·¥°¥Ê¥ë¤òÁ÷¤ëµö²Ä¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
- ESRCH
- »ØÄꤷ¤¿¥×¥í¥»¥¹¤Þ¤¿¤Ï¥×¥í¥»¥¹¡¦¥°¥ë¡¼¥×¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¡£ ¥¾¥ó¥Ó¥×¥í¥»¥¹¤Ï¸ºß¤¹¤ë¥×¥í¥»¥¹¤È¤·¤Æ¤ß¤Ê¤µ¤ì¤ë¡£ ¥¾¥ó¥Ó¥×¥í¥»¥¹¤È¤Ï¤¹¤Ç¤Ë½èÍý¤Ï½ªÎ»¤·¤Æ¤¤¤ë¤¬¡¢¿Æ¥×¥í¥»¥¹¤Ë¤è¤ë wait() ½èÍý¤¬¹Ô¤ï¤ì¤Æ¤¤¤Ê¤¤¥×¥í¥»¥¹¤Î¤³¤È¤Ç¤¢¤ë¡£
½àµò
SVr4, 4.3BSD, POSIX.1-2001Ãí°Õ
¥×¥í¥»¥¹ÈÖ¹æ 1 ¤Î init ¥×¥í¥»¥¹¤ËÁ÷¤ë¤³¤È¤¬¤Ç¤¤ë¥·¥°¥Ê¥ë¤Ï¡¢ init ¤¬ÌÀ¼¨Åª¤Ë¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤òÀßÄꤷ¤¿¥·¥°¥Ê¥ë¤À¤±¤Ç¤¢¤ë¡£ ¤³¤¦¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ï¡¢¸í¤Ã¤Æ¥·¥¹¥Æ¥à¤ò¥À¥¦¥ó¤µ¤»¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¢¤ë¡£POSIX.1-2001 ¤Ç¤Ï¡¢ kill(-1,sig) ¤¬ ¸½ºß¤Î¥×¥í¥»¥¹¤¬¥·¥°¥Ê¥ë¤òÁ÷¤ë¤³¤È¤¬½ÐÍè¤ë¥×¥í¥»¥¹Á´¤Æ¤Ë sig ¤òÁ÷¤ë¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£ ⤷¡¢¥·¥¹¥Æ¥à¼ÂÁõ»þ¤ËÄê¤á¤é¤ì¤¿¥·¥¹¥Æ¥à¥×¥í¥»¥¹¤Ï ¥·¥°¥Ê¥ë¤ÎÁ÷¿®Âоݤ«¤é½ü³°¤µ¤ì¤ë¡£ Linux ¤Ç¤Ï¡¢¥×¥í¥»¥¹¤¬¼«Ê¬¼«¿È¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¢ Linux ¤Î kill(-1,sig) ¤Ï¥«¥ì¥ó¥È¥×¥í¥»¥¹¤Ë¤Ï¥·¥°¥Ê¥ë¤òÁ÷¤é¤Ê¤¤¡£
POSIX.1-2001 ¤Ç¤Ï°Ê²¼¤ÎÆ°ºî¤Ë¤Ê¤ë¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£ ¼«Ê¬¼«¿È¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤ë¤È¡¢¥·¥°¥Ê¥ë¤òÁ÷¤Ã¤¿¥¹¥ì¥Ã¥É¤¬¤½¤Î¥·¥°¥Ê¥ë¤ò¥Ö¥í¥Ã¥¯ ¤·¤Æ¤ª¤é¤º¡¢Â¾¤Î¤É¤Î¥¹¥ì¥Ã¥É¤â¤½¤Î¥·¥°¥Ê¥ë¤ò¼õ¤±¤ë¾õÂ֤ˤâ¤Ê¤¯ sigwait(3) ¤Ç¤½¤Î¥·¥°¥Ê¥ë¤òÂԤäƤ⤤¤Ê¤¤¾ì¹ç¡¢ kill() ¤ÎÁ°¤Ë¾¯¤Ê¤¯¤È¤â°ì¤Ä¤Î¥Ö¥í¥Ã¥¯¤µ¤ì¤Æ¤¤¤Ê¤¤ ¥·¥°¥Ê¥ë¤¬¥·¥°¥Ê¥ë¤òÁ÷¤Ã¤¿¥¹¥ì¥Ã¥É¤ËÇÛÁ÷¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
Linux ¤Ç¤ÎÃí°Õ
Linux ¤Ç¤Ï¡¢Æø¢¤Î¤Ê¤¤¥×¥í¥»¥¹¤¬Â¾¤Î¥×¥í¥»¥¹¤Ë¥·¥°¥Ê¥ë¤òÁ÷¿®¤¹¤ë¤¿¤á¤Ë ɬÍפʸ¢¸Â¤Ë¤Ä¤¤¤Æ¤Î¥ë¡¼¥ë¤¬¡¢¥«¡¼¥Í¥ë¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤ê°ã¤Ã¤Æ¤¤¤ë¡£ ¥«¡¼¥Í¥ë 1.0 ¤«¤é 1.2.2 ¤Ç¤Ï¡¢Á÷¿®Â¦¤Î¼Â¸ú¥æ¡¼¥¶¡¼ID ¤¬¼õ¿®Â¦¤Î ¼Â¸ú¥æ¡¼¥¶¡¼ ID¤È°ìÃפ¹¤ì¤Ð¥·¥°¥Ê¥ë¤òÁ÷¿®¤Ç¤¤¿¡£ ¥«¡¼¥Í¥ë 1.2.3 ¤«¤é 1.3.77¤Ç¤Ï¡¢Á÷¿®Â¦¤Î¼Â¸ú¥æ¡¼¥¶¡¼ID ¤¬¼õ¿®Â¦¤Î ¼Â¥æ¡¼¥¶¡¼ID ¤«¼Â¸ú¥æ¡¼¥¶¡¼ID ¤Î¤¤¤º¤ì¤«¤È°ìÃפ¹¤ì¤Ð¥·¥°¥Ê¥ë¤òÁ÷¿®¤Ç¤¤¿¡£ ¸½ºß¤Î¥ë¡¼¥ë¤Ï¡¢POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤ª¤ê¡¢¥«¡¼¥Í¥ë 1.3.78 °Ê¹ß¤Ç ŬÍѤµ¤ì¤Æ¤¤¤ë¡£¥Ð¥°
¥Ð¡¼¥¸¥ç¥ó 2.6.7 °ÊÁ°¤Î 2.6 ·Ï¤Î¥«¡¼¥Í¥ë¤Ë¤Ï¡¢ ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤Ã¤¿¤È¤¤Ë¡¢ ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤¬¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î (Á´¥á¥ó¥Ð¡¼¤Ç¤Ï¤Ê¤¯) °ìÉô¤Î¥á¥ó¥Ð¡¼ ¤ËÂФ·¤Æ¤Î¤ß¥·¥°¥Ê¥ë¤òÁ÷¤ëµö²Ä¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢ kill() ¤¬¥¨¥é¡¼ EPERM ¤Ç¼ºÇÔ¤¹¤ë¤È¤¤¤¦¥Ð¥°¤¬¤¢¤ë¡£ ¤³¤Î¥¨¥é¡¼¤¬ÊÖ¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢¤½¤Î¥·¥°¥Ê¥ë¤Ï¸Æ¤Ó½Ð¤·¸µ¤¬ ¥·¥°¥Ê¥ë¤òÁ÷¤ëµö²Ä¤ò»ý¤ÄÁ´¤Æ¤Î¥×¥í¥»¥¹¤ØÁ÷¤é¤ì¤ë¡£´ØÏ¢¹àÌÜ
_exit(2), killpg(2), signal(2), sigqueue(2), tkill(2), exit(3), capabilities(7), signal(7)Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre