diff options
| author | Larry Rosenman <ler@FreeBSD.org> | 2020-03-08 02:55:04 +0000 |
|---|---|---|
| committer | Larry Rosenman <ler@FreeBSD.org> | 2020-03-08 02:55:04 +0000 |
| commit | 38c1af28b0b894cc0440e21293439d498a7ce9a2 (patch) | |
| tree | 0a95e11c8078a6a02e6bfaa5113ca4a679256cd9 /sysutils/lsof | |
| parent | databases/py-python-arango: Update 5.2.1 -> 5.3.0 (diff) | |
sysutils/lsof: fix compile on 13-CURRENT
Submitted by: mjg
Notes
Notes:
svn path=/head/; revision=527995
Diffstat (limited to 'sysutils/lsof')
| -rw-r--r-- | sysutils/lsof/Makefile | 2 | ||||
| -rw-r--r-- | sysutils/lsof/files/patch-dialects_freebsd_dproc.c | 96 |
2 files changed, 95 insertions, 3 deletions
diff --git a/sysutils/lsof/Makefile b/sysutils/lsof/Makefile index 193c8899bc37..13816fa0829c 100644 --- a/sysutils/lsof/Makefile +++ b/sysutils/lsof/Makefile @@ -6,7 +6,7 @@ PORTNAME= lsof DISTVERSION= 4.93.2 -PORTREVISION= 9 +PORTREVISION= 10 PORTEPOCH= 8 CATEGORIES= sysutils diff --git a/sysutils/lsof/files/patch-dialects_freebsd_dproc.c b/sysutils/lsof/files/patch-dialects_freebsd_dproc.c index 477f5f6f7dbf..26498fd3f803 100644 --- a/sysutils/lsof/files/patch-dialects_freebsd_dproc.c +++ b/sysutils/lsof/files/patch-dialects_freebsd_dproc.c @@ -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. */ |
