Add a VT_LOCKSWITCH ioctl that disallows vty switching. Something
like this can be emulated by VT_SETMODEing to VT_PROCESS and never releasing the vty, but this has a number of problems, most notably that a process must stay resident for the lock to be in effect. Reviewed by: roam, sheldonh
This commit is contained in:
parent
f55348f07c
commit
ce907d4246
@ -981,6 +981,13 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
|||||||
*(int *)data = scp->index + 1;
|
*(int *)data = scp->index + 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case VT_LOCKSWITCH: /* prevent vty switching */
|
||||||
|
if ((*(int *)data) & 0x01)
|
||||||
|
sc->flags |= SC_SCRN_VTYLOCK;
|
||||||
|
else
|
||||||
|
sc->flags &= ~SC_SCRN_VTYLOCK;
|
||||||
|
return 0;
|
||||||
|
|
||||||
case KDENABIO: /* allow io operations */
|
case KDENABIO: /* allow io operations */
|
||||||
error = suser(td);
|
error = suser(td);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
@ -2075,6 +2082,13 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
|
|||||||
|
|
||||||
DPRINTF(5, ("sc0: sc_switch_scr() %d ", next_scr + 1));
|
DPRINTF(5, ("sc0: sc_switch_scr() %d ", next_scr + 1));
|
||||||
|
|
||||||
|
/* prevent switch if previously requested */
|
||||||
|
if (sc->flags & SC_SCRN_VTYLOCK) {
|
||||||
|
sc_bell(sc->cur_scp, sc->cur_scp->bell_pitch,
|
||||||
|
sc->cur_scp->bell_duration);
|
||||||
|
return EPERM;
|
||||||
|
}
|
||||||
|
|
||||||
/* delay switch if the screen is blanked or being updated */
|
/* delay switch if the screen is blanked or being updated */
|
||||||
if ((sc->flags & SC_SCRN_BLANKED) || sc->write_in_progress
|
if ((sc->flags & SC_SCRN_BLANKED) || sc->write_in_progress
|
||||||
|| sc->blink_in_progress || sc->videoio_in_progress) {
|
|| sc->blink_in_progress || sc->videoio_in_progress) {
|
||||||
|
@ -194,6 +194,7 @@ typedef struct sc_softc {
|
|||||||
#define SC_SCRN_IDLE (1 << 5)
|
#define SC_SCRN_IDLE (1 << 5)
|
||||||
#define SC_SCRN_BLANKED (1 << 6)
|
#define SC_SCRN_BLANKED (1 << 6)
|
||||||
#define SC_SAVER_FAILED (1 << 7)
|
#define SC_SAVER_FAILED (1 << 7)
|
||||||
|
#define SC_SCRN_VTYLOCK (1 << 8)
|
||||||
|
|
||||||
#define SC_INIT_DONE (1 << 16)
|
#define SC_INIT_DONE (1 << 16)
|
||||||
#define SC_SPLASH_SCRN (1 << 17)
|
#define SC_SPLASH_SCRN (1 << 17)
|
||||||
|
@ -335,6 +335,9 @@ typedef struct vt_mode vtmode_t;
|
|||||||
/* get the index of the vty */
|
/* get the index of the vty */
|
||||||
#define VT_GETINDEX _IOR('v', 8, int)
|
#define VT_GETINDEX _IOR('v', 8, int)
|
||||||
|
|
||||||
|
/* prevent switching vtys */
|
||||||
|
#define VT_LOCKSWITCH _IOW('v', 9, int)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Video mode switching ioctl. See sys/fbio.h for mode numbers.
|
* Video mode switching ioctl. See sys/fbio.h for mode numbers.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user