Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/miscfs/procfs Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/034dcc5d26d0
branches:  netbsd-6
changeset: 777176:034dcc5d26d0
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Jul 06 15:28:21 2017 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1434):
        sys/miscfs/procfs/procfs_map.c: revision 1.45
Maps don't change that frequently between reads, so don't give up and
do what linux does (support reading from an offset).

diffstat:

 sys/miscfs/procfs/procfs_map.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (52 lines):

diff -r 11cdbb3b8712 -r 034dcc5d26d0 sys/miscfs/procfs/procfs_map.c
--- a/sys/miscfs/procfs/procfs_map.c    Thu Jul 06 15:27:18 2017 +0000
+++ b/sys/miscfs/procfs/procfs_map.c    Thu Jul 06 15:28:21 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_map.c,v 1.41.8.1 2013/07/29 08:17:55 msaitoh Exp $      */
+/*     $NetBSD: procfs_map.c,v 1.41.8.2 2017/07/06 15:28:21 snj Exp $  */
 
 /*
  * Copyright (c) 1993
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.41.8.1 2013/07/29 08:17:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.41.8.2 2017/07/06 15:28:21 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -124,15 +124,6 @@
        if (uio->uio_rw != UIO_READ)
                return EOPNOTSUPP;
 
-       if (uio->uio_offset != 0) {
-               /*
-                * we return 0 here, so that the second read returns EOF
-                * we don't support reading from an offset because the
-                * map could have changed between the two reads.
-                */
-               return 0;
-       }
-
        error = 0;
 
        if (linuxmode != 0)
@@ -219,7 +210,16 @@
        vm_map_unlock_read(map);
        uvmspace_free(vm);
 
-       error = uiomove(buffer, pos, uio);
+       /*
+        * We support reading from an offset, because linux does.
+        * The map could have changed between the two reads, and
+        * that could result in junk, but typically it does not.
+        */
+       if (uio->uio_offset < pos)
+               error = uiomove(buffer + uio->uio_offset,
+                   pos - uio->uio_offset, uio);
+       else
+               error = 0;
 out:
        if (path != NULL)
                free(path, M_TEMP);



Home | Main Index | Thread Index | Old Index