OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / setpgid.2
1 .\" Copyright (c) 1983, 1991 Regents of the University of California.
2 .\" and Copyright (C) 2007, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by the University of
16 .\"     California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"     @(#)getpgrp.2   6.4 (Berkeley) 3/10/91
34 .\"
35 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
36 .\" Modified 1995-04-15 by Michael Chastain <mec@shell.portal.com>:
37 .\"   Added 'getpgid'.
38 .\" Modified 1996-07-21 by Andries Brouwer <aeb@cwi.nl>
39 .\" Modified 1996-11-06 by Eric S. Raymond <esr@thyrsus.com>
40 .\" Modified 1999-09-02 by Michael Haardt <michael@moria.de>
41 .\" Modified 2002-01-18 by Michael Kerrisk <mtk.manpages@gmail.com>
42 .\" Modified 2003-01-20 by Andries Brouwer <aeb@cwi.nl>
43 .\" 2007-07-25, mtk, fairly substantial rewrites and rearrangements
44 .\" of text.
45 .\"
46 .\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
47 .\"         all rights reserved.
48 .\" Translated Sun Nov 21 18:54:10 JST 1999
49 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
50 .\" Updated Fri Feb  7 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
51 .\" Updated Sun Feb 23 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
52 .\" Updated 2007-09-25, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
53 .\" Updated 2010-04-23, Akihiro MOTOKI, LDP v3.24
54 .\"
55 .\"WORD:        process group           ¥×¥í¥»¥¹¥°¥ë¡¼¥×
56 .\"WORD:        process group ID        ¥×¥í¥»¥¹¥°¥ë¡¼¥× ID
57 .\"WORD:        terminal                Ã¼Ëö
58 .\"WORD:        foreground              ¥Õ¥©¥¢¥°¥é¥ó¥É
59 .\"WORD:        block                   ÃæÃÇ(block)
60 .\"WORD:        job control             ¥¸¥ç¥Ö¡¦¥³¥ó¥È¥í¡¼¥ë
61 .\"
62 .TH SETPGID 2 2010-09-26 "Linux" "Linux Programmer's Manual"
63 .\"O .SH NAME
64 .SH Ì¾Á°
65 .\"O setpgid, getpgid, setpgrp, getpgrp \- set/get process group
66 setpgid, getpgid, setpgrp, getpgrp \- ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÎÀßÄê/¼èÆÀ¤ò¹Ô¤¦
67 .\"O .SH SYNOPSIS
68 .SH ½ñ¼°
69 .B #include <unistd.h>
70 .sp
71 .BI "int setpgid(pid_t " pid ", pid_t " pgid );
72 .br
73 .BI "pid_t getpgid(pid_t " pid );
74 .sp
75 .BR "pid_t getpgrp(void);" "                 /* POSIX.1 version */"
76 .br
77 .BI "pid_t getpgrp(pid_t " pid ");\ \ \ \ \ \ \ \ \ \ \ "
78 /* BSD version */
79 .sp
80 .BR "int setpgrp(void);" "                   /* System V version */"
81 .br
82 .BI "int setpgrp(pid_t " pid ", pid_t " pgid ");\ "
83 /* BSD version */
84 .sp
85 .in -4n
86 .\"O Feature Test Macro Requirements for glibc (see
87 .\"O .BR feature_test_macros (7)):
88 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
89 .RB ( feature_test_macros (7)
90 »²¾È):
91 .in
92 .sp
93 .ad l
94 .PD 0
95 .BR getpgid ():
96 .RS 4
97 _XOPEN_SOURCE\ >=\ 500 ||
98 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
99 .br
100 .\"O || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
101 || /* glibc 2.12 °Ê¹ß: */ _POSIX_C_SOURCE\ >=\ 200809L
102 .RE
103 .sp
104 .BR setpgrp "() (POSIX.1):"
105 .nf
106     _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
107     _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
108 .fi
109 .sp
110 .BR setpgrp "()\ (BSD),"
111 .BR getpgrp "()\ (BSD):"
112 .nf
113     _BSD_SOURCE &&
114         !\ (_POSIX_SOURCE || _POSIX_C_SOURCE || _XOPEN_SOURCE ||
115            _XOPEN_SOURCE_EXTENDED || _GNU_SOURCE || _SVID_SOURCE)
116 .fi
117 .PD
118 .ad
119 .\"O .SH DESCRIPTION
120 .SH ÀâÌÀ
121 .\"O All of these interfaces are available on Linux,
122 .\"O and are used for getting and setting the
123 .\"O process group ID (PGID) of a process.
124 .\"O The preferred, POSIX.1-specified ways of doing this are:
125 .\"O .BR getpgrp (void),
126 .\"O for retrieving the calling process's PGID; and
127 .\"O .BR setpgid (),
128 .\"O for setting a process's PGID.
129 ¤³¤ì¤é¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤¹¤Ù¤Æ¤¬ Linux ¤ÇÍøÍѲÄǽ¤Ç¡¢
130 ¤³¤ì¤é¤ò»È¤Ã¤Æ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID (PGID) ¤Î
131 ¼èÆÀ¤äÀßÄ꤬¤Ç¤­¤ë¡£
132 ¿ä¾©¤Î¡¢POSIX.1 ¤Çµ¬Äꤵ¤ì¤¿ÊýË¡¤Ç¤Ï¡¢
133 .BR getpgrp (void)
134 ¤Ç¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î PGID ¤ò¼èÆÀ¤·¡¢
135 .BR setpgid ()
136 ¤ÇÀßÄꤹ¤ë¡£
137
138 .\"O .BR setpgid ()
139 .\"O sets the PGID of the process specified by
140 .\"O .I pid
141 .\"O to
142 .\"O .IR pgid .
143 .\"O If
144 .\"O .I pid
145 .\"O is zero, then the process ID of the calling process is used.
146 .\"O If
147 .\"O .I pgid
148 .\"O is zero, then the PGID of the process specified by
149 .\"O .I pid
150 .\"O is made the same as its process ID.
151 .BR setpgid ()
152 ¤Ï
153 .I pid
154 ¤Ç»ØÄꤷ¤¿¥×¥í¥»¥¹¤Î PGID ¤Ë
155 .I pgid
156 ¤òÀßÄꤹ¤ë¡£
157 .I pid
158 ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤¬ pid ¤È¤·¤Æ»ÈÍѤµ¤ì¤ë¡£
159 .I pgid
160 ¤¬¥¼¥í¤Ê¤é¤Ð¡¢
161 .I pid
162 ¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤Î PGID ¤¬¤½¤Î¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤È
163 Ʊ¤¸¤ËÀßÄꤵ¤ì¤ë¡£
164 .\"O If
165 .\"O .BR setpgid ()
166 .\"O is used to move a process from one process
167 .\"O group to another (as is done by some shells when creating pipelines),
168 .\"O both process groups must be part of the same session (see
169 .\"O .BR setsid (2)
170 .\"O and
171 .\"O .BR credentials (7)).
172 .\"O In this case,
173 .\"O the \fIpgid\fP specifies an existing process group to be joined and the
174 .\"O session ID of that group must match the session ID of the joining process.
175 .BR setpgid ()
176 ¤ò¥×¥í¥»¥¹¤ò¤¢¤ë¥×¥í¥»¥¹¥°¥ë¡¼¥×¤«¤éÊ̤Υ°¥ë¡¼¥×¤Ø
177 °ÜÆ°¤¹¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¾ì¹ç¤Ï (°ìÉô¤Î¥·¥§¥ë¤Ï¥Ñ¥¤¥×¥é¥¤¥ó¤òÀ¸À®
178 ¤¹¤ë»þ¤Ë¤³¤ì¤ò¹Ô¤¦)¡¢Î¾Êý¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÏƱ¤¸¥»¥Ã¥·¥ç¥ó¤Î
179 °ìÉô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
180 .RB ( setsid (2)
181 ¤È
182 .BR credentials (7)
183 »²¾È)¡£¤³¤Î¾ì¹ç¤Ï \fIpgid\fP ¤Ï»²²Ã¤¹¤Ù¤­´û¸¤Î
184 ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ò»ØÄꤷ¡¢¤½¤Î¥»¥Ã¥·¥ç¥ó ID ¤Ï»²²Ã¤¹¤ë¥×¥í¥»¥¹¤Î
185 ¥»¥Ã¥·¥ç¥ó ID ¤Ë°ìÃפ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
186
187 .\"O The POSIX.1 version of
188 .\"O .BR getpgrp (),
189 .\"O which takes no arguments,
190 .\"O returns the PGID of the calling process.
191 POSIX.1 ¥Ð¡¼¥¸¥ç¥ó¤Î
192 .BR getpgrp ()
193 ¤Ï°ú¤­¿ô¤ò°ì¤Ä¤â¤È¤é¤º¡¢
194 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î PGID ¤òÊÖ¤¹¡£
195
196 .\"O .BR getpgid ()
197 .\"O returns the PGID of the process specified by
198 .\"O .IR pid .
199 .\"O If
200 .\"O .I pid
201 .\"O is zero, the process ID of the calling process is used.
202 .\"O (Retrieving the PGID of a process other than the caller is rarely
203 .\"O necessary, and the POSIX.1
204 .\"O .BR getpgrp ()
205 .\"O is preferred for that task.)
206 .BR getpgid ()
207 ¤Ï
208 .I pid
209 ¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤Î PGID ¤òÊÖ¤¹¡£
210 .I pid
211 ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤¬ pid ¤È¤·¤Æ»ÈÍѤµ¤ì¤ë¡£
212 (¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹°Ê³°¤Î¥×¥í¥»¥¹¤Î PGID ¤Î¼èÆÀ¤¬É¬Íפˤʤ뤳¤È¤Ï
213 ¤á¤Ã¤¿¤Ë¤Ê¤¯¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î PGID ¤ò¼èÆÀ¤¹¤ë¤Ë¤Ï
214 POSIX.1 ¥Ð¡¼¥¸¥ç¥ó¤Î
215 .BR getpgrp ()
216 ¤ò»È¤¦¤Î¤¬Ë¾¤Þ¤·¤¤¡£)
217
218 .\"O The System V-style
219 .\"O .BR setpgrp (),
220 .\"O which takes no arguments, is equivalent to
221 .\"O .IR "setpgid(0,\ 0)" .
222 System V ¥Ð¡¼¥¸¥ç¥ó¤Î
223 .BR setpgrp ()
224 ¤Ï°ú¤­¿ô¤ò°ì¤Ä¤â¤È¤é¤º¡¢
225 .I "setpgid(0,\ 0)"
226 ¤ÈÅù²Á¤Ç¤¢¤ë¡£
227
228 .\"O The BSD-specific
229 .\"O .BR setpgrp ()
230 .\"O call, which takes arguments
231 .\"O .I pid
232 .\"O and
233 .\"O .IR pgid ,
234 .\"O is equivalent to
235 .\"O .IR "setpgid(pid, pgid)" .
236 BSD »ÅÍͤÎ
237 .BR setpgrp ()
238 ¤Ï
239 .I pid
240 ¤È
241 .I pgid
242 ¤ò°ú¤­¿ô¤Ë¤È¤ê¡¢
243 .I "setpgid(pid, pgid)"
244 ¤ÈÅù²Á¤Ç¤¢¤ë¡£
245 .\" The true BSD setpgrp() system call differs in allowing the PGID
246 .\" to be set to arbitrary values, rather than being restricted to
247 .\" PGIDs in the same session.
248
249 .\"O The BSD-specific
250 .\"O .BR getpgrp ()
251 .\"O call, which takes a single
252 .\"O .I pid
253 .\"O argument, is equivalent to
254 .\"O .IR "getpgid(pid)" .
255 BSD »ÅÍͤÎ
256 .BR getpgrp ()
257 ¤Ï
258 .I pid
259 ¤À¤±¤ò°ú¤­¿ô¤Ë¤È¤ê¡¢
260 .I "getpgid(pid)"
261 ¤ÈÅù²Á¤Ç¤¢¤ë¡£
262 .\"O .SH "RETURN VALUE"
263 .SH ÊÖ¤êÃÍ
264 .\"O On success,
265 .\"O .BR setpgid ()
266 .\"O and
267 .\"O .BR setpgrp ()
268 .\"O return zero.
269 .\"O On error, \-1 is returned, and
270 .\"O .I errno
271 .\"O is set appropriately.
272 .BR setpgid ()
273 ¤È
274 .BR setpgrp ()
275 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¡¢¥¼¥í¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
276 .I errno
277 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
278
279 .\"O The POSIX.1
280 .\"O .BR getpgrp ()
281 .\"O always returns the PGID of the caller.
282 POSIX.1 ¥Ð¡¼¥¸¥ç¥ó¤Î
283 .BR getpgrp ()
284 ¤Ï¾ï¤Ë¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹¤Î PGID ¤òÊÖ¤¹¡£
285
286 .\"O .BR getpgid (),
287 .\"O and the BSD-specific
288 .\"O .BR getpgrp ()
289 .\"O return a process group on success.
290 .\"O On error, \-1 is returned, and
291 .\"O .I errno
292 .\"O is set appropriately.
293 .BR getpgid ()
294 ¤È BSD »ÅÍͤÎ
295 .BR getpgrp ()
296 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¥×¥í¥»¥¹¥°¥ë¡¼¥×¤òÊÖ¤¹¡£
297 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
298 .I errno
299 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
300 .\"O .SH ERRORS
301 .SH ¥¨¥é¡¼
302 .TP
303 .B EACCES
304 .\"O An attempt was made to change the process group ID
305 .\"O of one of the children of the calling process and the child had
306 .\"O already performed an
307 .\"O .BR execve (2)
308 .\"O .RB ( setpgid (),
309 .\"O .BR setpgrp ()).
310 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î»Ò¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¤¬¡¢
311 ¤¹¤Ç¤Ë¤½¤Î»Ò¥×¥í¥»¥¹¤Ï
312 .BR execve (2)
313 ¤ò¼Â¹Ô¤·¤Æ¤¤¤¿¡£
314 .RB ( setpgid (),
315 .BR setpgrp ())
316 .TP
317 .B EINVAL
318 .\"O .I pgid
319 .\"O is less than 0
320 .\"O .RB ( setpgid (),
321 .\"O .BR setpgrp ()).
322 .I pgid
323 ¤¬ 0 ¤è¤ê¾®¤µ¤¤¡£
324 .RB ( setpgid (),
325 .BR setpgrp ())
326 .TP
327 .B EPERM
328 .\"O An attempt was made to move a process into a process group in a
329 .\"O different session, or to change the process
330 .\"O group ID of one of the children of the calling process and the
331 .\"O child was in a different session, or to change the process group ID of
332 .\"O a session leader
333 .\"O .RB ( setpgid (),
334 .\"O .BR setpgrp ()).
335 ¥×¥í¥»¥¹¤ò°Û¤Ê¤ë¥»¥Ã¥·¥ç¥ó¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë°ÜÆ°¤µ¤»¤è¤¦¤È¤·¤¿¡£
336 ¤Þ¤¿¤Ï¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î»Ò¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤òÊѹ¹¤·¤è¤¦¤È
337 ¤·¤¿¤¬¡¢¤½¤Î»Ò¥×¥í¥»¥¹¤ÏÊ̤Υ»¥Ã¥·¥ç¥ó¤À¤Ã¤¿¡£
338 ¤Þ¤¿¤Ï¥»¥Ã¥·¥ç¥ó¥ê¡¼¥À¡¼¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¡£
339 .RB ( setpgid (),
340 .BR setpgrp ())
341 .TP
342 .B ESRCH
343 .\"O For
344 .\"O .BR getpgid ():
345 .BR getpgid ()
346 ¤Î¾ì¹ç:
347 .I pid
348 ¤¬¤É¤Î¥×¥í¥»¥¹¤Ë¤â°ìÃפ·¤Ê¤¤¡£
349 .\"O For
350 .\"O .BR setpgid ():
351 .\"O .I pid
352 .\"O is not the calling process and not a child of the calling process.
353 .BR setpgid ()
354 ¤Î¾ì¹ç:
355 .I pid
356 ¤¬¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Ç¤Ï¤Ê¤¯¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î»Ò¥×¥í¥»¥¹¤Ç¤â¤Ê¤¤¡£
357 .\"O .SH "CONFORMING TO"
358 .SH ½àµò
359 .\"O .BR setpgid ()
360 .\"O and the version of
361 .\"O .BR getpgrp ()
362 .\"O with no arguments
363 .\"O conform to POSIX.1-2001.
364 .BR setpgid ()
365 ¤È¡¢°ú¤­¿ô¤Ê¤·¥Ð¡¼¥¸¥ç¥ó¤Î
366 .BR getpgrp ()
367 ¤Ï POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
368
369 .\"O POSIX.1-2001 also specifies
370 .\"O .BR getpgid ()
371 .\"O and the version of
372 .\"O .BR setpgrp ()
373 .\"O that takes no arguments.
374 POSIX.1-2001 ¤Ï¡¢
375 .BR getpgid ()
376 ¤È¡¢°ú¤­¿ô¤Ê¤·¥Ð¡¼¥¸¥ç¥ó¤Î
377 .BR setpgrp ()
378 ¤âµ¬Äꤷ¤Æ¤¤¤ë¡£
379 .\"O (POSIX.1-2008 marks this
380 .\"O .BR setpgrp ()
381 .\"O specification as obsolete.)
382 POSIX.1-2008 ¤Ï¡¢¤³¤Î
383 .BR setpgrp ()
384 ¤Î»ÅÍͤòÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
385
386 .\"O The version of
387 .\"O .BR getpgrp ()
388 .\"O with one argument and the version of
389 .\"O .BR setpgrp ()
390 .\"O that takes two arguments derive from 4.2BSD,
391 .\"O and are not specified by POSIX.1.
392 °ú¤­¿ô 1 ¸Ä¥Ð¡¼¥¸¥ç¥ó¤Î
393 .BR getpgrp ()
394 ¤È°ú¤­¿ô 2 ¸Ä¥Ð¡¼¥¸¥ç¥ó¤Î
395 .BR setpgrp ()
396 ¤Ï 4.2BSD ¤ËͳÍ褷¡¢
397 POSIX.1 ¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
398 .\"O .SH NOTES
399 .SH Ãí°Õ
400 .\"O A child created via
401 .\"O .BR fork (2)
402 .\"O inherits its parent's process group ID.
403 .\"O The PGID is preserved across an
404 .\"O .BR execve (2).
405 .BR fork (2)
406 ¤ÇºîÀ®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ï¡¢¿Æ¥×¥í¥»¥¹¤Î PGID
407 ¤ò·Ñ¾µ¤¹¤ë¡£
408 .BR execve (2)
409 ¤ÎÁ°¸å¤Ç PGID ¤ÏÊݸ¤µ¤ì¤ë¡£
410
411 .\"O Each process group is a member of a session and each process is a
412 .\"O member of the session of which its process group is a member.
413 ³Æ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ï¥»¥Ã¥·¥ç¥ó¤Î¥á¥ó¥Ð¡¼¤Ç¤¢¤ê¡¢³Æ¥×¥í¥»¥¹¤Ï
414 ¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬½ê°¤·¤Æ¤¤¤ë¥»¥Ã¥·¥ç¥ó¤Î¥á¥ó¥Ð¡¼¤Ç¤¢¤ë¡£
415
416 .\"O A session can have a controlling terminal.
417 .\"O At any time, one (and only one) of the process groups
418 .\"O in the session can be the foreground process group
419 .\"O for the terminal;
420 .\"O the remaining process groups are in the background.
421 .\"O If a signal is generated from the terminal (e.g., typing the
422 .\"O interrupt key to generate
423 .\"O .BR SIGINT ),
424 .\"O that signal is sent to the foreground process group.
425 .\"O (See
426 .\"O .BR termios (3)
427 .\"O for a description of the characters that generate signals.)
428 ¥»¥Ã¥·¥ç¥ó¤ÏÀ©¸æüËö (controlling terminal) ¤ò»ý¤Ä¤³¤È¤¬¤Ç¤­¤ë¡£
429 ¤¤¤Ä¤Ç¤â¡¢¥»¥Ã¥·¥ç¥ó¤Ë½ê°¤¹¤ë¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î°ì¤Ä (¤À¤±) ¤¬
430 üËö¤Î¥Õ¥©¥¢¥°¥é¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¤Ê¤ë¤³¤È¤¬¤Ç¤­¡¢
431 »Ä¤ê¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ï¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ë¤Ê¤ë¡£
432 üËö¤«¤é¥·¥°¥Ê¥ë¤¬À¸À®¤µ¤ì¤¿¾ì¹ç (Î㤨¤Ð¡¢ÃæÃÇ¥­¡¼¤òᤤ¤Æ
433 .B SIGINT
434 ¤¬À¸À®¤µ¤ì¤ë¤Ê¤É)¡¢¤½¤Î¥·¥°¥Ê¥ë¤Ï¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×
435 ¤ËÁ÷¤é¤ì¤ë
436 (¥·¥°¥Ê¥ë¤òÀ¸À®¤¹¤ëʸ»ú¤ÎÀâÌÀ¤Ï
437 .BR termios (3)
438 ¤ò»²¾È)¡£
439 .\"O Only the foreground process group may
440 .\"O .BR read (2)
441 .\"O from the terminal;
442 .\"O if a background process group tries to
443 .\"O .BR read (2)
444 .\"O from the terminal, then the group is sent a
445 .\"O .B SIGTSTP
446 .\"O signal, which suspends it.
447 .\"O The
448 .\"O .BR tcgetpgrp (3)
449 .\"O and
450 .\"O .BR tcsetpgrp (3)
451 .\"O functions are used to get/set the foreground
452 .\"O process group of the controlling terminal.
453 ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤À¤±¤¬Ã¼Ëö¤«¤é¤Î
454 .BR read (2)
455 ¤¬¤Ç¤­¤ë¡£
456 ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬Ã¼Ëö¤«¤é¤Î
457 .BR read (2)
458 ¤ò¹Ô¤ª¤¦¤È¤·¤¿¾ì¹ç¡¢¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¤Ï¥·¥°¥Ê¥ë
459 .B SIGTSTP
460 ¤¬Á÷¤é¤ì¡¢¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ï°ì»þÄä»ß (suspend) ¤¹¤ë¡£
461 ´Ø¿ô
462 .BR tcgetpgrp (3)
463 ¤È
464 .BR tcsetpgrp (3)
465 ¤ò»È¤¦¤È¡¢À©¸æüËö¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ò
466 ¼èÆÀ/ÀßÄê¤Ç¤­¤ë¡£
467
468 .\"O The
469 .\"O .BR setpgid ()
470 .\"O and
471 .\"O .BR getpgrp ()
472 .\"O calls are used by programs such as
473 .\"O .BR bash (1)
474 .\"O to create process groups in order to implement shell job control.
475 .BR setpgid ()
476 ¤È
477 .BR getpgrp ()
478 ¤Ï¡¢
479 .BR bash (1)
480 ¤Î¤è¤¦¤Ê¥×¥í¥°¥é¥à¤Ç¡¢¥·¥§¥ë¤Î¥¸¥ç¥ÖÀ©¸æ (job control) ¤Î¼ÂÁõ¤Î¤¿¤á¤Î
481 ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤òºîÀ®¤¹¤ë¤Î¤Ë»È¤ï¤ì¤ë¡£
482
483 .\"O If a session has a controlling terminal, and the
484 .\"O .B CLOCAL
485 .\"O flag for that terminal is not set,
486 .\"O and a terminal hangup occurs, then the session leader is sent a
487 .\"O .BR SIGHUP .
488 .\"O If the session leader exits, then a
489 .\"O .B SIGHUP
490 .\"O signal will also be sent to each process in the foreground
491 .\"O process group of the controlling terminal.
492 ¥»¥Ã¥·¥ç¥ó¤¬À©¸æüËö¤ò»ý¤Ã¤Æ¤¤¤Æ¡¢¤½¤ÎüËö¤ËÂФ·¤Æ
493 .B CLOCAL
494 ¥Õ¥é¥°¤¬ÀßÄꤵ¤ì¤Æ¤ª¤é¤º¡¢Ã¼Ëö¤Î¥Ï¥ó¥°¥¢¥Ã¥×¤¬µ¯¤­¤¿¾ì¹ç¡¢
495 ¥»¥Ã¥·¥ç¥ó¡¦¥ê¡¼¥À¡¼¤Ë
496 .B SIGHUP
497 ¤¬Á÷¤é¤ì¤ë¡£
498 ¥»¥Ã¥·¥ç¥ó¡¦¥ê¡¼¥À¡¼¤¬½ªÎ»¤·¤¿¾ì¹ç¤Ë¤Ï¡¢¤½¤ÎÀ©¸æüËö¤Î
499 ¥Õ¥©¥¢¥°¥é¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë½ê°¤¹¤ë³Æ¥×¥í¥»¥¹¤Ë¤â
500 .B SIGHUP
501 ¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¤ë¡£
502
503 .\"O If the exit of the process causes a process group to become orphaned,
504 .\"O and if any member of the newly orphaned process group is stopped, then a
505 .\"O .B SIGHUP
506 .\"O signal followed by a
507 .\"O .B SIGCONT
508 .\"O signal will be sent to each process
509 .\"O in the newly orphaned process group.
510 ¥×¥í¥»¥¹¤Î½ªÎ»¤Ë¤è¤Ã¤Æ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬¸É»ù (orphaned) ¤Ë¤Ê¤Ã¤¿ºÝ¤Ë¡¢
511 ¤½¤Î¿·¤¿¤Ë¸É»ù¤Ë¤Ê¤Ã¤¿¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ËÄä»ß¤·¤Æ¤¤¤ë¥á¥ó¥Ð¡¼¤¬¤¤¤ì¤Ð¡¢
512 ¤½¤Î¸É»ù¤Ë¤Ê¤Ã¤¿¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë°¤¹Á´¤Æ¤Î¥×¥í¥»¥¹¤Ë
513 .B SIGHUP
514 ¥·¥°¥Ê¥ë¤Ë³¤±¤Æ
515 .B SIGCONT
516 ¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¤ë¡£
517 .\" exit.3 refers to the following text:
518 .\"O An orphaned process group is one in which the parent of
519 .\"O every member of process group is either itself also a member
520 .\"O of the process group or is a member of a process group
521 .\"O in a different session (see also
522 .\"O .BR credentials (7)).
523 ¸É»ù¤Ë¤Ê¤Ã¤¿ (orphaned) ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤È¤Ï¡¢
524 ¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÎÁ´¤Æ¤Î¥á¥ó¥Ð¡¼¤Ë¤Ä¤¤¤Æ¡¢¥á¥ó¥Ð¡¼¤Î¿Æ¥×¥í¥»¥¹¤¬¡¢
525 ¿Æ¥×¥í¥»¥¹¼«¿È¤â¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î¥á¥ó¥Ð¡¼¤«¡¢
526 Ê̤Υ»¥Ã¥·¥ç¥ó¤Ë°¤¹¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î¥á¥ó¥Ð¡¼¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¤è¤¦¤Ê¡¢
527 ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î¤³¤È¤Ç¤¢¤ë¡£
528 .\"O .SH "SEE ALSO"
529 .SH ´ØÏ¢¹àÌÜ
530 .BR getuid (2),
531 .BR setsid (2),
532 .BR tcgetpgrp (3),
533 .BR tcsetpgrp (3),
534 .BR termios (3),
535 .BR credentials (7)