View | Details | Raw Unified | Return to bug 242533 | Differences between
and this patch

Collapse All | Expand All

(-)files/patch-sysdeps_freebsd_procmap.c (-27 / +85 lines)
Lines 1-31 Link Here
1
--- sysdeps/freebsd/procmap.c.orig	2015-08-17 18:59:37 UTC
1
--- sysdeps/freebsd/procmap.c.orig	2017-08-07 18:43:41.000000000 -0400
2
+++ sysdeps/freebsd/procmap.c
2
+++ sysdeps/freebsd/procmap.c	2019-12-17 13:35:07.862105000 -0500
3
@@ -52,6 +52,8 @@
3
@@ -66,7 +66,6 @@
4
 #include <sys/mount.h>
4
 #undef _KERNEL
5
 #include <ufs/ufs/quota.h>
6
 #include <ufs/ufs/inode.h>
7
+#include <ufs/ufs/extattr.h>
8
+#include <ufs/ufs/ufsmount.h>
9
 #include <fs/devfs/devfs.h>
10
 #if (__FreeBSD_version >= 600006) || defined(__FreeBSD_kernel__)
11
 #include <fs/devfs/devfs_int.h>
12
@@ -86,6 +88,8 @@ _glibtop_sysdeps_freebsd_dev_inode (glib
13
         struct cdev_priv priv;
14
 #if __FreeBSD_version < 800039
15
         struct cdev si;
16
+#else
17
+        struct ufsmount um;
18
 #endif
5
 #endif
19
 
6
 
20
         *inum = 0;
7
-
21
@@ -167,7 +171,9 @@ _glibtop_sysdeps_freebsd_dev_inode (glib
8
 #include <sys/ucred.h>
9
 #include <sys/sysctl.h>
22
 
10
 
11
@@ -231,6 +230,21 @@
12
         server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
13
 }
23
 
14
 
24
 #if (__FreeBSD_version >= 800039) || (__FreeBSD_kernel_version >= 800039)
15
+#if (__FreeBSD_version >= 1300062)
25
-        if (kvm_read (server->machine->kd, (gulong) cdev2priv(inode.i_dev), (char *) &priv,
16
+static int
26
+        if (kvm_read (server->machine->kd, (gulong) inode.i_ump, (char *) &um,
17
+procstat_vm_map_reader(void *token, vm_map_entry_t addr, vm_map_entry_t dest)
27
+		      sizeof (um)) != sizeof (um) ||
18
+{
28
+            kvm_read (server->machine->kd, (gulong) cdev2priv(um.um_dev), (char *) &priv,
19
+        kvm_t *kd;
29
 		      sizeof (priv))
20
+        size_t nbytes = sizeof (*dest);
30
 #else
21
+
31
         if (kvm_read (server->machine->kd, (gulong) inode.i_dev, (char *) &si,
22
+        if (nbytes >= SSIZE_MAX)
23
+                return (0);
24
+
25
+        kd = (kvm_t *) token;
26
+        return (kvm_read (kd, (unsigned long) addr, dest, nbytes) == nbytes);
27
+}
28
+#endif
29
+
30
 /* Provides detailed information about a process. */
31
 
32
 glibtop_map_entry *
33
@@ -245,6 +259,10 @@
34
         struct vnode vnode;
35
         int count;
36
         int update = 0;
37
+#if (__FreeBSD_version >= 1300062)
38
+        vm_map_entry_t entryp;
39
+        struct vm_map_entry *entryn;
40
+#endif
41
 
42
         memset (buf, 0, sizeof (glibtop_proc_map));
43
 
44
@@ -273,10 +291,21 @@
45
                 return NULL;
46
         }
47
 
48
+#if (__FreeBSD_version >= 1300062)
49
+        entryn = &vmspace.vm_map.header;
50
+        entryp = vm_map_entry_read_succ (server->machine->kd, entryn,
51
+                                         procstat_vm_map_reader);
52
+	first = entryn;
53
+#else
54
         first = vmspace.vm_map.header.next;
55
+#endif
56
 
57
         if (kvm_read (server->machine->kd,
58
+#if (__FreeBSD_version >= 1300062)
59
+                        (gulong) entryn,
60
+#else
61
                         (gulong) vmspace.vm_map.header.next,
62
+#endif
63
                         (char *) &entry, sizeof (entry)) != sizeof (entry)) {
64
                 glibtop_warn_io_r (server, "kvm_read (entry)");
65
 		glibtop_suid_leave (server);
66
@@ -299,7 +328,11 @@
67
 
68
                 if (update) {
69
                         if (kvm_read (server->machine->kd,
70
+#if (__FreeBSD_version >= 1300062)
71
+                                        (gulong) entryn,
72
+#else
73
                                         (gulong) entry.next,
74
+#endif
75
                                         (char *) &entry, sizeof (entry)) != sizeof (entry)) {
76
                                 glibtop_warn_io_r (server, "kvm_read (entry)");
77
                                 continue;
78
@@ -377,7 +410,11 @@
79
                 if (entry.protection & VM_PROT_EXECUTE)
80
                         mentry->perm |= GLIBTOP_MAP_PERM_EXECUTE;
81
 
82
+#if (__FreeBSD_version >= 1300062)
83
+        } while (entryn != first);
84
+#else
85
         } while (entry.next != first);
86
+#endif
87
 
88
         glibtop_suid_leave (server);
89
 

Return to bug 242533