-/*
- * Revoke access the current tty by all processes.
- * Used only by the super-user in init
- * to give ``clean'' terminals at login.
- */
-vhangup()
-{
-
- if (u.u_error = suser(u.u_cred, &u.u_acflag))
- return;
- if (u.u_ttyp == NULL)
- return;
- forceclose(u.u_ttyd);
- if ((u.u_ttyp->t_state) & TS_ISOPEN)
- gsignal(u.u_ttyp->t_pgid, SIGHUP);
- u.u_ttyp->t_session = 0;
- u.u_ttyp->t_pgid = 0;
-}
-
-forceclose(dev)
- dev_t dev;
-{
- register struct file *fp;
- register struct vnode *vp;
-
- for (fp = file; fp < fileNFILE; fp++) {
- if (fp->f_count == 0)
- continue;
- if (fp->f_type != DTYPE_VNODE)
- continue;
- vp = (struct vnode *)fp->f_data;
- if (vp == 0)
- continue;
- if (vp->v_type != VCHR)
- continue;
- if (vp->v_rdev != dev)
- continue;
- fp->f_flag &= ~(FREAD|FWRITE);
- }
-}
-