| 1 |
'\" t |
| 2 |
.\" %%%LICENSE_START(PUBLIC_DOMAIN) |
| 3 |
.\" This page is in the public domain. - aeb |
| 4 |
.\" %%%LICENSE_END |
| 5 |
.\" |
| 6 |
.TH unlockpt 3 2025-09-21 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
unlockpt \- unlock a pseudoterminal master/slave pair |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #define _XOPEN_SOURCE |
| 15 |
.B #include <stdlib.h> |
| 16 |
.P |
| 17 |
.BI "int unlockpt(int " fd ); |
| 18 |
.fi |
| 19 |
.P |
| 20 |
.RS -4 |
| 21 |
Feature Test Macro Requirements for glibc (see |
| 22 |
.BR feature_test_macros (7)): |
| 23 |
.RE |
| 24 |
.P |
| 25 |
.BR unlockpt (): |
| 26 |
.nf |
| 27 |
Since glibc 2.24: |
| 28 |
_XOPEN_SOURCE >= 500 |
| 29 |
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) |
| 30 |
glibc 2.23 and earlier: |
| 31 |
_XOPEN_SOURCE |
| 32 |
.fi |
| 33 |
.SH DESCRIPTION |
| 34 |
The |
| 35 |
.BR unlockpt () |
| 36 |
function unlocks the slave pseudoterminal device |
| 37 |
corresponding to the master pseudoterminal referred to by the file descriptor |
| 38 |
.IR fd . |
| 39 |
.P |
| 40 |
.BR unlockpt () |
| 41 |
should be called before opening the slave side of a pseudoterminal. |
| 42 |
.SH RETURN VALUE |
| 43 |
When successful, |
| 44 |
.BR unlockpt () |
| 45 |
returns 0. |
| 46 |
Otherwise, it returns \-1 and sets |
| 47 |
.I errno |
| 48 |
to indicate the error. |
| 49 |
.SH ERRORS |
| 50 |
.TP |
| 51 |
.B EBADF |
| 52 |
The |
| 53 |
.I fd |
| 54 |
argument is not a file descriptor open for writing. |
| 55 |
.TP |
| 56 |
.B EINVAL |
| 57 |
The |
| 58 |
.I fd |
| 59 |
argument is not associated with a master pseudoterminal. |
| 60 |
.SH ATTRIBUTES |
| 61 |
For an explanation of the terms used in this section, see |
| 62 |
.BR attributes (7). |
| 63 |
.TS |
| 64 |
allbox; |
| 65 |
lbx lb lb |
| 66 |
l l l. |
| 67 |
Interface Attribute Value |
| 68 |
T{ |
| 69 |
.na |
| 70 |
.nh |
| 71 |
.BR unlockpt () |
| 72 |
T} Thread safety MT-Safe |
| 73 |
.TE |
| 74 |
.SH STANDARDS |
| 75 |
POSIX.1-2008. |
| 76 |
.SH HISTORY |
| 77 |
glibc 2.1. |
| 78 |
POSIX.1-2001. |
| 79 |
.SH SEE ALSO |
| 80 |
.BR grantpt (3), |
| 81 |
.BR posix_openpt (3), |
| 82 |
.BR ptsname (3), |
| 83 |
.BR pts (4), |
| 84 |
.BR pty (7) |