Source-Changes-HG archive

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

[src/trunk]: src/sys/kern fix bogus uio->uio_offset check introduced in rev. ...



details:   https://anonhg.NetBSD.org/src/rev/970cb4aa3490
branches:  trunk
changeset: 512821:970cb4aa3490
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Jul 17 18:18:52 2001 +0000

description:
fix bogus uio->uio_offset check introduced in rev. 1.5, which effectively
disabled loans for writes (a.k.a "direct write"), oops; use uio->uio_resid
for the check instead

don't bother updating uio->uio_offset in pipe_direct_write(), it's not used
by upper layers anyway

diffstat:

 sys/kern/sys_pipe.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r e4f7bc6e0190 -r 970cb4aa3490 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c       Tue Jul 17 17:46:42 2001 +0000
+++ b/sys/kern/sys_pipe.c       Tue Jul 17 18:18:52 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_pipe.c,v 1.6 2001/07/17 06:05:28 jdolecek Exp $    */
+/*     $NetBSD: sys_pipe.c,v 1.7 2001/07/17 18:18:52 jdolecek Exp $    */
 
 /*
  * Copyright (c) 1996 John S. Dyson
@@ -1128,8 +1128,8 @@
                return (error);
        }
 
-       uio->uio_offset += bcnt;
        uio->uio_resid  -= bcnt;
+       /* uio_offset not updated, not set/uset for write(2) */
 
        return (0);
 }
@@ -1222,7 +1222,7 @@
                 * away on us.
                 */
                if ((uio->uio_iov[0].iov_len >= PIPE_MINDIRECT) &&
-                   (uio->uio_offset == 0) &&
+                   (uio->uio_resid == orig_resid) &&
                    (fp->f_flag & FNONBLOCK) == 0 &&
                    (wpipe->pipe_map.kva || (amountpipekva < limitpipekva))) {
                        error = pipe_direct_write(wpipe, uio);



Home | Main Index | Thread Index | Old Index