diff options
author | apb <apb@pkgsrc.org> | 2009-08-11 20:53:06 +0000 |
---|---|---|
committer | apb <apb@pkgsrc.org> | 2009-08-11 20:53:06 +0000 |
commit | da19853de635455c38d96cd50f02669b40c197cd (patch) | |
tree | ed50f2119d7e547fac81ba80e316fb5ed4f3ceba /sysutils/lsof/patches | |
parent | ee194064d672935e837464b697cc3deafdfe13ca (diff) | |
download | pkgsrc-da19853de635455c38d96cd50f02669b40c197cd.tar.gz |
Make this build again on netbsd-current. Bump PKGREVISION to 5.
Diffstat (limited to 'sysutils/lsof/patches')
-rw-r--r-- | sysutils/lsof/patches/patch-ah | 95 |
1 files changed, 78 insertions, 17 deletions
diff --git a/sysutils/lsof/patches/patch-ah b/sysutils/lsof/patches/patch-ah index 4812edc62f7..f5fb04f0ed2 100644 --- a/sysutils/lsof/patches/patch-ah +++ b/sysutils/lsof/patches/patch-ah @@ -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 ++# 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 -+#define FILESTRUCT struct fdfile ++# 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. + */ +@@ -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 (!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); |