Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc Detect "EOF" conditions on the memory-s...



details:   https://anonhg.NetBSD.org/src/rev/d9f6637b0631
branches:  trunk
changeset: 499157:d9f6637b0631
user:      pk <pk%NetBSD.org@localhost>
date:      Mon Nov 13 15:31:44 2000 +0000

description:
Detect "EOF" conditions on the memory-special files.

diffstat:

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

diffs (39 lines):

diff -r 57e5878c5abb -r d9f6637b0631 sys/arch/sparc/sparc/mem.c
--- a/sys/arch/sparc/sparc/mem.c        Mon Nov 13 15:24:22 2000 +0000
+++ b/sys/arch/sparc/sparc/mem.c        Mon Nov 13 15:31:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.25 2000/06/29 07:40:11 mrg Exp $ */
+/*     $NetBSD: mem.c,v 1.26 2000/11/13 15:31:44 pk Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -112,6 +112,7 @@
                physlock = 1;
        }
        while (uio->uio_resid > 0 && error == 0) {
+               int n;
                iov = uio->uio_iov;
                if (iov->iov_len == 0) {
                        uio->uio_iov++;
@@ -120,6 +121,10 @@
                                panic("mmrw");
                        continue;
                }
+
+               /* Note how much is still to go */
+               n = uio->uio_resid;
+
                switch (minor(dev)) {
 
                /* minor device 0 is physical memory */
@@ -201,6 +206,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