1
0
Files
irix-657m-src/eoe/man/man2/setpgid.2
2022-09-29 17:59:04 +03:00

98 lines
2.4 KiB
Groff

'\"macro stdmacro
.if n .pH g2.setpgid @(#)setpgid 41.3 of 4/11/91
.\" Copyright 1991 UNIX System Laboratories, Inc.
.\" Copyright 1989, 1990 AT&T
.nr X
.if \nX=0 .ds x} setpgid 2 "" "\&"
.if \nX=1 .ds x} setpgid 2 ""
.if \nX=2 .ds x} setpgid 2 "" "\&"
.if \nX=3 .ds x} setpgid "" "" "\&"
.TH \*(x}
.SH NAME
\f4setpgid\f1 \- set process group ID
.SH SYNOPSIS
\f4#include <sys/types.h>
.br
\f4#include <unistd.h>
.PP
\f4int setpgid(pid_t pid, pid_t pgid);\f1
.SH DESCRIPTION
\f4setpgid\fP sets the process group
.SM ID
of the process with
.SM ID
\f2pid\f1 to \f2pgid\f1.
If \f2pgid\f1 is equal to \f2pid\f1, the
process becomes a process group leader. If \f2pgid\f1 is not equal to \f2pid\f1,
the process becomes a member of an existing process group.
.PP
If \f2pid\f1 is equal to 0, the process
.SM ID
of the calling process is used.
If \f2pgid\f1 is equal to 0, the process specified by \f2pid\f1 becomes
a process group leader.
.PP
\f4setpgid\fP fails and returns an error if one or more of the following
are true:
.TP 15
\f4EACCES\fP
.I pid
matches the process
.SM ID
of a child process of the
calling process and the child process has successfully executed an \%\f4exec\fP(2)
function.
.\".TP 15
.\"\f4EACCES\fP
.\"The Mandatory Access Control (MAC) level of the calling process does
.\"not equal the MAC level of \f2pid\fP.
.TP
\f4EINVAL\fP
.I pgid
is not a valid process group id value.
.TP
\f4EINVAL\fP
The calling process has a controlling terminal that does not support job control.
.TP
\f4EPERM\fP
The process indicated by the
.I pid
argument is a session leader.
.TP 15
\f4EPERM\fP
.I pid
matches the process
.SM ID
of a child process of the
calling process and the child process is not in the same session as the
calling process.
.TP
\f4EPERM\fP
.I pgid
does not match the process
.SM ID
of the process
indicated by the
.I pid
argument and there is no process with a process group
.SM ID
that matches
.I pgid
in the same session as the calling process.
.TP
\f4ESRCH\fP
.I pid
does not match the process
.SM ID
of the calling
process or of a child process of the calling process.
.SH SEE ALSO
\f4exec\fP(2), \f4exit\fP(2), \f4fork\fP(2),
\f4getpid\fP(2), \f4getpgid\fP(2), \f4setsid\fP(2),
\f4tcsetpgrp\fP(3T).
.SH DIAGNOSTICS
Upon successful completion, \f4setpgid\fP returns a value of 0. Otherwise, a
value of \-1 is returned and \f4errno\fP is set to indicate the error.
.\" @(#)setpgid.2 6.2 of 9/6/83
.Ee