xref: /csrg-svn/lib/libc/gen/tcsetpgrp.3 (revision 52295)
151201Smarc.\" Copyright (c) 1991 The Regents of the University of California.
251201Smarc.\" All rights reserved.
351201Smarc.\"
451201Smarc.\" %sccs.include.redist.roff%
551201Smarc.\"
6*52295Sbostic.\"	@(#)tcsetpgrp.3	5.2 (Berkeley) 02/03/92
751201Smarc.\"
8*52295Sbostic.Dd ""
952281Smarc.Dt TCSETPGRP
1052281Smarc.Os
1152281Smarc.Sh NAME
1252281Smarc.Nm tcsetpgrp
13*52295Sbostic.Nd set foreground process group ID
14*52295Sbostic.Sh SYNOPSIS
15*52295Sbostic.Fd #include <sys/types.h>
16*52295Sbostic.Ft int
17*52295Sbostic.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
18*52295Sbostic.Sh DESCRIPTION
19*52295SbosticIf the process has a controlling terminal, the
20*52295Sbostic.Nm tcsetpgrp
21*52295Sbosticfunction sets the foreground process group ID associated with the
22*52295Sbosticterminal device to
23*52295Sbostic.Fa pgrp_id .
24*52295SbosticThe terminal device associated with
25*52295Sbostic.Fa fd
26*52295Sbosticmust be the controlling terminal of the calling process and the
27*52295Sbosticcontrolling terminal must be currently associated with the session
28*52295Sbosticof the calling process.
29*52295SbosticThe value of
30*52295Sbostic.Fa pgrp_id
31*52295Sbosticmust be the same as the process group ID of a process in the same
32*52295Sbosticsession as the calling process.
33*52295Sbostic.Pp
34*52295SbosticUpon successful completion,
35*52295Sbostic.Nm tcsetpgrp
36*52295Sbosticreturns a value of zero.
37*52295Sbostic.Sh ERRORS
38*52295SbosticIf an error occurs,
39*52295Sbostic.Nm tcgetpgrp
40*52295Sbosticreturns -1 and the global variable
41*52295Sbostic.Va errno
42*52295Sbosticis set to indicate the error, as follows:
43*52295Sbostic.Bl -tag -width Er
44*52295Sbostic.It Bq Er EBADF
45*52295SbosticThe
46*52295Sbostic.Fa fd
47*52295Sbosticargument is not a valid file descriptor.
48*52295Sbostic.It Bq Er EINVAL
49*52295SbosticAn invalid value of
50*52295Sbostic.Fa pgrp_id
51*52295Sbosticwas specified.
52*52295Sbostic.It Bq Er ENOTTY
53*52295SbosticThe calling process does not have a controlling terminal, or the file
54*52295Sbosticrepresented by
55*52295Sbostic.Fa fd
56*52295Sbosticis not the controlling terminal, or the controlling terminal is no
57*52295Sbosticlonger associated with the session of the calling process.
58*52295Sbostic.It Bq Er EPERM
59*52295SbosticThe
60*52295Sbostic.Fa pgrp_id
61*52295Sbosticargument does not match the process group ID of a process in the same
62*52295Sbosticsession as the calling process.
63*52295Sbostic.El
64*52295Sbostic.Sh SEE ALSO
65*52295Sbostic.Xr setpgid 3 ,
66*52295Sbostic.Xr setsid 2 ,
67*52295Sbostic.Xr tcgetpgrp 3
68*52295Sbostic.Sh STANDARDS
69*52295SbosticThe
70*52295Sbostic.Nm tcsetpgprp
71*52295Sbosticfunction is expected to be compliant with the
72*52295Sbostic.St -p1003.1-88
73*52295Sbosticspecification.
74