unlockpt() — Unlock a pseudoterminal master and slave pair

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
Single UNIX Specification, Version 3

both  

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <stdlib.h>

int unlockpt(int fildes);

General description

The unlockpt() function unlocks the slave pseudoterminal device associated with the master to which fildes refers.

Portable applications must call unlockpt() before opening the slave side of a pseudoterminal device.

Returned value

If successful, unlockpt() returns 0.

If unsuccessful, unlockpt() returns -1 and sets errno to one of the following values:
Error Code
Description
EACCESS
Either a grantpt() has not yet been issued, or an unlockpt() has already been issued. An unlockpt() must be issued after a grantpt(), and can only be issued once.
EBADF
The fildes argument is not a file descriptor open for writing.
EINVAL
The fildes argument is not associated with a master pseudoterminal device.

Related information