unlockpt(3)
π unlockpt(3) β the pty-unlocking girlie π
okay so bestie, welcome to unlockpt(3) from the Library Functions Manual πΈ this is a libc function, she's a little legend, and she's here to unlock a pseudoterminal master/slave pair. yes. that's the whole vibe. let's get into it π«Ά
β¨ NAME β¨
unlockpt β unlock a pseudoterminal master/slave pair π
π LIBRARY π
Standard C library (libc, -lc) π
π SYNOPSIS π
#define _XOPEN_SOURCE
#include <stdlib.h>
int unlockpt(int fd);
π¦ Feature Test Macro Requirements for glibc (see feature_test_macros(7)) π¦
unlockpt():
- Since glibc 2.24:
_XOPEN_SOURCE >= 500
- glibc 2.23 and earlier:
_XOPEN_SOURCE
like ok glibc really said "know your macros before you call me" π iconic gatekeeping fr.
π DESCRIPTION π
so the unlockpt() function unlocks the slave pseudoterminal device that corresponds to the master pseudoterminal referred to by the file descriptor fd. that's it, that's the job, she ate and left no crumbs π
unlockpt() should be called before opening the slave side of a pseudoterminal. order matters bestie, this is not a choose-your-own-adventure situation π
β¨
β RETURN VALUE β
when successful, unlockpt() returns 0. slay π
otherwise, it returns -1 and sets errno to indicate the error. not slay π
π ERRORS π
EBADFβ thefdargument is not a file descriptor open for writing. bestie that fd is NOT valid for this, put it down πEINVALβ thefdargument is not associated with a master pseudoterminal. wrong terminal, wrong vibe, vibe check failed fr fr π
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
- Interface:
unlockpt() - Attribute: Thread safety
- Value:
MT-Safe
so yes she's MT-Safe, she can hang with multiple threads, no drama, no beef, queen behavior β¨
πΈ STANDARDS πΈ
POSIX.1-2008. certified, official, on the list π
π§ HISTORY π§
glibc 2.1. POSIX.1-2001. she's been around a minute, lowkey a legacy icon π
π₯ SEE ALSO π₯
grantpt(3), posix_openpt(3), ptsname(3), pts(4), pty(7)
π«Ά reminder: callunlockpt()before opening the slave side. skipping that step is giving "I didn't read the instructions" energy and you WILL be getting that-1π
k love u bye, this was Linux man-pages 6.20, dated 2025-09-21 β and that's the whole page bestie, no cap ππβ¨ππ¦πΈ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms