tcgetpgrp(3P) INTERACTIVE UNIX System (POSIX) tcgetpgrp(3P)
NAME
tcgetpgrp - get foreground process group ID
SYNOPSIS
#include <sys/types.h>
pid_t tcgetpgrp (fildes)
int fildes;
DESCRIPTION
The tcgetpgrp() function returns the value of the process
group ID of the foreground process group associated with the
terminal.
The tcgetpgrp() function is allowed from a process that is a
member of a background process group; however, the informa-
tion may be changed by a process that is a member of a fore-
ground process group.
SEE ALSO
setpgid(2), setsid(2), tcsetpgrp(3).
RETURN VALUES
Upon successful completion, tcgetpgrp() returns the process
group ID of the foreground process group associated with the
terminal. Otherwise, a value of -1 is returned, and errno
is set to indicate the error.
ERRORS
If any of the following conditions occur, the tcgetpgrp()
function returns -1 and sets errno to the corresponding
value:
[EBADF]
The fildes argument is not a valid file descriptor.
[ENOSYS]
The tcgetpgrp() function is not supported in this
implementation.
[ENOTTY]
The calling process does not have a controlling termi-
nal or the file is not the controlling terminal.
Rev. 1.1 Page 1