xref: /csrg-svn/lib/libc/gen/tcsetpgrp.3 (revision 61111)
1*61111Sbostic.\" Copyright (c) 1991, 1993
2*61111Sbostic.\"	The Regents of the University of California.  All rights reserved.
351201Smarc.\"
451201Smarc.\" %sccs.include.redist.roff%
551201Smarc.\"
6*61111Sbostic.\"	@(#)tcsetpgrp.3	8.1 (Berkeley) 06/04/93
751201Smarc.\"
852295Sbostic.Dd ""
958370Sbostic.Dt TCSETPGRP 3
1052281Smarc.Os
1152281Smarc.Sh NAME
1252281Smarc.Nm tcsetpgrp
1352295Sbostic.Nd set foreground process group ID
1452295Sbostic.Sh SYNOPSIS
1552295Sbostic.Fd #include <sys/types.h>
1653069Sbostic.Fd #include <unistd.h>
1752295Sbostic.Ft int
1852295Sbostic.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
1952295Sbostic.Sh DESCRIPTION
2052295SbosticIf the process has a controlling terminal, the
2152295Sbostic.Nm tcsetpgrp
2252295Sbosticfunction sets the foreground process group ID associated with the
2352295Sbosticterminal device to
2452295Sbostic.Fa pgrp_id .
2552295SbosticThe terminal device associated with
2652295Sbostic.Fa fd
2752295Sbosticmust be the controlling terminal of the calling process and the
2852295Sbosticcontrolling terminal must be currently associated with the session
2952295Sbosticof the calling process.
3052295SbosticThe value of
3152295Sbostic.Fa pgrp_id
3252295Sbosticmust be the same as the process group ID of a process in the same
3352295Sbosticsession as the calling process.
3452295Sbostic.Pp
3552295SbosticUpon successful completion,
3652295Sbostic.Nm tcsetpgrp
3752295Sbosticreturns a value of zero.
3852295Sbostic.Sh ERRORS
3952295SbosticIf an error occurs,
4052295Sbostic.Nm tcgetpgrp
4152295Sbosticreturns -1 and the global variable
4252295Sbostic.Va errno
4352295Sbosticis set to indicate the error, as follows:
4452295Sbostic.Bl -tag -width Er
4552295Sbostic.It Bq Er EBADF
4652295SbosticThe
4752295Sbostic.Fa fd
4852295Sbosticargument is not a valid file descriptor.
4952295Sbostic.It Bq Er EINVAL
5052295SbosticAn invalid value of
5152295Sbostic.Fa pgrp_id
5252295Sbosticwas specified.
5352295Sbostic.It Bq Er ENOTTY
5452295SbosticThe calling process does not have a controlling terminal, or the file
5552295Sbosticrepresented by
5652295Sbostic.Fa fd
5752295Sbosticis not the controlling terminal, or the controlling terminal is no
5852295Sbosticlonger associated with the session of the calling process.
5952295Sbostic.It Bq Er EPERM
6052295SbosticThe
6152295Sbostic.Fa pgrp_id
6252295Sbosticargument does not match the process group ID of a process in the same
6352295Sbosticsession as the calling process.
6452295Sbostic.El
6552295Sbostic.Sh SEE ALSO
6652295Sbostic.Xr setpgid 3 ,
6752295Sbostic.Xr setsid 2 ,
6852295Sbostic.Xr tcgetpgrp 3
6952295Sbostic.Sh STANDARDS
7052295SbosticThe
7152295Sbostic.Nm tcsetpgprp
7252295Sbosticfunction is expected to be compliant with the
7352295Sbostic.St -p1003.1-88
7452295Sbosticspecification.
75