Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/miscfs/kernfs Pull up revision 1.84 (requested by j...



details:   https://anonhg.NetBSD.org/src/rev/eb6d62834039
branches:  netbsd-1-6
changeset: 529166:eb6d62834039
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Oct 14 00:06:29 2002 +0000

description:
Pull up revision 1.84 (requested by jdolecek in ticket #911):
put back the while loop in kernfs_getattr() removed in rev 1.82; it's
necessary to get the whole file length e.g. for msgbuf
this fixes the '/kern/msgbuf & less' problem reported on port-i386
by Dave Tyson

diffstat:

 sys/miscfs/kernfs/kernfs_vnops.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r fafb4f90f937 -r eb6d62834039 sys/miscfs/kernfs/kernfs_vnops.c
--- a/sys/miscfs/kernfs/kernfs_vnops.c  Mon Oct 14 00:04:36 2002 +0000
+++ b/sys/miscfs/kernfs/kernfs_vnops.c  Mon Oct 14 00:06:29 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vnops.c,v 1.79.10.1 2002/07/21 00:52:37 lukem Exp $     */
+/*     $NetBSD: kernfs_vnops.c,v 1.79.10.2 2002/10/14 00:06:29 lukem Exp $     */
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.79.10.1 2002/07/21 00:52:37 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.79.10.2 2002/10/14 00:06:29 lukem Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -497,7 +497,7 @@
                vap->va_size = DEV_BSIZE;
        } else {
                const struct kern_target *kt = VTOKERN(vp)->kf_kt;
-               size_t total;
+               size_t nread, total;
 #ifdef KERNFS_DIAGNOSTIC
                printf("kernfs_getattr: stat target %s\n", kt->kt_name);
 #endif
@@ -505,10 +505,14 @@
                vap->va_mode = kt->kt_mode;
                vap->va_nlink = 1;
                vap->va_fileid = 1 + (kt - kern_targets);
-               buf = strbuf;
-               if (0 == (error = kernfs_xread(kt, 0, &buf,
-                               sizeof(strbuf), &total)))
-                       vap->va_size = total;
+               total = 0;
+               do {
+                       buf = strbuf;
+                       error = kernfs_xread(kt, total, &buf,
+                               sizeof(strbuf), &nread);
+                       total += nread;
+               } while (error == 0 && nread != 0);
+               vap->va_size = total;
        }
 
 #ifdef KERNFS_DIAGNOSTIC



Home | Main Index | Thread Index | Old Index