Make this build again on netbsd-current. Bump PKGREVISION to 5.
This commit is contained in:
parent
ee194064d6
commit
da19853de6
3 changed files with 82 additions and 21 deletions
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.101 2009/05/30 11:10:56 zafer Exp $
|
||||
# $NetBSD: Makefile,v 1.102 2009/08/11 20:53:06 apb Exp $
|
||||
|
||||
DISTNAME= lsof_4.78
|
||||
PKGNAME= ${DISTNAME:S/_/-/}.${OS_VERSION}
|
||||
PKGREVISION= 4
|
||||
PKGREVISION= 5
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ \
|
||||
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/NEW/ \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.76 2009/05/17 20:40:46 seb Exp $
|
||||
$NetBSD: distinfo,v 1.77 2009/08/11 20:53:06 apb Exp $
|
||||
|
||||
SHA1 (lsof_4.78.tar.bz2) = 0379fc9f38a931ce19e8386e662314d96fc2a099
|
||||
RMD160 (lsof_4.78.tar.bz2) = 50d71e500f1109cda717b73ce209c0e100a6dbe9
|
||||
|
@ -10,4 +10,4 @@ SHA1 (patch-ad) = 4bd73dea4770c7f5a43be0d096c26e7d6728dd2c
|
|||
SHA1 (patch-ae) = 1d8c1c3baf9575631c23d3ced7b12fab1df95cd6
|
||||
SHA1 (patch-af) = b52c15a507960ecf33a61a3cbd608a92ebac1188
|
||||
SHA1 (patch-ag) = 2f14b7954976e3b3d43034e13bf31d14ca65e4e3
|
||||
SHA1 (patch-ah) = 0ed8ca9cc34d85dc01b135e70077c922d26d8831
|
||||
SHA1 (patch-ah) = f7bee41b341e500bb8c802f9a5862dd64c30a38c
|
||||
|
|
|
@ -1,20 +1,42 @@
|
|||
$NetBSD: patch-ah,v 1.3 2008/05/17 23:53:29 christos Exp $
|
||||
$NetBSD: patch-ah,v 1.4 2009/08/11 20:53:06 apb Exp $
|
||||
|
||||
--- dialects/n+obsd/dproc.c.orig 2005-05-11 08:54:00.000000000 -0400
|
||||
+++ dialects/n+obsd/dproc.c 2008-05-17 19:35:00.000000000 -0400
|
||||
@@ -37,6 +37,11 @@
|
||||
--- dialects/n+obsd/dproc.c.orig 2005-05-11 14:54:00.000000000 +0200
|
||||
+++ dialects/n+obsd/dproc.c
|
||||
@@ -37,6 +37,33 @@ static char *rcsid = "$Id: dproc.c,v 1.1
|
||||
|
||||
#include "lsof.h"
|
||||
|
||||
+#if __NetBSD_Version__ < 499006200
|
||||
+#define FILESTRUCT struct file
|
||||
+#if __NetBSD_Version__ >= 499006200
|
||||
+ /*
|
||||
+ * In NetBSD-4.99.62, struct fdfile was added, struct filedesc::fd_ofiles
|
||||
+ * changed type from struct file ** to struct fdfile **, and
|
||||
+ * fd_ofileflags disappeared from struct filedesc, being
|
||||
+ * replaced by fields in struct fdfile.
|
||||
+ */
|
||||
+# define HAVE_STRUCT_FDFILE 1
|
||||
+# define FILESTRUCT struct fdfile
|
||||
+#else
|
||||
+#define FILESTRUCT struct fdfile
|
||||
+# undef HAVE_STRUCT_FDFILE
|
||||
+# define FILESTRUCT struct file
|
||||
+#endif
|
||||
+#if __NetBSD_Version__ >= 599001400
|
||||
+ /*
|
||||
+ * Between NetBSD-5.99.13 and 5.99.14, struct fdtab was added, and
|
||||
+ * struct filedesc::fd_ofiles and fd_nfiles were replaced by
|
||||
+ * struct filedesc::fd_dt (a pointer to struct fdtab).
|
||||
+ */
|
||||
+# define HAVE_STRUCT_FDTAB 1
|
||||
+# define NFILES(fd,dt) ((dt).dt_nfiles)
|
||||
+# define OFILES(fd,dt) ((dt).dt_ff)
|
||||
+#else
|
||||
+# undef HAVE_STRUCT_FDTAB
|
||||
+# define NFILES(fd,dt) ((fd).fd_nfiles)
|
||||
+# define OFILES(fd,dt) ((fd).fd_ofiles)
|
||||
+#endif
|
||||
|
||||
_PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
|
||||
_PROTOTYPE(static void get_kernel_access,(void));
|
||||
@@ -152,7 +157,7 @@
|
||||
@@ -152,7 +179,7 @@ gather_proc_info()
|
||||
struct filedesc fd;
|
||||
int i, nf;
|
||||
MALLOC_S nb;
|
||||
|
@ -23,9 +45,39 @@ $NetBSD: patch-ah,v 1.3 2008/05/17 23:53:29 christos Exp $
|
|||
static int ofbb = 0;
|
||||
short pss, sf;
|
||||
int px;
|
||||
@@ -280,12 +285,12 @@
|
||||
@@ -179,6 +206,10 @@ gather_proc_info()
|
||||
struct kinfo_proc *p;
|
||||
#endif /* defined(HASKVMGETPROC2) */
|
||||
|
||||
+#if HAVE_STRUCT_FDTAB
|
||||
+ struct fdtab dt;
|
||||
+#endif /* HAVE_STRUCT_FDTAB */
|
||||
+
|
||||
/*
|
||||
* Read the process table.
|
||||
*/
|
||||
if (!fd.fd_ofiles || (nf = fd.fd_nfiles) <= 0)
|
||||
@@ -218,7 +249,14 @@ gather_proc_info()
|
||||
if (!p->P_FD
|
||||
|| kread((KA_T)p->P_FD, (char *)&fd, sizeof(fd)))
|
||||
continue;
|
||||
- if (!fd.fd_refcnt || fd.fd_lastfile > fd.fd_nfiles)
|
||||
+ if (!fd.fd_refcnt)
|
||||
+ continue;
|
||||
+#if HAVE_STRUCT_FDTAB
|
||||
+ if (!fd.fd_dt
|
||||
+ || kread((KA_T)fd.fd_dt, (char *)&dt, sizeof(dt)))
|
||||
+ continue;
|
||||
+#endif /* ! HAVE_STRUCT_FDTAB */
|
||||
+ if (fd.fd_lastfile > NFILES(fd,dt))
|
||||
continue;
|
||||
|
||||
#if defined(HASCWDINFO)
|
||||
@@ -278,14 +316,14 @@ gather_proc_info()
|
||||
/*
|
||||
* Read open file structure pointers.
|
||||
*/
|
||||
- if (!fd.fd_ofiles || (nf = fd.fd_nfiles) <= 0)
|
||||
+ if (!OFILES(fd,dt) || (nf = NFILES(fd,dt)) <= 0)
|
||||
continue;
|
||||
- nb = (MALLOC_S)(sizeof(struct file *) * nf);
|
||||
+ nb = (MALLOC_S)(sizeof(FILESTRUCT *) * nf);
|
||||
|
@ -39,22 +91,31 @@ $NetBSD: patch-ah,v 1.3 2008/05/17 23:53:29 christos Exp $
|
|||
if (!ofb) {
|
||||
(void) fprintf(stderr, "%s: PID %d, no file * space\n",
|
||||
Pn, p->P_PID);
|
||||
@@ -311,8 +316,10 @@
|
||||
@@ -293,7 +331,7 @@ gather_proc_info()
|
||||
}
|
||||
ofbb = nb;
|
||||
}
|
||||
- if (kread((KA_T)fd.fd_ofiles, (char *)ofb, nb))
|
||||
+ if (kread((KA_T)OFILES(fd,dt), (char *)ofb, nb))
|
||||
continue;
|
||||
|
||||
#if defined(HASFSTRUCT)
|
||||
@@ -311,8 +349,10 @@ gather_proc_info()
|
||||
}
|
||||
pofb = nb;
|
||||
}
|
||||
+#if __NetBSD_Version__ < 499006200
|
||||
+#if ! HAVE_STRUCT_FDFILE
|
||||
if (!fd.fd_ofileflags || kread((KA_T)fd.fd_ofileflags, pof, nb))
|
||||
zeromem(pof, nb);
|
||||
+#endif
|
||||
+#endif /* ! HAVE_STRUCT_FDFILE */
|
||||
}
|
||||
#endif /* defined(HASFSTRUCT) */
|
||||
|
||||
@@ -321,8 +328,20 @@
|
||||
@@ -321,8 +361,20 @@ gather_proc_info()
|
||||
*/
|
||||
for (i = 0; i < nf; i++) {
|
||||
if (ofb[i]) {
|
||||
+#if __NetBSD_Version__ >= 499006200
|
||||
+#if HAVE_STRUCT_FDFILE
|
||||
+ struct fdfile fdf;
|
||||
+ if (kread((KA_T)ofb[i], (char *)&fdf, sizeof(fdf)))
|
||||
+ continue;
|
||||
|
@ -63,9 +124,9 @@ $NetBSD: patch-ah,v 1.3 2008/05/17 23:53:29 christos Exp $
|
|||
+ continue;
|
||||
+ if (pof)
|
||||
+ pof[i] = fdf.ff_exclose;
|
||||
+#else
|
||||
+#else /* ! HAVE_STRUCT_FDFILE */
|
||||
+ Cfp = ofb[i];
|
||||
+#endif
|
||||
+#endif /* ! HAVE_STRUCT_FDFILE */
|
||||
alloc_lfile(NULL, i);
|
||||
- process_file((KA_T)(Cfp = ofb[i]));
|
||||
+ process_file((KA_T)Cfp);
|
||||
|
|
Loading…
Reference in a new issue