1 .\" Copyright (c) 1991 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)exec.3 6.4 (Berkeley) 4/19/91
34 .\" Converted for Linux, Mon Nov 29 11:12:48 1993, faith@cs.unc.edu
35 .\" Updated more for Linux, Tue Jul 15 11:54:18 1997, pacman@cqc.com
36 .\" Modified, 24 Jun 2004, Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" Added note on casting NULL
39 .\" Japanese Version Copyright (c) 1998 Masato Taruishi
40 .\" all rights reserved.
41 .\" Translated 1998-05-27, Masato Taruishi
42 .\" Modified 1998-08-08, Fujiwara Teruyoshi <fujiwara@linux.or.jp>
43 .\" Modified 2000-10-06, Kentaro Shirakata <argrath@ub32.org>
44 .\" Modified 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
45 .\" Updated 2010-10-27, Akihiro Motoki <amotoki@dd.iij4u.or.jp>, LDP v3.29
47 .\"WORD: null-terminated strings NULL¤Ç½ª¤ï¤ëʸ»úÎó
48 .\"WORD: anti-Trojan-horse measure ¥È¥í¥¤¤ÎÌÚÇÏÂкö
49 .\"WORD: external variable ³°ÉôÊÑ¿ô
50 .\"WORD: current directory first ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤¬ºÇ½é
51 .\"WORD: the attempted execve ¸Æ¤Ó½Ð¤½¤¦¤È¤·¤¿execve
52 .\"WORD: variadic function ²ÄÊÑĹ°ú¤¿ô´Ø¿ô
53 .\"WORD: semantics (¥×¥í¥°¥é¥à¤Î)Æ°ºî
55 .TH EXEC 3 2010-09-25 "GNU" "Linux Programmer's Manual"
57 execl, execlp, execle, execv, execvp, execvpe \- ¥Õ¥¡¥¤¥ë¤ò¼Â¹Ô¤¹¤ë
59 .B #include <unistd.h>
61 .B extern char **environ;
63 .BI "int execl(const char *" path ", const char *" arg ", ...);"
65 .BI "int execlp(const char *" file ", const char *" arg ", ...);"
67 .BI "int execle(const char *" path ", const char *" arg ,
69 .BI " ..., char * const " envp "[]);"
71 .BI "int execv(const char *" path ", char *const " argv "[]);"
73 .BI "int execvp(const char *" file ", char *const " argv "[]);"
75 .BI "int execvpe(const char *" file ", char *const " argv "[],"
77 .BI " char *const " envp "[]);"
80 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
81 .RB ( feature_test_macros (7)
89 ¥Õ¥¡¥ß¥ê¡¼¤Î´Ø¿ô¤Ï¸½ºß¤Î¥×¥í¥»¥¹¥¤¥á¡¼¥¸¤ò¿·¤·¤¤¥×¥í¥»¥¹¥¤¥á¡¼¥¸¤ÇÃÖ¤
90 ´¹¤¨¤ë¡£¤³¤Î¥Þ¥Ë¥å¥¢¥ë¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë´Ø¿ô¤Ï
92 ¤Î¥Õ¥í¥ó¥È¥¨¥ó¥É¤Ç¤¢¤ë¡£
93 (¸½ºß¤Î¥×¥í¥»¥¹¥¤¥á¡¼¥¸¤ÎÃÖ¤´¹¤¨¤Ë¤Ä¤¤¤Æ¤Î¾ÜºÙ¤Ï
97 ¤³¤ì¤é¤Î´Ø¿ô¤ÎºÇ½é¤Î°ú¤¿ô¤Ï¡¢¼Â¹Ô¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤Î̾Á°¤Ç¤¢¤ë¡£
105 ¤È¤½¤ì¤Ë³¤¯¾ÊάÉôʬ¤Ï
111 ¤³¤ì¤é¤Ë¤Ï¡¢¼Â¹Ô¤µ¤ì¤ë¥×¥í¥°¥é¥à¤ÇÍøÍѲÄǽ¤Ê°ú¤¿ô¤Î¥ê¥¹¥È¤ò»ØÄꤹ¤ë
112 (°ú¤¿ô¤Î¥ê¥¹¥È¤Ï NULL ¤Ç½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤«¤é¹½À®¤µ¤ì¤ë)¡£
113 ´·½¬¤È¤·¤Æ¡¢ºÇ½é¤Î°ú¤¿ô¤Ï¡¢¼Â¹Ô¤µ¤ì¤ë¥Õ¥¡¥¤¥ë̾
114 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ë¤¹¤ë¡£°ú¤¿ô¤Î¥ê¥¹¥È¤Ïɬ¤º NULL
115 ¤Ç½ª¤ï¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï²ÄÊÑĹ°ú¤¿ô´Ø¿ô¤Ê¤Î¤Ç¡¢
118 ¤È¥¥ã¥¹¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
124 ¤Ï¡¢ÍøÍѲÄǽ¤Ê°ú¤¿ô¥ê¥¹¥È (NULL ¤Ç½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ø¤Î
125 ¥Ý¥¤¥ó¥¿¤ÎÇÛÎó) ¤ò¿·¤·¤¤¥×¥í¥°¥é¥à¤ËÅϤ¹¡£
126 ´·½¬¤È¤·¤Æ¡¢ºÇ½é¤Î°ú¤¿ô¤Ï¼Â¹Ô¤µ¤ì¤ë¥Õ¥¡¥¤¥ë̾¤Ø
127 ¤Î¥Ý¥¤¥ó¥¿¤Ë¤¹¤ë¡£¥Ý¥¤¥ó¥¿¤ÎÇÛÎó¤Ïɬ¤º
128 NULL ¤Ç½ª¤ï¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
133 ¤Ç¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤¬°ú¤¿ô
135 ·Ðͳ¼Â¹Ô¤µ¤ì¤ë¥×¥í¥°¥é¥à¤Î´Ä¶¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
137 °ú¤¿ô¤Ï¡¢NULL ¤Ç½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤ÎÇÛÎó¤Ç¤¢¤ê¡¢
138 NULL ¥Ý¥¤¥ó¥¿¤Ç½ª¤ï¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
139 ¾¤Î´Ø¿ô¤Ç¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î³°ÉôÊÑ¿ô
141 ¤«¤é¿·¤·¤¤¥×¥í¥»¥¹ÍѤδĶ¤òÍ¿¤¨¤ë¡£
142 .SS execlp() ¤È execvp() ¤ÎÆÃÊ̤ÊÆ°ºî
148 ¤Ï¡¢»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë̾¤¬¥¹¥é¥Ã¥·¥å (/) ¤ò´Þ¤ó¤Ç¤¤¤Ê¤¤¾ì¹ç¡¢
149 ¥·¥§¥ë¤ÈƱ¤¸Æ°ºî¤Ç¼Â¹Ô²Äǽ¤Ê¥Õ¥¡¥¤¥ë¤òõº÷¤¹¤ë¡£
150 ¥Õ¥¡¥¤¥ë¤Î¸¡º÷¤Ï¡¢´Ä¶ÊÑ¿ô
152 ¤Ç»ØÄꤵ¤ì¤¿¥³¥í¥ó¶èÀÚ¤ê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¥Ñ¥¹Ì¾¤Î¥ê¥¹¥È¤òÂоݤ˹Ԥï¤ì¤ë¡£
153 ¤³¤ÎÊÑ¿ô¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¥Ñ¥¹Ì¾¤Î¥ê¥¹¥È¤Î¥Ç¥Õ¥©¥ë¥ÈÃͤȤ·¤Æ¡¢
154 ¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤Î¸å¤í¤Ë¡¢
156 ¤¬ÊÖ¤¹¥Ç¥£¥ì¥¯¥È¥ê¤Î¥ê¥¹¥È¤ò¤Ä¤Ê¤²¤¿Ãͤ¬»ÈÍѤµ¤ì¤ë (¤³¤Î
158 ¤Î¸Æ¤Ó½Ð¤·¤Ç¤ÏÄ̾ï "/bin:/usr/bin" ¤¬ÊÖ¤µ¤ì¤ë)¡£
160 »ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë̾¤¬¥¹¥é¥Ã¥·¥å¤ò´Þ¤à¾ì¹ç¡¢
162 ¤Ï̵»ë¤µ¤ì¡¢»ØÄꤵ¤ì¤¿¥Ñ¥¹Ì¾¤Î¥Õ¥¡¥¤¥ë¤¬¼Â¹Ô¤µ¤ì¤ë¡£
164 ¤µ¤é¤Ë¡¢¤¤¤¯¤Ä¤«¤Î¥¨¥é¡¼¤ÏÆÃÊ̤˽èÍý¤µ¤ì¤ë¡£
166 ¥Õ¥¡¥¤¥ë¤¬¼Â¹Ô¥Õ¥¡¥¤¥ë¤Ç¤Ê¤¤¾ì¹ç (¤³¤Î¤È¤¸Æ¤Ó½Ð¤½¤¦¤È¤·¤¿
170 ¤Ç¼ºÇÔ¤¹¤ë)¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï»Ä¤ê¤Î¸¡º÷¥Ñ¥¹¤Î¸¡º÷¤ò³¤±¤ë¡£
171 ¾¤Ë¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤é¤Ê¤¯¤Ê¤Ã¤¿¾ì¹ç
176 .\" fujiwara: ¸Ä¿ÍŪ¤Ë¤Ï¡ÖÉüµ¢¤¹¤ë¡×¤ÎÊý¤¬¹¥¤(^_^;
178 ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¤¬¼Â¹Ô·Á¼°¤È¤·¤Æǧ¼±¤Ç¤¤Ê¤¤¾ì¹ç
179 (¤³¤Î¤È¤¸Æ¤Ó½Ð¤½¤¦¤È¤·¤¿
183 ¤Ç¼ºÇÔ¤¹¤ë)¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï¤½¤Î¥Õ¥¡¥¤¥ë¤òºÇ½é¤Î°ú¤¿ô¤È¤·¤¿¥·¥§¥ë
185 ¤ò¼Â¹Ô¤¹¤ë (¤³¤ì¤Ë¤â¼ºÇÔ¤·¤¿¾ì¹ç¡¢¤³¤ì°Ê¾å¤Î¸¡º÷¤Ï¹Ô¤ï¤ì¤Ê¤¤)¡£
188 ·²¤Î´Ø¿ô¤¬Éüµ¢¤¹¤ë¤Î¤Ï¡¢¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Î¤ß¤Ç¤¢¤ë¡£
191 ¤Ë¥¨¥é¡¼¤ÎÆâÍƤ¬¥»¥Ã¥È¤µ¤ì¤ë¡£
193 ¤³¤ì¤éÁ´¤Æ¤Î´Ø¿ô¤Ï¼ºÇÔ¤¹¤ë¾ì¹ç¤¬¤¢¤ë¡£¤½¤Î¾ì¹ç¡¢
195 ¤ËÂФ·¤Æµ¬Äꤵ¤ì¤¿¥¨¥é¡¼¤¬
200 ´Ø¿ô¤Ï glibc 2.11 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
202 POSIX.1-2001, POSIX.1-2008.
205 ´Ø¿ô¤Ï GNU ¤Ë¤è¤ë³ÈÄ¥¤Ç¤¢¤ë¡£
207 Linux °Ê³°¤Î¥·¥¹¥Æ¥à¤Ë¤Ï¡¢
208 (´Ä¶ÊÑ¿ô \fBPATH\fR ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¤È¤¤Î)
209 ¥Ç¥Õ¥©¥ë¥È¤Î¥Ñ¥¹¤Ë¤ª¤¤¤Æ¡¢¥«¥ì¥ó¥È¡¦¥Ç¥£¥ì¥¯¥È¥ê¤¬
213 ¤Î¸å¤í¤ËÇÛÃÖ¤µ¤ì¤ë¤â¤Î¤â¤¢¤ë¡£
214 ¤³¤ì¤Ï¥È¥í¥¤¤ÎÌÚÇÏÂкö¤Î¤¿¤á¤Ç¤¢¤ë¡£
215 Linux ¤Ç¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥Ñ¥¹¤Ë¡¢ÀΤʤ¬¤é¤Î¡Ö¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò
216 Àè¤Ëõº÷¡×¤È¤¤¤¦¥ë¡¼¥ë¤ò»È¤Ã¤Æ¤¤¤ë¡£
218 ¥Õ¥¡¥¤¥ë¤ò¼Â¹Ô¤·¤è¤¦¤È¤·¤Æ¤¤¤ë´Ö¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿»þ¤Î
222 ¤Î¤Õ¤ë¤Þ¤¤¤Ë¤Ä¤¤¤ÆÎò»ËŪ¤Ê´·½¬¤Ï¤¢¤ë¤¬¡¢ÅÁÅýŪ¤Ëʸ½ñ¤È¤·¤ÆµºÜ¤µ¤ì¤Æ¤ª¤é¤º¡¢
223 POSIX ɸ½à¤Ç¤âµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£BSD (¤Þ¤¿¤ª¤½¤é¤¯Â¾¤Î¥·¥¹¥Æ¥à) ¤Ç¤Ï¡¢
225 ¤¬È¯À¸¤·¤¿¾ì¹ç¡¢¼«Æ°Åª¤ËÃæÃÇ (sleep) ¤·ºÆ»î¹Ô¤ò¹Ô¤¦¡£
226 Linux ¤Ï¤½¤ì¤ò¥Ï¡¼¥É¥¨¥é¡¼¤È¤·¤Æ¼è¤ê°·¤¤Â¨ºÂ¤ËÉüµ¢¤¹¤ë¡£
232 ¤Ï¡¢¾å¤ÇÀâÌÀ¤·¤¿¥¨¥é¡¼¤È¡¢¤³¤ì¤é 2 ¤Ä¤Î´Ø¿ô¼«¿È¤¬ÊÖ¤¹
236 °Ê³°¤ÎÁ´¤Æ¤Î¥¨¥é¡¼¤ò̵»ë¤·¤Æ¤¤¤¿¤¬¡¢
237 º£¤Ç¤Ï¡¢¾å¤ÇÀâÌÀ¤·¤¿°Ê³°¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ç¤â¡¢
238 Ê֤äƤ¯¤ë¤è¤¦Êѹ¹¤µ¤ì¤¿¡£