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

From: Mateusz Guzik <mjguzik_at_gmail.com>
Date: Wed, 4 Mar 2020 22:29:48 +0100
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
_at__at_ -37,7 +37,9 _at__at_

 #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));
_at__at_ -132,6 +134,14 _at__at_
 	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;
_at__at_ -312,6 +322,21 _at__at_
 		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.
 	 */
_at__at_ -347,20 +372,20 _at__at_
 	/*
 	 * 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();
 	    }
_at__at_ -369,10 +394,10 _at__at_
 	/*
 	 * 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>
Received on Wed Mar 04 2020 - 20:29:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:23 UTC