Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 pull over from sparc port's mem.c:



details:   https://anonhg.NetBSD.org/src/rev/9135f6b78682
branches:  trunk
changeset: 499349:9135f6b78682
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Nov 17 23:18:53 2000 +0000

description:
pull over from sparc port's mem.c:
>revision 1.26
>date: 2000/11/13 15:31:44;  author: pk;  state: Exp;  lines: +10 -1
>Detect "EOF" conditions on the memory-special files.

diffstat:

 sys/arch/sparc64/sparc64/mem.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r 18b033210a30 -r 9135f6b78682 sys/arch/sparc64/sparc64/mem.c
--- a/sys/arch/sparc64/sparc64/mem.c    Fri Nov 17 22:47:30 2000 +0000
+++ b/sys/arch/sparc64/sparc64/mem.c    Fri Nov 17 23:18:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.15 2000/07/27 13:59:26 mrg Exp $ */
+/*     $NetBSD: mem.c,v 1.16 2000/11/17 23:18:53 mrg Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -113,6 +113,7 @@
                physlock = 1;
        }
        while (uio->uio_resid > 0 && error == 0) {
+               int n;
                iov = uio->uio_iov;
                if (iov->iov_len == 0) {
                        uio->uio_iov++;
@@ -121,6 +122,10 @@
                                panic("mmrw");
                        continue;
                }
+
+               /* Note how much is still to go */
+               n = uio->uio_resid;
+
                switch (minor(dev)) {
 
                /* minor device 0 is physical memory */
@@ -258,6 +263,10 @@
                default:
                        return (ENXIO);
                }
+
+               /* If we didn't make any progress (i.e. EOF), we're done here */
+               if (n == uio->uio_resid)
+                       break;
        }
        if (minor(dev) == 0) {
 unlock:



Home | Main Index | Thread Index | Old Index