grantpt(S)
grantpt --
grant access to the slave pseudo-terminal device
Syntax
cc ...-lc
# include <stdlib.h>
int grantpt(int fildes);
Description
The function
grantpt(S)
changes the mode and ownership of the
slave pseudo-terminal device associated with its master
pseudo-terminal counter part.
fildes is a file descriptor
referencing the master pseudo-terminal device.
A
setuid(S)
root program
is invoked to change the permissions.
The user ID of the slave is set to the real
owner 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 writable by the group.
Return values
On successful completion,
grantpt( )
returns 0; otherwise it returns -1.
Diagnostics
Under the following conditions,
grantpt( )
fails and sets errno to:
[EBADF]-
fildes is not a valid open file descriptor.
[EINVAL]-
fildes is not associated with a master pseudo-terminal device.
[EACCESS]-
the corresponding slave device could not be accessed.
Warning
The current implementation of
grantpt( )
does a
fork(S)/exec(S)
internally.
If the caller has SIGCHLD (or SIGCLD)
signal handlers set up,
these handlers will be triggered by the call on
grantpt( ).
See
sigaction(S)
and
siginfo(FP)
for further information.
See also
exec(S),
fork(S),
open(S),
ptsname(S),
setuid(S),
sigaction(S),
siginfo(FP),
unlockpt(S)
Standards conformance
grantpt(S)
is conformant with:
X/Open CAE Specification, System Interfaces and Headers, Issue 4, Version 2.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003