Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

vhangup(2)

FieldValue
Numbers (x64 / i386 / arm64-generic / arm32)153 / 111 / 58 / 111 (cached kernel tables; hub agrees)
Since (kernel)1.0
Man pageman2/vhangup.2 (local cache, dated 2021-03-22)
glibc wrapperDeclared in <unistd.h>; feature macros: _DEFAULT_SOURCE since glibc 2.21 (_BSD_SOURCE or a low _XOPEN_SOURCE before); vhangup@@GLIBC_2.2.5 (nm -D on glibc 2.41)
Aliases coverednone
Ledger IDSC-vhangup (researched/BRIEF)

Purpose

vhangup() simulates a hangup on the current terminal, terminating the existing session’s access so that the next login finds a “clean” terminal. It is the mechanism init(1)/login(1) use when reinitializing a tty line: the virtual hangup severs the previous users’ association with the terminal device the way a carrier loss would.

Synopsis

#include <unistd.h>
int vhangup(void);

Arguments and behavior

No arguments; the call operates on the controlling terminal of the calling process.

Return value and errors

Returns 0 on success; -1 with errno: EPERM (insufficient privilege).

Flags and constants

No flag arguments.

Security and notes

  • The gate is explicit in the man page: the CAP_SYS_TTY_CONFIG capability is required; anything else gets EPERM.
  • Linux-specific and nonportable by its own man page; user-space code should not call it.

References