[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

tcgetpgrp Subroutine


Gets foreground process group ID.


Standard C Library (libc.a)


#include <unistd.h>
pid_t tcgetpgrp (FileDescriptor)
int FileDescriptor;


The tcgetpgrp subroutine returns the value of the process group ID of the foreground process group associated with the terminal. The function can be called from a background process; however, the foreground process can subsequently change the information.


FileDescriptor Indicates the open file descriptor for the terminal special file.

Return Values

Upon successful completion, the process group ID of the foreground process is returned. If there is no foreground process group, a value greater than 1 that does not match the process group ID of any existing process group is returned. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The tcgetpgrp subroutine is unsuccessful if one of the following is true:

EBADF The FileDescriptor argument is not a valid file descriptor.
EINVAL The function is not appropriate for the file associated with the FileDescriptor argument.
ENOTTY The calling process does not have a controlling terminal or the file is not the controlling terminal.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The setpgid subroutine, setsid subroutine, tcsetpgrp subroutine.

The Input and Output Handling Programmer's Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

[ Previous | Next | Contents | Glossary | Home | Search ]