summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_compat.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-09-04 16:30:53 +0000
committered <ed@FreeBSD.org>2008-09-04 16:30:53 +0000
commit28aa9d102277d4a544ee19767f6b6e2dca476cce (patch)
tree42e35652fae865c2113f073aae21cd6b8c7dfa6a /sys/kern/tty_compat.c
parentae590ad889f1c382c39f6763ef5ef77fd55dd386 (diff)
downloadFreeBSD-src-28aa9d102277d4a544ee19767f6b6e2dca476cce.zip
FreeBSD-src-28aa9d102277d4a544ee19767f6b6e2dca476cce.tar.gz
Fix an awful bug inside our COMPAT_43TTY code.
When I migrated tty_compat.c to MPSAFE TTY, I just hooked it up to the build and fixed it until it compiled and somewhat worked. It turns out this was not the smartest thing, because the old TTY layer also had a field called t_flags, which contained a set of sgtty flags. This means our current COMPAT_43TTY code overwrites the TTY flags, causing all strange problems to occur. Fix this code to use a new struct member called t_compatflags. This commit may cause kern/127054 to be fixed, but this still has to be tested/confirmed by the originator. It has to be fixed anyway. PR: kern/127054
Diffstat (limited to 'sys/kern/tty_compat.c')
-rw-r--r--sys/kern/tty_compat.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/kern/tty_compat.c b/sys/kern/tty_compat.c
index 6736cfb..00764b8 100644
--- a/sys/kern/tty_compat.c
+++ b/sys/kern/tty_compat.c
@@ -121,7 +121,8 @@ ttsetcompat(struct tty *tp, u_long *com, caddr_t data, struct termios *term)
term->c_ospeed = tp->t_termios.c_ospeed;
term->c_cc[VERASE] = sg->sg_erase;
term->c_cc[VKILL] = sg->sg_kill;
- tp->t_flags = (tp->t_flags&0xffff0000) | (sg->sg_flags&0xffff);
+ tp->t_compatflags = (tp->t_compatflags&0xffff0000) |
+ (sg->sg_flags&0xffff);
ttcompatsetflags(tp, term);
*com = (*com == TIOCSETP) ? TIOCSETAF : TIOCSETA;
break;
@@ -160,14 +161,15 @@ ttsetcompat(struct tty *tp, u_long *com, caddr_t data, struct termios *term)
case TIOCLBIC:
case TIOCLSET:
if (*com == TIOCLSET)
- tp->t_flags = (tp->t_flags&0xffff) | *(int *)data<<16;
+ tp->t_compatflags = (tp->t_compatflags&0xffff) |
+ *(int *)data<<16;
else {
- tp->t_flags =
- (ttcompatgetflags(tp)&0xffff0000)|(tp->t_flags&0xffff);
+ tp->t_compatflags = (ttcompatgetflags(tp)&0xffff0000) |
+ (tp->t_compatflags&0xffff);
if (*com == TIOCLBIS)
- tp->t_flags |= *(int *)data<<16;
+ tp->t_compatflags |= *(int *)data<<16;
else
- tp->t_flags &= ~(*(int *)data<<16);
+ tp->t_compatflags &= ~(*(int *)data<<16);
}
ttcompatsetlflags(tp, term);
*com = TIOCSETA;
@@ -209,7 +211,7 @@ tty_ioctl_compat(struct tty *tp, u_long com, caddr_t data, struct thread *td)
compatspeeds);
sg->sg_erase = cc[VERASE];
sg->sg_kill = cc[VKILL];
- sg->sg_flags = tp->t_flags = ttcompatgetflags(tp);
+ sg->sg_flags = tp->t_compatflags = ttcompatgetflags(tp);
break;
}
case TIOCGETC: {
@@ -237,10 +239,10 @@ tty_ioctl_compat(struct tty *tp, u_long com, caddr_t data, struct thread *td)
break;
}
case TIOCLGET:
- tp->t_flags =
+ tp->t_compatflags =
(ttcompatgetflags(tp) & 0xffff0000UL)
- | (tp->t_flags & 0xffff);
- *(int *)data = tp->t_flags>>16;
+ | (tp->t_compatflags & 0xffff);
+ *(int *)data = tp->t_compatflags>>16;
if (ttydebug)
printf("CLGET: returning %x\n", *(int *)data);
break;
@@ -329,7 +331,7 @@ ttcompatgetflags(struct tty *tp)
static void
ttcompatsetflags(struct tty *tp, struct termios *t)
{
- int flags = tp->t_flags;
+ int flags = tp->t_compatflags;
tcflag_t iflag = t->c_iflag;
tcflag_t oflag = t->c_oflag;
tcflag_t lflag = t->c_lflag;
@@ -406,7 +408,7 @@ ttcompatsetflags(struct tty *tp, struct termios *t)
static void
ttcompatsetlflags(struct tty *tp, struct termios *t)
{
- int flags = tp->t_flags;
+ int flags = tp->t_compatflags;
tcflag_t iflag = t->c_iflag;
tcflag_t oflag = t->c_oflag;
tcflag_t lflag = t->c_lflag;
OpenPOWER on IntegriCloud