Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode use write instead of putchar putchar putch...



details:   https://anonhg.NetBSD.org/src/rev/0f31015cc840
branches:  trunk
changeset: 772034:0f31015cc840
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Dec 15 01:04:14 2011 +0000

description:
use write instead of putchar putchar putchar putchar putchar ... for console output

diffstat:

 sys/arch/usermode/dev/ttycons.c    |  12 +++++-------
 sys/arch/usermode/include/thunk.h  |   3 ++-
 sys/arch/usermode/usermode/thunk.c |  10 ++++++++--
 3 files changed, 15 insertions(+), 10 deletions(-)

diffs (88 lines):

diff -r 50499be7066e -r 0f31015cc840 sys/arch/usermode/dev/ttycons.c
--- a/sys/arch/usermode/dev/ttycons.c   Thu Dec 15 00:40:03 2011 +0000
+++ b/sys/arch/usermode/dev/ttycons.c   Thu Dec 15 01:04:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycons.c,v 1.11 2011/12/12 17:07:42 jmcneill Exp $ */
+/* $NetBSD: ttycons.c,v 1.12 2011/12/15 01:04:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.11 2011/12/12 17:07:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.12 2011/12/15 01:04:15 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -301,8 +301,8 @@
 static void
 ttycons_start(struct tty *t)
 {
-       u_char buf[64+1];
-       int s, len, i;
+       u_char buf[80+1];
+       int s, len; //, i;
 
        s = spltty();
        if (t->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) {
@@ -313,9 +313,7 @@
        splx(s);
 
        len = q_to_b(&t->t_outq, buf, sizeof(buf) - 1);
-       for (i = 0; i < len; i++) {
-               thunk_putchar(buf[i]);
-       }
+       thunk_write(1, buf, len);
 
        s = spltty();
        t->t_state &= ~TS_BUSY;
diff -r 50499be7066e -r 0f31015cc840 sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Thu Dec 15 00:40:03 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Thu Dec 15 01:04:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.38 2011/12/15 00:40:03 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.39 2011/12/15 01:04:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -103,6 +103,7 @@
 int    thunk_fstat_getsize(int, ssize_t *, ssize_t *);
 ssize_t        thunk_pread(int, void *, size_t, off_t);
 ssize_t        thunk_pwrite(int, const void *, size_t, off_t);
+ssize_t        thunk_write(int, const void *, size_t);
 int    thunk_fsync(int);
 int    thunk_mkstemp(char *);
 int    thunk_unlink(const char *);
diff -r 50499be7066e -r 0f31015cc840 sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Thu Dec 15 00:40:03 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Thu Dec 15 01:04:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.44 2011/12/15 00:40:03 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.45 2011/12/15 01:04:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.44 2011/12/15 00:40:03 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.45 2011/12/15 01:04:14 jmcneill Exp $");
 #endif
 
 #include <sys/types.h>
@@ -410,6 +410,12 @@
        return pwrite(d, buf, nbytes, offset);
 }
 
+ssize_t
+thunk_write(int d, const void *buf, size_t nbytes)
+{
+       return write(d, buf, nbytes);
+}
+
 int
 thunk_fsync(int fd)
 {



Home | Main Index | Thread Index | Old Index