[package - head-amd64-default][sysutils/lsof] Failed for lsof-4.93.2_9,8 in build

Mateusz Guzik mjguzik at gmail.com
Wed Mar 4 21:29:53 UTC 2020


This should do it, it has a blind HAS_PWD define put in which you
should take out for the commit. You can conditionalize HAS_PWD just on
the kernel being -CURRENT. I don't think supporting older versions of
said branch is of significance.

--- dproc.c	2020-03-04 21:29:18.153427000 +0000
+++ /root/dproc.c	2020-03-04 21:24:12.629513000 +0000
@@ -37,7 +37,9 @@

 #include "lsof.h"

+#define HAS_PWD

+
 _PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
 _PROTOTYPE(static void get_kernel_access,(void));
 _PROTOTYPE(static void process_text,(KA_T vm));
@@ -132,6 +134,14 @@
 	KA_T fa;
 #endif	/* defined(HAS_FDESCENTTBL) */

+#if	defined(HAS_PWD)
+	struct pwd pwd;
+#endif	/* defined(HAS_FDESCENTTBL) */
+
+	struct vnode *cdir;
+	struct vnode *rdir;
+	struct vnode *jdir;
+
 	static ofb_t *ofb = NULL;
 	static int ofbb = 0;
 	int pgid, pid;
@@ -312,6 +322,21 @@
 		continue;
 #endif	/* defined(HAS_FDESCENTTBL) */

+#if	defined(HAS_PWD)
+	    cdir = rdir = jdir = NULL;
+	    if (fd.fd_pwd != NULL) {
+		    if (!kread((KA_T)fd.fd_pwd, (char *)&pwd, sizeof(pwd))) {
+			    cdir = pwd.pwd_cdir;
+			    rdir = pwd.pwd_rdir;
+			    jdir = pwd.pwd_jdir;
+		    }
+	    }
+#else
+	    cdir = fd.fd_cdir;
+	    rdir = fd.fd_rdir;
+	    jdir = fd.fd_jdir;
+#endif
+
 	/*
 	 * Allocate a local process structure.
 	 */
@@ -347,20 +372,20 @@
 	/*
 	 * Save current working directory information.
 	 */
-	    if (!ckscko && fd.fd_cdir) {
+	    if (!ckscko && cdir) {
 		alloc_lfile(CWD, -1);
 		Cfp = (struct file *)NULL;
-		process_node((KA_T)fd.fd_cdir);
+		process_node((KA_T)cdir);
 		if (Lf->sf)
 		    link_lfile();
 	    }
 	/*
 	 * Save root directory information.
 	 */
-	    if (!ckscko && fd.fd_rdir) {
+	    if (!ckscko && rdir) {
 		alloc_lfile(RTD, -1);
 		Cfp = (struct file *)NULL;
-		process_node((KA_T)fd.fd_rdir);
+		process_node((KA_T)rdir);
 		if (Lf->sf)
 		    link_lfile();
 	    }
@@ -369,10 +394,10 @@
 	/*
 	 * Save jail directory information.
 	 */
-	    if (!ckscko && fd.fd_jdir) {
+	    if (!ckscko && jdir) {
 		alloc_lfile("jld", -1);
 		Cfp = (struct file *)NULL;
-		process_node((KA_T)fd.fd_jdir);
+		process_node((KA_T)jdir);
 		if (Lf->sf)
 		    link_lfile();
 	    }


-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the freebsd-current mailing list