[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    grantpt(3C) manual page Table of Contents

Name

grantpt - grant access to the slave pseudo-terminal device

Synopsis

int grantpt(int fildes);

MT-Level

Safe

Description

The function grantpt() changes the mode and ownership of the slave pseudo-terminal device associated with its master pseudo-terminal counter part. fildes is the file descriptor returned from a successful open of the master pseudo-terminal device. A setuid root program (see setuid(2) ) is invoked to change the permissions. The user ID of the slave is set to the real UID of the calling process and the group ID is set to a reserved group. The permission mode of the slave pseudo-terminal is set to readable, writable by the owner and writeable by the group.

Return Values

Upon successful completion, the function grantpt() returns 0; otherwise it returns -1. Failure could occur if fildes is not an open file descriptor, if fildes is not associated with a master pseudo-terminal device, or if the corresponding slave device could not be accessed. grantpt() will also fail if it is unable to successfully invoke the setuid root program.

See Also

open(2) , setuid(2) , ptsname(3C) , unlockpt(3C)


Table of Contents