The Open Group Base Specifications Issue 6
IEEE Std 1003.1, 2003 Edition
Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.

NAME

tcgetpgrp - get the foreground process group ID

SYNOPSIS

#include <unistd.h>

pid_t tcgetpgrp(int
fildes);

DESCRIPTION

The tcgetpgrp() function shall return the value of the process group ID of the foreground process group associated with the terminal.

If there is no foreground process group, tcgetpgrp() shall return a value greater than 1 that does not match the process group ID of any existing process group.

The tcgetpgrp() function is allowed from a process that is a member of a background process group; however, the information may be subsequently changed by a process that is a member of a foreground process group.

RETURN VALUE

Upon successful completion, tcgetpgrp() shall return the value of the process group ID of the foreground process associated with the terminal. Otherwise, -1 shall be returned and errno set to indicate the error.

ERRORS

The tcgetpgrp() function shall fail if:

[EBADF]
The fildes argument is not a valid file descriptor.
[ENOTTY]
The calling process does not have a controlling terminal, or the file is not the controlling terminal.

The following sections are informative.

EXAMPLES

None.

APPLICATION USAGE

None.

RATIONALE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

setsid() , setpgid() , tcsetpgrp() , the Base Definitions volume of IEEE Std 1003.1-2001, <sys/types.h>, <unistd.h>

CHANGE HISTORY

First released in Issue 3. Included for alignment with the POSIX.1-1988 standard.

Issue 6

In the SYNOPSIS, the optional include of the <sys/types.h> header is removed.

The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:

End of informative text.


UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
[ Main Index | XBD | XCU | XSH | XRAT ]