summaryrefslogtreecommitdiff
path: root/sysutils/lsof/patches/patch-ah
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/lsof/patches/patch-ah')
-rw-r--r--sysutils/lsof/patches/patch-ah74
1 files changed, 74 insertions, 0 deletions
diff --git a/sysutils/lsof/patches/patch-ah b/sysutils/lsof/patches/patch-ah
new file mode 100644
index 00000000000..4812edc62f7
--- /dev/null
+++ b/sysutils/lsof/patches/patch-ah
@@ -0,0 +1,74 @@
+$NetBSD: patch-ah,v 1.3 2008/05/17 23:53:29 christos 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 @@
+
+ #include "lsof.h"
+
++#if __NetBSD_Version__ < 499006200
++#define FILESTRUCT struct file
++#else
++#define FILESTRUCT struct fdfile
++#endif
+
+ _PROTOTYPE(static void enter_vn_text,(KA_T va, int *n));
+ _PROTOTYPE(static void get_kernel_access,(void));
+@@ -152,7 +157,7 @@
+ struct filedesc fd;
+ int i, nf;
+ MALLOC_S nb;
+- static struct file **ofb = NULL;
++ static FILESTRUCT **ofb = NULL;
+ static int ofbb = 0;
+ short pss, sf;
+ int px;
+@@ -280,12 +285,12 @@
+ */
+ if (!fd.fd_ofiles || (nf = fd.fd_nfiles) <= 0)
+ continue;
+- nb = (MALLOC_S)(sizeof(struct file *) * nf);
++ nb = (MALLOC_S)(sizeof(FILESTRUCT *) * nf);
+ if (nb > ofbb) {
+ if (!ofb)
+- ofb = (struct file **)malloc(nb);
++ ofb = (FILESTRUCT **)malloc(nb);
+ else
+- ofb = (struct file **)realloc((MALLOC_P *)ofb, nb);
++ ofb = (FILESTRUCT **)realloc((MALLOC_P *)ofb, nb);
+ if (!ofb) {
+ (void) fprintf(stderr, "%s: PID %d, no file * space\n",
+ Pn, p->P_PID);
+@@ -311,8 +316,10 @@
+ }
+ pofb = nb;
+ }
++#if __NetBSD_Version__ < 499006200
+ if (!fd.fd_ofileflags || kread((KA_T)fd.fd_ofileflags, pof, nb))
+ zeromem(pof, nb);
++#endif
+ }
+ #endif /* defined(HASFSTRUCT) */
+
+@@ -321,8 +328,20 @@
+ */
+ for (i = 0; i < nf; i++) {
+ if (ofb[i]) {
++#if __NetBSD_Version__ >= 499006200
++ struct fdfile fdf;
++ if (kread((KA_T)ofb[i], (char *)&fdf, sizeof(fdf)))
++ continue;
++ Cfp = fdf.ff_file;
++ if (Cfp == NULL)
++ continue;
++ if (pof)
++ pof[i] = fdf.ff_exclose;
++#else
++ Cfp = ofb[i];
++#endif
+ alloc_lfile(NULL, i);
+- process_file((KA_T)(Cfp = ofb[i]));
++ process_file((KA_T)Cfp);
+ if (Lf->sf) {
+
+ #if defined(HASFSTRUCT)