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

tcsetpgrp Subroutine

Purpose

Sets foreground process group ID.

Library

Standard C Library (libc.a)

Syntax

#include <unistd.h>
int tcsetpgrp (FileDescriptorProcessGroupID)
int FileDescriptor;
pid_t ProcessGroupID;

Description

If the process has a controlling terminal, the tcsetpgrp subroutine sets the foreground process group ID associated with the terminal to the value of the ProcessGroupID parameter. The file associated with the FileDescriptor parameter must be the controlling terminal of the calling process, and the controlling terminal must be currently associated with the session of the calling process. The value of the ProcessGroupID parameter must match a process group ID of a process in the same session as the calling process.

Parameters

FileDescriptor Specifies an open file descriptor.
ProcessGroupID Specifies the process group identifier.

Return Values

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

This function is unsuccessful if one of the following is true:

EBADF The FileDescriptor parameter is not a valid file descriptor.
EINVAL The ProcessGroupID parameter is invalid.
ENOTTY The calling process does not have a controlling terminal, or the file is not the controlling terminal, or the controlling terminal is no longer associated with the session of the calling process.
EPERM The ProcessGroupID parameter is valid, but does not match the process group ID of a process in the same session as the calling process.

Implementation Specifics

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

Related Information

The tcgetpgrp 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 ]