Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Sep 2008 21:10:02 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 150235 for review
Message-ID:  <200809212110.m8LLA25m032738@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=150235

Change 150235 by ed@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809212110.m8LLA25m032738>