OSDN Git Service

8a012b785ef341e4311c2338b817356e558a01bb
[linuxjm/LDP_man-pages.git] / release / 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 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified Sun Sep 11 19:19:05 1994 <faith@cs.unc.edu>
26 .\" Modified Mon Mar 25 10:19:00 1996 <aeb@cwi.nl> (merged a few
27 .\"     tiny changes from a man page by Charles Livingston).
28 .\" Modified Sun Jul 21 14:45:46 1996 <aeb@cwi.nl>
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" This file was generated with po4a. Translate the source file.
33 .\"
34 .\"*******************************************************************
35 .TH SETSID 2 2013\-02\-11 Linux "Linux Programmer's Manual"
36 .SH 名前
37 setsid \- セッション (session) を作成し、プロセスグループ ID を設定する
38 .SH 書式
39 .ad l
40 \fB#include <unistd.h>\fP
41 .sp
42 \fBpid_t setsid(void);\fP
43 .br
44 .ad b
45 .SH 説明
46 \fBsetsid\fP()  creates a new session if the calling process is not a process
47 group leader.  The calling process is the leader of the new session, the
48 process group leader of the new process group, and has no controlling
49 terminal.  The process group ID and session ID of the calling process are
50 set to the PID of the calling process.  The calling process will be the only
51 process in this new process group and in this new session.
52 .SH 返り値
53 成功すると、呼び出したプロセスの (新しい) セッション ID が返される。 エラーの場合は、 \fI(pid_t)\ \-1\fP が返され、
54 \fIerror\fP にエラーを示す値が設定される。
55 .SH エラー
56 .TP 
57 \fBEPERM\fP
58 いずれかのプロセスのプロセスグループ ID が、 呼び出したプロセスの PID と等しい。 これは、呼び出したプロセスが既にプロセスリーダーの場合には
59 \fBsetsid\fP()  は失敗することを意味する。
60 .SH 準拠
61 SVr4, POSIX.1\-2001.
62 .SH 注意
63 \fBfork\fP(2)  で作成された子プロセスは、親プロセスのセッション ID を継承する。 \fBexecve\fP(2)  の前後でセッション ID
64 は保存される。
65
66 プロセスグループ・リーダーとは、そのプロセスのプロセスグループ ID が その PID に等しいプロセスである。 \fBsetsid\fP()
67 を確実に成功させるためには、 \fBfork\fP(2)  して \fBexit\fP(2)  し、子プロセスで \fBsetsid\fP()  を行なえば良い。
68 .SH 関連項目
69 \fBsetsid\fP(1), \fBgetsid\fP(2), \fBsetpgid\fP(2), \fBsetpgrp\fP(2), \fBtcgetsid\fP(3),
70 \fBcredentials\fP(7)
71 .SH この文書について
72 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
73 である。プロジェクトの説明とバグ報告に関する情報は
74 http://www.kernel.org/doc/man\-pages/ に書かれている。