[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


tcgetpgrp Subroutine

Purpose

Gets foreground process group ID.

Library

Standard C Library (libc.a)

Syntax

#include <unistd.h>


pid_t tcgetpgrp ( FileDescriptor)
int FileDescriptor;

Description

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.

Parameters


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 (setpgid or setpgrp Subroutine) subroutine, setsid (setsid Subroutine) subroutine, tcsetpgrp (tcsetpgrp Subroutine) subroutine.

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


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]