1.\" Copyright (c) 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)tcsetpgrp.3 5.2 (Berkeley) 02/03/92 7.\" 8.Dd "" 9.Dt TCSETPGRP 10.Os 11.Sh NAME 12.Nm tcsetpgrp 13.Nd set foreground process group ID 14.Sh SYNOPSIS 15.Fd #include <sys/types.h> 16.Ft int 17.Fn tcsetpgrp "int fd" "pid_t pgrp_id" 18.Sh DESCRIPTION 19If the process has a controlling terminal, the 20.Nm tcsetpgrp 21function sets the foreground process group ID associated with the 22terminal device to 23.Fa pgrp_id . 24The terminal device associated with 25.Fa fd 26must be the controlling terminal of the calling process and the 27controlling terminal must be currently associated with the session 28of the calling process. 29The value of 30.Fa pgrp_id 31must be the same as the process group ID of a process in the same 32session as the calling process. 33.Pp 34Upon successful completion, 35.Nm tcsetpgrp 36returns a value of zero. 37.Sh ERRORS 38If an error occurs, 39.Nm tcgetpgrp 40returns -1 and the global variable 41.Va errno 42is set to indicate the error, as follows: 43.Bl -tag -width Er 44.It Bq Er EBADF 45The 46.Fa fd 47argument is not a valid file descriptor. 48.It Bq Er EINVAL 49An invalid value of 50.Fa pgrp_id 51was specified. 52.It Bq Er ENOTTY 53The calling process does not have a controlling terminal, or the file 54represented by 55.Fa fd 56is not the controlling terminal, or the controlling terminal is no 57longer associated with the session of the calling process. 58.It Bq Er EPERM 59The 60.Fa pgrp_id 61argument does not match the process group ID of a process in the same 62session as the calling process. 63.El 64.Sh SEE ALSO 65.Xr setpgid 3 , 66.Xr setsid 2 , 67.Xr tcgetpgrp 3 68.Sh STANDARDS 69The 70.Nm tcsetpgprp 71function is expected to be compliant with the 72.St -p1003.1-88 73specification. 74