OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / release / man3 / system.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Sat Jul 24 17:51:15 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" Modified 11 May 1998 by Joseph S. Myers (jsm28@cam.ac.uk)
25 .\" Modified 14 May 2001, 23 Sep 2001 by aeb
26 .\" 2004-12-20, mtk
27 .\"
28 .\" Japanese Version Copyright (c) 1996 Shoichi OZAWA
29 .\"     all right reserved.
30 .\" Translated 1996-09-01, Shoichi OZAWA <ozawa@omika.hitachi.co.jp>
31 .\" Updated 2001-03-19, Kentaro Shirakata <argrath@ub32.org>
32 .\" Updated 2001-10-16, Kentaro Shirakata <argrath@ub32.org>
33 .\" Updated 2005-02-27, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\"
35 .\"WORD:        feature test macro      µ¡Ç½¸¡ºº¥Þ¥¯¥í
36 .\"
37 .TH SYSTEM 3  2004-12-20 "" "Linux Programmer's Manual"
38 .SH Ì¾Á°
39 system \- ¥·¥§¥ë¥³¥Þ¥ó¥É¤Î¼Â¹Ô
40 .SH ½ñ¼°
41 .nf
42 .B #include <stdlib.h>
43 .sp
44 .BI "int system(const char *" "command" );
45 .fi
46 .SH ÀâÌÀ
47 .BR system ()
48 ¤Ï
49 .I command
50 ¤Ç»ØÄꤷ¤¿¥³¥Þ¥ó¥É¤ò
51 .B "/bin/sh \-c"
52 .I command
53 ¤Î·Á¤Ç¼Â¹Ô¤¹¤ë¡£»ØÄꤷ¤¿¥³¥Þ¥ó¥É¤¬½ªÎ»¤¹¤ì¤Ð¤³¤Î´Ø¿ô¤â½ªÎ»¤¹¤ë¡£
54 ¥³¥Þ¥ó¥É¼Â¹ÔÃæ¤Ï¡¢
55 .B SIGCHLD
56 ¤Ï¥Ö¥í¥Ã¥¯¤µ¤ì¡¢
57 .B SIGINT
58 ¤È
59 .B SIGQUIT
60 ¤Ï̵»ë¤µ¤ì¤ë¡£
61 .SH ÊÖ¤êÃÍ
62 ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç
63 .RB ( fork (2)
64 ¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¤Ê¤É)¡¢\-1 ¤òÊÖ¤¹¡£
65 ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢¥³¥Þ¥ó¥É¤Î¥¹¥Æ¡¼¥¿¥¹¤òÊÖ¤¹¡£
66 ¸å¼Ô¤Î¾ì¹ç¡¢¥¹¥Æ¡¼¥¿¥¹¤Ï
67 .BR wait (2)
68 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Õ¥©¡¼¥Þ¥Ã¥È¤ÇÊ֤äƤ¯¤ë¡£
69 ½¾¤Ã¤Æ¡¢¥³¥Þ¥ó¥É¤Î½ªÎ»¥³¡¼¥É¤Ï
70 .I WEXITSTATUS(status)
71 ¤ÇÆÀ¤ë¤³¤È¤¬½ÐÍè¤ë¡£
72 .I /bin/sh
73 ¤¬¼Â¹Ô½ÐÍè¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
74 ½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ï¥³¥Þ¥ó¥É¤¬
75 .I exit(127)
76 ¤ò¼Â¹Ô¤·¤¿¾ì¹ç¤ÈƱ¤¸¤Ë¤Ê¤ë¡£
77 .PP
78 .I command
79 ¤ÎÃͤ¬ NULL ¤Î¤È¤­¤Ï¡¢
80 .BR system ()
81 ¤Ï¥·¥§¥ë¤¬ÍøÍѲÄǽ¤Ê¤é¥¼¥í°Ê³°¤ÎÃͤòÊÖ¤·¡¢ÍøÍÑÉԲĤʤ饼¥í¤òÊÖ¤¹¡£
82 .PP
83 .BR system ()
84 ¤Ï¾¤Î»Ò¥×¥í¥»¥¹¤Î¥¦¥¨¥¤¥È¥¹¥Æ¡¼¥¿¥¹¤Ë¤Ï±Æ¶Á¤òÍ¿¤¨¤Ê¤¤¡£
85 .SH ½àµò
86 C89, C99, POSIX.1-2001.
87 .SH Ãí°Õ
88 .PP
89 µ¡Ç½¸¡ºº¥Þ¥¯¥í¤Ç¤¢¤ë
90 .B _XOPEN_SOURCE
91 ¤¬ÄêµÁ¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢
92 .BR wait (2)
93 ¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¥Þ¥¯¥í·²
94 .RB ( WEXITSTATUS ()
95 Åù) ¤¬
96 .I <stdlib.h>
97 ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤ÈÍøÍѲÄǽ¤Ë¤Ê¤ë¡£
98 .PP
99 ´û¤Ë½Ò¤Ù¤¿¤è¤¦¤Ë¡¢
100 .BR system ()
101 ¤Ï
102 .B SIGINT
103 ¤È
104 .B SIGQUIT
105 ¤ò̵»ë¤¹¤ë¡£
106 ¤è¤Ã¤Æ¥ë¡¼¥×¤«¤é
107 .BR system ()
108 ¤ò¸Æ¤Ö¥×¥í¥°¥é¥à¤Ï¡¢
109 °Ê²¼¤ÎÎã¤Î¤è¤¦¤Ë»Ò¥×¥í¥»¥¹¤Î½ªÎ»¾õÂÖ¤ò¼«Ê¬¤Ç¥Á¥§¥Ã¥¯¤·¤Æ¤ª¤«¤Ê¤¤¤È¡¢
110 ÃæÃǤǤ­¤Ê¤¯¤Ê¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
111 .br
112 .nf
113
114     while (something) {
115         int ret = system("foo");
116
117         if (WIFSIGNALED(ret) &&
118             (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
119                 break;
120     }
121 .fi
122 .PP
123 set-user-ID ¤ä set-group-ID ¤ÎÆø¢¤ò¤â¤Ä¥×¥í¥°¥é¥à¤ÎÃæ¤Ç¤Ï
124 .BR system ()
125 ¤ò»È¤Ã¤Æ¤Ï¤¤¤±¤Ê¤¤¡£¤Ê¤¼¤Ê¤é¡¢¤¢¤ë´Ä¶­ÊÑ¿ô¤Î̤ÃΤÎÃͤˤè¤Ã¤Æ
126 ¥·¥¹¥Æ¥à¤Î°ÂÁ´¤¬Â»¤Ê¤ï¤ì¤ë¤«¤é¤Ç¤¢¤ë¡£Âå¤ï¤ê¤Ë
127 .BR exec (3)
128 ´ØÏ¢¤Î´Ø¿ô·²¤ÎÃæ¤Ç
129 .BR execlp (3)
130 ¤È
131 .BR execvp (3)
132 °Ê³°¤Î´Ø¿ô¤ò»ÈÍѤ¹¤Ù¤­¤Ç¤¢¤ë¡£
133 ¼ÂºÝ¤Î¤È¤³¤í¡¢
134 .BR system ()
135 ¤Ï
136 .I /bin/sh
137 ¤¬ bash ¥Ð¡¼¥¸¥ç¥ó 2 ¤Ç¤¢¤ë¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
138 set-user-ID ¤ä set-group-ID ¤ÎÆø¢¤ò»ý¤Ä¥×¥í¥°¥é¥à¤«¤é¤ÏÀµ¤·¤¯Æ°ºî¤·¤Ê¤¤¡£
139 ¤Ê¤¼¤Ê¤é¡¢bash ¥Ð¡¼¥¸¥ç¥ó 2 ¤Ï¥¹¥¿¡¼¥È¥¢¥Ã¥×»þ¤ËÆø¢¤òÍî¤È¤¹¤«¤é¤Ç¤¢¤ë¡£
140 (Debian ¤Ç¤Ï¡¢sh ¤È¤·¤Æµ¯Æ°¤µ¤ì¤¿»þ¤Ë¤Ï¤³¤Î¤è¤¦¤ÊÆ°ºî¤ò¹Ô¤Ê¤ï¤Ê¤¤¤è¤¦¤Ë
141 ½¤Àµ¤µ¤ì¤¿ bash ¤òÍѤ¤¤Æ¤¤¤ë)
142 .PP
143 glibc 2.1.3 ¤è¤êÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢
144 .I command
145 ¤¬ NULL ¤Î¾ì¹ç¤Ë
146 .I /bin/sh
147 ¤¬ÍøÍѲÄǽ¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯¤Ï¼ÂºÝ¤Ë¤Ï¹Ô¤ï¤º¡¢
148 ¤¤¤Ä¤Ç¤âÍøÍѲÄǽ¤Ç¤¢¤ë¤È¤ß¤Ê¤·¤Æ¤¤¤¿¡£
149 .BR system ()
150 ¤Ï¤³¤Î¾ì¹ç¤Ë¾ï¤Ë 1 ¤òÊÖ¤·¤Æ¤¤¤¿¡£
151 POSIX.1-2001 ¤Ç¤Ï¥·¥§¥ë¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¤È¤¤¤¦É¸½à¤Ë½àµò¤·¤¿¼ÂÁõ¤ò
152 Í׵ᤷ¤Æ¤¤¤ë¤¬¡¢glibc 2.1.3 °Ê¹ß¤Ç¤Ï¥·¥§¥ë¤Î¥Á¥§¥Ã¥¯¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¡£
153 ¤Ê¤¼¤Ê¤é¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥°¥é¥à¤¬
154 .BR system ()
155 ¤ò¸Æ¤Ó½Ð¤¹¤è¤êÁ°¤Ë (POSIX.1-2001 ¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤)
156 .BR chroot (2)
157 ¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤¿»þ¤Ë¤Ï¡¢¥·¥§¥ë¤¬ÍøÍѲÄǽ¤Ç¤Ê¤¤¾ì¹ç¤ä¼Â¹Ô²Äǽ¥Õ¥¡¥¤¥ë
158 ¤Ç¤Ê¤¤¾ì¹ç¤¬¤¢¤ë¤«¤é¤Ç¤¢¤ë¡£
159 .PP
160 ¼Â¹Ô¤·¤¿¥·¥§¥ë¥³¥Þ¥ó¥É¤¬ 127
161 .RB ( /bin/sh
162 ¤Î¸Æ¤Ó½Ð¤·¤Ë¼ºÇÔ¤·¤¿»þ¤ËÊÖ¤¹ÃÍ) ¤òÊÖ¤¹¤³¤È¤â¹Í¤¨¤é¤ì¤ë¡£
163 ¤½¤Î¤¿¤á¡¢¥×¥í¥°¥é¥à¤Ï (¥ê¥¿¡¼¥ó¥³¡¼¥É¤ò¸«¤ë¤À¤±¤Ç¤Ï)
164 .BR execve (2)
165 ¤Î¸Æ¤Ó½Ð¤·¤¬¼ºÇÔ¤·¤¿¤³¤È¤ò³Î¼Â¤ËÃΤ뤳¤È¤Ï¤Ç¤­¤Ê¤¤¡£
166 .SH ´ØÏ¢¹àÌÜ
167 .BR sh (1),
168 .BR signal (2),
169 .BR wait (2),
170 .BR exec (3)