grantpt(S-osr5)
grantpt --
grant access to the slave pseudo-terminal device
Syntax
cc ...-lc
# include <stdlib.h>
int grantpt(int fildes);
Description
The function
grantpt(S-osr5)
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-osr5)
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-osr5)/exec(S-osr5)
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-osr5)
and
siginfo(FP)
for further information.
See also
exec(S-osr5),
fork(S-osr5),
open(S-osr5),
ptsname(S-osr5),
setuid(S-osr5),
sigaction(S-osr5),
siginfo(FP),
unlockpt(S-osr5)
Standards conformance
grantpt(S-osr5)
is conformant with:
X/Open CAE Specification, System Interfaces and Headers, Issue 4, Version 2.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005