1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-29 10:18:30 +00:00

sysutils/lsof: Update to 4.94

* Update to 4.94.
* Update or remove patches that are included in upstream.
* Fix build with Clang 11 without setting 'CFLAGS+=-fcommon' in Makefile.
* Use new pwddesc structure if applicable.

Change Log: https://github.com/lsof-org/lsof/releases/tag/4.94.0

Submitted by:	Yasuhiro Kimura <yasu@utahime.org>
PR:		251096
MFH:		2021Q1
This commit is contained in:
Dimitry Andric 2021-01-30 13:12:16 +00:00
parent 8797165bf0
commit 5fd66cdfbf
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=563403
8 changed files with 50 additions and 248 deletions

View File

@ -5,8 +5,7 @@
# 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
@ -33,7 +32,6 @@ AIM_CFLAGS= -DAIM
BOOKE_DESC= Set for BOOKE hardware
BOOKE_CFLAGS= -DBOOKE
CFLAGS+= -fcommon
CFLAGS_powerpc= -DAIM
CFLAGS_powerpcspe= -DBOOKE

View File

@ -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

View File

@ -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 # }

View File

@ -1,40 +1,15 @@
--- 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 <stddef.h>
#include <stdlib.h>
#include <dirent.h>
#include <nlist.h>
@@ -45,6 +46,12 @@
#include <signal.h>
#include <unistd.h>
-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 <sys/_lock.h>
+#undef _KERNEL
+#endif /* FREEBSDV>=13000 */
# if FREEBSDV>=4000
# if FREEBSDV>=5000
# if FREEBSDV<6020
@@ -105,6 +112,12 @@ typedef struct device *device_t;
#include <sys/conf.h>
+/*
+ * include <stdbool.h> for refcount(9)
+ */
+#include <stdbool.h>
+
+
# 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 {

View File

@ -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 <fs/tmpfs/tmpfs.h>
-#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;

View File

@ -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 <sys/param.h>
+#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 */

View File

@ -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;

View File

@ -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");