Copyright (c) 1998, Sun Microsystems, Inc. All Rights Reserved.
Copyright (c) 1980 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution.
#include <unistd.h> void vhangup(void);
The vhangup() function is used by the initialization process init(1M) (among others) to ensure 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 controlling terminal of the invoking process and revokes access permissions on each instance of the terminal that it finds. Further attempts to access the terminal by the affected processes will yield I/O errors (EBADF or EIO). A SIGHUP (hangup signal) is sent to the process group of the controlling terminal.
init(1M)
Access to the controlling terminal using /dev/tty is still possible.
This call should be replaced by an automatic mechanism that takes place on process exit.