Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <stdlib.h>
int grantpt(int fildes);
The grantpt() function changes the mode and ownership of the slave pseudoterminal device. fildes should be the file descriptor of the corresponding master pseudoterminal. The user ID of the slave is set to the real UID of the calling process and the group ID is set to the group ID associated with the group name specified by the installation in the TTYGROUP() initialization parameter. The permission mode of the slave pseudoterminal is set to readable and writable by the owner, and writable by the group.
You can provide secure connections by either using grantpt() and unlockpt(), or by simply issuing the first open against the slave pseudoterminal from the first userid or process that opened the master terminal.
If successful, grantpt() returns 0.