151201Smarc.\" Copyright (c) 1991 The Regents of the University of California. 251201Smarc.\" All rights reserved. 351201Smarc.\" 451201Smarc.\" %sccs.include.redist.roff% 551201Smarc.\" 6*52281Smarc.\" @(#)tcsetpgrp.3 5.1 (Berkeley) 02/02/92 751201Smarc.\" 8*52281Smarc.Dd Jun 11, 1991 9*52281Smarc.Dt TCSETPGRP 10*52281Smarc.Os 11*52281Smarc.Sh NAME 12*52281Smarc.Nm tcsetpgrp 1351201Smarc.LP 1451201Smarc.B "Process Group ID" 1551201Smarc.LP 1651201Smarc.B "Function: tcsetpgrp()" 1751201Smarc.LP 1851201Smarc.B "Synopsis" 1951201Smarc.LP 2051201Smarc.nf 2151201Smarc#include <sys/types.h> 2251201Smarc 2351201Smarcint tcsetpgrp(int fildes, pid_t pgrp_id); 2451201Smarc.fi 2551201Smarc.LP 2651201Smarc.B "Description" 2751201Smarc.LP 2851201SmarcIf the process has a controlling terminal, the tcsetpgrp() function 2951201Smarcshall set the foreground process group ID associated with the 3051201Smarcterminal to pgrp_id. The file associated with fildes must be the 3151201Smarccontrolling terminal of the calling process and the controlling 3251201Smarcterminal must be currently associated with the session of the 3351201Smarccalling process. The value of pgrp_id must match a process group 3451201SmarcID of a process in the same session as the calling process. 3551201Smarc.LP 3651201Smarc.B "Returns" 3751201Smarc.LP 3851201SmarcUpon successful completion, tcsetpgrp() returns a value of zero. 3951201SmarcOtherwise, a value of -1 is returned and errno is set to indicate the 4051201Smarcerror. 4151201Smarc.LP 4251201Smarc.B "Errors" 4351201Smarc.LP 4451201SmarcIf any of the following conditions occur, the tcsetpgrp() function shall 4551201Smarcreturn -1 and set errno to the corresponding value: 4651201Smarc.nf 4751201Smarc [EBADF] The fildes argument is not a valid file descriptor. 4851201Smarc 4951201Smarc [EINVAL] The value of the pgrp_id argument is a value not 5051201Smarc supported by the implementation. 5151201Smarc 5251201Smarc [ENOSYS] The tcsetpgrp() function is not supported in this 5351201Smarc implementation. 5451201Smarc 5551201Smarc [ENOTTY] The calling process does not have a controlling 5651201Smarc terminal, or the file is not the controlling terminal, 5751201Smarc or the controlling terminal is no longer associated with 5851201Smarc the session of the calling process. 5951201Smarc 6051201Smarc [EPERM] The value of pgrp_id is a value supported by the 6151201Smarc implementation but does not match the process group ID 6251201Smarc of a process in the same session as the calling process. 6351201Smarc.fi 64