VHANGUP(2) — UNIX Programmer’s Manual
NAME
vhangup − virtually “hangup” the current control terminal
SYNOPSIS
vhangup()
DESCRIPTION
Vhangup is used by the initialization process init(8) (among others) to arrange that users are given “clean”’ terminals at login, by revoking access of the previous users’ processes to the terminal. To effect this, vhangup searches the system tables for references to the control terminal of the invoking process, revoking access permissions on each instance of the terminal which it finds. Further attempts to access the terminal by the affected processes will yield i/o errors (EBADF). Finally, a hangup signal (SIGHUP) is sent to the process group of the control terminal.
The use of this call is restricted to the superuser.
ERRORS
[EPERM] The caller is not the superuser.
SEE ALSO
init (8)
BUGS
Access to the control terminal via /dev/tty is still possible.
If the device can be opened through two different inodes (distinct, non-hardlinked filenames created with separate mknod(2) calls), processes that have the alternate inodes open do not receive the hangup signal.
This call should be replaced by an automatic mechanism which takes place on process exit.
4BSD