nightly: remove unused BINARCHIVE
[unleashed.git] / share / man / man2 / setpgid.2
bloba97e7691b18ad7fdd06118567cd88829313b0091
1 '\" te
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"
7 .SH NAME
8 setpgid \- set process group ID
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/types.h>
13 #include <unistd.h>
15 \fBint\fR \fBsetpgid\fR(\fBpid_t\fR \fIpid\fR, \fBpid_t\fR \fIpgid\fR);
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
21 The \fBsetpgid()\fR function sets the process group \fBID\fR of the process
22 with \fBID\fR \fIpid\fR to \fIpgid\fR.
23 .sp
24 .LP
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
27 group leaders.
28 .sp
29 .LP
30 If \fIpgid\fR is not equal to \fIpid\fR, the process becomes a member of an
31 existing process group.
32 .sp
33 .LP
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
36 process group leader.
37 .SH RETURN VALUES
38 .sp
39 .LP
40 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
41 returned and \fBerrno\fR is set to indicate the error.
42 .SH ERRORS
43 .sp
44 .LP
45 The \fBsetpgid()\fR function will fail if:
46 .sp
47 .ne 2
48 .na
49 \fB\fBEACCES\fR\fR
50 .ad
51 .RS 10n
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)).
55 .RE
57 .sp
58 .ne 2
59 .na
60 \fB\fBEINVAL\fR\fR
61 .ad
62 .RS 10n
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.
66 .RE
68 .sp
69 .ne 2
70 .na
71 \fB\fBEPERM\fR\fR
72 .ad
73 .RS 10n
74 The process indicated by the \fIpid\fR argument is a session leader.
75 .RE
77 .sp
78 .ne 2
79 .na
80 \fB\fBEPERM\fR\fR
81 .ad
82 .RS 10n
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
85 process.
86 .RE
88 .sp
89 .ne 2
90 .na
91 \fB\fBEPERM\fR\fR
92 .ad
93 .RS 10n
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
97 process.
98 .RE
101 .ne 2
103 \fB\fBESRCH\fR\fR
105 .RS 10n
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.
110 .SH ATTRIBUTES
113 See \fBattributes\fR(5) for descriptions of the following attributes:
118 box;
119 c | c
120 l | l .
121 ATTRIBUTE TYPE  ATTRIBUTE VALUE
123 Interface Stability     Standard
125 MT-Level        Async-Signal-Safe
128 .SH SEE ALSO
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)