Index: head/sysutils/lsof/Makefile =================================================================== --- head/sysutils/lsof/Makefile (revision 563402) +++ head/sysutils/lsof/Makefile (revision 563403) @@ -1,66 +1,64 @@ # Created by: David O'Brien # $FreeBSD$ # note: If someone has a fix for a particular ARCH please feel free # to commit it. I (ler) don't have access to all the ARCH's PORTNAME= lsof -DISTVERSION= 4.93.2 -PORTREVISION= 14 +DISTVERSION= 4.94.0 PORTEPOCH= 8 CATEGORIES= sysutils MAINTAINER= ler@FreeBSD.org COMMENT= Lists information about open files (similar to fstat(1)) LICENSE= lsof LICENSE_NAME= lsof LICENSE_FILE= ${FILESDIR}/LICENSE LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept USES= compiler shebangfix tar:bzip2 HAS_CONFIGURE= yes USE_GITHUB= yes GH_ACCOUNT= lsof-org OPTIONS_DEFINE_powerpc64= AIM BOOKE OPTIONS_DEFAULT_powerpc64= AIM AIM_DESC= Set for AIM hardware AIM_CFLAGS= -DAIM BOOKE_DESC= Set for BOOKE hardware BOOKE_CFLAGS= -DBOOKE -CFLAGS+= -fcommon CFLAGS_powerpc= -DAIM CFLAGS_powerpcspe= -DBOOKE SHEBANG_FILES= scripts/sort_res.perl5 .include CONFIGURE_SCRIPT= Configure CONFIGURE_ARGS= -n freebsd CONFIGURE_ENV= LSOF_CC="${CC}" FREEBSD_SYS="${SRC_BASE}/sys" # GCC needs -lzfs -lzpool for reasons unknown. If someone can # figure out why, I (ler) am all ears. .if ${CHOSEN_COMPILER_TYPE} == gcc CONFIGURE_ENV+= LSOF_CFGL="-lzfs -lzpool" . endif .if !exists(${SRC_BASE}/sys/kern/kern_lockf.c) IGNORE+= requires kernel sources .endif do-install: ${INSTALL_PROGRAM} ${WRKSRC}/lsof ${STAGEDIR}${PREFIX}/sbin (cd ${WRKSRC} && /usr/bin/soelim Lsof.8 > ${WRKSRC}/lsof.8) ${INSTALL_MAN} ${WRKSRC}/lsof.8 ${STAGEDIR}${MAN8PREFIX}/man/man8/lsof.8 @${MKDIR} ${STAGEDIR}${PREFIX}/share/lsof ${INSTALL_SCRIPT} ${WRKSRC}/scripts/* ${STAGEDIR}${PREFIX}/share/lsof @${CHMOD} 0444 ${STAGEDIR}${PREFIX}/share/lsof/00* .include Index: head/sysutils/lsof/distinfo =================================================================== --- head/sysutils/lsof/distinfo (revision 563402) +++ head/sysutils/lsof/distinfo (revision 563403) @@ -1,3 +1,3 @@ -TIMESTAMP = 1557404723 -SHA256 (lsof-org-lsof-4.93.2_GH0.tar.gz) = 3df912bd966fc24dc73ddea3e36a61d79270b21b085936a4caabca56e5b486a2 -SIZE (lsof-org-lsof-4.93.2_GH0.tar.gz) = 1319222 +TIMESTAMP = 1605257406 +SHA256 (lsof-org-lsof-4.94.0_GH0.tar.gz) = a9865eeb581c3abaac7426962ddb112ecfd86a5ae93086eb4581ce100f8fa8f4 +SIZE (lsof-org-lsof-4.94.0_GH0.tar.gz) = 1340224 Index: head/sysutils/lsof/files/patch-dialects_freebsd_dnode.c =================================================================== --- head/sysutils/lsof/files/patch-dialects_freebsd_dnode.c (revision 563402) +++ head/sysutils/lsof/files/patch-dialects_freebsd_dnode.c (nonexistent) @@ -1,21 +0,0 @@ ---- dialects/freebsd/dnode.c.orig 2019-05-08 07:32:25 UTC -+++ dialects/freebsd/dnode.c -@@ -58,9 +58,7 @@ _PROTOTYPE(static int lkup_dev_tty,(dev_t *dr, INODETY - - - #if defined(HAS_TMPFS) --#define _KERNEL - #include --#undef _KERNEL - #endif /* defined(HAS_TMPFS) */ - - _PROTOTYPE(static void get_lock_state,(KA_T f)); -@@ -562,7 +560,7 @@ process_overlaid_node: - * Get the pseudo vnode tag type for FreeBSD >= 5. - */ - vtag = VT_UNKNOWN; -- if (v->v_tag && !kread((KA_T)v->v_tag, (char *)&vtbuf, sizeof(vtbuf))) -+ if (!kread((KA_T)v->v_lock.lock_object.lo_name, (char *)&vtbuf, sizeof(vtbuf))) - { - vtbuf[sizeof(vtbuf) - 1] = '\0'; - vtbp = vtbuf; Property changes on: head/sysutils/lsof/files/patch-dialects_freebsd_dnode.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/lsof/files/patch-dialects_freebsd_dnode2.c =================================================================== --- head/sysutils/lsof/files/patch-dialects_freebsd_dnode2.c (revision 563402) +++ head/sysutils/lsof/files/patch-dialects_freebsd_dnode2.c (nonexistent) @@ -1,17 +0,0 @@ ---- dialects/freebsd/dnode2.c.orig 2019-05-08 07:32:25 UTC -+++ dialects/freebsd/dnode2.c -@@ -49,7 +49,13 @@ static char *rcsid = "$Id: dnode2.c,v 1.7 2018/02/14 1 - * - * Note: clang's complaint about VOP_FSYNC can't be avoided. - */ --#define VOP_UNLOCK(vp, f) ((void)0) -+#include -+#if __FreeBSD_version >= 1300074 -+#define VOP_UNLOCK_FLAGS(vp, f) ((void)0) -+#define VOP_UNLOCK(vp) ((void)0) -+#else -+#define VOP_UNLOCK(vp, f) ((void)0) -+#endif - # endif /* defined(__clang__) */ - - #define KLD_MODULE /* for ARM: prevent "ARM_NARCH is 0 " error */ Property changes on: head/sysutils/lsof/files/patch-dialects_freebsd_dnode2.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/lsof/files/patch-dialects_freebsd_dsock.c =================================================================== --- head/sysutils/lsof/files/patch-dialects_freebsd_dsock.c (revision 563402) +++ head/sysutils/lsof/files/patch-dialects_freebsd_dsock.c (nonexistent) @@ -1,11 +0,0 @@ ---- dialects/freebsd/dsock.c.orig 2019-05-08 07:32:25 UTC -+++ dialects/freebsd/dsock.c -@@ -182,7 +182,7 @@ process_socket(sa) - #endif /* FREEBSDV<4050 */ - - #if defined(HASIPv6) && !defined(HASINRIAIPv6) -- struct in6pcb in6p; -+ struct inpcb in6p; - #endif /* defined(HASIPv6) && !defined(HASINRIAIPv6) */ - - (void) snpf(Lf->type, sizeof(Lf->type), "sock"); Property changes on: head/sysutils/lsof/files/patch-dialects_freebsd_dsock.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/lsof/files/patch-Configure =================================================================== --- head/sysutils/lsof/files/patch-Configure (revision 563402) +++ head/sysutils/lsof/files/patch-Configure (revision 563403) @@ -1,11 +1,22 @@ ---- Configure.orig 2019-05-22 14:43:59 UTC -+++ Configure -@@ -1639,7 +1639,7 @@ kernel generation process. +--- Configure.orig 2020-11-10 11:00:21.000000000 -0800 ++++ Configure 2021-01-29 19:04:42.100811000 -0800 +@@ -1628,6 +1628,10 @@ + LSOF_TSTBIGF=" " + LSOF_VERS=13000 + ;; ++ 14*) ++ LSOF_TSTBIGF=" " ++ LSOF_VERS=14000 ++ ;; + *) + echo Unknown FreeBSD release: `uname -r` + rm -f $LSOF_HLP +@@ -1639,7 +1643,7 @@ # Clear LSOF_UNSUP message for supported versions of FreeBSD. case $LSOF_VERS in # { -- 4090|8020|8030|8040|9000|10000|11000|12000) -+ 4090|8020|8030|8040|9000|10000|11000|12000|13000) +- 4090|8020|8030|8040|9000|10000|11000|12000|13000) ++ 4090|8020|8030|8040|9000|10000|11000|12000|13000|14000) LSOF_UNSUP="" ;; esac # } Index: head/sysutils/lsof/files/patch-dialects-freebsd-dlsof.h =================================================================== --- head/sysutils/lsof/files/patch-dialects-freebsd-dlsof.h (revision 563402) +++ head/sysutils/lsof/files/patch-dialects-freebsd-dlsof.h (revision 563403) @@ -1,52 +1,27 @@ ---- dialects/freebsd/dlsof.h.orig 2019-05-08 07:32:25 UTC +--- dialects/freebsd/dlsof.h.orig 2020-11-10 19:00:21 UTC +++ dialects/freebsd/dlsof.h -@@ -38,6 +38,7 @@ - #if !defined(FREEBSD_LSOF_H) - #define FREEBSD_LSOF_H 1 +@@ -559,7 +559,7 @@ typedef u_long KA_T; + * Global storage definitions (including their structure definitions) + */ -+#include - #include - #include - #include -@@ -45,6 +46,12 @@ - #include - #include +-struct file * Cfp; ++extern struct file * Cfp; -+#if FREEBSDV>=13000 -+/* This header is a huge mess. Please don't support EOL FreeBSD releases. */ -+#define _KERNEL 1 -+#include -+#undef _KERNEL -+#endif /* FREEBSDV>=13000 */ - # if FREEBSDV>=4000 - # if FREEBSDV>=5000 - # if FREEBSDV<6020 -@@ -105,6 +112,12 @@ typedef struct device *device_t; - - #include - -+/* -+ * include for refcount(9) -+ */ -+#include -+ -+ - # if defined(HAS_VM_MEMATTR_T) - #undef vm_memattr_t - # endif /* defined(HAS_VM_MEMATTR_T) */ -@@ -652,9 +665,15 @@ struct sfile { + # if FREEBSDV>=2000 + extern kvm_t *Kd; +@@ -663,9 +663,15 @@ struct sfile { */ struct namecache { +# if __FreeBSD_version < 1202000 || (__FreeBSD_version >= 1300000 && __FreeBSD_version < 1300105) LIST_ENTRY(namecache) nc_hash; /* hash chain */ LIST_ENTRY(namecache) nc_src; /* source vnode list */ TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ +# else + LIST_ENTRY(namecache) nc_src; /* source vnode list */ + TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ + LIST_ENTRY(namecache) nc_hash; /* hash chain */ +# endif struct vnode *nc_dvp; /* vnode of parent of name */ struct vnode *nc_vp; /* vnode the name refers to */ u_char nc_flag; /* flag bits */ Index: head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c =================================================================== --- head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c (revision 563402) +++ head/sysutils/lsof/files/patch-dialects_freebsd_dproc.c (revision 563403) @@ -1,157 +1,24 @@ ---- dialects/freebsd/dproc.c.orig 2019-05-08 07:32:25 UTC +--- dialects/freebsd/dproc.c.orig 2020-11-10 19:00:21 UTC +++ dialects/freebsd/dproc.c -@@ -37,6 +37,14 @@ static char *rcsid = "$Id: dproc.c,v 1.20 2018/02/14 1 +@@ -125,6 +125,9 @@ gather_proc_info() + * streams with eXPORT data, + * where supported */ + struct filedesc fd; ++#if defined(PWDDESC_KVM_LOAD_PWD) ++ struct pwddesc pd; ++#endif /* defined(PWDDESC_KVM_LOAD_PWD) */ + int i, nf; + MALLOC_S nb; - #include "lsof.h" +@@ -330,7 +333,11 @@ gather_proc_info() -+/* -+ * 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; -@@ -305,13 +322,29 @@ gather_proc_info() - if (!fd.fd_files - || kread((KA_T)fd.fd_files, (char *)&fdt, sizeof(fdt))) - continue; -- if (!fd.fd_refcnt || fd.fd_lastfile > fdt.fdt_nfiles) -+ if (!fd.fd_refcnt) - continue; - #else /* !defined(HAS_FDESCENTTBL) */ - if (!fd.fd_refcnt || fd.fd_lastfile > fd.fd_nfiles) - 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); - } - -+static int -+vm_map_reader(void *token, vm_map_entry_t addr, vm_map_entry_t dest) -+{ -+ return (kread((KA_T)addr, (char *)dest, sizeof(*dest))); -+} - -+#if __FreeBSD_version < 1300060 -+typedef int vm_map_entry_reader(void *token, vm_map_entry_t addr, -+ vm_map_entry_t dest); -+ -+static inline vm_map_entry_t -+vm_map_entry_read_succ(void *token, struct vm_map_entry *const clone, -+ vm_map_entry_reader reader) -+{ -+ vm_map_entry_t next; -+ -+ next = clone->next; -+ if (!reader(token, next, clone)) -+ return (NULL); -+ return (next); -+} -+#endif /* __FreeBSD_version < 1300060 */ -+ - /* - * process_text() - process text information - */ -@@ -682,20 +737,15 @@ process_text(vm) - /* - * Read the vm_map structure. Search its vm_map_entry structure list. - */ -+ vmme = vmsp.vm_map.header; -+ e = &vmme; - for (i = 0; i < vmsp.vm_map.nentries; i++) { - - /* - * Read the next vm_map_entry. - */ -- if (i == 0) -- e = &vmsp.vm_map.header; -- else { -- if (!(ka = (KA_T)e->next)) -- return; -- e = &vmme; -- if (kread(ka, (char *)e, sizeof(vmme))) -- return; -- } -+ if (!vm_map_entry_read_succ(NULL, e, vm_map_reader)) -+ return; - - #if defined(MAP_ENTRY_IS_A_MAP) - if (e->eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP)) + #if defined(HAS_PWD) + cdir = rdir = jdir = NULL; ++#if defined(PWDDESC_KVM_LOAD_PWD) ++ pwd_addr = (KA_T)PWDDESC_KVM_LOAD_PWD(&pd); ++#else /* defined(PWDDESC_KVM_LOAD_PWD) */ + pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd); ++#endif /* defened(PWDDESC_KVM_LOAD_PWD) */ + if (pwd_addr != 0) { + if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) { + cdir = pwd.pwd_cdir;