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

Technical Reference: Base Operating System and Extensions, Volume 1


grantpt Subroutine

Purpose

Changes the mode and ownership of a pseudo-terminal device.

Library

Standard C Library (libc.a)

Syntax

#include <stdlib.h>


int grantpt ( FileDescriptor)
int FileDescriptor;

Description

The grantpt subroutine changes the mode and the ownership of the slave pseudo-terminal associated with the master pseudo-terminal device defined by the FileDescriptor parameter. The user ID of the slave pseudo-terminal is set to the real UID of the calling process. The group ID of the slave pseudo-terminal is set to an unspecified group ID. The permission mode of the slave pseudo-terminal is set to readable and writeable by the owner, and writeable by the group.

Parameters


FileDescriptor Specifies the file descriptor of the master pseudo-terminal device.

Return Value

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

The grantpt function may fail if:

EBADF The fildes argument is not a valid open file descriptor.
EINVAL The fildes argument is not associated with a master pseudo-terminal device.
EACCES The corresponding slave pseudo-terminal device could not be accessed.

Implementation Specifics

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

Related Information

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