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

Collapse All | Expand All

(-)sysutils/lsof/Makefile (-2 / +1 lines)
Lines 5-12 Link Here
5
#       to commit it.  I (ler) don't have access to all the ARCH's
5
#       to commit it.  I (ler) don't have access to all the ARCH's
6
6
7
PORTNAME=	lsof
7
PORTNAME=	lsof
8
DISTVERSION=	4.93.2
8
DISTVERSION=	4.94.0
9
PORTREVISION=	14
10
PORTEPOCH=	8
9
PORTEPOCH=	8
11
CATEGORIES=	sysutils
10
CATEGORIES=	sysutils
12
11
(-)sysutils/lsof/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1557404723
1
TIMESTAMP = 1605257406
2
SHA256 (lsof-org-lsof-4.93.2_GH0.tar.gz) = 3df912bd966fc24dc73ddea3e36a61d79270b21b085936a4caabca56e5b486a2
2
SHA256 (lsof-org-lsof-4.94.0_GH0.tar.gz) = a9865eeb581c3abaac7426962ddb112ecfd86a5ae93086eb4581ce100f8fa8f4
3
SIZE (lsof-org-lsof-4.93.2_GH0.tar.gz) = 1319222
3
SIZE (lsof-org-lsof-4.94.0_GH0.tar.gz) = 1340224
(-)sysutils/lsof/files/patch-Configure (-11 lines)
Lines 1-11 Link Here
1
--- Configure.orig	2019-05-22 14:43:59 UTC
2
+++ Configure
3
@@ -1639,7 +1639,7 @@ kernel generation process.
4
     # Clear LSOF_UNSUP message for supported versions of FreeBSD.
5
     
6
     case $LSOF_VERS in  # {
7
-    4090|8020|8030|8040|9000|10000|11000|12000)
8
+    4090|8020|8030|8040|9000|10000|11000|12000|13000)
9
       LSOF_UNSUP=""
10
       ;;
11
     esac	# }
(-)sysutils/lsof/files/patch-dialects-freebsd-dlsof.h (-36 / +2 lines)
Lines 1-40 Link Here
1
--- dialects/freebsd/dlsof.h.orig	2019-05-08 07:32:25 UTC
1
--- dialects/freebsd/dlsof.h.orig	2020-11-10 19:00:21 UTC
2
+++ dialects/freebsd/dlsof.h
2
+++ dialects/freebsd/dlsof.h
3
@@ -38,6 +38,7 @@
3
@@ -663,9 +663,15 @@ struct sfile {
4
 #if	!defined(FREEBSD_LSOF_H)
5
 #define	FREEBSD_LSOF_H	1
6
 
7
+#include <stddef.h>
8
 #include <stdlib.h>
9
 #include <dirent.h>
10
 #include <nlist.h>
11
@@ -45,6 +46,12 @@
12
 #include <signal.h>
13
 #include <unistd.h>
14
 
15
+#if    FREEBSDV>=13000
16
+/* This header is a huge mess.  Please don't support EOL FreeBSD releases. */
17
+#define        _KERNEL 1
18
+#include <sys/_lock.h>
19
+#undef _KERNEL
20
+#endif         /* FREEBSDV>=13000 */
21
 # if	FREEBSDV>=4000
22
 #  if	FREEBSDV>=5000
23
 #   if	FREEBSDV<6020
24
@@ -105,6 +112,12 @@ typedef	struct device	*device_t;
25
 
26
 #include <sys/conf.h>
27
 
28
+/* 
29
+ * include <stdbool.h> for refcount(9)
30
+ */
31
+#include <stdbool.h>
32
+ 
33
+
34
 #  if	defined(HAS_VM_MEMATTR_T)
35
 #undef	vm_memattr_t
36
 #  endif	/* defined(HAS_VM_MEMATTR_T) */
37
@@ -652,9 +665,15 @@ struct sfile {
38
  */
4
  */
39
 
5
 
40
 struct	namecache {
6
 struct	namecache {
(-)sysutils/lsof/files/patch-dialects_freebsd_dnode.c (-21 lines)
Lines 1-21 Link Here
1
--- dialects/freebsd/dnode.c.orig	2019-05-08 07:32:25 UTC
2
+++ dialects/freebsd/dnode.c
3
@@ -58,9 +58,7 @@ _PROTOTYPE(static int lkup_dev_tty,(dev_t *dr, INODETY
4
 
5
 
6
 #if	defined(HAS_TMPFS)
7
-#define	_KERNEL
8
 #include <fs/tmpfs/tmpfs.h>
9
-#undef	_KERNEL
10
 #endif	/* defined(HAS_TMPFS) */
11
 
12
 _PROTOTYPE(static void get_lock_state,(KA_T f));
13
@@ -562,7 +560,7 @@ process_overlaid_node:
14
  * Get the pseudo vnode tag type for FreeBSD >= 5.
15
  */
16
 	vtag = VT_UNKNOWN;
17
-	if (v->v_tag && !kread((KA_T)v->v_tag, (char *)&vtbuf, sizeof(vtbuf)))
18
+	if (!kread((KA_T)v->v_lock.lock_object.lo_name, (char *)&vtbuf, sizeof(vtbuf)))
19
 	{
20
 	    vtbuf[sizeof(vtbuf) - 1] = '\0';
21
 	    vtbp = vtbuf;
(-)sysutils/lsof/files/patch-dialects_freebsd_dnode2.c (-17 lines)
Lines 1-17 Link Here
1
--- dialects/freebsd/dnode2.c.orig	2019-05-08 07:32:25 UTC
2
+++ dialects/freebsd/dnode2.c
3
@@ -49,7 +49,13 @@ static char *rcsid = "$Id: dnode2.c,v 1.7 2018/02/14 1
4
  *
5
  * Note: clang's complaint about VOP_FSYNC can't be avoided.
6
  */
7
-#define	VOP_UNLOCK(vp, f)	((void)0)
8
+#include <sys/param.h>
9
+#if __FreeBSD_version >= 1300074
10
+#define VOP_UNLOCK_FLAGS(vp, f) ((void)0)
11
+#define VOP_UNLOCK(vp)  ((void)0)
12
+#else
13
+#define VOP_UNLOCK(vp, f)       ((void)0)
14
+#endif
15
 # endif	/* defined(__clang__) */
16
 
17
 #define	KLD_MODULE		/* for ARM: prevent "ARM_NARCH is 0 " error */
(-)sysutils/lsof/files/patch-dialects_freebsd_dproc.c (-155 / +12 lines)
Lines 1-157 Link Here
1
--- dialects/freebsd/dproc.c.orig	2019-05-08 07:32:25 UTC
1
--- dialects/freebsd/dproc.c.orig	2020-11-10 19:00:21 UTC
2
+++ dialects/freebsd/dproc.c
2
+++ dialects/freebsd/dproc.c
3
@@ -37,6 +37,14 @@ static char *rcsid = "$Id: dproc.c,v 1.20 2018/02/14 1
3
@@ -330,7 +330,11 @@ gather_proc_info()
4
 
4
 
5
 #include "lsof.h"
5
 #if	defined(HAS_PWD)
6
 
6
 	    cdir = rdir = jdir = NULL;
7
+/*
7
+#if       __FreeBSD_version >= 1300130
8
+ * This is not an exact version but it should not matter. At worst there
8
+	    pwd_addr = (KA_T)PWDDESC_KVM_LOAD_PWD(&fd);
9
+ * is a small version window where this lsof does not compile on older
9
+#else   /* __FreeBSD_version >= 1300130 */
10
+ * -CURRENT.
10
 	    pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
11
+ */
11
+#endif  /* __FreeBSD_version >= 1300130 */
12
+#if __FreeBSD_version >= 1300081
12
 	    if (pwd_addr != 0) {
13
+#define HAS_PWD
13
 		    if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) {
14
+#endif
14
 			    cdir = pwd.pwd_cdir;
15
 
16
 _PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
17
 _PROTOTYPE(static void get_kernel_access,(void));
18
@@ -132,6 +140,15 @@ gather_proc_info()
19
 	KA_T fa;
20
 #endif	/* defined(HAS_FDESCENTTBL) */
21
 
22
+#if	defined(HAS_PWD)
23
+	struct pwd pwd;
24
+	KA_T pwd_addr;
25
+#endif	/* defined(HAS_FDESCENTTBL) */
26
+
27
+	struct vnode *cdir;
28
+	struct vnode *rdir;
29
+	struct vnode *jdir;
30
+
31
 	static ofb_t *ofb = NULL;
32
 	static int ofbb = 0;
33
 	int pgid, pid;
34
@@ -305,13 +322,29 @@ gather_proc_info()
35
 	    if (!fd.fd_files
36
 	    ||  kread((KA_T)fd.fd_files, (char *)&fdt, sizeof(fdt)))
37
 		continue;
38
-	    if (!fd.fd_refcnt || fd.fd_lastfile > fdt.fdt_nfiles)
39
+	    if (!fd.fd_refcnt)
40
 		continue;
41
 #else	/* !defined(HAS_FDESCENTTBL) */
42
 	    if (!fd.fd_refcnt || fd.fd_lastfile > fd.fd_nfiles)
43
 		continue;
44
 #endif	/* defined(HAS_FDESCENTTBL) */
45
 
46
+#if	defined(HAS_PWD)
47
+	    cdir = rdir = jdir = NULL;
48
+	    pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
49
+	    if (pwd_addr != 0) {
50
+		    if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) {
51
+			    cdir = pwd.pwd_cdir;
52
+			    rdir = pwd.pwd_rdir;
53
+			    jdir = pwd.pwd_jdir;
54
+		    }
55
+	    }
56
+#else
57
+	    cdir = fd.fd_cdir;
58
+	    rdir = fd.fd_rdir;
59
+	    jdir = fd.fd_jdir;
60
+#endif
61
+
62
 	/*
63
 	 * Allocate a local process structure.
64
 	 */
65
@@ -347,20 +380,20 @@ gather_proc_info()
66
 	/*
67
 	 * Save current working directory information.
68
 	 */
69
-	    if (!ckscko && fd.fd_cdir) {
70
+	    if (!ckscko && cdir) {
71
 		alloc_lfile(CWD, -1);
72
 		Cfp = (struct file *)NULL;
73
-		process_node((KA_T)fd.fd_cdir);
74
+		process_node((KA_T)cdir);
75
 		if (Lf->sf)
76
 		    link_lfile();
77
 	    }
78
 	/*
79
 	 * Save root directory information.
80
 	 */
81
-	    if (!ckscko && fd.fd_rdir) {
82
+	    if (!ckscko && rdir) {
83
 		alloc_lfile(RTD, -1);
84
 		Cfp = (struct file *)NULL;
85
-		process_node((KA_T)fd.fd_rdir);
86
+		process_node((KA_T)rdir);
87
 		if (Lf->sf)
88
 		    link_lfile();
89
 	    }
90
@@ -369,10 +402,10 @@ gather_proc_info()
91
 	/*
92
 	 * Save jail directory information.
93
 	 */
94
-	    if (!ckscko && fd.fd_jdir) {
95
+	    if (!ckscko && jdir) {
96
 		alloc_lfile("jld", -1);
97
 		Cfp = (struct file *)NULL;
98
-		process_node((KA_T)fd.fd_jdir);
99
+		process_node((KA_T)jdir);
100
 		if (Lf->sf)
101
 		    link_lfile();
102
 	    }
103
@@ -655,7 +688,29 @@ kread(addr, buf, len)
104
 	return((br == len) ? 0 : 1);
105
 }
106
 
107
+static int
108
+vm_map_reader(void *token, vm_map_entry_t addr, vm_map_entry_t dest)
109
+{
110
+	return (kread((KA_T)addr, (char *)dest, sizeof(*dest)));
111
+}
112
 
113
+#if	__FreeBSD_version < 1300060
114
+typedef int vm_map_entry_reader(void *token, vm_map_entry_t addr,
115
+    vm_map_entry_t dest);
116
+
117
+static inline vm_map_entry_t
118
+vm_map_entry_read_succ(void *token, struct vm_map_entry *const clone,
119
+     vm_map_entry_reader reader)
120
+{
121
+	vm_map_entry_t next;
122
+
123
+	next = clone->next;
124
+	if (!reader(token, next, clone))
125
+		return (NULL);
126
+	return (next);
127
+}
128
+#endif	/*  __FreeBSD_version < 1300060 */
129
+
130
 /*
131
  * process_text() - process text information
132
  */
133
@@ -682,20 +737,15 @@ process_text(vm)
134
 /*
135
  * Read the vm_map structure.  Search its vm_map_entry structure list.
136
  */
137
+	vmme = vmsp.vm_map.header;
138
+	e = &vmme;
139
 	for (i = 0; i < vmsp.vm_map.nentries; i++) {
140
 
141
 	/*
142
 	 * Read the next vm_map_entry.
143
 	 */
144
-	    if (i == 0)
145
-		e = &vmsp.vm_map.header;
146
-	    else {
147
-		if (!(ka = (KA_T)e->next))
148
-		    return;
149
-		e = &vmme;
150
-		if (kread(ka, (char *)e, sizeof(vmme)))
151
-		    return;
152
-	    }
153
+	    if (!vm_map_entry_read_succ(NULL, e, vm_map_reader))
154
+		return;
155
 
156
 #if	defined(MAP_ENTRY_IS_A_MAP)
157
 	    if (e->eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
(-)sysutils/lsof/files/patch-dialects_freebsd_dsock.c (-11 lines)
Lines 1-11 Link Here
1
--- dialects/freebsd/dsock.c.orig	2019-05-08 07:32:25 UTC
2
+++ dialects/freebsd/dsock.c
3
@@ -182,7 +182,7 @@ process_socket(sa)
4
 #endif	/* FREEBSDV<4050 */
5
 
6
 #if	defined(HASIPv6) && !defined(HASINRIAIPv6)
7
-	struct in6pcb in6p;
8
+	struct inpcb in6p;
9
 #endif	/* defined(HASIPv6) && !defined(HASINRIAIPv6) */
10
 
11
 	(void) snpf(Lf->type, sizeof(Lf->type), "sock");

Return to bug 251096