1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
|
.\" Copyright (c) 1983, 1991 Regents of the University of California.
.\" and Copyright (C) 2007, Michael Kerrisk <mtk.manpages@gmail.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)getpgrp.2 6.4 (Berkeley) 3/10/91
.\"
.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
.\" Modified 1995-04-15 by Michael Chastain <mec@shell.portal.com>:
.\" Added 'getpgid'.
.\" Modified 1996-07-21 by Andries Brouwer <aeb@cwi.nl>
.\" Modified 1996-11-06 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 1999-09-02 by Michael Haardt <michael@moria.de>
.\" Modified 2002-01-18 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Modified 2003-01-20 by Andries Brouwer <aeb@cwi.nl>
.\" 2007-07-25, mtk, fairly substantial rewrites and rearrangements
.\" of text.
.\"
.\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sun Nov 21 18:54:10 JST 1999
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated Fri Feb 7 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
.\" Updated Sun Feb 23 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2007-09-25, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
.\"
.\"WORD: process group ץ롼
.\"WORD: process group ID ץ롼ID
.\"WORD: terminal ü
.\"WORD: foreground ե
.\"WORD: block (block)
.\"WORD: job control ֡ȥ
.\"
.TH SETPGID 2 2007-07-26 "Linux" "Linux Programmer's Manual"
.SH ̾
setpgid, getpgid, setpgrp, getpgrp \- ץ롼פ/Ԥ
.SH
.B #include <unistd.h>
.sp
.BI "int setpgid(pid_t " pid ", pid_t " pgid );
.br
.BI "pid_t getpgid(pid_t " pid );
.sp
.BR "pid_t getpgrp(void);" " /* POSIX.1 version */"
.br
.BI "pid_t getpgrp(psid_t " pid ");\ \ \ \ \ \ \ \ \ "
/* BSD version */
.sp
.BR "int setpgrp(void);" " /* System V version */"
.br
.BI "int setpgrp(pid_t " pid ", pid_t " pgid );
/* BSD version */
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.ad l
.BR getpgid ():
_XOPEN_SOURCE\ >=\ 500
.br
.BR setpgrp ()
(POSIX.1): _SVID_SOURCE || _XOPEN_SOURCE >= 500
.sp
.BR setpgrp "()\ (BSD),"
.BR getpgrp "()\ (BSD):"
_BSD_SOURCE && !\ (_POSIX_SOURCE || _POSIX_C_SOURCE ||
_XOPEN_SOURCE || _XOPEN_SOURCE_EXTENDED || _GNU_SOURCE || _SVID_SOURCE)
.ad b
.SH
Υե٤Ƥ Linux Ѳǽǡ
ȤäƥץΥץ롼 ID (PGID)
꤬Ǥ롣
侩ΡPOSIX.1 ǵꤵ줿ˡǤϡ
.BR getpgrp (void)
ǸƤӽФץ PGID
.BR setpgid ()
ꤹ롣
.BR setpgid ()
.I pid
ǻꤷץ PGID
.I pgid
ꤹ롣
.I pid
ʤСƤӽФץΥץ ID pid ȤƻѤ롣
.I pgid
ʤС
.I pid
ǻꤵ줿ץΥץID PGID ȤƻѤ롣
.BR setpgid ()
ץץ롼פ̤Υ롼פ
ư뤿˻Ѥ (Υϥѥץ饤
ˤԤ)ξΥץ롼פƱå
ǤʤФʤʤ
.RB ( setsid (2)
.BR credentials (7)
)ξ \fIpgid\fP ϻä٤¸
ץ롼פꤷΥå ID ϻäץ
å ID ˰פʤФʤʤ
POSIX.1 С
.BR getpgrp ()
ϰĤȤ餺
ƤӽФץ PGID ֤
.BR getpgid ()
.I pid
ǻꤵ줿ץ PGID ֤
.I pid
ʤСƤӽФץΥץ ID pid ȤƻѤ롣
(ƤӽФץʳΥץ PGID μɬפˤʤ뤳Ȥ
äˤʤƤӽФץ PGID ˤ
POSIX.1 С
.BR getpgrp ()
ȤΤ˾ޤ)
System V С
.BR setpgrp ()
ϰĤȤ餺
.I "setpgid(0,\ 0)"
Ǥ롣
BSD ͤ
.BR setpgrp ()
.I pid
.I pgid
ˤȤꡢ
.I "setpgid(pid, pgid)"
Ǥ롣
.\" The true BSD setpgrp() system call differs in allowing the PGID
.\" to be set to arbitrary values, rather than being restricted to
.\" PGIDs in the same session.
BSD ͤ
.BR getpgrp ()
.I pid
ˤȤꡢ
.I "getpgid(pid)"
Ǥ롣
.SH ֤
.BR setpgid ()
.BR setpgrp ()
硢֤顼ξ \-1 ֤
.I errno
Ŭڤꤵ롣
POSIX.1 С
.BR getpgrp ()
Ͼ˸ƤӽФץ PGID ֤
.BR getpgid ()
BSD ͤ
.BR getpgrp ()
ץ롼פ֤
顼ξ \-1 ֤
.I errno
Ŭڤꤵ롣
.SH 顼
.TP
.B EACCES
ƤӽФץλҥץΥץ롼 ID ѹ褦Ȥ
Ǥˤλҥץ
.BR execve (2)
¹ԤƤ
.RB ( setpgid (),
.BR setpgrp ())
.TP
.B EINVAL
.I pgid
0 꾮
.RB ( setpgid (),
.BR setpgrp ())
.TP
.B EPERM
ץۤʤ륻åΥץ롼פ˰ư褦Ȥ
ޤϸƤӽФץλҥץΥץ롼 ID ѹ褦
λҥץ̤Υåä
ޤϥåΥץ롼 ID ѹ褦Ȥ
.RB ( setpgid (),
.BR setpgrp ())
.TP
.B ESRCH
.BR getpgid ()
ξ:
.I pid
ɤΥץˤפʤ
.BR setpgid ()
ξ:
.I pid
ƤӽФΥץǤϤʤƤӽФΥץλҥץǤʤ
.SH
.BR setpgid ()
ȡʤС
.BR getpgrp ()
POSIX.1-2001 ˽Ƥ롣
POSIX.1-2001 ϡ
.BR getpgid ()
ȡʤС
.BR setpgrp ()
ꤷƤ롣
1 ĥС
.BR getpgrp ()
Ȱ 2 ĥС
.BR setpgrp ()
4.2BSD ͳ褷
POSIX.1 ǤϵꤵƤʤ
.SH
.BR fork (2)
Ǻ줿ҥץϡƥץ PGID
Ѿ롣
.BR execve (2)
PGID ¸롣
ƥץ롼פϥåΥСǤꡢƥץ
Υץ롼פ°Ƥ륻åΥСǤ롣
åü (controlling terminal) ĤȤǤ롣
ĤǤ⡢å˽°ץ롼פΰ ()
üΥեɤΥץ롼פˤʤ뤳ȤǤ
ĤΥץ롼פϥХå饦ɤˤʤ롣
ü饷ʥ뤬줿 (㤨Сǥá
.B SIGINT
ʤ)Υʥϥե饦ɤΥץ롼
(ʥʸ
.BR termios (3)
)
ե饦ɤΥץ롼פü
.BR read (2)
Ǥ롣
Хå饦ɤΥץ롼פü
.BR read (2)
ԤȤ硢Υץ롼פˤϥʥ
.B SIGTSTP
졢Υץ롼פϰ (suspend) 롣
ؿ
.BR tcgetpgrp (3)
.BR tcsetpgrp (3)
ȤȡüΥե饦ɤΥץ롼פ
/Ǥ롣
.BR setpgid ()
.BR getpgrp ()
ϡ
.BR bash (1)
Τ褦ʥץǡΥ (job control) μΤ
ץ롼פΤ˻Ȥ롣
åüäƤơüФ
.B CLOCAL
ե饰ꤵƤ餺üΥϥåפ硢
å
.B SIGHUP
롣
åλˤϡü
եɤΥץ롼פ˽°ƥץˤ
.B SIGHUP
ʥ뤬롣
ץνλˤäƥץ롼פɻ (orphaned) ˤʤäݤˡ
ο˸ɻˤʤäץ롼פߤƤСС
θɻˤʤäץ롼פƤΥץ
.B SIGHUP
ʥ³
.B SIGCONT
ʥ뤬롣
.SH Ϣ
.BR getuid (2),
.BR setsid (2),
.BR tcgetpgrp (3),
.BR tcsetpgrp (3),
.BR termios (3),
.BR credentials (7)
|