grantpt()
Grant access to a slave pseudo-terminal device
Synopsis:
#include <stdlib.h>
int grantpt( int fildes );
Arguments:
- fildes
- The file descriptor of a master pseudo-terminal device.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
This function is in libc.a, but not in libc.so
(in order to save space).
Description:
The grantpt() function changes the mode and ownership of the slave pseudo-terminal device associated with its master pseudo-terminal counterpart. The fildes argument is a file descriptor that refers to a master pseudo-terminal device. The user and group IDs of the slave are set to the real user and group IDs of the calling process. The permission mode of the slave pseudo-terminal is set to readable and writable by the owner, and writable by the group.
Returns:
0, or -1 if an error occurred (errno is set).
Errors:
- EBADF
- The fildes argument isn't a valid open file descriptor.
- EINVAL
- The fildes argument isn't associated with a master pseudo-terminal device.
- EACCES
- The corresponding slave pseudo-terminal device couldn't be accessed.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |