'\"macro stdmacro
.if n .pH g3c.grantpt @(#)grantpt	40.4 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} grantpt 3C "" "\&"
.if \nX=1 .ds x} grantpt 3C ""
.if \nX=2 .ds x} grantpt 3C "" "\&"
.if \nX=3 .ds x} grantpt "" "" "\&"
.TH \*(x}
.SH NAME
\f4grantpt\fP \- grant access to the slave pseudo-terminal device
.SH SYNOPSIS
.nf
\f4int grantpt(int fildes\fP);
.fi
.SH DESCRIPTION
The function \f4grantpt\fP changes the mode and ownership of the
slave pseudo-terminal device associated with its master 
pseudo-terminal counter part.
\f2fildes\f1 is the file descriptor returned from a successful
open of the master pseudo-terminal device.
A \f4setuid\f1 root program [see \f4setuid\fP(2)]
is invoked to change the permissions.
The user \s-1ID\s+1 of the slave is set to the effective
owner of the calling process and the group \s-1ID\s+1 is set to a 
reserved group.
The permission mode of the slave pseudo-terminal is set to readable,
writeable by the owner and writeable by the group.
.SH "RETURN VALUE"
Upon successful completion, the function \f4grantpt\fP returns 
\f40\f1; otherwise it returns \f4-1\f1.
Failure could occur if \f2fildes\f1 is not an open file 
descriptor, if \f2fildes\fP is not associated with a master pseudo-terminal device,
or if the corresponding slave device could not be accessed.
.SH "SEE ALSO"
.nf
\f4open\f1(2), \f4setuid\fP(2).
.sp .5
\f4ptsname\fP(3C), \f4unlockpt\fP(3C)
in the \f2Programmer's Guide: \s-1STREAMS\s0\fP.
.fi
