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.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
33 .\" @(#)getpgrp.2 6.4 (Berkeley) 3/10/91
35 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
36 .\" Modified 1995-04-15 by Michael Chastain <mec@shell.portal.com>:
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
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
55 .\"WORD: process group ¥×¥í¥»¥¹¥°¥ë¡¼¥×
56 .\"WORD: process group ID ¥×¥í¥»¥¹¥°¥ë¡¼¥× ID
57 .\"WORD: terminal üËö
58 .\"WORD: foreground ¥Õ¥©¥¢¥°¥é¥ó¥É
59 .\"WORD: block ̾̂(block)
60 .\"WORD: job control ¥¸¥ç¥Ö¡¦¥³¥ó¥È¥í¡¼¥ë
62 .TH SETPGID 2 2009-09-20 "Linux" "Linux Programmer's Manual"
64 setpgid, getpgid, setpgrp, getpgrp \- ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÎÀßÄê/¼èÆÀ¤ò¹Ô¤¦
66 .B #include <unistd.h>
68 .BI "int setpgid(pid_t " pid ", pid_t " pgid );
70 .BI "pid_t getpgid(pid_t " pid );
72 .BR "pid_t getpgrp(void);" " /* POSIX.1 version */"
74 .BI "pid_t getpgrp(pid_t " pid ");\ \ \ \ \ \ \ \ \ "
77 .BR "int setpgrp(void);" " /* System V version */"
79 .BI "int setpgrp(pid_t " pid ", pid_t " pgid );
83 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
84 .RB ( feature_test_macros (7)
90 _XOPEN_SOURCE\ >=\ 500
93 (POSIX.1): _SVID_SOURCE || _XOPEN_SOURCE >= 500
95 .BR setpgrp "()\ (BSD),"
96 .BR getpgrp "()\ (BSD):"
97 _BSD_SOURCE && !\ (_POSIX_SOURCE || _POSIX_C_SOURCE ||
98 _XOPEN_SOURCE || _XOPEN_SOURCE_EXTENDED || _GNU_SOURCE || _SVID_SOURCE)
101 ¤³¤ì¤é¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤¹¤Ù¤Æ¤¬ Linux ¤ÇÍøÍѲÄǽ¤Ç¡¢
102 ¤³¤ì¤é¤ò»È¤Ã¤Æ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID (PGID) ¤Î
104 ¿ä¾©¤Î¡¢POSIX.1 ¤Çµ¬Äꤵ¤ì¤¿ÊýË¡¤Ç¤Ï¡¢
106 ¤Ç¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î PGID ¤ò¼èÆÀ¤·¡¢
113 ¤Ç»ØÄꤷ¤¿¥×¥í¥»¥¹¤Î PGID ¤Ë
117 ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤¬ pid ¤È¤·¤Æ»ÈÍѤµ¤ì¤ë¡£
121 ¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤Î PGID ¤¬¤½¤Î¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤È
124 ¤ò¥×¥í¥»¥¹¤ò¤¢¤ë¥×¥í¥»¥¹¥°¥ë¡¼¥×¤«¤éÊ̤Υ°¥ë¡¼¥×¤Ø
125 °ÜÆ°¤¹¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¾ì¹ç¤Ï (°ìÉô¤Î¥·¥§¥ë¤Ï¥Ñ¥¤¥×¥é¥¤¥ó¤òÀ¸À®
126 ¤¹¤ë»þ¤Ë¤³¤ì¤ò¹Ô¤¦)¡¢Î¾Êý¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÏƱ¤¸¥»¥Ã¥·¥ç¥ó¤Î
127 °ìÉô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
131 »²¾È)¡£¤³¤Î¾ì¹ç¤Ï \fIpgid\fP ¤Ï»²²Ã¤¹¤Ù¤´û¸¤Î
132 ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ò»ØÄꤷ¡¢¤½¤Î¥»¥Ã¥·¥ç¥ó ID ¤Ï»²²Ã¤¹¤ë¥×¥í¥»¥¹¤Î
133 ¥»¥Ã¥·¥ç¥ó ID ¤Ë°ìÃפ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
137 ¤Ï°ú¤¿ô¤ò°ì¤Ä¤â¤È¤é¤º¡¢
138 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î PGID ¤òÊÖ¤¹¡£
143 ¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤Î PGID ¤òÊÖ¤¹¡£
145 ¤¬¥¼¥í¤Ê¤é¤Ð¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤¬ pid ¤È¤·¤Æ»ÈÍѤµ¤ì¤ë¡£
146 (¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹°Ê³°¤Î¥×¥í¥»¥¹¤Î PGID ¤Î¼èÆÀ¤¬É¬Íפˤʤ뤳¤È¤Ï
147 ¤á¤Ã¤¿¤Ë¤Ê¤¯¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î PGID ¤ò¼èÆÀ¤¹¤ë¤Ë¤Ï
150 ¤ò»È¤¦¤Î¤¬Ë¾¤Þ¤·¤¤¡£)
152 System V ¥Ð¡¼¥¸¥ç¥ó¤Î
154 ¤Ï°ú¤¿ô¤ò°ì¤Ä¤â¤È¤é¤º¡¢
165 .I "setpgid(pid, pgid)"
167 .\" The true BSD setpgrp() system call differs in allowing the PGID
168 .\" to be set to arbitrary values, rather than being restricted to
169 .\" PGIDs in the same session.
182 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¡¢¥¼¥í¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
188 ¤Ï¾ï¤Ë¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹¤Î PGID ¤òÊÖ¤¹¡£
193 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¥×¥í¥»¥¹¥°¥ë¡¼¥×¤òÊÖ¤¹¡£
194 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
200 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î»Ò¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¤¬¡¢
201 ¤¹¤Ç¤Ë¤½¤Î»Ò¥×¥í¥»¥¹¤Ï
214 ¥×¥í¥»¥¹¤ò°Û¤Ê¤ë¥»¥Ã¥·¥ç¥ó¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë°ÜÆ°¤µ¤»¤è¤¦¤È¤·¤¿¡£
215 ¤Þ¤¿¤Ï¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î»Ò¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤òÊѹ¹¤·¤è¤¦¤È
216 ¤·¤¿¤¬¡¢¤½¤Î»Ò¥×¥í¥»¥¹¤ÏÊ̤Υ»¥Ã¥·¥ç¥ó¤À¤Ã¤¿¡£
217 ¤Þ¤¿¤Ï¥»¥Ã¥·¥ç¥ó¥ê¡¼¥À¡¼¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¡£
225 ¤¬¤É¤Î¥×¥í¥»¥¹¤Ë¤â°ìÃפ·¤Ê¤¤¡£
229 ¤¬¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Ç¤Ï¤Ê¤¯¡¢¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î»Ò¥×¥í¥»¥¹¤Ç¤â¤Ê¤¤¡£
232 ¤È¡¢°ú¤¿ô¤Ê¤·¥Ð¡¼¥¸¥ç¥ó¤Î
234 ¤Ï POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
238 ¤È¡¢°ú¤¿ô¤Ê¤·¥Ð¡¼¥¸¥ç¥ó¤Î
241 POSIX.1-2008 ¤Ï¡¢¤³¤Î
243 ¤Î»ÅÍͤòÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
245 °ú¤¿ô 1 ¸Ä¥Ð¡¼¥¸¥ç¥ó¤Î
247 ¤È°ú¤¿ô 2 ¸Ä¥Ð¡¼¥¸¥ç¥ó¤Î
250 POSIX.1 ¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
253 ¤ÇºîÀ®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ï¡¢¿Æ¥×¥í¥»¥¹¤Î PGID
256 ¤ÎÁ°¸å¤Ç PGID ¤ÏÊݸ¤µ¤ì¤ë¡£
258 ³Æ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ï¥»¥Ã¥·¥ç¥ó¤Î¥á¥ó¥Ð¡¼¤Ç¤¢¤ê¡¢³Æ¥×¥í¥»¥¹¤Ï
259 ¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬½ê°¤·¤Æ¤¤¤ë¥»¥Ã¥·¥ç¥ó¤Î¥á¥ó¥Ð¡¼¤Ç¤¢¤ë¡£
261 ¥»¥Ã¥·¥ç¥ó¤ÏÀ©¸æüËö (controlling terminal) ¤ò»ý¤Ä¤³¤È¤¬¤Ç¤¤ë¡£
262 ¤¤¤Ä¤Ç¤â¡¢¥»¥Ã¥·¥ç¥ó¤Ë½ê°¤¹¤ë¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î°ì¤Ä (¤À¤±) ¤¬
263 üËö¤Î¥Õ¥©¥¢¥°¥é¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¤Ê¤ë¤³¤È¤¬¤Ç¤¡¢
264 »Ä¤ê¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ï¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ë¤Ê¤ë¡£
265 üËö¤«¤é¥·¥°¥Ê¥ë¤¬À¸À®¤µ¤ì¤¿¾ì¹ç (Î㤨¤Ð¡¢ÃæÃÇ¥¡¼¤òᤤ¤Æ
267 ¤¬À¸À®¤µ¤ì¤ë¤Ê¤É)¡¢¤½¤Î¥·¥°¥Ê¥ë¤Ï¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×
269 (¥·¥°¥Ê¥ë¤òÀ¸À®¤¹¤ëʸ»ú¤ÎÀâÌÀ¤Ï
272 ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤À¤±¤¬Ã¼Ëö¤«¤é¤Î
275 ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬Ã¼Ëö¤«¤é¤Î
277 ¤ò¹Ô¤ª¤¦¤È¤·¤¿¾ì¹ç¡¢¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¤Ï¥·¥°¥Ê¥ë
279 ¤¬Á÷¤é¤ì¡¢¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ï°ì»þÄä»ß (suspend) ¤¹¤ë¡£
284 ¤ò»È¤¦¤È¡¢À©¸æüËö¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ò
292 ¤Î¤è¤¦¤Ê¥×¥í¥°¥é¥à¤Ç¡¢¥·¥§¥ë¤Î¥¸¥ç¥ÖÀ©¸æ (job control) ¤Î¼ÂÁõ¤Î¤¿¤á¤Î
293 ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤òºîÀ®¤¹¤ë¤Î¤Ë»È¤ï¤ì¤ë¡£
295 ¥»¥Ã¥·¥ç¥ó¤¬À©¸æüËö¤ò»ý¤Ã¤Æ¤¤¤Æ¡¢¤½¤ÎüËö¤ËÂФ·¤Æ
297 ¥Õ¥é¥°¤¬ÀßÄꤵ¤ì¤Æ¤ª¤é¤º¡¢Ã¼Ëö¤Î¥Ï¥ó¥°¥¢¥Ã¥×¤¬µ¯¤¤¿¾ì¹ç¡¢
298 ¥»¥Ã¥·¥ç¥ó¡¦¥ê¡¼¥À¡¼¤Ë
301 ¥»¥Ã¥·¥ç¥ó¡¦¥ê¡¼¥À¡¼¤¬½ªÎ»¤·¤¿¾ì¹ç¤Ë¤Ï¡¢¤½¤ÎÀ©¸æüËö¤Î
302 ¥Õ¥©¥¢¥°¥é¥ó¥É¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë½ê°¤¹¤ë³Æ¥×¥í¥»¥¹¤Ë¤â
306 ¥×¥í¥»¥¹¤Î½ªÎ»¤Ë¤è¤Ã¤Æ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬¸É»ù (orphaned) ¤Ë¤Ê¤Ã¤¿ºÝ¤Ë¡¢
307 ¤½¤Î¿·¤¿¤Ë¸É»ù¤Ë¤Ê¤Ã¤¿¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ËÄä»ß¤·¤Æ¤¤¤ë¥á¥ó¥Ð¡¼¤¬¤¤¤ì¤Ð¡¢
308 ¤½¤Î¸É»ù¤Ë¤Ê¤Ã¤¿¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë°¤¹Á´¤Æ¤Î¥×¥í¥»¥¹¤Ë
313 .\" exit.3 refers to the following text:
314 ¸É»ù¤Ë¤Ê¤Ã¤¿ (orphaned) ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤È¤Ï¡¢
315 ¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÎÁ´¤Æ¤Î¥á¥ó¥Ð¡¼¤Ë¤Ä¤¤¤Æ¡¢¥á¥ó¥Ð¡¼¤Î¿Æ¥×¥í¥»¥¹¤¬¡¢
316 ¿Æ¥×¥í¥»¥¹¼«¿È¤â¤½¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î¥á¥ó¥Ð¡¼¤«¡¢
317 Ê̤Υ»¥Ã¥·¥ç¥ó¤Ë°¤¹¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î¥á¥ó¥Ð¡¼¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¤è¤¦¤Ê¡¢
318 ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î¤³¤È¤Ç¤¢¤ë¡£