pkgsrc/sysutils/lsof/patches/patch-af
tnn da8aab559f lsof: fix wrong conditional added in patch-af 1.20
machine/ptrace.h pulls in sys/module_hook.h after 2019-11-27 under _KERNEL
This corresponds to NetBSD 9.99.19.
sys/module_hook.h is not installed.
Ergo sys/ptrace.h must be included /without/ defining _KERNEL.
2020-05-13 19:36:56 +00:00

160 lines
4.8 KiB
Text

$NetBSD: patch-af,v 1.21 2020/05/13 19:36:56 tnn Exp $
--- dialects/n+obsd/dlsof.h.orig 2006-03-28 23:54:15.000000000 +0200
+++ dialects/n+obsd/dlsof.h 2020-04-16 14:25:29.349520955 +0200
@@ -45,8 +45,11 @@
#include <setjmp.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
+#if (!defined(NETBSDV) || __NetBSD_Version__>=999001900)
+#include <sys/ptrace.h> /* pulled in by procfs.h, but needs to be pulled in before _KERNEL is defined */
+#endif
# if defined(HASGETBOOTFILE)
#include <util.h>
# endif /* defined(HASGETBOOTFILE) */
@@ -94,8 +97,12 @@
#define _KERNEL
# endif /* (defined(OPENBSDV) && OPENBSDV<3030)
|| (defined(NETBSDV) && __NetBSD_Version__>=106060000) */
+# if defined(NETBSDV) && NETBSDV>=1003000
+#define sockproto NETBSD_sockproto
+# endif /* defined(NETBSDV) && NETBSDV>=1003000 */
+
#include <sys/mount.h>
# if (defined(OPENBSDV) && OPENBSDV>=3030) \
|| (defined(NETBSDV) && __NetBSD_Version__>=106060000)
@@ -105,12 +112,8 @@
#include <rpc/types.h>
#include <sys/protosw.h>
-# if defined(NETBSDV) && NETBSDV>=1003000
-#define sockproto NETBSD_sockproto
-# endif /* defined(NETBSDV) && NETBSDV>=1003000 */
-
#include <sys/socket.h>
# if defined(HASMSDOSFS)
# if HASMSDOSFS==1
@@ -146,8 +149,11 @@
# endif /* (defined(OPENBSDV) && OPENBSDV<3030)
|| (defined(NETBSDV) && __NetBSD_Version__<106060000) */
#define _KERNEL
+#ifndef VFS_PROTOS
+#define VFS_PROTOS(x)
+#endif
struct nameidata; /* to satisfy a function prototype in msdosfsmount.h */
#include <msdosfs/msdosfsmount.h>
#undef _KERNEL
#include <msdosfs/direntry.h>
@@ -160,8 +166,9 @@
#include <sys/socketvar.h>
#include <sys/un.h>
#include <sys/unpcb.h>
+#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
@@ -169,9 +176,8 @@
#include <netinet/ip6.h>
#include <netinet6/in6_pcb.h>
# endif /* defined(HASIPv6) && defined(NETBSDV) && !defined(HASINRIAIPv6) */
-#include <net/route.h>
#include <netinet/in_pcb.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <netinet/tcpip.h>
@@ -263,8 +269,11 @@
#endif /* defined(HASBUFQ_H) */
#undef KERNEL
#include <ufs/mfs/mfsnode.h>
+# if defined(HASTMPFS)
+#include <fs/tmpfs/tmpfs.h>
+# endif /* defined(HASTMPFS) */
# if defined(HASNFSPROTO)
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
@@ -359,8 +368,11 @@
# if defined(HASPROCFS)
# if defined(HASPROCFS_PFSROOT)
#define _KERNEL
# endif /* defined(HASPROCFS_PFSROOT) */
+#if (defined(NETBSDV) && __NetBSD_Version__>=900000000)
+#include <sys/ptrace.h>
+#endif
#include <miscfs/procfs/procfs.h>
# if defined(HASPROCFS_PFSROOT)
#undef _KERNEL
#define Proot PFSroot
@@ -369,9 +381,8 @@
#define Pmem PFSmem
#define Pregs PFSregs
#define Pfile PFSfile
#define Pfpregs PFSfpregs
-#define Pctl PFSctl
#define Pstatus PFSstatus
#define Pnote PFSnote
#define Pnotepg PFSnotepg
# if defined(NetBSDV)
@@ -381,8 +392,11 @@
# if NETBSDV>=1006000
#define Pmap PFSmap
#define Pmaps PFSmaps
# endif /* NETBSDV>=1006000 */
+# if NETBSDV<8099000
+#define Pctl PFSctl
+# endif /* NETBSDV<8099000 */
# endif /* defined(NetBSDV) */
# endif /* defined(HASPROCFS_PFSROOT) */
#include <machine/reg.h>
# endif /* defined(HASPROCFS) */
@@ -488,9 +502,14 @@
struct l_vfs {
KA_T addr; /* kernel address */
fsid_t fsid; /* file system ID */
+#if defined(NETBSDV) && __NetBSD_Version__ >= 499002500
+ /* MFSNAMELEN was removed from the kernel source after 4.99.24 */
+ char type[sizeof(((struct statvfs *)NULL)->f_fstypename)]; /* type of file system */
+#else
char type[MFSNAMELEN]; /* type of file system */
+#endif
char *dir; /* mounted directory */
char *fsname; /* file system name */
struct l_vfs *next; /* forward link */
};
@@ -564,9 +583,9 @@
#define NCACHE_NMLEN nc_nlen /* name length in NCACHE */
#define NCACHE_NODEADDR nc_vp /* node address in NCACHE */
#define NCACHE_PARADDR nc_dvp /* parent node address in NCACHE */
-# if (defined(OPENBSDV) && OPENBSDV>=2010) || (defined(NETBSDV) && NETBSDV>=1002000)
+# if (defined(OPENBSDV) && OPENBSDV>=2010) || (defined(NETBSDV) && NETBSDV>=1002000 && __NetBSD_Version__ < 999005400)
#define NCACHE_NXT nc_hash.le_next /* link in NCACHE */
# else /* (defined(OPENBSDV) && OPENBSDV>=2010) || (defined(NETBSDV) && NETBSDV>=1002000) */
# if defined(NetBSD1_0) && NetBSD<1994101
#define NCACHE_NXT nc_nxt /* link in NCACHE */
@@ -580,5 +599,13 @@
#define NCACHE_NODEID nc_vpid /* node ID in NCACHE */
# endif /* defined(HASNCVPID) */
# endif /* defined(HASNCACHE) */
+#if defined(VV_ROOT) /* NetBSD >= 4.99.33 */
+#define VNODE_VFLAG v_vflag
+#define NCACHE_VROOT VV_ROOT
+#else
+#define VNODE_VFLAG v_flag
+#define NCACHE_VROOT VROOT
+#endif /* VV_ROOT */
+
#endif /* NETBSD_LSOF_H */