svn commit: r198745 - in stable/8: etc sys sys/amd64/include/xen sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf sys/dev/syscons sys/dev/xen/xenpci sys/kern sys/sys usr.sbin/jail

Ed Schouten ed at FreeBSD.org
Sun Nov 1 10:30:31 UTC 2009


Author: ed
Date: Sun Nov  1 10:30:30 2009
New Revision: 198745
URL: http://svn.freebsd.org/changeset/base/198745

Log:
  MFC various commits back to stable/8:
  
  SVN r197174:
    Make sure we never place the cursor outside the screen.
  
    For some vague reason, it may be possible that scp->cursor_pos exceeds
    scp->ysize * scp->xsize. This means that teken_set_cursor() may get
    called with an invalid position. Just ignore the old cursor position in
    this case.
  
    Reported by:  Paul B. Mahol <onemda gmail com>
  
  SVN r198213:
    Make lock devices work properly.
  
    It turned out I did add the code to use the init state devices to set
    the termios structure when opening the device, but it seems I totally
    forgot to add the bits required to force the actual locking of flags
    through the lock state devices.
  
    Reported by:	ru
  
  SVN r198215, r198217:
    Fix a typo in the jail(8) manpage.
  
    Submitted by: Jille Timmermans <jille quis cx>
  
  SVN r198216:
    Fix qouting in a comment, to make it look more consistent
  
    Submitted by: Jille Timmermans <jille quis cx>
  
  SVN r198223:
    Properly set the low watermarks when reducing the baud rate.
  
    Now that buffers are deallocated lazily, we should not use
    tty*q_getsize() to obtain the buffer size to calculate the low
    watermarks. Doing this may cause the watermark to be placed outside the
    typical buffer size.
  
    This caused some regressions after my previous commit to the TTY code,
    which allows pseudo-devices to resize the buffers as well.
  
    Reported by:  yongari, dougb

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/rc.subr
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/syscons/scterm-teken.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/tty.c
  stable/8/sys/sys/ttyqueue.h
  stable/8/usr.sbin/jail/   (props changed)
  stable/8/usr.sbin/jail/jail.8

Modified: stable/8/etc/rc.subr
==============================================================================
--- stable/8/etc/rc.subr	Sun Nov  1 10:01:39 2009	(r198744)
+++ stable/8/etc/rc.subr	Sun Nov  1 10:30:30 2009	(r198745)
@@ -565,7 +565,7 @@ run_rc_command()
 		rc_fast=yes
 		rc_quiet=yes
 		;;
-	force*)				# "force prefix; always run
+	force*)				# "force" prefix; always run
 		rc_force=yes
 		_rc_prefix=force
 		rc_arg=${rc_arg#${_rc_prefix}}

Modified: stable/8/sys/dev/syscons/scterm-teken.c
==============================================================================
--- stable/8/sys/dev/syscons/scterm-teken.c	Sun Nov  1 10:01:39 2009	(r198744)
+++ stable/8/sys/dev/syscons/scterm-teken.c	Sun Nov  1 10:30:30 2009	(r198745)
@@ -130,9 +130,12 @@ scteken_init(scr_stat *scp, void **softc
 		tp.tp_col = scp->xsize;
 		teken_set_winsize(&ts->ts_teken, &tp);
 
-		tp.tp_row = scp->cursor_pos / scp->xsize;
-		tp.tp_col = scp->cursor_pos % scp->xsize;
-		teken_set_cursor(&ts->ts_teken, &tp);
+		if (scp->cursor_pos < scp->ysize * scp->xsize) {
+			/* Valid old cursor position. */
+			tp.tp_row = scp->cursor_pos / scp->xsize;
+			tp.tp_col = scp->cursor_pos % scp->xsize;
+			teken_set_cursor(&ts->ts_teken, &tp);
+		}
 		break;
 	}
 

Modified: stable/8/sys/kern/tty.c
==============================================================================
--- stable/8/sys/kern/tty.c	Sun Nov  1 10:01:39 2009	(r198744)
+++ stable/8/sys/kern/tty.c	Sun Nov  1 10:30:30 2009	(r198745)
@@ -109,14 +109,14 @@ tty_watermarks(struct tty *tp)
 	ttyinq_setsize(&tp->t_inq, tp, bs);
 
 	/* Set low watermark at 10% (when 90% is available). */
-	tp->t_inlow = (ttyinq_getsize(&tp->t_inq) * 9) / 10;
+	tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10;
 
 	/* Provide an ouput buffer for 0.2 seconds of data. */
 	bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX);
 	ttyoutq_setsize(&tp->t_outq, tp, bs);
 
 	/* Set low watermark at 10% (when 90% is available). */
-	tp->t_outlow = (ttyoutq_getsize(&tp->t_outq) * 9) / 10;
+	tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10;
 }
 
 static int
@@ -523,6 +523,34 @@ ttydev_ioctl(struct cdev *dev, u_long cm
 			goto done;
 	}
 
+	if (cmd == TIOCSETA || cmd == TIOCSETAW || cmd == TIOCSETAF) {
+		struct termios *old = &tp->t_termios;
+		struct termios *new = (struct termios *)data;
+		struct termios *lock = TTY_CALLOUT(tp, dev) ?
+		    &tp->t_termios_lock_out : &tp->t_termios_lock_in;
+		int cc;
+
+		/*
+		 * Lock state devices.  Just overwrite the values of the
+		 * commands that are currently in use.
+		 */
+		new->c_iflag = (old->c_iflag & lock->c_iflag) |
+		    (new->c_iflag & ~lock->c_iflag);
+		new->c_oflag = (old->c_oflag & lock->c_oflag) |
+		    (new->c_oflag & ~lock->c_oflag);
+		new->c_cflag = (old->c_cflag & lock->c_cflag) |
+		    (new->c_cflag & ~lock->c_cflag);
+		new->c_lflag = (old->c_lflag & lock->c_lflag) |
+		    (new->c_lflag & ~lock->c_lflag);
+		for (cc = 0; cc < NCCS; ++cc)
+			if (lock->c_cc[cc])
+				new->c_cc[cc] = old->c_cc[cc];
+		if (lock->c_ispeed)
+			new->c_ispeed = old->c_ispeed;
+		if (lock->c_ospeed)
+			new->c_ospeed = old->c_ospeed;
+	}
+
 	error = tty_ioctl(tp, cmd, data, td);
 done:	tty_unlock(tp);
 

Modified: stable/8/sys/sys/ttyqueue.h
==============================================================================
--- stable/8/sys/sys/ttyqueue.h	Sun Nov  1 10:01:39 2009	(r198744)
+++ stable/8/sys/sys/ttyqueue.h	Sun Nov  1 10:30:30 2009	(r198745)
@@ -93,6 +93,13 @@ ttyinq_getsize(struct ttyinq *ti)
 }
 
 static __inline size_t
+ttyinq_getallocatedsize(struct ttyinq *ti)
+{
+
+	return (ti->ti_quota * TTYINQ_DATASIZE);
+}
+
+static __inline size_t
 ttyinq_bytesleft(struct ttyinq *ti)
 {
 	size_t len;
@@ -143,6 +150,13 @@ ttyoutq_getsize(struct ttyoutq *to)
 }
 
 static __inline size_t
+ttyoutq_getallocatedsize(struct ttyoutq *to)
+{
+
+	return (to->to_quota * TTYOUTQ_DATASIZE);
+}
+
+static __inline size_t
 ttyoutq_bytesleft(struct ttyoutq *to)
 {
 	size_t len;

Modified: stable/8/usr.sbin/jail/jail.8
==============================================================================
--- stable/8/usr.sbin/jail/jail.8	Sun Nov  1 10:01:39 2009	(r198744)
+++ stable/8/usr.sbin/jail/jail.8	Sun Nov  1 10:30:30 2009	(r198745)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 25, 2009
+.Dd October 18, 2009
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -377,7 +377,7 @@ Since raw sockets can be used to configu
 network subsystems, extra caution should be used where privileged access
 to jails is given out to untrusted parties.
 .It Va allow.chflags
-Normally, priveleged users inside a jail are treated as unprivileged by
+Normally, privileged users inside a jail are treated as unprivileged by
 .Xr chflags 2 .
 When this parameter is set, such users are treated as privileged, and
 may manipulate system file flags subject to the usual constraints on


More information about the svn-src-all mailing list