OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man2 / setsid.2
1 .\" Copyright Michael Haardt (michael@cantor.informatik.rwth-aachen.de)
2 .\"     Sat Aug 27 20:43:50 MET DST 1994
3 .\"
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
22 .\" USA.
23 .\"
24 .\" Modified Sun Sep 11 19:19:05 1994 <faith@cs.unc.edu>
25 .\" Modified Mon Mar 25 10:19:00 1996 <aeb@cwi.nl> (merged a few
26 .\"     tiny changes from a man page by Charles Livingston).
27 .\" Modified Sun Jul 21 14:45:46 1996 <aeb@cwi.nl>
28 .\"
29 .\"*******************************************************************
30 .\"
31 .\" This file was generated with po4a. Translate the source file.
32 .\"
33 .\"*******************************************************************
34 .TH SETSID 2 2008\-12\-03 Linux "Linux Programmer's Manual"
35 .SH 名前
36 setsid \- セッション (session) を作成し、プロセス・グループ ID を設定する
37 .SH 書式
38 .ad l
39 \fB#include <unistd.h>\fP
40 .sp
41 \fBpid_t setsid(void);\fP
42 .br
43 .ad b
44 .SH 説明
45 \fBsetsid\fP()  は呼び出したプロセスがプロセス・グループ・リーダー (process group leader)
46 でなければ、新しいセッションを作成する。 呼び出したプロセスは新しいセッションのリーダー、新しいプロセス・グループの
47 プロセス・グループ・リーダーとなり、tty の制御を持たない。 呼び出したプロセスのプロセス・グループ ID とセッション ID には、
48 呼び出したプロセスの PID が設定される。呼び出したプロセスはこの 新しいプロセス・グループ、この新しいセッションの唯一のプロセスとなる。
49 .SH 返り値
50 成功すると、呼び出したプロセスの (新しい) セッション ID が返される。 エラーの場合は、 \fI(pid_t)\ \-1\fP が返され、
51 \fIerror\fP にエラーを示す値が設定される。
52 .SH エラー
53 .TP 
54 \fBEPERM\fP
55 いずれかのプロセスのプロセス・グループ ID が、 呼び出したプロセスの PID と等しい。
56 これは、呼び出したプロセスが既にプロセス・リーダーの場合には \fBsetsid\fP()  は失敗することを意味する。
57 .SH 準拠
58 SVr4, POSIX.1\-2001.
59 .SH 注意
60 \fBfork\fP(2)  で作成された子プロセスは、親プロセスのセッション ID を継承する。 \fBexecve\fP(2)  の前後でセッション ID
61 は保存される。
62
63 プロセス・グループ・リーダーとは、そのプロセスのプロセス・グループ ID が その PID に等しいプロセスである。 \fBsetsid\fP()
64 を確実に成功させるためには、 \fBfork\fP(2)  して \fBexit\fP(2)  し、子プロセスで \fBsetsid\fP()  を行なえば良い。
65 .SH 関連項目
66 \fBgetsid\fP(2), \fBsetpgid\fP(2), \fBsetpgrp\fP(2), \fBtcgetsid\fP(3),
67 \fBcredentials\fP(7)