pkgsrc/sysutils/lsof/patches/patch-ad
atatat 8a3a940f43 A patch (courtesy of the lsof maintainer) to make lsof build again on
NetBSD-current, where the structure of the vnode has been altered.
This patch will, as usual, be obsoleted by the next lsof release.
PKGREVISION bumped accordingly.

Install the lsof.8 man page in man8 instead of installing the
preformatted copy in man1 (doing so used to slide by, by new groff
really doesn't like formatting preformatted man pages, and besides, it
was in the wrong place).

Since the only thing left untouched was the DESCR file, I also added
mention of kqueues as something lsof might note, meaning that this
patch touches every file in the pkg.
2003-08-13 13:24:15 +00:00

124 lines
3.4 KiB
Text

$NetBSD: patch-ad,v 1.5 2003/08/13 13:24:17 atatat Exp $
Patch for vnode/DNLC interface change courtesy of lsof maintainer.
--- lib/rnam.c.orig 2000-08-02 08:53:30.000000000 -0400
+++ lib/rnam.c
@@ -111,7 +111,10 @@
* table */
struct l_nch {
KA_T na; /* node address */
+
+# if defined(NCACHE_NODEID)
unsigned long id; /* capability ID */
+# endif /* defined(NCACHE_NODEID) */
# if defined(NCACHE_PARADDR) && defined(NCACHE_PARID)
KA_T pa; /* parent node address */
@@ -128,13 +131,18 @@
static struct l_nch **Nchash = (struct l_nch **)NULL;
/* Ncache hash pointers */
static int Ncfirst = 1; /* first-call status */
-
+
+# if defined(NCACHE_NODEID)
#define ncachehash(i,n) Nchash+(((((int)(n)>>2)+((int)(i)))*31415)&Mch)
+_PROTOTYPE(static struct l_nch *ncache_addr,(unsigned long i, KA_T na));
+# else /* !defined(NCACHE_NODEID) */
+#define ncachehash(n) Nchash+((((int)(n)>>2)*31415)&Mch)
+_PROTOTYPE(static struct l_nch *ncache_addr,(KA_T na));
+# endif /* defined(NCACHE_NODEID) */
+
#define DEFNCACHESZ 1024 /* local size if X_NCSIZE kernel value < 1 */
#define LNCHINCRSZ 64 /* local size increment */
-_PROTOTYPE(static struct l_nch *ncache_addr,(unsigned long i, KA_T na));
-
# if !defined(NCACHE_NO_ROOT)
_PROTOTYPE(static int ncache_isroot,(KA_T na, char *cp));
# endif /* !defined(NCACHE_NO_ROOT) */
@@ -145,14 +153,32 @@
*/
static struct l_nch *
+
+# if defined(NCACHE_NODEID)
ncache_addr(i, na)
unsigned long i; /* node's capability ID */
+# else /* !defined(NCACHE_NODEID) */
+ncache_addr(na)
+# endif /* defined(NCACHE_NODEID) */
+
KA_T na; /* node's address */
{
struct l_nch **hp;
- for (hp = ncachehash(i, na); *hp; hp++) {
+# if defined(NCACHE_NODEID)
+ for (hp = ncachehash(i, na); *hp; hp++)
+# else /* !defined(NCACHE_NODEID) */
+ for (hp = ncachehash(na); *hp; hp++)
+# endif /* defined(NCACHE_NODEID) */
+
+ {
+
+# if defined(NCACHE_NODEID)
if ((*hp)->id == i && (*hp)->na == na)
+# else /* !defined(NCACHE_NODEID) */
+ if ((*hp)->na == na)
+# endif /* defined(NCACHE_NODEID) */
+
return(*hp);
}
return((struct l_nch *)NULL);
@@ -422,8 +448,10 @@
}
# endif /* defined(NCACHE_NXT) */
+# if defined(NCACHE_NODEID)
lc->na = (KA_T)kc->NCACHE_NODEADDR;
lc->id = kc->NCACHE_NODEID;
+# endif /* defined(NCACHE_NODEID) */
# if defined(NCACHE_PARADDR)
lc->pa = (KA_T)kc->NCACHE_PARADDR;
@@ -495,8 +523,21 @@
Exit(1);
}
for (i = 0, lc = Ncache; i < Nc; i++, lc++) {
- for (hp = ncachehash(lc->id, lc->na), n = 1; *hp; hp++) {
+
+# if defined(NCACHE_NODEID)
+ for (hp = ncachehash(lc->id, lc->na), n = 1; *hp; hp++)
+# else /* defined(NCACHE_NODEID) */
+ for (hp = ncachehash(lc->na), n = 1; *hp; hp++)
+# endif /* defined(NCACHE_NODEID) */
+
+ {
+
+# if defined(NCACHE_NODEID)
if ((*hp)->na == lc->na && (*hp)->id == lc->id
+# else /* defined(NCACHE_NODEID) */
+ if ((*hp)->na == lc->na
+# endif /* defined(NCACHE_NODEID) */
+
&& strcmp((*hp)->nm, lc->nm) == 0
# if defined(NCACHE_PARADDR) && defined(NCACHE_PARID)
@@ -557,7 +598,15 @@
/*
* Look up the name cache entry for the node address.
*/
- if (Nc == 0 || !(lc = ncache_addr(Lf->id, Lf->na))) {
+
+# if defined(NCACHE_NODEID)
+ if (Nc == 0 || !(lc = ncache_addr(Lf->id, Lf->na)))
+# else /* defined(NCACHE_NODEID) */
+ if (Nc == 0 || !(lc = ncache_addr(Lf->na)))
+# endif /* defined(NCACHE_NODEID) */
+
+
+ {
/*
* If the node has no cache entry, see if it's the mount