PERFORCE change 150235 for review

Ed Schouten ed at FreeBSD.org
Sun Sep 21 21:10:03 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=150235

Change 150235 by ed at ed_dull on 2008/09/21 21:09:33

	When the hook doesn't implement rint, but has a rint_bypass
	hook, use a default rint implementation that just converts calls
	to rint_bypass.

Affected files ...

.. //depot/projects/mpsafetty/sys/kern/tty.c#41 edit

Differences ...

==== //depot/projects/mpsafetty/sys/kern/tty.c#41 (text+ko) ====

@@ -1655,6 +1655,16 @@
 		ttydevsw_inwakeup(tp);
 }
 
+static int
+ttyhook_defrint(struct tty *tp, char c, int flags)
+{
+
+	if (ttyhook_rint_bypass(tp, &c, 1) != 1)
+		return (-1);
+	
+	return (0);
+}
+
 int
 ttyhook_register(struct tty **rtp, struct thread *td, int fd,
     struct ttyhook *th, void *softc)
@@ -1700,6 +1710,10 @@
 	/* Maybe we can switch into bypass mode now. */
 	ttydisc_optimize(tp);
 
+	/* Silently convert rint() calls to rint_bypass() when possible. */
+	if (!ttyhook_hashook(tp, rint) && ttyhook_hashook(tp, rint_bypass))
+		th->th_rint = ttyhook_defrint;
+
 done3:	tty_unlock(tp);
 done2:	dev_relthread(dev);
 done1:	fdrop(fp, td);


More information about the p4-projects mailing list