-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
.\" and Copyright (c) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Modified by Michael Haardt <michael@moria.de>
.\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
.\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
.\" Add text describing limits on command-line arguments + environment
.\"
-.\" Japanese Version Copyright (c) 1996 TABATA Tomohira
-.\" all rights reserved.
-.\" Translated 1996-07-04, TABATA Tomohira <loba@k2.t.u-tokyo.ac.jp>
-.\" Updated 1997-12-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Updated 2001-08-17, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Updated 2005-02-05, Yuichi SATO <ysato444@yahoo.co.jp>
-.\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2005-11-19, Akihiro MOTOKI
-.\" Updated 2006-08-13, Akihiro MOTOKI, LDP v2.39
-.\" Updated 2007-01-09, Akihiro MOTOKI, LDP v2.43
-.\" Updated 2007-06-03, Akihiro MOTOKI, LDP v2.51
-.\" Updated 2007-10-12, Akihiro MOTOKI, LDP v2.66
-.\" Updated 2008-04-04, Akihiro MOTOKI, LDP v2.79
-.\" Updated 2008-11-05, Akihiro MOTOKI, LDP v3.12
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
.\"
-.TH EXECVE 2 2010-01-06 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH ̾Á°
-.\"O execve \- execute program
-execve \- ¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤¹¤ë
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
-.B #include <unistd.h>
+.\"*******************************************************************
+.TH EXECVE 2 2013\-07\-04 Linux "Linux Programmer's Manual"
+.SH 名前
+execve \- プログラムを実行する
+.SH 書式
+\fB#include <unistd.h>\fP
.sp
-.BI "int execve(const char *" filename ", char *const " argv "[], "
+\fBint execve(const char *\fP\fIfilename\fP\fB, char *const \fP\fIargv\fP\fB[], \fP
.br
-.BI " char *const " envp []);
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O .BR execve ()
-.\"O executes the program pointed to by \fIfilename\fP.
-.\"O \fIfilename\fP must be either a binary executable, or a script
-.\"O starting with a line of the form:
-.BR execve ()
-¤Ï¡¢\fIfilename\fP ¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤¿¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤¹¤ë¡£
-\fIfilename\fP ¤Ï¡¢¥Ð¥¤¥Ê¥ê¼Â¹Ô·Á¼°¤«¡¢
-°Ê²¼¤Î·Á¼°¤Î¹Ô¤Ç»Ï¤Þ¤ë¥¹¥¯¥ê¥×¥È¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+\fB char *const \fP\fIenvp\fP\fB[]);\fP
+.SH 説明
+\fBexecve\fP() は、\fIfilename\fP によって指定されたプログラムを実行する。 \fIfilename\fP は、バイナリ実行形式か、
+以下の形式の行で始まるスクリプトでなければならない。
.in +4n
.nf
-\fB#!\fP \fIinterpreter \fP[optional-arg]
+\fB#!\fP \fIinterpreter \fP[optional\-arg]
.fi
.in
-.\"O For details of the latter case, see "Interpreter scripts" below.
-¸å¼Ô¤Î¾ÜºÙ¤Ï¡¢¸å¤í¤Î¡Ö¥¤¥ó¥¿¥×¥ê¥¿¡¦¥¹¥¯¥ê¥×¥È¡×¤ÎÀá¤ò»²¾È¤Î¤³¤È¡£
-
-.\"O \fIargv\fP is an array of argument strings passed to the new program.
-.\"O \fIenvp\fP is an array of strings, conventionally of the form
-.\"O \fBkey=value\fP, which are passed as environment to the new program.
-.\"O Both \fIargv\fP and \fIenvp\fP must be terminated by a null pointer.
-.\"O The argument vector and environment can be accessed by the
-.\"O called program's main function, when it is defined as:
-\fIargv\fP ¤Ï¿·¤·¤¤¥×¥í¥°¥é¥à¤ËÅϤµ¤ì¤ë°ú¤¿ôʸ»úÎó¤ÎÇÛÎó¤Ç¤¢¤ë¡£
-\fIenvp\fP ¤Ïʸ»úÎó¤ÎÇÛÎó¤Ç¤¢¤ê¡¢ÅÁÅýŪ¤Ë \fBkey=value\fP ¤Î·Á¼°¤ò
-¤·¤Æ¤ª¤ê¡¢¿·¤·¤¤¥×¥í¥°¥é¥à¤Î´Ä¶ÊÑ¿ô¤È¤·¤ÆÅϤµ¤ì¤ë¡£
-\fIargv\fP ¤È \fIenvp\fP ¤Ï¤¤¤º¤ì¤â¤Î NULL ¥Ý¥¤¥ó¥¿¤Ç½ª¤ï¤Ã¤Æ¤¤¤ë
-ɬÍפ¬¤¢¤ë¡£°ú¤¿ôÇÛÎó¤È´Ä¶ÊÑ¿ô¤Ï¡¢¸Æ¤Ó½Ð¤µ¤ì¤¿¥×¥í¥°¥é¥à¤Î main ´Ø¿ô¤ò
-°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥¢¥¯¥»¥¹²Äǽ¤Ë¤Ê¤ë¡£
+後者の詳細は、後ろの「インタプリタ・スクリプト」の節を参照のこと。
+
+\fIargv\fP は新しいプログラムに渡される引き数文字列の配列である。
+慣例では、引き数文字列の最初の要素には実行されたファイルに関連付けられた
+ファイル名を含めることになっている。
+\fIenvp\fP は文字列の配列であり、伝統的に \fBkey=value\fP の形式をしており、
+新しいプログラムの環境変数として渡される。
+\fIargv\fP と \fIenvp\fP はいずれもの NULL ポインタで終わっている必要がある。
+引き数配列と環境変数は、呼び出されたプログラムの main 関数を
+以下のように定義することによってアクセス可能になる。
.in +4n
.nf
.fi
.in
-.\"O .BR execve ()
-.\"O does not return on success, and the text, data, bss, and
-.\"O stack of the calling process are overwritten by that of the program
-.\"O loaded.
-À®¸ù¤·¤¿¾ì¹ç¡¢
-.BR execve ()
-¤ÏÊÖ¤é¤Ê¤¤¡£
-¤½¤·¤Æ¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î text, data, bss, ¥¹¥¿¥Ã¥¯¤Ï¡¢
-Æɤ߹þ¤Þ¤ì¤¿¥×¥í¥°¥é¥à¤Ë¤è¤Ã¤Æ¾å½ñ¤¤µ¤ì¤ë¡£
-
-.\"O If the current program is being ptraced, a \fBSIGTRAP\fP is sent to it
-.\"O after a successful
-.\"O .BR execve ().
-¸µ¤Î¥×¥í¥°¥é¥à¤¬ ptrace ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
-.BR execve ()
-¤¬À®¸ù¤·¤¿¸å¤Ë
-¤½¤Î¥×¥í¥°¥é¥à¤Ë \fBSIGTRAP\fP ¤¬Á÷¤é¤ì¤ë¡£
-
-.\"O If the set-user-ID bit is set on the program file pointed to by
-.\"O \fIfilename\fP,
-.\"O and the underlying file system is not mounted
-.\"O .I nosuid
-.\"O (the
-.\"O .B MS_NOSUID
-.\"O flag for
-.\"O .BR mount (2)),
-.\"O and the calling process is not being ptraced,
-.\"O then the effective user ID of the calling process is changed
-.\"O to that of the owner of the program file.
-.\"O Similarly, when the set-group-ID
-.\"O bit of the program file is set the effective group ID of the calling
-.\"O process is set to the group of the program file.
-.I filename
-¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë¤Ë set-user-ID ¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤ª¤ê¡¢
-¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬
-.I nosuid
-.RB ( mount (2)
-¤Î
-.B MS_NOSUID
-¥Õ¥é¥°) ¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤ª¤é¤º¡¢
-¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬ ptrace ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
-¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¼Â¸ú (effective) ¥æ¡¼¥¶ ID ¤Ï
-¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë¤Î½êÍ¼Ô (owner) ¤ËÊѹ¹¤µ¤ì¤ë¡£
-ƱÍͤˡ¢¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë¤Ë set-group-ID ¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢
-¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î͸ú¥°¥ë¡¼¥× ID ¤Ï
-¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë¤Î¥°¥ë¡¼¥×¤ËÊѹ¹¤µ¤ì¤ë¡£
-
-.\"O The effective user ID of the process is copied to the saved set-user-ID;
-.\"O similarly, the effective group ID is copied to the saved set-group-ID.
-.\"O This copying takes place after any effective ID changes that occur
-.\"O because of the set-user-ID and set-group-ID permission bits.
-¥×¥í¥»¥¹¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤ÏÊݸ (saved) set-user-ID ¤Ë¥³¥Ô¡¼¤µ¤ì¤ë¡£
-ƱÍͤˡ¢¼Â¸ú¥°¥ë¡¼¥× ID ¤ÏÊݸ set-group-ID ¤Ë¥³¥Ô¡¼¤µ¤ì¤ë¡£
-¤³¤Î¥³¥Ô¡¼¤Ï¡¢set-user-ID / set-group-ID µö²Ä¥Ó¥Ã¥È¤Ë¤è¤êȯÀ¸¤¹¤ë
-¼Â¸ú ID ¤ÎÊѹ¹¸å¤Ë¹Ô¤ï¤ì¤ë¡£
-
-.\"O If the executable is an a.out dynamically linked
-.\"O binary executable containing
-.\"O shared-library stubs, the Linux dynamic linker
-.\"O .BR ld.so (8)
-.\"O is called at the start of execution to bring
-.\"O needed shared libraries into memory
-.\"O and link the executable with them.
-¼Â¹Ô¥Õ¥¡¥¤¥ë¤¬Æ°Åª¥ê¥ó¥¯¤µ¤ì¤¿ a.out ¼Â¹Ô·Á¼°¤Ç¡¢¶¦Í¥é¥¤¥Ö¥é¥ê¤Î
-¥¹¥¿¥Ö¤ò´Þ¤à¤â¤Î¤À¤Ã¤¿¾ì¹ç¡¢¼Â¹Ô¤Î³«»Ï»þ¤Ë Linux ¤Î
-¥À¥¤¥Ê¥ß¥Ã¥¯¡¦¥ê¥ó¥«
-.BR ld.so (8)
-¤¬¸Æ¤Ó½Ð¤µ¤ì¡¢É¬Íפʶ¦Í¥é¥¤¥Ö¥é¥ê¤ò¥á¥â¥ê¤ËÆɤ߹þ¤ó¤Ç¥ê¥ó¥¯¤ò¹Ô¤¦¡£
-
-.\"O If the executable is a dynamically linked ELF executable, the
-.\"O interpreter named in the PT_INTERP segment is used to load the needed
-.\"O shared libraries.
-.\"O This interpreter is typically
-.\"O \fI/lib/ld-linux.so.1\fP for binaries linked with the
-.\"O Linux libc 5, or \fI/lib/ld-linux.so.2\fP for binaries linked with the
-.\"O glibc 2.
-¼Â¹Ô¥Õ¥¡¥¤¥ë¤¬¥À¥¤¥Ê¥ß¥Ã¥¯¡¦¥ê¥ó¥¯¤µ¤ì¤¿ ELF ¼Â¹Ô·Á¼°¤À¤Ã¤¿¾ì¹ç¡¢
-PT_INTERP ¥»¥°¥á¥ó¥È¤Ë»ØÄꤵ¤ì¤¿¥¤¥ó¥¿¥×¥ê¥¿¤¬É¬ÍפÊ
-¶¦Í¥é¥¤¥Ö¥é¥ê (shared library) ¤òÆɤ߹þ¤à¤Î¤Ë»ÈÍѤµ¤ì¤ë¡£
-Ä̾¥¤¥ó¥¿¥×¥ê¥¿¤È¤·¤Æ¤Ï¡¢
-Linux libc 5 ¤ò¥ê¥ó¥¯¤·¤¿¥Ð¥¤¥Ê¥ê¤Î¾ì¹ç¤Ë¤Ï
-\fI/lib/ld-linux.so.1\fP ¤¬¡¢
-glibc 2 ¤ò¥ê¥ó¥¯¤·¤¿¥Ð¥¤¥Ê¥ê¤Î¾ì¹ç¤Ë¤Ï
-\fI/lib/ld-linux.so.2\fP ¤¬»ÈÍѤµ¤ì¤ë¡£
-
-.\"O All process attributes are preserved during an
-.\"O .BR execve (),
-.\"O except the following:
-°Ê²¼¤Ë¼¨¤¹°Ê³°¤Î¤¹¤Ù¤Æ¤Î¥×¥í¥»¥¹Â°À¤Ï
-.BR execve ()
-¤ÎÁ°¸å¤ÇÊÝ»ý¤µ¤ì¤ë¡£
-.IP *
-.\"O The dispositions of any signals that are being caught are
-.\"O reset to the default
-.\"O .RB ( signal (7)).
-Ê᪤µ¤ì¤¿¥·¥°¥Ê¥ë¤Î½èÍýÊýË¡ (disposition) ¤Ï
-¥Ç¥Õ¥©¥ë¥ÈÆ°ºî¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤ë
-.RB ( signal (7))¡£
+成功した場合、 \fBexecve\fP() は返らない。 そして、呼び出し元のプロセスの text, data, bss, スタックは、
+読み込まれたプログラムによって上書きされる。
+
+元のプログラムが ptrace されている場合、 \fBexecve\fP() が成功した後に そのプログラムに \fBSIGTRAP\fP が送られる。
+
+\fIfilename\fP で指定されたプログラムファイルに set\-user\-ID ビットが設定されており、 ファイルが存在するファイルシステムが
+\fInosuid\fP (\fBmount\fP(2) の \fBMS_NOSUID\fP フラグ) でマウントされておらず、 呼び出したプロセスが ptrace
+されていない場合、 呼び出したプロセスの実効 (effective) ユーザ ID は プログラムファイルの所有者 (owner) に変更される。
+同様に、プログラムファイルに set\-group\-ID ビットが設定されていた場合、 呼び出したプロセスの有効グループ ID は
+プログラムファイルのグループに変更される。
+
+プロセスの実効ユーザ ID は保存 (saved) set\-user\-ID にコピーされる。 同様に、実効グループ ID は保存
+set\-group\-ID にコピーされる。 このコピーは、set\-user\-ID / set\-group\-ID 許可ビットにより発生する 実効 ID
+の変更後に行われる。
+
+実行ファイルが動的リンクされた a.out 実行形式で、共有ライブラリの スタブを含むものだった場合、実行の開始時に Linux の
+ダイナミック・リンカ \fBld.so\fP(8) が呼び出され、必要な共有ライブラリをメモリに読み込んでリンクを行う。
+
+実行ファイルがダイナミック・リンクされた ELF 実行形式だった場合、
+PT_INTERP セグメントに指定されたインタプリタが必要な 共有ライブラリ
+(shared library) を読み込むのに使用される。
+通常、インタプリタは glibc 2 をリンクしたバイナリでは
+\fI/lib/ld\-linux.so.2\fP である (古い Linux libc5 をリンクした
+バイナリでは、通常のインタプリタは \fI/lib/ld\-linux.so.1\fP であった)。
+
+以下に示す以外のすべてのプロセス属性は \fBexecve\fP() の前後で保持される。
+.IP * 3
+捕捉されたシグナルの処理方法 (disposition) は デフォルト動作にリセットされる (\fBsignal\fP(7))。
.IP *
-.\"O Any alternate signal stack is not preserved
-.\"O .RB ( sigaltstack (2)).
-ÂåÂØ¥·¥°¥Ê¥ë¥¹¥¿¥Ã¥¯¤Ï¤É¤ì¤âÊÝ»ý¤µ¤ì¤Ê¤¤
-.RB ( sigaltstack (2))¡£
+代替シグナルスタックはどれも保持されない (\fBsigaltstack\fP(2))。
.IP *
-.\"O Memory mappings are not preserved
-.\"O .RB ( mmap (2)).
-¥á¥â¥ê¥Þ¥Ã¥Ô¥ó¥°¤ÏÊÝ»ý¤µ¤ì¤Ê¤¤
-.RB ( mmap (2))¡£
+メモリマッピングは保持されない (\fBmmap\fP(2))。
.IP *
-.\"O Attached System V shared memory segments are detached
-.\"O .RB ( shmat (2)).
-Éղ䵤줿 (attached) System V ¶¦Í¥á¥â¥ê¥»¥°¥á¥ó¥È¤ÏʬΥ¤µ¤ì¤ë
-.RB ( shmat (2))¡£
+付加された (attached) System V 共有メモリセグメントは分離される (\fBshmat\fP(2))。
.IP *
-.\"O POSIX shared memory regions are unmapped
-.\"O .RB ( shm_open (3)).
-POSIX ¶¦Í¥á¥â¥êÎΰè¤Ï¥Þ¥Ã¥Ô¥ó¥°¤ò²ò½ü¤µ¤ì¤ë
-.RB ( shm_open (3))¡£
+POSIX 共有メモリ領域はマッピングを解除される (\fBshm_open\fP(3))。
.IP *
-.\"O Open POSIX message queue descriptors are closed
-.\"O .RB ( mq_overview (7)).
-¥ª¡¼¥×¥ó¤µ¤ì¤¿ POSIX ¥á¥Ã¥»¡¼¥¸¥¥å¡¼¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¥¯¥í¡¼¥º¤µ¤ì¤ë
-.RB ( mq_overview (7))¡£
+オープンされた POSIX メッセージキューディスクリプタはクローズされる (\fBmq_overview\fP(7))。
.IP *
-.\"O Any open POSIX named semaphores are closed
-.\"O .RB ( sem_overview (7)).
-¥ª¡¼¥×¥ó¤µ¤ì¤¿ POSIX ̾Á°ÉÕ¤¥»¥Þ¥Õ¥©¤Ï¤¤¤º¤ì¤â¥¯¥í¡¼¥º¤µ¤ì¤ë
-.RB ( sem_overview (7))¡£
+オープンされた POSIX 名前付きセマフォはいずれもクローズされる (\fBsem_overview\fP(7))。
.IP *
-.\"O POSIX timers are not preserved
-.\"O .RB ( timer_create (2)).
-POSIX ¥¿¥¤¥Þ¤ÏÊÝ»ý¤µ¤ì¤Ê¤¤
-.RB ( timer_create (2))¡£
+POSIX タイマは保持されない (\fBtimer_create\fP(2))。
.IP *
-.\"O Any open directory streams are closed
-.\"O .RB ( opendir (3)).
-¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¥¹¥È¥ê¡¼¥à¤Ï¤¤¤º¤ì¤â¥¯¥í¡¼¥º¤µ¤ì¤ë
-.RB ( opendir (3))¡£
+オープンされたディレクトリストリームはいずれもクローズされる (\fBopendir\fP(3))。
.IP *
-.\"O Memory locks are not preserved
-.\"O .RB ( mlock (2),
-.\"O .BR mlockall (2)).
-¥á¥â¥ê¥í¥Ã¥¯¤ÏÊÝ»ý¤µ¤ì¤Ê¤¤
-.RB ( mlock (2),
-.BR mlockall (2))¡£
+メモリロックは保持されない (\fBmlock\fP(2), \fBmlockall\fP(2))。
.IP *
-.\"O Exit handlers are not preserved
-.\"O .RB ( atexit (3),
-.\"O .BR on_exit (3)).
-½ªÎ» (exit) ¥Ï¥ó¥É¥é¤ÏÊÝ»ý¤µ¤ì¤Ê¤¤
-.RB ( atexit (3),
-.BR on_exit (3))¡£
+終了 (exit) ハンドラは保持されない (\fBatexit\fP(3), \fBon_exit\fP(3))。
.IP *
-.\"O The floating-point environment is reset to the default (see
-.\"O .BR fenv (3)).
-ÉâÆ°¾®¿ôÅÀ´ØÏ¢¤Î´Ä¶¤Ï¥Ç¥Õ¥©¥ë¥È¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤ë
-.RB ( fenv (3)
-»²¾È)¡£
+浮動小数点関連の環境はデフォルトにリセットされる (\fBfenv\fP(3) 参照)。
.PP
-.\"O The process attributes in the preceding list are all specified
-.\"O in POSIX.1-2001.
-.\"O The following Linux-specific process attributes are also
-.\"O not preserved during an
-.\"O .BR execve ():
-¾åµ¤Î¥ê¥¹¥È¤Î¥×¥í¥»¥¹Â°À¤Ï¤¤¤º¤ì¤â POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
-°Ê²¼¤Ë¼¨¤¹ Linux ¸ÇÍ¤Î¥×¥í¥»¥¹Â°À¤â
-.BR execve ()
-¤ÎÁ°¸å¤ÇÊÝ»ý¤µ¤ì¤Ê¤¤¡£
+上記のリストのプロセス属性はいずれも POSIX.1\-2001 で規定されている。 以下に示す Linux 固有のプロセス属性も \fBexecve\fP()
+の前後で保持されない。
.IP * 3
-.\"O The
-.\"O .BR prctl (2)
-.\"O .B PR_SET_DUMPABLE
-.\"O flag is set,
-.\"O unless a set-user-ID or set-group ID program is being executed,
-.\"O in which case it is cleared.
-set-user-ID ¤« set-group-ID ¤µ¤ì¤¿¥×¥í¥°¥é¥à¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
-.BR prctl (2)
-¤Î
-.B PR_SET_DUMPABLE
-¥Õ¥é¥°¤Ï¥¯¥ê¥¢¤µ¤ì¤ë¡£¤½¤ì°Ê³°¤Î¾ì¹ç¡¢¤³¤Î¥Õ¥é¥°¤Ï¥»¥Ã¥È¤µ¤ì¤ë¡£
+set\-user\-ID か set\-group\-ID されたプログラムが実行されている場合、 \fBprctl\fP(2) の
+\fBPR_SET_DUMPABLE\fP フラグはクリアされる。それ以外の場合、このフラグはセットされる。
+.IP *
+\fBprctl\fP(2) の \fBPR_SET_KEEPCAPS\fP フラグはクリアされる。
+.IP *
+(Linux 2.4.36 以降 / 2.6.23 以降) set\-user\-ID や set\-group\-ID されたプログラムが実行された場合、
+\fBprctl\fP(2) の \fBPR_SET_PDEATHSIG\fP フラグで設定された parent death シグナルはクリアされる。
.IP *
-.\"O The
-.\"O .BR prctl (2)
-.\"O .B PR_SET_KEEPCAPS
-.\"O flag is cleared.
-.BR prctl (2)
-¤Î
-.B PR_SET_KEEPCAPS
-¥Õ¥é¥°¤Ï¥¯¥ê¥¢¤µ¤ì¤ë¡£
+プロセス名は新しい実行ファイルの名前にリセットされる。 プロセス名は \fBprctl\fP(2) の \fBPR_SET_NAME\fP で設定でき、
+\fIps\ \-o comm\fP で表示できる。
.IP *
-.\"O The process name, as set by
-.\"O .BR prctl (2)
-.\"O .B PR_SET_NAME
-.\"O (and displayed by
-.\"O .IR "ps\ \-o comm" ),
-.\"O is reset to the name of the new executable file.
-¥×¥í¥»¥¹Ì¾¤Ï¿·¤·¤¤¼Â¹Ô¥Õ¥¡¥¤¥ë¤Î̾Á°¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤ë¡£
-¥×¥í¥»¥¹Ì¾¤Ï
-.BR prctl (2)
-¤Î
-.B PR_SET_NAME
-¤ÇÀßÄê¤Ç¤¡¢
-.I "ps\ \-o comm"
-¤Çɽ¼¨¤Ç¤¤ë¡£
+\fBSECBIT_KEEP_CAPS\fP の \fIsecurebits\fP フラグはクリアされる。 \fBcapabilities\fP(7) 参照。
.IP *
-.\"O The termination signal is reset to
-.\"O .B SIGCHLD
-.\"O (see
-.\"O .BR clone (2)).
-½ªÎ»¥·¥°¥Ê¥ë (termination signal) ¤Ï
-.B SIGCHLD
-¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤ë
-.RB ( clone (2)
-»²¾È)¡£
+終了シグナル (termination signal) は \fBSIGCHLD\fP にリセットされる (\fBclone\fP(2) 参照)。
.PP
-.\"O Note the following further points:
-°Ê²¼¤ÎÅÀ¤Ë¤Ä¤¤¤Æ¤âÃí°Õ¤¹¤ë¤³¤È:
+以下の点についても注意すること:
.IP * 3
-.\"O All threads other than the calling thread are destroyed during an
-.\"O .BR execve ().
-.\"O Mutexes, condition variables, and other pthreads objects are not preserved.
-¸Æ¤Ó½Ð¤·¸µ¥¹¥ì¥Ã¥É°Ê³°¤ÎÁ´¤Æ¤Î¥¹¥ì¥Ã¥É¤Ï
-.BR execve ()
-Ãæ¤ËÇË´þ¤µ¤ì¤ë¡£
-mutex¡¢¾ò·ïÊÑ¿ô¡¢¤½¤Î¾¤Î pthread ¥ª¥Ö¥¸¥§¥¯¥È¤ÏÊÝ»ý¤µ¤ì¤Ê¤¤¡£
+呼び出し元スレッド以外の全てのスレッドは \fBexecve\fP() 中に破棄される。 mutex、条件変数、その他の pthread
+オブジェクトは保持されない。
.IP *
-.\"O The equivalent of \fIsetlocale(LC_ALL, "C")\fP
-.\"O is executed at program start-up.
-\fIsetlocale(LC_ALL, "C")\fP ÁêÅö¤Î½èÍý¤¬¥×¥í¥°¥é¥à³«»Ï»þ¤Ë¼Â¹Ô¤µ¤ì¤ë¡£
+\fIsetlocale(LC_ALL, "C")\fP 相当の処理がプログラム開始時に実行される。
.IP *
-.\"O POSIX.1-2001 specifies that the dispositions of any signals that
-.\"O are ignored or set to the default are left unchanged.
-.\"O POSIX.1-2001 specifies one exception: if
-.\"O .B SIGCHLD
-.\"O is being ignored,
-.\"O then an implementation may leave the disposition unchanged or
-.\"O reset it to the default; Linux does the former.
-POSIX.1-2001 ¤Ï¡¢Æ°ºî¤¬Ìµ»ë¤«¥Ç¥Õ¥©¥ë¥È¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÁ´¤Æ¤Î¥·¥°¥Ê¥ë
-¤Î½èÍýÊýË¡¤ÏÊѹ¹¤»¤º¤½¤Î¤Þ¤Þ¤Ë¤¹¤ë¡¢¤Èµ¬Äꤷ¤Æ¤¤¤ë¡£
-⤷¡¢POSIX.1-2001 ¤Ë¤Ï°ì¤ÄÎã³°¤¬¤¢¤ê¡¢
-.B SIGCHLD
-¤¬Ìµ»ë¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
-¤½¤Î½èÍýÊýË¡¤òÊѹ¹¤»¤º¤Ë¤½¤Î¤Þ¤Þ¤Ë¤¹¤ë¤«¡¢¥Ç¥Õ¥©¥ë¥ÈÆ°ºî¤Ë¥ê¥»¥Ã¥È¤¹¤ë¤«¤Ï
-¼ÂÁõ°Í¸¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
-Linux ¤Ç¤ÏÁ°¼Ô (Êѹ¹¤·¤Ê¤¤) ¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
+POSIX.1\-2001 は、動作が無視かデフォルトに設定されている全てのシグナル の処理方法は変更せずそのままにする、と規定している。
+但し、POSIX.1\-2001 には一つ例外があり、 \fBSIGCHLD\fP が無視になっている場合、
+その処理方法を変更せずにそのままにするか、デフォルト動作にリセットするかは 実装依存となっている。 Linux では前者 (変更しない) となっている。
.IP *
-.\"O Any outstanding asynchronous I/O operations are canceled
-.\"O .RB ( aio_read (3),
-.\"O .BR aio_write (3)).
-´°Î»¤·¤Æ¤¤¤Ê¤¤ÈóƱ´ü I/O Áàºî¤Ï¥¥ã¥ó¥»¥ë¤µ¤ì¤ë
-.RB ( aio_read (3),
-.BR aio_write (3))¡£
+完了していない非同期 I/O 操作はキャンセルされる (\fBaio_read\fP(3), \fBaio_write\fP(3))。
.IP *
-.\"O For the handling of capabilities during
-.\"O .BR execve (),
-.\"O see
-.\"O .BR capabilities (7).
-.BR execve (2)
-»þ¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î°·¤¤¤Ë¤Ä¤¤¤Æ¤Ï¡¢
-.BR capabilities (7)
-¤ò»²¾È¡£
+\fBexecve\fP(2) 時のケーパビリティの扱いについては、 \fBcapabilities\fP(7) を参照。
.IP *
-.\"O By default, file descriptors remain open across an
-.\"O .BR execve ().
-.\"O File descriptors that are marked close-on-exec are closed;
-.\"O see the description of
-.\"O .B FD_CLOEXEC
-.\"O in
-.\"O .BR fcntl (2).
-.\"O (If a file descriptor is closed, this will cause the release
-.\"O of all record locks obtained on the underlying file by this process.
-.\"O See
-.\"O .BR fcntl (2)
-.\"O for details.)
-¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï
-.BR execve ()
-¤ò¹Ô¤Ã¤¿¸å¤Ç¤â¥ª¡¼¥×¥ó¤µ¤ì¤¿¤Þ¤Þ¤Ç¤¢¤ë¡£
-close-on-exec ¤Î°õ¤¬ÉÕ¤¤¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¥¯¥í¡¼¥º¤µ¤ì¤ë¡£
-.BR fcntl (2)
-¤Î
-.B FD_CLOEXEC
-¤ÎÀâÌÀ¤ò»²¾È¡£
-(¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬¥¯¥í¡¼¥º¤µ¤ì¤ë¤È¡¢¤³¤Î¥×¥í¥»¥¹¤¬
-¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂбþ¤¹¤ë¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ³ÍÆÀ¤·¤Æ¤¤¤¿
-¥ì¥³¡¼¥É¤Î¥í¥Ã¥¯¤¬Á´¤Æ²òÊü¤µ¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£)
-.\"O POSIX.1-2001 says that if file descriptors 0, 1, and 2 would
-.\"O otherwise be closed after a successful
-.\"O .BR execve (),
-.\"O and the process would gain privilege because the set-user_ID or
-.\"O set-group_ID permission bit was set on the executed file,
-.\"O then the system may open an unspecified file for each of these
-.\"O file descriptors.
-.\"O As a general principle, no portable program, whether privileged or not,
-.\"O can assume that these three file descriptors will remain
-.\"O closed across an
-.\"O .BR execve ().
-POSIX.1-2001 ¤Ç¤Ï¡¢
-¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ 0, 1, 2 ¤¬
-.BR execve ()
-À®¸ù¸å¤Ë¤É¤³¤«¤Ç¥¯¥í¡¼¥º¤µ¤ì¡¢¤«¤Ä
-¼Â¹Ô¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤Ë set-user_ID ¤« set-group_ID ¤Îµö²Ä¥Ó¥Ã¥È¤¬
-¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Æ¥×¥í¥»¥¹¤¬Æø¢¤ò³ÍÆÀ¤·¤¿¾ì¹ç¡¢
-¥·¥¹¥Æ¥à¤Ï²¿¤é¤«¤Î¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤¹¤ëºÝ¤Ë
-¤³¤ì¤é¤ÎÈÖ¹æ¤Î¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¤É¤ì¤«¤ò»È¤¦¤³¤È¤¬¤¢¤ë¡¢
-¤È¤µ¤ì¤Æ¤¤¤ë¡£
-¸¶Â§¤È¤·¤Æ¡¢°Ü¿¢À¤¬É¬Í×¤Ê¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
-Æø¢¤ÎÍ̵¤Ë´Ø¤ï¤é¤º¡¢
-.BR execve ()
-¤ÎÁ°¸å¤Ç¤³¤ì¤é 3¤Ä¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬¥¯¥í¡¼¥º¤µ¤ì¤¿¤Þ¤Þ¤Ç
-¤¢¤ë¤³¤È¤òÁ°Äó¤Ë¤¹¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£
.\" On Linux it appears that these file descriptors are
.\" always open after an execve(), and it looks like
.\" Solaris 8 and FreeBSD 6.1 are the same. -- mtk, 30 Apr 2007
-.\"O .SS Interpreter scripts
-.SS ¥¤¥ó¥¿¥×¥ê¥¿¡¦¥¹¥¯¥ê¥×¥È
-.\"O An interpreter script is a text file that has execute
-.\"O permission enabled and whose first line is of the form:
-¥¤¥ó¥¿¥×¥ê¥¿¡¦¥¹¥¯¥ê¥×¥È¤È¤Ï¡¢¼Â¹Ôµö²Ä¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Æ¡¢
-ºÇ½é¤Î¹Ô¤¬°Ê²¼¤Î·Á¤Ë¤Ê¤Ã¤Æ¤¤¤ë¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤Î¤³¤È¤Ç¤¢¤ë¡£
+デフォルトでは、ファイルディスクリプタは \fBexecve\fP() を行った後でもオープンされたままである。 close\-on\-exec
+の印が付いているファイルディスクリプタはクローズされる。 \fBfcntl\fP(2) の \fBFD_CLOEXEC\fP の説明を参照。
+(ファイルディスクリプタがクローズされると、このプロセスが ファイルディスクリプタに対応するファイルに対して獲得していた
+レコードのロックが全て解放されることになる。) POSIX.1\-2001 では、 ファイルディスクリプタ 0, 1, 2 が \fBexecve\fP()
+成功後にどこかでクローズされ、かつ 実行されるファイルに set\-user_ID か set\-group_ID の許可ビットが
+セットされていてプロセスが特権を獲得した場合、 システムは何らかのファイルをオープンする際に これらの番号のディスクリプタのどれかを使うことがある、
+とされている。 原則として、移植性が必要なプログラムでは、 特権の有無に関わらず、 \fBexecve\fP() の前後でこれら
+3つのファイルディスクリプタがクローズされたままで あることを前提にすることはできない。
+.SS インタプリタ・スクリプト
+インタプリタ・スクリプトとは、実行許可が有効になっていて、 最初の行が以下の形になっているテキストファイルのことである。
.in +4n
.nf
-\fB#!\fP \fIinterpreter \fP[optional-arg]
+\fB#!\fP \fIinterpreter \fP[optional\-arg]
.fi
.in
-.\"O The
-.\"O .I interpreter
-.\"O must be a valid pathname for an
-.\"O executable which is not itself a script.
-.I interpreter
-¤Ï͸ú¤Ê¼Â¹Ô¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹Ì¾¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢
-¤½¤ì¼«¿È¤¬¥¹¥¯¥ê¥×¥È¤Ç¤¢¤Ã¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
-.\"O If the
-.\"O .I filename
-.\"O argument of
-.\"O .BR execve ()
-.\"O specifies an interpreter script, then
-.\"O .I interpreter
-.\"O will be invoked with the following arguments:
-.BR execve ()
-¤Î
-.I filename
-°ú¤¿ô¤¬¥¤¥ó¥¿¥×¥ê¥¿¥¹¥¯¥ê¥×¥È¤ò»ØÄꤷ¤Æ¤¤¤ë¾ì¹ç¡¢
-.I interpreter
-¤Ï°Ê²¼¤Î°ú¤¿ô¤Çµ¯Æ°¤µ¤ì¤ë¡£
+\fIinterpreter\fP は有効な実行ファイルのパス名でなければならず、 それ自身がスクリプトであってはならない。 \fBexecve\fP() の
+\fIfilename\fP 引き数がインタプリタスクリプトを指定している場合、 \fIinterpreter\fP は以下の引き数で起動される。
.in +4n
.nf
-\fIinterpreter\fP [optional-arg] \fIfilename\fP arg...
+\fIinterpreter\fP [optional\-arg] \fIfilename\fP arg...
.fi
.in
-.\"O where
-.\"O .I arg...
-.\"O is the series of words pointed to by the
-.\"O .I argv
-.\"O argument of
-.\"O .BR execve ().
-.I arg...
-¤Ï
-.BR execve ()
-¤Î
-.I argv
-°ú¤¿ô¤¬»Ø¤¹¥ï¡¼¥ÉÎó¤Ç¤¢¤ë¡£
-
-.\"O For portable use,
-.\"O .I optional-arg
-.\"O should either be absent, or be specified as a single word (i.e., it
-.\"O should not contain white space); see NOTES below.
-°Ü¿¢À¤ò»ý¤¿¤¹¤Ë¤Ï¡¢
-.I optional-arg
-¤Ï¶õ¤« 1¥ï¡¼¥É¤À¤±¤Ë¤¹¤Ù¤¤Ç¤¢¤ë
-(¤Ä¤Þ¤ê¡¢¥Û¥ï¥¤¥È¡¦¥¹¥Ú¡¼¥¹¤ò´Þ¤á¤ë¤Ù¤¤Ç¤Ï¤Ê¤¤)¡£
-²¼µ¤Î¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È¡£
-.\"O .SS "Limits on size of arguments and environment"
-.SS "°ú¤¿ô¤È´Ä¶ÊÑ¿ô¤Î¹ç·×¥µ¥¤¥º¤Î¾å¸Â"
-.\"O Most Unix implementations impose some limit on the total size
-.\"O of the command-line argument
-.\"O .RI ( argv )
-.\"O and environment
-.\"O .RI ( envp )
-.\"O strings that may be passed to a new program.
-.\"O POSIX.1 allows an implementation to advertise this limit using the
-.\"O .B ARG_MAX
-.\"O constant (either defined in
-.\"O .I <limits.h>
-.\"O or available at run time using the call
-.\"O .IR "sysconf(_SC_ARG_MAX)" ).
-¤Û¤È¤ó¤É¤Î Unix ¤Î¼ÂÁõ¤Ï¡¢¿·¤·¤¤¥×¥í¥°¥é¥à¤ËÅϤ¹¤³¤È¤¬¤Ç¤¤ë
-¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô
-.RI ( argv )
-¤È´Ä¶ÊÑ¿ô
-.RI ( envp )
-¤Îʸ»úÎ󷲤ιç·×¥µ¥¤¥º¤Ë²¿¤é¤«¤Î¾å¸Â¤òÀߤ±¤Æ¤¤¤ë¡£
-POSIX.1 ¤Ï¡¢
-.B ARG_MAX
-Äê¿ô¤ò»È¤Ã¤Æ¤³¤Î¾å¸Â¤ò·è¤á¤ë¼ÂÁõ¤òǧ¤á¤Æ¤¤¤ë
-.RB ( ARG_MAX
-¤Ï
-.I <limits.h>
-¤ÇÄêµÁ¤µ¤ì¤ë¤«¡¢¼Â¹Ô»þ¤Ë
-.I "sysconf(_SC_ARG_MAX)"
-¤Î¸Æ¤Ó½Ð¤·¤ÇÆþ¼ê¤Ç¤¤ë¤«¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë)¡£
-
-.\"O On Linux prior to kernel 2.6.23, the memory used to store the
-.\"O environment and argument strings was limited to 32 pages
-.\"O (defined by the kernel constant
-.\"O .BR MAX_ARG_PAGES ).
-.\"O On architectures with a 4-kB page size,
-.\"O this yields a maximum size of 128 kB.
-¥«¡¼¥Í¥ë 2.6.23 ¤è¤êÁ°¤Î Linux ¤Ç¤Ï¡¢´Ä¶ÊÑ¿ô¤È°ú¤¿ô¤Îʸ»úÎ󷲤ò
-³ÊǼ¤¹¤ë¤Î¤Ë»ÈÍѤµ¤ì¤ë¥á¥â¥ê¤Ï 32 ¥Ú¡¼¥¸¤ËÀ©¸Â¤µ¤ì¤Æ¤¤¤¿
-(32 ¥Ú¡¼¥¸¤È¤¤¤¦¤Î¤Ï¥«¡¼¥Í¥ëÄê¿ô
-.B MAX_ARG_PAGES
-¤ÇÄêµÁ¤µ¤ì¤ë)¡£¤·¤¿¤¬¤Ã¤Æ¡¢
-¥Ú¡¼¥¸¥µ¥¤¥º¤¬ 4 kB ¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤Ï¡¢
-ºÇÂ祵¥¤¥º¤Ï 128 kB ¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ë¡£
-
-.\"O On kernel 2.6.23 and later, most architectures support a size limit
-.\"O derived from the soft
-.\"O .B RLIMIT_STACK
-.\"O resource limit (see
-.\"O .BR getrlimit (2))
-.\"O that is in force at the time of the
-.\"O .BR execve ()
-.\"O call.
-¥«¡¼¥Í¥ë 2.6.23 °Ê¹ß¤Ç¤Ï¡¢¤Û¤È¤ó¤É¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ë¤ª¤¤¤Æ¡¢
-.BR execve ()
-¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þÅÀ¤ÇŬÍѤµ¤ì¤Æ¤¤¤ë¥ê¥½¡¼¥¹¤Î¥½¥Õ¥È¾å¸Â
-.B RLIMIT_STACK
-¤Ë´ð¤Å¤¤¤¿¥µ¥¤¥º¾å¸Â¤¬»È¤ï¤ì¤ë
-.\"O (Architectures with no memory management unit are excepted:
-.\"O they maintain the limit that was in effect before kernel 2.6.23.)
-.\"O This change allows programs to have a much larger
-.\"O argument and/or environment list.
-(¥á¥â¥ê´ÉÍý¥æ¥Ë¥Ã¥È (MMU) ¤ò»ý¤¿¤Ê¤¤¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ï¾åµ¤ÎÊѹ¹¤Î
-Îã³°¤Ç¤¢¤ê¡¢¤³¤ì¤é¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤Ï¥«¡¼¥Í¥ë 2.6.23 ¤è¤êÁ°¤È
-Ʊ¤¸¾å¸Â¤¬¤½¤Î¤Þ¤Þ»ÈÍѤµ¤ì¤ë)¡£
+\fIarg...\fP は \fBexecve\fP() の \fIargv\fP 引き数が指すワード列である。
+
+移植性を持たすには、 \fIoptional\-arg\fP は空か 1ワードだけにすべきである (つまり、ホワイト・スペースを含めるべきではない)。
+下記の「注意」の節を参照。
+.SS 引き数と環境変数の合計サイズの上限
+ほとんどの UNIX の実装は、新しいプログラムに渡すことができる コマンドライン引き数 (\fIargv\fP) と環境変数 (\fIenvp\fP)
+の文字列群の合計サイズに何らかの上限を設けている。 POSIX.1 は、 \fBARG_MAX\fP 定数を使ってこの上限を決める実装を認めている
+(\fBARG_MAX\fP は \fI<limits.h>\fP で定義されるか、実行時に \fIsysconf(_SC_ARG_MAX)\fP
+の呼び出しで入手できるかのいずれかである)。
+
+カーネル 2.6.23 より前の Linux では、環境変数と引き数の文字列群を 格納するのに使用されるメモリは 32 ページに制限されていた (32
+ページというのはカーネル定数 \fBMAX_ARG_PAGES\fP で定義される)。したがって、 ページサイズが 4 kB のアーキテクチャでは、
+最大サイズは 128 kB ということになる。
+
.\" For some background on the changes to ARG_MAX in kernels 2.6.23 and
.\" 2.6.25, see:
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=5786
.\" http://bugzilla.kernel.org/show_bug.cgi?id=10095
.\" http://thread.gmane.org/gmane.linux.kernel/646709/focus=648101,
.\" checked into 2.6.25 as commit a64e715fc74b1a7dcc5944f848acc38b2c4d4ee2.
-.\"O For these architectures, the total size is limited to 1/4 of the allowed
-.\"O stack size.
-.\"O (Imposing the 1/4-limit
-.\"O ensures that the new program always has some stack space.)
-¤³¤ì¤é¤Î¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤Ï¡¢¹ç·×¥µ¥¤¥º¤Ïµö²Ä¤µ¤ì¤¿¥¹¥¿¥Ã¥¯¥µ¥¤¥º¤Î
-1/4 ¤ËÀ©¸Â¤µ¤ì¤Æ¤¤¤ë
-(1/4 ¤Î¾å¸Â¤òÀߤ±¤Æ¤¤¤ë¤Î¤Ï¡¢¿·¤·¤¤¥×¥í¥°¥é¥à¤¬É¬¤º¤¢¤ëÄøÅÙ¤Î
-¥¹¥¿¥Ã¥¯¶õ´Ö¤ò»ý¤Æ¤ë¤³¤È¤òÊݾڤ¹¤ë¤¿¤á¤Ç¤¢¤ë)¡£
.\" Ollie: That doesn't include the lists of pointers, though,
.\" so the actual usage is a bit higher (1 pointer per argument).
-.\"O Since Linux 2.6.25,
-.\"O the kernel places a floor of 32 pages on this size limit,
-.\"O so that, even when
-.\"O .BR RLIMIT_STACK
-.\"O is set very low,
-.\"O applications are guaranteed to have at least as much argument and
-.\"O environment space as was provided by Linux 2.6.23 and earlier.
-.\"O (This guarantee was not provided in Linux 2.6.23 and 2.6.24.)
-Linux 2.6.25 °Ê¹ß¤Ç¤Ï¡¢¥«¡¼¥Í¥ë¤Ï¤³¤Î¥µ¥¤¥º¾å¸Â¤Ë 32 ¥Ú¡¼¥¸¤Î²¼¸Â¤ò
-Àߤ±¤Æ¤¤¤ë¡£¤³¤ì¤Ë¤è¤ê¡¢
-.B RLIMIT_STACK
-¤¬Èó¾ï¤Ë¾®¤µ¤¯ÀßÄꤵ¤ì¤¿¾ì¹ç¤Ç¤â¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¾¯¤Ê¤¯¤È¤â
-Linux 2.6.23 °ÊÁ°¤ÇÄ󶡤µ¤ì¤Æ¤¤¤¿¤Î¤ÈƱ¤¸Â礤µ¤Î°ú¤¿ô¤È´Ä¶ÊÑ¿ô¤Î¶õ´Ö
-¤ÈƱ¤¸¤À¤±¤Ï³ÎÊݤǤ¤ë¤³¤È¤¬Êݾڤµ¤ì¤Æ¤¤¤ë
-(¤³¤ÎºÇÄã¸Â¤ÎÊÝ¾Ú¤Ï Linux 2.6.23 ¤È 2.6.24 ¤Ç¤ÏÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤)¡£
-.\"O Additionally, the limit per string is 32 pages (the kernel constant
-.\"O .BR MAX_ARG_STRLEN ),
-.\"O and the maximum number of strings is 0x7FFFFFFF.
-¤Þ¤¿¡¢³Æʸ»úÎó¤Î¾å¸Â¤Ï 32 ¥Ú¡¼¥¸ (¥«¡¼¥Í¥ëÄê¿ô
-.BR MAX_ARG_STRLEN )
-¤Ç¡¢Ê¸»úÎó¿ô¤ÎºÇÂçÃÍ¤Ï 0x7FFFFFFF ¤Ç¤¢¤ë¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O On success,
-.\"O .BR execve ()
-.\"O does not return, on error \-1 is returned, and
-.\"O .I errno
-.\"O is set appropriately.
-À®¸ù¤¹¤ë¤È
-.BR execve ()
-¤ÏÊÖ¤é¤Ê¤¤¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
-.I errno
-¤òŬÀÚ¤ËÀßÄꤹ¤ë¡£
-.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
-.TP
-.B E2BIG
-.\"O The total number of bytes in the environment
-.\"O .RI ( envp )
-.\"O and argument list
-.\"O .RI ( argv )
-.\"O is too large.
-´Ä¶ÊÑ¿ô
-.RI ( envp )
-¤È°ú¤¿ô¥ê¥¹¥È
-.RI ( argv )
-¤Î¹ç·×¥Ð¥¤¥È¿ô¤¬Â礲᤮¤ë¡£
-.TP
-.B EACCES
-.\"O Search permission is denied on a component of the path prefix of
-.\"O .I filename
-.\"O or the name of a script interpreter.
-.\"O (See also
-.\"O .BR path_resolution (7).)
-.I filename
-¤ä¥¹¥¯¥ê¥×¥È¥¤¥ó¥¿¥×¥ê¥¿Ì¾¤Î¹½À®Í×ÁǤ˸¡º÷µö²Ä (search permission)
-¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤
-.RB ( path_resolution (7)
-¤â»²¾È¤¹¤ë¤³¤È)¡£
-.TP
-.B EACCES
-.\"O The file or a script interpreter is not a regular file.
-¥Õ¥¡¥¤¥ë¤â¤·¤¯¤Ï¥¹¥¯¥ê¥×¥È¤Î¥¤¥ó¥¿¥×¥ê¥¿¤¬Ä̾ï¥Õ¥¡¥¤¥ë (regular file)
-¤Ç¤Ê¤¤¡£
-.TP
-.B EACCES
-.\"O Execute permission is denied for the file or a script or ELF interpreter.
-¥Õ¥¡¥¤¥ë¤ä¥¹¥¯¥ê¥×¥È¤ä ELF ¥¤¥ó¥¿¥×¥ê¥¿¤Ë
-¼Â¹Ôµö²Ä (execute permission) ¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤¡£
-.TP
-.B EACCES
-.\"O The file system is mounted
-.\"O .IR noexec .
-¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬
-.I noexec
-¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¡£
-.TP
-.B EFAULT
-.\"O .I filename
-.\"O points outside your accessible address space.
-.I filename
-¤¬¥¢¥¯¥»¥¹²Äǽ¤Ê¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤ò»Ø¤·¤Æ¤¤¤ë¡£
-.TP
-.B EINVAL
-.\"O An ELF executable had more than one PT_INTERP segment (i.e., tried to
-.\"O name more than one interpreter).
-ELF ¼Â¹Ô·Á¼°¤ÇÊ£¿ô¤Î PT_INTERP ¥»¥°¥á¥ó¥È¤¬Â¸ºß¤¹¤ë¡£
-(¤¹¤Ê¤ï¤ÁÊ£¿ô¤Î¥¤¥ó¥¿¥×¥ê¥¿¤ò»ØÄꤷ¤¿¡£)
-.TP
-.B EIO
-.\"O An I/O error occurred.
-I/O ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
-.TP
-.B EISDIR
-.\"O An ELF interpreter was a directory.
-ELF ¥¤¥ó¥¿¥×¥ê¥¿¤¬¥Ç¥£¥ì¥¯¥È¥ê¤À¤Ã¤¿¡£
-.TP
-.B ELIBBAD
-.\"O An ELF interpreter was not in a recognized format.
-ELF ¥¤¥ó¥¿¥×¥ê¥¿¤¬Íý²ò¤Ç¤¤ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¤Ê¤«¤Ã¤¿¡£
-.TP
-.B ELOOP
-.\"O Too many symbolic links were encountered in resolving
-.\"O .I filename
-.\"O or the name of a script or ELF interpreter.
-.I filename
-¤ä¥¹¥¯¥ê¥×¥È¤ä ELF ¤Î¥¤¥ó¥¿¥×¥ê¥¿¤ò²ò·è¤¹¤ëºÝ¤ËÁø¶ø¤·¤¿
-¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤¬Â¿²á¤®¤ë¡£
-.TP
-.B EMFILE
-.\"O The process has the maximum number of files open.
-¤½¤Î¥×¥í¥»¥¹¤¬¥ª¡¼¥×¥ó¤Ç¤¤ë¥Õ¥¡¥¤¥ë¿ô¤Î¾å¸Â¤Þ¤Ç´û¤Ë¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¡£
-.TP
-.B ENAMETOOLONG
-.\"O .I filename
-.\"O is too long.
-.I filename
-¤¬Ä¹²á¤®¤ë¡£
-.TP
-.B ENFILE
-.\"O The system limit on the total number of open files has been reached.
-¤½¤Î¥·¥¹¥Æ¥à¤Ç¥ª¡¼¥×¥ó¤Ç¤¤ë¥Õ¥¡¥¤¥ë¿ô¤ÎÀ©¸Â¤Ë㤷¤¿¡£
-.TP
-.B ENOENT
-.\"O The file
-.\"O .I filename
-.\"O or a script or ELF interpreter does not exist, or a shared library
-.\"O needed for file or interpreter cannot be found.
-¥Õ¥¡¥¤¥ë
-.I filename
-¤«¥¹¥¯¥ê¥×¥È¤ä ELF ¤Î¥¤¥ó¥¿¥×¥ê¥¿¤¬Â¸ºß¤·¤Ê¤¤¡£
-.TP
-.B ENOEXEC
-.\"O An executable is not in a recognized format, is for the wrong
-.\"O architecture, or has some other format error that means it cannot be
-.\"O executed.
-¼Â¹Ô¥Õ¥¡¥¤¥ë¤¬Íý²ò¤Ç¤¤Ê¤¤·Á¼°¤Ç¤¢¤ë¤«¡¢°ã¤¦¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Î¤â¤Î¤«¡¢
-¤½¤Î¾¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¡¦¥¨¥é¡¼¤Ë¤è¤ê¼Â¹Ô¤¬¤Ç¤¤Ê¤«¤Ã¤¿¡£
-.TP
-.B ENOMEM
-.\"O Insufficient kernel memory was available.
-¥«¡¼¥Í¥ë¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
-.TP
-.B ENOTDIR
-.\"O A component of the path prefix of
-.\"O .I filename
-.\"O or a script or ELF interpreter is not a directory.
-.I filename
-¤ä¥¹¥¯¥ê¥×¥È¤ä ELF ¤Î¥¤¥ó¥¿¥×¥ê¥¿¤Î¹½À®Í×ÁǤ¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
-.TP
-.B EPERM
-.\"O The file system is mounted
-.\"O .IR nosuid ,
-.\"O the user is not the superuser,
-.\"O and the file has the set-user-ID or set-group-ID bit set.
-¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬
-.I nosuid
-¤Ç¥Þ¥¦¥ó¥È¤µ¤ì¡¢¥æ¡¼¥¶¤¬¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤Ç¤Ê¤¯¡¢
-¥Õ¥¡¥¤¥ë¤Ë set-user-ID ¤¢¤ë¤¤¤Ï set-group-ID ¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£
-.TP
-.B EPERM
-.\"O The process is being traced, the user is not the superuser and the
-.\"O file has the set-user-ID or set-group-ID bit set.
-¥×¥í¥»¥¹¤¬¥È¥ì¡¼¥¹¤µ¤ì¡¢¥æ¡¼¥¶¤¬¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤Ç¤Ê¤¯¡¢
-¥Õ¥¡¥¤¥ë¤Ë set-user-ID ¤¢¤ë¤¤¤Ï set-group-ID ¥Ó¥Ã¥È¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£
-.TP
-.B ETXTBSY
-.\"O Executable was open for writing by one or more processes.
-¼Â¹Ô¥Õ¥¡¥¤¥ë¤ò½ñ¤¹þ¤ßÍѤ˥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¥×¥í¥»¥¹¤¬¤¢¤ë¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-.\"O SVr4, 4.3BSD, POSIX.1-2001.
-.\"O POSIX.1-2001 does not document the #! behavior
-.\"O but is otherwise compatible.
-.\"O .\" SVr4 documents additional error
-.\"O .\" conditions EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP; POSIX does not
-.\"O .\" document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL,
-.\"O .\" EISDIR or ELIBBAD error conditions.
-SVr4, 4.3BSD, POSIX.1-2001.
-POSIX.1-2001 ¤Ë¤Ï #! Æ°ºî¤Ë¤Ä¤¤¤Æ¤Îµ½Ò¤Ï¤Ê¤¤¤¬¡¢
-¾¤Ï¸ß´¹À¤¬¤¢¤ë¡£
-.\" SVr4 ¤Ë¤Ï¾¤Ë EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP
-.\" ¤Ë¤Ä¤¤¤Æ¤Îµ½Ò¤¬¤¢¤ë¡£
-.\" POSIX ¤Ë¤Ï ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE,
-.\" EINVAL, EISDIR, ELIBBAD ¥¨¥é¡¼¾õÂ֤ˤĤ¤¤Æ¤Îµ½Ò¤Ï¤Ê¤¤¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O Set-user-ID and set-group-ID processes can not be
-.\"O .BR ptrace (2)d.
-set-user-id ¥×¥í¥»¥¹¤È set-group-ID ¥×¥í¥»¥¹¤Ï
-.BR ptrace (2)
-¤Ç¤¤Ê¤¤¡£
-
-.\"O Linux ignores the set-user-ID and set-group-ID bits on scripts.
-Linux ¤Ï¥¹¥¯¥ê¥×¥È¤Î set-user-ID ¤È set-group-ID ¥Ó¥Ã¥È¤ò̵»ë¤¹¤ë¡£
-
-.\"O The result of mounting a file system
-.\"O .I nosuid
-.\"O varies across Linux kernel versions:
-.\"O some will refuse execution of set-user-ID and set-group-ID
-.\"O executables when this would
-.\"O give the user powers she did not have already (and return
-.\"O .BR EPERM ),
-.\"O some will just ignore the set-user-ID and set-group-ID bits and
-.\"O .BR exec ()
-.\"O successfully.
-¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ò
-.I nosuid
-¤Ç¥Þ¥¦¥ó¥È¤·¤¿¾ì¹ç¤Ë set-user-ID/set-group-ID ¤Î¼Â¹Ô¥Õ¥¡¥¤¥ë¤ò
-¤É¤ÎÍͤ˰·¤¦¤«¤Ï¡¢Linux ¥«¡¼¥Í¥ë¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë:
-¤¢¤ë¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢¤¹¤Ç¤ËɬÍפʸ¢¸Â¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¤ò½ü¤¤¤Æ¡¢
-¤½¤Î¼Â¹Ô¤òµñÈݤ¹¤ë (¤½¤·¤Æ
-.B EPERM
-¤òÊÖ¤¹)¡£Ê̤Τ¢¤ë¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï
-set-user-ID/set-group-ID ¥Ó¥Ã¥È¤Î¤ß¤ò̵»ë¤·
-.BR exec ()
-¤ÏÀ®¸ù¤¹¤ë¡£
-
-.\"O A maximum line length of 127 characters is allowed for the first line in
-.\"O a #! executable shell script.
-#! ¼Â¹Ô·Á¼°¤Î¥·¥§¥ë¡¦¥¹¥¯¥ê¥×¥È¤Î 1¹ÔÌܤ˵ö¤µ¤ì¤Æ¤¤¤ëʸ»ú¿ô¤Ï¡¢
-ºÇÂç 127 ʸ»ú¤Ç¤¢¤ë¡£
-
-.\"O The semantics of the
-.\"O .I optional-arg
-.\"O argument of an interpreter script vary across implementations.
-.\"O On Linux, the entire string following the
-.\"O .I interpreter
-.\"O name is passed as a single argument to the interpreter,
-.\"O and this string can include white space.
-.\"O However, behavior differs on some other systems.
-.\"O Some systems
-.\"O .\" e.g., Solaris 8
-.\"O use the first white space to terminate
-.\"O .IR optional-arg .
-.\"O On some systems,
-.\"O .\" e.g., FreeBSD before 6.0, but not FreeBSD 6.0 onwards
-.\"O an interpreter script can have multiple arguments,
-.\"O and white spaces in
-.\"O .I optional-arg
-.\"O are used to delimit the arguments.
-¥¤¥ó¥¿¥×¥ê¥¿¡¦¥¹¥¯¥ê¥×¥È¤Î
-.I optional-arg
-°ú¤¿ô¤Î²ò¼áÊýË¡¤Ï¼ÂÁõ¤Ë¤è¤ê°Û¤Ê¤ë¡£
-Linux ¤Ç¤Ï¡¢¥¤¥ó¥¿¥×¥ê¥¿Ì¾
-.I interpreter
-¤Ë³¤¯Ê¸»úÎóÁ´ÂΤ¬¥¤¥ó¥¿¥×¥ê¥¿¤Ë 1¸Ä¤Î°ú¤¿ô¤È¤·¤ÆÅϤµ¤ì¤ë¡£
-¤·¤«¤·¡¢Æ°ºî¤¬°Û¤Ê¤ë¥·¥¹¥Æ¥à¤â¤¢¤ë¡£
-¤¢¤ë¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
-.\" Î㤨¤Ð¡¢Solaris 8
-.I optional-arg
-¤Î¤¦¤ÁºÇ½é¤Î¥Û¥ï¥¤¥È¡¦¥¹¥Ú¡¼¥¹¤Þ¤Ç¤¬
-°ú¤¿ô¤È¤·¤ÆÅϤµ¤ì¤ë¡£
-¤Þ¤¿¡¢Ê̤Υ·¥¹¥Æ¥à¤Ç¤Ï
-.\" Î㤨¤Ð¡¢6.0 ¤è¤êÁ°¤Î FreeBSD (FreeBSD 6.0 °Ê¹ß¤Ï°ã¤¦)
-¥¤¥ó¥¿¥×¥ê¥¿¡¦¥¹¥¯¥ê¥×¥È¤ÏÊ£¿ô¤Î°ú¤¿ô¤ò»ý¤Ä¤³¤È¤¬¤Ç¤¡¢
-.I optional-arg
-Æâ¤Î¥Û¥ï¥¤¥È¡¦¥¹¥Ú¡¼¥¹¤¬°ú¤¿ô¤Î¶èÀÚ¤ê¤È¤Ê¤ë¡£
-
-.\"O On Linux,
-.\"O .I argv
-.\"O can be specified as NULL,
-.\"O which has the same effect as specifying this argument
-.\"O as a pointer to a list containing a single NULL pointer.
-.\"O .B "Do not take advantage of this misfeature!"
-.\"O It is nonstandard and nonportable:
-.\"O on most other Unix systems doing this will result in an error
-.\"O .RB ( EFAULT ).
-Linux ¤Ç¤Ï¡¢
-.I argv
-¤Ë NULL ¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£¤³¤ì¤Ï¡¢¤³¤Î°ú¤¿ô¤Ë NULL ¥Ý¥¤¥ó¥¿
-1¸Ä¤À¤±¤ò´Þ¤à¥ê¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤ò»ØÄꤷ¤¿¤Î¤ÈƱ¤¸¸ú²Ì¤ò»ý¤Ä¡£
-.BR ¡Ö¤³¤Î´Ö°ã¤Ã¤¿µ¡Ç½¤òÍøÍѤ·¤Ê¤¤¤³¤È¡× ¡£
-¤³¤ì¤ÏÈóɸ½à¤Ç¡¢°Ü¿¢À¤â¤Ê¤¤¡£
-¾¤Î¤Û¤È¤ó¤É¤Î Unix ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢¤³¤ì¤ò¹Ô¤¦¤È¥¨¥é¡¼
-.RB ( EFAULT )
-¤Ë¤Ê¤ë¡£
+カーネル 2.6.23 以降では、ほとんどのアーキテクチャにおいて、 \fBexecve\fP() が呼び出された時点で適用されているリソースのソフト上限
+\fBRLIMIT_STACK\fP に基づいたサイズ上限が使われる (メモリ管理ユニット (MMU) を持たないアーキテクチャは上記の変更の
+例外であり、これらのアーキテクチャではカーネル 2.6.23 より前と 同じ上限がそのまま使用される)。
+これらのアーキテクチャでは、合計サイズは許可されたスタックサイズの 1/4 に制限されている (1/4
+の上限を設けているのは、新しいプログラムが必ずある程度の スタック空間を持てることを保証するためである)。 Linux 2.6.25
+以降では、カーネルはこのサイズ上限に 32 ページの下限を 設けている。これにより、 \fBRLIMIT_STACK\fP
+が非常に小さく設定された場合でも、アプリケーションが少なくとも Linux 2.6.23 以前で提供されていたのと同じ大きさの引き数と環境変数の空間
+と同じだけは確保できることが保証されている (この最低限の保証は Linux 2.6.23 と 2.6.24 では提供されていない)。
+また、各文字列の上限は 32 ページ (カーネル定数 \fBMAX_ARG_STRLEN\fP) で、文字列数の最大値は 0x7FFFFFFF である。
+.SH 返り値
+成功すると \fBexecve\fP() は返らない。エラーの場合は \-1 を返し、 \fIerrno\fP を適切に設定する。
+.SH エラー
+.TP
+\fBE2BIG\fP
+環境変数 (\fIenvp\fP) と引き数リスト (\fIargv\fP) の合計バイト数が大き過ぎる。
+.TP
+\fBEACCES\fP
+\fIfilename\fP やスクリプトインタプリタ名の構成要素に検索許可 (search permission) が与えられていない
+(\fBpath_resolution\fP(7) も参照すること)。
+.TP
+\fBEACCES\fP
+ファイルもしくはスクリプトのインタプリタが通常ファイル (regular file) でない。
+.TP
+\fBEACCES\fP
+ファイルやスクリプトや ELF インタプリタに 実行許可 (execute permission) が与えられていない。
+.TP
+\fBEACCES\fP
+ファイル・システムが \fInoexec\fP でマウントされている。
+.TP
+\fBEFAULT\fP
+\fIfilename\fP がアクセス可能なアドレス空間の外を指している。
+.TP
+\fBEINVAL\fP
+ELF 実行形式で複数の PT_INTERP セグメントが存在する。 (すなわち複数のインタプリタを指定した。)
+.TP
+\fBEIO\fP
+I/O エラーが発生した。
+.TP
+\fBEISDIR\fP
+ELF インタプリタがディレクトリだった。
+.TP
+\fBELIBBAD\fP
+ELF インタプリタが理解できるフォーマットでなかった。
+.TP
+\fBELOOP\fP
+\fIfilename\fP やスクリプトや ELF のインタプリタを解決する際に遭遇した シンボリック・リンクが多過ぎる。
+.TP
+\fBEMFILE\fP
+そのプロセスがオープンできるファイル数の上限まで既にオープンしている。
+.TP
+\fBENAMETOOLONG\fP
+\fIfilename\fP が長過ぎる。
+.TP
+\fBENFILE\fP
+オープンされたファイルの総数がシステム全体の上限に達していた。
+.TP
+\fBENOENT\fP
+ファイル \fIfilename\fP かスクリプトや ELF のインタプリタが存在しない。
+.TP
+\fBENOEXEC\fP
+実行ファイルが理解できない形式であるか、違うアーキテクチャのものか、 その他のフォーマット・エラーにより実行ができなかった。
+.TP
+\fBENOMEM\fP
+カーネルに十分なメモリがない。
+.TP
+\fBENOTDIR\fP
+\fIfilename\fP やスクリプトや ELF のインタプリタの構成要素がディレクトリでない。
+.TP
+\fBEPERM\fP
+ファイル・システムが \fInosuid\fP でマウントされ、ユーザがスーパーユーザでなく、 ファイルに set\-user\-ID あるいは
+set\-group\-ID ビットが設定されている。
+.TP
+\fBEPERM\fP
+プロセスがトレースされ、ユーザがスーパーユーザでなく、 ファイルに set\-user\-ID あるいは set\-group\-ID ビットが設定されている。
+.TP
+\fBETXTBSY\fP
+実行ファイルを書き込み用にオープンしているプロセスがある。
+.SH 準拠
+.\" SVr4 documents additional error
+.\" conditions EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP; POSIX does not
+.\" document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL,
+.\" EISDIR or ELIBBAD error conditions.
+SVr4, 4.3BSD, POSIX.1\-2001. POSIX.1\-2001 には #! 動作についての記述はないが、 他は互換性がある。
+.SH 注意
+set\-user\-id プロセスと set\-group\-ID プロセスは \fBptrace\fP(2) できない。
+
+Linux はスクリプトの set\-user\-ID と set\-group\-ID ビットを無視する。
+
+ファイルシステムを \fInosuid\fP でマウントした場合に set\-user\-ID/set\-group\-ID の実行ファイルを
+どの様に扱うかは、Linux カーネルのバージョンによって異なる: あるバージョンでは、すでに必要な権限を持っている場合を除いて、 その実行を拒否する
+(そして \fBEPERM\fP を返す)。別のあるバージョンでは set\-user\-ID/set\-group\-ID ビットのみを無視し \fBexec\fP()
+は成功する。
+
+#! 実行形式のシェル・スクリプトの 1行目に許されている文字数は、 最大 127 文字である。
+
+.\" e.g., Solaris 8
+.\" e.g., FreeBSD before 6.0, but not FreeBSD 6.0 onward
+インタプリタ・スクリプトの \fIoptional\-arg\fP 引き数の解釈方法は実装により異なる。 Linux では、インタプリタ名
+\fIinterpreter\fP に続く文字列全体がインタプリタに 1個の引き数として渡される。 しかし、動作が異なるシステムもある。 あるシステムでは、
+\fIoptional\-arg\fP のうち最初のホワイト・スペースまでが 引き数として渡される。 また、別のシステムでは
+インタプリタ・スクリプトは複数の引き数を持つことができ、 \fIoptional\-arg\fP 内のホワイト・スペースが引き数の区切りとなる。
+
.\" e.g., EFAULT on Solaris 8 and FreeBSD 6.1; but
.\" HP-UX 11 is like Linux -- mtk, Apr 2007
.\" Bug filed 30 Apr 2007: http://bugzilla.kernel.org/show_bug.cgi?id=8408
.\" Bug rejected (because fix would constitute an ABI change).
.\"
+Linux では、 \fIargv\fP と \fIenvp\fP のいずれかには NULL を指定することができる。これは、これらの引き数に NULL ポインタ
+1個だけを含むリストへのポインタを指定したのと同じ効果を持つ。 \fB「この間違った機能を利用しないこと」\fP。 これは非標準で、移植性もない。
+他のほとんどの UNIX システムでは、これを行うとエラー (\fBEFAULT\fP) になる。
-.\"O POSIX.1-2001 says that values returned by
-.\"O .BR sysconf (3)
-.\"O should be invariant over the lifetime of a process.
-.\"O However, since Linux 2.6.23, if the
-.\"O .BR RLIMIT_STACK
-.\"O resource limit changes, then the value reported by
-.\"O .B _SC_ARG_MAX
-.\"O will also change,
-.\"O to reflect the fact that the limit on space for holding
-.\"O command-line arguments and environment variables has changed.
-POSIX.1-2001 ¤Ï¡¢
-.BR sysconf (3)
-¤¬ÊÖ¤¹ÃÍ¤Ï¥×¥í¥»¥¹¤ÎÀ¸Â¸Ãæ¤ÏÊѲ½¤·¤Ê¤¤¤Ù¤¤À¤È¤·¤Æ¤¤¤ë¡£
-¤·¤«¤·¤Ê¤¬¤é¡¢Linux 2.6.23 °Ê¹ß¤Ç¤Ï¡¢¥ê¥½¡¼¥¹¾å¸Â
-.B RLIMIT_STACK
-¤¬ÊѲ½¤·¤¿¾ì¹ç¡¢
-¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô¤È´Ä¶ÊÑ¿ô¤òÊÝ»ý¤¹¤ë¤¿¤á¤Î¶õ´Ö¤ËÂФ¹¤ë¾å¸Â¤¬
-ÊѲ½¤·¤¿¤³¤È¤òÈ¿±Ç¤·¤Æ¡¢
-.B _SC_ARG_MAX
-¤¬ÊÖ¤¹ÃͤâÊѲ½¤¹¤ë¡£
.\"
-.\"O .\" .SH BUGS
-.\"O .\" Some Linux versions have failed to check permissions on ELF
-.\"O .\" interpreters. This is a security hole, because it allows users to
-.\"O .\" open any file, such as a rewinding tape device, for reading. Some
-.\"O .\" Linux versions have also had other security holes in
-.\"O .\" .BR execve ()
-.\"O .\" that could be exploited for denial of service by a suitably crafted
-.\"O .\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
-.\" .SH ¥Ð¥°
-.\" Linux ÈǤÎÃæ¤Ë¤Ï¡¢ELF ¥¤¥ó¥¿¥×¥ê¥¿¤Ë¤ª¤±¤ë
-.\" ¸¢¸Â¤Î¥Á¥§¥Ã¥¯¤Ë¼ºÇÔ¤¹¤ë¤â¤Î¤¬¤¢¤ë¡£
-.\" ¤³¤ì¤Ï¥»¥¥å¥ê¥Æ¥£¥Û¡¼¥ë¤Ç¤¢¤ë¡£
-.\" ¤Ê¤¼¤Ê¤é¡¢¥æ¡¼¥¶¤ËǤ°Õ¤Î¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤òµö²Ä¤·¤¿¤ê¡¢
-.\" Æɤ߹þ¤ß¤Î¤¿¤á¤Ë¥Æ¡¼¥×¥Ç¥Ð¥¤¥¹¤ò´¬¤Ìᤷ¤òµö²Ä¤·¤¿¤ê¤¹¤ë¡£
-.\" Linux ÈǤÎÃæ¤Ë¤Ï
+.\" .SH BUGS
+.\" Some Linux versions have failed to check permissions on ELF
+.\" interpreters. This is a security hole, because it allows users to
+.\" open any file, such as a rewinding tape device, for reading. Some
+.\" Linux versions have also had other security holes in
.\" .BR execve ()
-.\" ¤Ë¾¤Î¥»¥¥å¥ê¥Æ¥£¥Û¡¼¥ë¤¬
-.\" ¸ºß¤¹¤ë¤â¤Î¤â¤¢¤ê¡¢¹ªÌ¯¤ËºÙ¹©¤µ¤ì¤¿ ELF ¥Ð¥¤¥Ê¥ê¤Ë¤è¤Ã¤Æ
-.\" ¥µ¡¼¥Ó¥¹µñÈÝ (denial of service) ¤ËÍøÍѤµ¤ì¤Æ¤·¤Þ¤¦¡£
-.\" 2.0.34 ¤Þ¤¿ 2.2.15 ¤Ë¤Ï¡¢ÃΤé¤ì¤Æ¤¤¤ëÌäÂê¤Ï¤Ê¤¤¡£
-.\"O .SS Historical
-.SS Îò»Ë
-.\"O With Unix V6 the argument list of an
-.\"O .BR exec ()
-.\"O call was ended by 0,
-.\"O while the argument list of
-.\"O .I main
-.\"O was ended by \-1.
-.\"O Thus, this argument list was not directly usable in a further
-.\"O .BR exec ()
-.\"O call.
-.\"O Since Unix V7 both are NULL.
-Unix V6 ¤Ç¤Ï
-.BR exec ()
-¥³¡¼¥ë¤Î°ú¤¿ô¥ê¥¹¥È¤Ï 0 ¤Ç½ªÃ¼¤µ¤ì¡¢
-.I main
-¤Î°ú¤¿ô¥ê¥¹¥È¤Ï \-1 ¤Ç½ªÃ¼¤µ¤ì¤Æ¤¤¤¿¡£
-¤½¤Î¤¿¤á¡¢
-.I main
-¤Î°ú¤¿ô¥ê¥¹¥È¤Ï¡¢¤½¤Î¸å¤Î
-.BR exec ()
-¥³¡¼¥ë¤Ë¤ÏľÀÜ»ÈÍѤǤ¤Ê¤«¤Ã¤¿¡£
-Unix V7 °Ê¹ß¤Ç¤Ï¡¢¤È¤â¤Ë NULL ¤Ç½ªÃ¼¤µ¤ì¤ë¡£
-.\"O .SH EXAMPLE
-.SH Îã
-.\"O The following program is designed to be execed by the second program below.
-.\"O It just echoes its command-line one per line.
-¤³¤Î¥×¥í¥°¥é¥à¤Ï¡¢°Ê²¼¤ÎÆó¤ÄÌÜ¤Î¥×¥í¥°¥é¥à¤«¤é¼Â¹Ô¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£
-¥³¥Þ¥ó¥É¥é¥¤¥ó¤ò 1¹Ô¤Ë 1¸Ä¤º¤Äɽ¼¨¤¹¤ë¤À¤±¤Î¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡£
+.\" that could be exploited for denial of service by a suitably crafted
+.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
+POSIX.1\-2001 は、 \fBsysconf\fP(3) が返す値はプロセスの生存中は変化しないべきだとしている。 しかしながら、Linux
+2.6.23 以降では、リソース上限 \fBRLIMIT_STACK\fP が変化した場合、 コマンドライン引き数と環境変数を保持するための空間に対する上限が
+変化したことを反映して、 \fB_SC_ARG_MAX\fP が返す値も変化する。
+.SS 歴史
+UNIX V6 では \fBexec\fP() コールの引き数リストは 0 で終端され、 \fImain\fP の引き数リストは \-1 で終端されていた。
+そのため、 \fImain\fP の引き数リストは、その後の \fBexec\fP() コールには直接使用できなかった。 UNIX V7 以降では、ともに
+NULL で終端される。
+.SH 例
+このプログラムは、以下の二つ目のプログラムから実行するためのものである。 コマンドラインを 1行に 1個ずつ表示するだけのプログラムである。
.in +4n
.nf
int j;
for (j = 0; j < argc; j++)
- printf("argv[%d]: %s\\n", j, argv[j]);
+ printf("argv[%d]: %s\en", j, argv[j]);
exit(EXIT_SUCCESS);
}
.fi
.in
-.\"O This program can be used to exec the program named in its command-line
-.\"O argument:
-°Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¡¢¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô¤Ç»ØÄꤷ¤¿Ì¾Á°¤Î¥×¥í¥°¥é¥à¤ò
-¼Â¹Ô¤¹¤ë¤Î¤Ë»È¤¦¡£
+以下のプログラムは、コマンドライン引き数で指定した名前のプログラムを 実行するのに使う。
.in +4n
.nf
char *newenviron[] = { NULL };
if (argc != 2) {
- fprintf(stderr, "Usage: %s <file-to-exec>\\n", argv[0]);
+ fprintf(stderr, "Usage: %s <file\-to\-exec>\en", argv[0]);
exit(EXIT_FAILURE);
}
.fi
.in
-.\"O We can use the second program to exec the first as follows:
-Æó¤ÄÌÜ¤Î¥×¥í¥°¥é¥à¤ò»È¤Ã¤Æ°ì¤ÄÌÜ¤Î¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï
-°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¡£
+二つ目のプログラムを使って一つ目のプログラムを実行するには 以下のようにする。
.in +4n
.nf
-.RB "$" " cc myecho.c \-o myecho"
-.RB "$" " cc execve.c \-o execve"
-.RB "$" " ./execve ./myecho"
+$\fB cc myecho.c \-o myecho\fP
+$\fB cc execve.c \-o execve\fP
+$\fB ./execve ./myecho\fP
argv[0]: ./myecho
argv[1]: hello
argv[2]: world
.fi
.in
-.\"O We can also use these programs to demonstrate the use of a script
-.\"O interpreter.
-.\"O To do this we create a script whose "interpreter" is our
-.\"O .I myecho
-.\"O program:
-¤µ¤é¤Ë¡¢¤³¤ì¤é¤Î¥×¥í¥°¥é¥à¤ò»È¤Ã¤Æ¡¢¥¹¥¯¥ê¥×¥È¡¦¥¤¥ó¥¿¥×¥ê¥¿¤ÎÎã¤ò¼¨¤¹¡£
-¤³¤Î¤¿¤á¤Ë¡¢¡Ö¥¤¥ó¥¿¥×¥ê¥¿¡×¤È¤·¤ÆÀè¤Û¤ÉºîÀ®¤·¤¿¥×¥í¥°¥é¥à
-.I myecho
-¤ò»È¤¦¥¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ë¡£
+さらに、これらのプログラムを使って、スクリプト・インタプリタの例を示す。 このために、「インタプリタ」として先ほど作成したプログラム \fImyecho\fP
+を使うスクリプトを作成する。
.in +4n
.nf
-.RB "$" " cat > script.sh"
-.B #! ./myecho script-arg
-.B ^D
-.RB "$" " chmod +x script.sh"
+$\fB cat > script.sh\fP
+\fB#! ./myecho script\-arg\fP
+\fB^D\fP
+$\fB chmod +x script.sh\fP
.fi
.in
-.\"O We can then use our program to exec the script:
-ºîÀ®¤·¤Æ¤ª¤¤¤¿¥×¥í¥°¥é¥à¤ò»È¤Ã¤Æ¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¤¹¤ë¡£
+作成しておいたプログラムを使ってスクリプトを実行する。
.in +4n
.nf
-.RB "$" " ./execve ./script.sh"
+$\fB ./execve ./script.sh\fP
argv[0]: ./myecho
-argv[1]: script-arg
+argv[1]: script\-arg
argv[2]: ./script.sh
argv[3]: hello
argv[4]: world
.fi
.in
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR chmod (2),
-.BR fork (2),
-.BR ptrace (2),
-.BR execl (3),
-.BR fexecve (3),
-.BR getopt (3),
-.BR credentials (7),
-.BR environ (7),
-.BR path_resolution (7),
-.BR ld.so (8)
+.SH 関連項目
+\fBchmod\fP(2), \fBfork\fP(2), \fBptrace\fP(2), \fBexecl\fP(3), \fBfexecve\fP(3),
+\fBgetopt\fP(3), \fBcredentials\fP(7), \fBenviron\fP(7), \fBpath_resolution\fP(7),
+\fBld.so\fP(8)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。