Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

grantpt - grant access to the slave pseudoterminal

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

int grantpt(int fildes); 

Description

The grantpt() function changes the access permissions and the owner of the slave
pseudoterminal assigned to its master counterpart. fildes is a file descriptor that was
returned when the master pseudoterminal was opened successfully. A program with the s
bit set for root is called (/usr/lib/pt-chmod). The user ID of the slave device is the
same as the effective user ID of the calling process, and the group ID is set to a reserved
group ID. The access permissions are set such that for the slave pseudoterminal reading
and writing are permitted for the owner and writing is permitted for the group.

Return val.

0

-1

if successful.

if there is an error. errno is set to indicate the error.

Errors

grantpt() will fail if:

 

 

EBADF

fildes is not a valid open file descriptor

 

EINVAL

fildes is not assigned to a main pseudoterminal.

 

EACCES

The corresponding slave device could not be accessed.

Notes

grantpt() will also fail if the application has implemented a signal handling routine to
catch SIGCHLD signals.

See also

open(), ptsname(), setuid(), unlockpt(), stdlib.h.