diff --git a/sysutils/lsof/Makefile b/sysutils/lsof/Makefile index 7648cdc29b99..eb07b5f88525 100644 --- a/sysutils/lsof/Makefile +++ b/sysutils/lsof/Makefile @@ -1,71 +1,76 @@ # 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.99.5 PORTEPOCH= 8 CATEGORIES= sysutils MAINTAINER= ler@FreeBSD.org COMMENT= Lists information about open files (similar to fstat(1)) WWW= https://github.com/lsof-org/lsof/ LICENSE= lsof LICENSE_NAME= lsof LICENSE_FILE= ${FILESDIR}/LICENSE LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept BUILD_DEPENDS= ${LOCALBASE}/bin/bash:shells/bash USES= compiler cpe shebangfix CPE_VENDOR= lsof_project USE_GITHUB= yes GH_ACCOUNT= lsof-org SHEBANG_FILES= scripts/*.pl HAS_CONFIGURE= yes CFLAGS_powerpcspe= -DBOOKE OPTIONS_DEFINE= NOSOCKSECURITY SECURITY OPTIONS_DEFINE_powerpc64= AIM BOOKE OPTIONS_DEFAULT= OPTIONS_DEFAULT_powerpc64= AIM AIM_DESC= Set for AIM hardware BOOKE_DESC= Set for BOOKE hardware NOSOCKSECURITY_DESC= Non-root users can only list their own files except sockets (Implies SECURITY) SECURITY_DESC= Non-root users can only list their own files AIM_CFLAGS= -DAIM BOOKE_CFLAGS= -DBOOKE NOSOCKSECURITY_IMPLIES= SECURITY NOSOCKSECURITY_CFLAGS= -DHASNOSOCKSECURITY SECURITY_CFLAGS= -DHASSECURITY .include CONFIGURE_SCRIPT= Configure CONFIGURE_ARGS= -n freebsd CONFIGURE_ENV= FREEBSD_SYS="${SRC_BASE}/sys" \ LSOF_CC="${CC}" \ LSOF_OPINC="-idirafter ${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 (or set SRC_BASE) .endif do-install: ${INSTALL_PROGRAM} ${WRKSRC}/lsof ${STAGEDIR}${PREFIX}/sbin (cd ${WRKSRC} && ${SOELIM} Lsof.8 > ${WRKSRC}/lsof.8) ${INSTALL_MAN} ${WRKSRC}/lsof.8 ${STAGEDIR}${MANDIRS}/man8/lsof.8 ${MKDIR} ${STAGEDIR}${DATADIR} ${INSTALL_SCRIPT} ${WRKSRC}/scripts/* ${STAGEDIR}${DATADIR} +# Create dummy empty vnode_if.h in case vnode.h includes it +# (true on FreeBSD 16, harmless if not). +post-patch: + ${TOUCH} ${WRKSRC}/include/vnode_if.h + .include diff --git a/sysutils/lsof/files/patch-lib_dialects_freebsd_dlsof.h b/sysutils/lsof/files/patch-lib_dialects_freebsd_dlsof.h index 788ca976508f..d4b9236badd3 100644 --- a/sysutils/lsof/files/patch-lib_dialects_freebsd_dlsof.h +++ b/sysutils/lsof/files/patch-lib_dialects_freebsd_dlsof.h @@ -1,10 +1,48 @@ ---- lib/dialects/freebsd/dlsof.h.orig 2026-03-25 16:34:30 UTC +--- lib/dialects/freebsd/dlsof.h.orig +++ lib/dialects/freebsd/dlsof.h -@@ -147,6 +147,7 @@ int getmntinfo(struct statfs **, int); +@@ -43,14 +43,31 @@ + # include + # include + +-# 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 */ ++/* ++ * Pull these in without _KERNEL. Using _KERNEL below is abuse ++ * in the first place, but this mitigates a bunch of new issues in ++ * FreeBSD 16. This relies on the fact that the system includes use ++ * header guards, so once they are included without _KERNEL the ++ * later (implicit/indirect) ones with _KERNEL are no-ops. ++ * ++ * Add dummy declarations for _KERNEL items that we don't actually ++ * need but get pulled in anyway. ++ */ ++# include ++# include ++# include ++ ++# define LOCK_FILE NULL ++# define LOCK_LINE 0 ++# define MALLOC_DECLARE(type) extern struct malloc_type type ++# define TRUE 1 ++# define FALSE 0 ++typedef struct vm_page *vm_page_t; ++ + # define _KERNEL 1 + ++# include ++ + # if defined(HAS_VM_MEMATTR_T) + /* + * The d_mmap2_t function typedef in may need the definition +@@ -147,6 +164,7 @@ int getmntinfo(struct statfs **, int); # include # include # define _WANT_INPCB /* for FreeBSD 12 and above */ +# include # include # include # include