vhangup(2)

โœจ vhangup(2) โ€” virtually hangup the current terminal โœจ

okay bestie, so this is vhangup, from section 2 of the Linux manual (that's the system calls girlies ๐Ÿ’…). Buckle up, it's a short one but it's iconic.


๐Ÿ’– NAME ๐Ÿ’–

vhangup โ€” virtually hangup the current terminal

๐ŸŒธ LIBRARY ๐ŸŒธ

Standard C library (libc, -lc). yes queen, you just link it like normal ๐Ÿซถ

โœจ SYNOPSIS โœจ

#include <unistd.h>

int vhangup(void);

๐ŸŽ€ Feature Test Macro Requirements for glibc ๐ŸŽ€

(peep feature_test_macros(7) if you wanna know the whole lore)

For vhangup():

  • Since glibc 2.21:
    • _DEFAULT_SOURCE
  • In glibc 2.19 and 2.20:
    • _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
  • Up to and including glibc 2.19:
    • _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)

like, the vibes of these macros changed over the glibc eras, okay? don't @ me, just define the right one ๐Ÿ”ฅ


๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

vhangup() simulates a hangup on the current terminal. basically it's giving "you don't get to linger here" energy ๐Ÿ’€

This call arranges for other users to have a "clean" terminal at login time. so when the next person logs in, they get a fresh, untouched tty โ€” no leftover nonsense from whoever was there before. immaculate. pristine. main character terminal ๐ŸŒˆโœจ


๐Ÿฆ‹ RETURN VALUE ๐Ÿฆ‹

  • On success, zero is returned. slay ๐Ÿ’–
  • On error, -1 is returned, and errno is set to indicate the error. not slay ๐Ÿ˜ญ

๐Ÿ“ ERRORS ๐Ÿ“

  • EPERM โ€” The calling process has insufficient privilege to call vhangup(); the CAP_SYS_TTY_CONFIG capability is required. so likeโ€ฆ you need the keys to the kingdom, bestie. no cap, this one's a privileged move ๐Ÿ‘‘

๐Ÿ’œ STANDARDS ๐Ÿ’œ

Linux. periodt. ๐ŸŽ€


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ


ngl this syscall is short but she is powerful โ€” messing with terminals at login means you better know exactly what you're doing, so double-check that CAP_SYS_TTY_CONFIG before you go feral ๐Ÿ™ˆ

and that's the whole page, bestie ๐Ÿ’… this one came straight from the Linux man-pages 6.20, dated 2026-02-08. go forth and hang up those terminals (virtually). bye ilysm ๐Ÿซถโœจ

๐Ÿ“ฆ 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
  • ๐Ÿ“œ the page's license: Linux-man-pages-copyleft
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms