TCGETPGRP(3C)
NAME
tcgetpgrp − get foreground process group id
SYNOPSIS
#include <sys/types.h>
pid_t tcgetpgrp (fildes)
int fildes;
DESCRIPTION
Tcgetpgrp returns the value of the process group ID of the foreground process group associated with the terminal referenced by fildes. Tcgetpgrp is allowed from a process that is a member of a background process group (See termio(7)); however, the information may be subsequently changed by a process that is a member of a foreground process group.
RETURN VALUE
Upon successful completion, the value of the process group ID of the foreground process group associated with the terminal referenced by fildes is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
Tcgetpgrp will fail if one or more of the following is true:
[EBADF] Fildes is not a valid file descriptor.
[ENOTTY] The file associated with fildes is not the controlling terminal or the calling process does not have a controlling terminal.
[EACCES] The file associated with fildes is the controlling terminal of the calling process, however, there is no foreground process group defined for the controlling terminal.
WARNING
The error EACCES, which is returned if the controlling terminal has no foreground process group, may not be returned in future releases, depending on the course taken by the POSIX standard. Portable applications therefore should not rely on this error condition.
SEE ALSO
tcsetpgrp(3C), termio(7), setpgid(2), setsid(2).
STANDARDS CONFORMANCE
tcgetpgrp: XPG3, POSIX.1, FIPS 151-1
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989