2 .\" Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SETPGID 2 "Dec 28, 1996"
8 setpgid \- set process group ID
12 #include <sys/types.h>
15 \fBint\fR \fBsetpgid\fR(\fBpid_t\fR \fIpid\fR, \fBpid_t\fR \fIpgid\fR);
21 The \fBsetpgid()\fR function sets the process group \fBID\fR of the process
22 with \fBID\fR \fIpid\fR to \fIpgid\fR.
25 If \fIpgid\fR is equal to \fIpid\fR, the process becomes a process group
26 leader. See \fBIntro\fR(2) for more information on session leaders and process
30 If \fIpgid\fR is not equal to \fIpid\fR, the process becomes a member of an
31 existing process group.
34 If \fIpid\fR is equal to 0, the process \fBID\fR of the calling process is
35 used. If \fIpgid\fR is equal to 0, the process specified by \fIpid\fR becomes a
40 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
41 returned and \fBerrno\fR is set to indicate the error.
45 The \fBsetpgid()\fR function will fail if:
52 The \fIpid\fR argument matches the process \fBID\fR of a child process of the
53 calling process and the child process has successfully executed one of the
54 \fIexec\fR family of functions (see \fBexec\fR(2)).
63 The \fIpgid\fR argument is less than (\fBpid_t) 0\fR or greater than or equal
64 to \fBPID_MAX\fR, or the calling process has a controlling terminal that does
65 not support job control.
74 The process indicated by the \fIpid\fR argument is a session leader.
83 The \fIpid\fR argument matches the process \fBID\fR of a child process of the
84 calling process and the child process is not in the same session as the calling
94 The \fIpgid\fR argument does not match the process \fBID\fR of the process
95 indicated by the \fIpid\fR argument, and there is no process with a process
96 group \fBID\fR that matches \fIpgid\fR in the same session as the calling
106 The \fIpid\fR argument does not match the process \fBID\fR of the calling
107 process or of a child process of the calling process.
113 See \fBattributes\fR(5) for descriptions of the following attributes:
121 ATTRIBUTE TYPE ATTRIBUTE VALUE
123 Interface Stability Standard
125 MT-Level Async-Signal-Safe
131 \fBIntro\fR(2), \fBexec\fR(2), \fBexit\fR(2), \fBfork\fR(2), \fBgetpid\fR(2),
132 \fBgetsid\fR(2), \fBattributes\fR(5), \fBstandards\fR(5)