Merge from sys/dev/syscons/syscons.c 1.373
kse changes # Note: There are a number of trivial and non-trivial diffs between this and # sys/dev/syscons/syscons.c that I didn't try to account for. Reviewed by: julian, bde, jhb
This commit is contained in:
parent
06da1def0c
commit
5fb0e81d8b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83433
@ -439,7 +439,7 @@ scdevtounit(dev_t dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scopen(dev_t dev, int flag, int mode, struct proc *p)
|
scopen(dev_t dev, int flag, int mode, struct thread *td)
|
||||||
{
|
{
|
||||||
int unit = scdevtounit(dev);
|
int unit = scdevtounit(dev);
|
||||||
sc_softc_t *sc;
|
sc_softc_t *sc;
|
||||||
@ -478,7 +478,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
|
|||||||
(*linesw[tp->t_line].l_modem)(tp, 1);
|
(*linesw[tp->t_line].l_modem)(tp, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (tp->t_state & TS_XCLUDE && suser(p))
|
if (tp->t_state & TS_XCLUDE && suser_td(td))
|
||||||
return(EBUSY);
|
return(EBUSY);
|
||||||
|
|
||||||
error = (*linesw[tp->t_line].l_open)(dev, tp);
|
error = (*linesw[tp->t_line].l_open)(dev, tp);
|
||||||
@ -498,7 +498,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scclose(dev_t dev, int flag, int mode, struct proc *p)
|
scclose(dev_t dev, int flag, int mode, struct thread *td)
|
||||||
{
|
{
|
||||||
struct tty *tp = dev->si_tty;
|
struct tty *tp = dev->si_tty;
|
||||||
scr_stat *scp;
|
scr_stat *scp;
|
||||||
@ -636,7 +636,7 @@ scparam(struct tty *tp, struct termios *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
int i;
|
int i;
|
||||||
@ -649,23 +649,23 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
|
|
||||||
/* If there is a user_ioctl function call that first */
|
/* If there is a user_ioctl function call that first */
|
||||||
if (sc_user_ioctl) {
|
if (sc_user_ioctl) {
|
||||||
error = (*sc_user_ioctl)(dev, cmd, data, flag, p);
|
error = (*sc_user_ioctl)(dev, cmd, data, flag, td);
|
||||||
if (error != ENOIOCTL)
|
if (error != ENOIOCTL)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = sc_vid_ioctl(tp, cmd, data, flag, p);
|
error = sc_vid_ioctl(tp, cmd, data, flag, td);
|
||||||
if (error != ENOIOCTL)
|
if (error != ENOIOCTL)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
#ifndef SC_NO_HISTORY
|
#ifndef SC_NO_HISTORY
|
||||||
error = sc_hist_ioctl(tp, cmd, data, flag, p);
|
error = sc_hist_ioctl(tp, cmd, data, flag, td);
|
||||||
if (error != ENOIOCTL)
|
if (error != ENOIOCTL)
|
||||||
return error;
|
return error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SC_NO_SYSMOUSE
|
#ifndef SC_NO_SYSMOUSE
|
||||||
error = sc_mouse_ioctl(tp, cmd, data, flag, p);
|
error = sc_mouse_ioctl(tp, cmd, data, flag, td);
|
||||||
if (error != ENOIOCTL)
|
if (error != ENOIOCTL)
|
||||||
return error;
|
return error;
|
||||||
#endif
|
#endif
|
||||||
@ -676,7 +676,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
sc = scp->sc;
|
sc = scp->sc;
|
||||||
|
|
||||||
if (scp->tsw) {
|
if (scp->tsw) {
|
||||||
error = (*scp->tsw->te_ioctl)(scp, tp, cmd, data, flag, p);
|
error = (*scp->tsw->te_ioctl)(scp, tp, cmd, data, flag, td);
|
||||||
if (error != ENOIOCTL)
|
if (error != ENOIOCTL)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -857,7 +857,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
DPRINTF(5, ("sc%d: VT_SETMODE ", sc->unit));
|
DPRINTF(5, ("sc%d: VT_SETMODE ", sc->unit));
|
||||||
if (scp->smode.mode == VT_PROCESS) {
|
if (scp->smode.mode == VT_PROCESS) {
|
||||||
p1 = pfind(scp->pid);
|
p1 = pfind(scp->pid);
|
||||||
if (scp->proc == p1 && scp->proc != p) {
|
if (scp->proc == p1 && scp->proc != td->td_proc) {
|
||||||
if (p1)
|
if (p1)
|
||||||
PROC_UNLOCK(p1);
|
PROC_UNLOCK(p1);
|
||||||
DPRINTF(5, ("error EPERM\n"));
|
DPRINTF(5, ("error EPERM\n"));
|
||||||
@ -886,9 +886,9 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
DPRINTF(5, ("error EINVAL\n"));
|
DPRINTF(5, ("error EINVAL\n"));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
DPRINTF(5, ("VT_PROCESS %d, ", p->p_pid));
|
DPRINTF(5, ("VT_PROCESS %d, ", td->td_proc->p_pid));
|
||||||
bcopy(data, &scp->smode, sizeof(struct vt_mode));
|
bcopy(data, &scp->smode, sizeof(struct vt_mode));
|
||||||
scp->proc = p;
|
scp->proc = td->td_proc;
|
||||||
scp->pid = scp->proc->p_pid;
|
scp->pid = scp->proc->p_pid;
|
||||||
if ((scp == sc->cur_scp) && (sc->unit == sc_console_unit))
|
if ((scp == sc->cur_scp) && (sc->unit == sc_console_unit))
|
||||||
cons_unavail = TRUE;
|
cons_unavail = TRUE;
|
||||||
@ -913,7 +913,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
/* ...and this process is controlling it. */
|
/* ...and this process is controlling it. */
|
||||||
if (scp->proc != p) {
|
if (scp->proc != td->td_proc) {
|
||||||
splx(s);
|
splx(s);
|
||||||
return EPERM;
|
return EPERM;
|
||||||
}
|
}
|
||||||
@ -979,19 +979,19 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDENABIO: /* allow io operations */
|
case KDENABIO: /* allow io operations */
|
||||||
error = suser(p);
|
error = suser_td(td);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return error;
|
return error;
|
||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
p->p_frame->tf_eflags |= PSL_IOPL;
|
td->td_frame->tf_eflags |= PSL_IOPL;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDDISABIO: /* disallow io operations (default) */
|
case KDDISABIO: /* disallow io operations (default) */
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
p->p_frame->tf_eflags &= ~PSL_IOPL;
|
td->td_frame->tf_eflags &= ~PSL_IOPL;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1278,7 +1278,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
|
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
|
||||||
if (error != ENOIOCTL)
|
if (error != ENOIOCTL)
|
||||||
return(error);
|
return(error);
|
||||||
error = ttioctl(tp, cmd, data, flag);
|
error = ttioctl(tp, cmd, data, flag);
|
||||||
|
Loading…
Reference in New Issue
Block a user