Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Mar 2020 02:55:05 +0000 (UTC)
From:      Larry Rosenman <ler@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r527995 - in head/sysutils/lsof: . files
Message-ID:  <202003080255.0282t5WK045197@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ler
Date: Sun Mar  8 02:55:04 2020
New Revision: 527995
URL: https://svnweb.freebsd.org/changeset/ports/527995

Log:
  sysutils/lsof: fix compile on 13-CURRENT
  
  Submitted by:	mjg

Modified:
  head/sysutils/lsof/Makefile
  head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c

Modified: head/sysutils/lsof/Makefile
==============================================================================
--- head/sysutils/lsof/Makefile	Sun Mar  8 02:37:32 2020	(r527994)
+++ head/sysutils/lsof/Makefile	Sun Mar  8 02:55:04 2020	(r527995)
@@ -6,7 +6,7 @@
 
 PORTNAME=	lsof
 DISTVERSION=	4.93.2
-PORTREVISION=	9
+PORTREVISION=	10
 PORTEPOCH=	8
 CATEGORIES=	sysutils
 

Modified: head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c
==============================================================================
--- head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c	Sun Mar  8 02:37:32 2020	(r527994)
+++ head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c	Sun Mar  8 02:55:04 2020	(r527995)
@@ -1,6 +1,98 @@
 --- dialects/freebsd/dproc.c.orig	2019-05-08 07:32:25 UTC
 +++ dialects/freebsd/dproc.c
-@@ -655,7 +655,29 @@ kread(addr, buf, len)
+@@ -37,6 +37,14 @@ static char *rcsid = "$Id: dproc.c,v 1.20 2018/02/14 1
+ 
+ #include "lsof.h"
+ 
++/*
++ * This is not an exact version but it should not matter. At worst there
++ * is a small version window where this lsof does not compile on older
++ * -CURRENT.
++ */
++#if __FreeBSD_version >= 1300081
++#define HAS_PWD
++#endif
+ 
+ _PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
+ _PROTOTYPE(static void get_kernel_access,(void));
+@@ -132,6 +140,15 @@ gather_proc_info()
+ 	KA_T fa;
+ #endif	/* defined(HAS_FDESCENTTBL) */
+ 
++#if	defined(HAS_PWD)
++	struct pwd pwd;
++	KA_T pwd_addr;
++#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 +329,22 @@ gather_proc_info()
+ 		continue;
+ #endif	/* defined(HAS_FDESCENTTBL) */
+ 
++#if	defined(HAS_PWD)
++	    cdir = rdir = jdir = NULL;
++	    pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
++	    if (pwd_addr != 0) {
++		    if (!kread(pwd_addr, (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 +380,20 @@ gather_proc_info()
+ 	/*
+ 	 * 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 +402,10 @@ gather_proc_info()
+ 	/*
+ 	 * 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();
+ 	    }
+@@ -655,7 +688,29 @@ kread(addr, buf, len)
  	return((br == len) ? 0 : 1);
  }
  
@@ -30,7 +122,7 @@
  /*
   * process_text() - process text information
   */
-@@ -682,20 +704,15 @@ process_text(vm)
+@@ -682,20 +737,15 @@ process_text(vm)
  /*
   * Read the vm_map structure.  Search its vm_map_entry structure list.
   */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003080255.0282t5WK045197>