TCSETPGRP(3) BSD Programmer's Manual TCSETPGRP(3)
t
\btc
\bcs
\bse
\bet
\btp
\bpg
\bgr
\brp
\bp - set foreground process group ID
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
#
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<s
\bsy
\bys
\bs/
\b/t
\bty
\byp
\bpe
\bes
\bs.
\b.h
\bh>
\b>
#
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<u
\bun
\bni
\bis
\bst
\btd
\bd.
\b.h
\bh>
\b>
t
\btc
\bcs
\bse
\bet
\btp
\bpg
\bgr
\brp
\bp(_
\bi_
\bn_
\bt _
\bf_
\bd, _
\bp_
\bi_
\bd_
\b__
\bt _
\bp_
\bg_
\br_
\bp_
\b__
\bi_
\bd);
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
If the process has a controlling terminal, the t
\btc
\bcs
\bse
\bet
\btp
\bpg
\bgr
\brp
\bp function sets
the foreground process group ID associated with the terminal device to
_
\bp_
\bg_
\br_
\bp_
\b__
\bi_
\bd. The terminal device associated with _
\bf_
\bd must be the controlling
terminal of the calling process and the controlling terminal must be cur-
rently associated with the session of the calling process. The value of
_
\bp_
\bg_
\br_
\bp_
\b__
\bi_
\bd must be the same as the process group ID of a process in the same
session as the calling process.
Upon successful completion, t
\btc
\bcs
\bse
\bet
\btp
\bpg
\bgr
\brp
\bp returns a value of zero.
If an error occurs, t
\btc
\bcg
\bge
\bet
\btp
\bpg
\bgr
\brp
\bp returns -1 and the global variable _
\be_
\br_
\br_
\bn_
\bo is
set to indicate the error, as follows:
[EBADF] The _
\bf_
\bd argument is not a valid file descriptor.
[EINVAL] An invalid value of _
\bp_
\bg_
\br_
\bp_
\b__
\bi_
\bd was specified.
[ENOTTY] The calling process does not have a controlling terminal,
or the file represented by _
\bf_
\bd is not the controlling termi-
nal, or the controlling terminal is no longer associated
with the session of the calling process.
[EPERM] The _
\bp_
\bg_
\br_
\bp_
\b__
\bi_
\bd argument does not match the process group ID of
a process in the same session as the calling process.
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
setpgid(3), setsid(2), tcgetpgrp(3)
S
\bST
\bTA
\bAN
\bND
\bDA
\bAR
\bRD
\bDS
\bS
The t
\btc
\bcs
\bse
\bet
\btp
\bpg
\bgp
\bpr
\brp
\bp function is expected to be compliant with the IEEE
Std1003.1-1988 (``POSIX'') specification.