unlockpt()

Updated: April 19, 2023

Unlock a pseudo-terminal master/slave pair

Synopsis:

#include <stdlib.h>

int unlockpt( int filedes );

Arguments:

filedes
The file descriptor for the master pseudo-terminal.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The unlockpt() function unlocks the slave pseudo-terminal device associated with the master to which filedes refers. Call unlockpt() before you open the slave side of a pseudo-terminal device.

Returns:

0, or -1 if an error occurred (errno is set).

Errors:

EBADF
The filedes argument isn't a file descriptor open for writing.
EINTR
The call was interrupted by a signal.
EINVAL
The filedes argument isn't associated with a master pseudo-terminal device.

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes