xref: /original-bsd/lib/libc/gen/tcsetpgrp.3 (revision e59fb703)
Copyright (c) 1991 The Regents of the University of California.
All rights reserved.

%sccs.include.redist.roff%

@(#)tcsetpgrp.3 1.1 (Berkeley) 09/26/91

"Process Group ID"

"Function: tcsetpgrp()"

"Synopsis"

#include <sys/types.h>

int tcsetpgrp(int fildes, pid_t pgrp_id);

"Description"

If the process has a controlling terminal, the tcsetpgrp() function shall set the foreground process group ID associated with the terminal to pgrp_id. The file associated with fildes must be the controlling terminal of the calling process and the controlling terminal must be currently associated with the session of the calling process. The value of pgrp_id must match a process group ID of a process in the same session as the calling process.

"Returns"

Upon successful completion, tcsetpgrp() returns a value of zero. Otherwise, a value of -1 is returned and errno is set to indicate the error.

"Errors"

If any of the following conditions occur, the tcsetpgrp() function shall return -1 and set errno to the corresponding value:

 [EBADF] The fildes argument is not a valid file descriptor.

 [EINVAL] The value of the pgrp_id argument is a value not
 supported by the implementation.

 [ENOSYS] The tcsetpgrp() function is not supported in this
 implementation.

 [ENOTTY] The calling process does not have a controlling
 terminal, or the file is not the controlling terminal,
 or the controlling terminal is no longer associated with
 the session of the calling process.

 [EPERM] The value of pgrp_id is a value supported by the
 implementation but does not match the process group ID
 of a process in the same session as the calling process.