diff options
author | jym <jym@pkgsrc.org> | 2011-03-21 00:22:02 +0000 |
---|---|---|
committer | jym <jym@pkgsrc.org> | 2011-03-21 00:22:02 +0000 |
commit | 23debc63fcabad978d735283c040ba113235d2b7 (patch) | |
tree | 53fb570107c2f27f2100ed9a18e8330635494c60 | |
parent | 2d34f6362a4258c8a98a961c83995427cded0ac5 (diff) | |
download | pkgsrc-23debc63fcabad978d735283c040ba113235d2b7.tar.gz |
When we moved from fd_ofiles to a struct fdtab, the fd_ofiles became
an array of pointer (in struct fdtab) rather than a pointer of pointers.
Sadly for us, no, arrays and pointers are not equivalent from a memory
perspective: while pointers from/to another address space can
be consumed by kvm(3) to query for data in kernel space, arrays
are more tricky, especially when their content is copied in userland:
they are part of the copied struct.
Address of array members are only valid in their own address space,
in our case userland, which is (fortunately?) different from kernel space.
This breaks the various kvm_read() calls that query for file descriptor
information. Consequence: lsof(1) cannot print filedescriptor information
(starting from 5.99.14), and silently ignores the errors, as using
the userland fdtab (``dt'' variable) is not valid for kernel.
Fix that by using the ``fd_dt'' member of struct filedes, which stores
the address of the fdtab struct in kernel address space. Took a few hours
to understand what was going on with lsof(1), hmmm.
Luckily, fstat(1) uses the proper model (checked about 5min ago). Why
lsof(1) decided not to log an error on kvm_read() is... a good question.
Bump rev.
-rw-r--r-- | sysutils/lsof/Makefile | 3 | ||||
-rw-r--r-- | sysutils/lsof/distinfo | 4 | ||||
-rw-r--r-- | sysutils/lsof/patches/patch-ah | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/sysutils/lsof/Makefile b/sysutils/lsof/Makefile index a58a8f0940e..a2d494ed0cc 100644 --- a/sysutils/lsof/Makefile +++ b/sysutils/lsof/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.108 2010/05/14 19:01:11 tez Exp $ +# $NetBSD: Makefile,v 1.109 2011/03/21 00:22:02 jym Exp $ DISTNAME= lsof_4.83 PKGNAME= ${DISTNAME:S/_/-/} CATEGORIES= sysutils +PKGREVISION= 1 MASTER_SITES= ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ \ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/NEW/ \ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/ \ diff --git a/sysutils/lsof/distinfo b/sysutils/lsof/distinfo index 8a5b449d44d..6b49f9c111b 100644 --- a/sysutils/lsof/distinfo +++ b/sysutils/lsof/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.79 2010/05/10 08:21:41 sbd Exp $ +$NetBSD: distinfo,v 1.80 2011/03/21 00:22:02 jym Exp $ SHA1 (lsof_4.83.tar.bz2) = 1aee4c8de6959d84613030a65e90855a922493bf RMD160 (lsof_4.83.tar.bz2) = 9a03b41362d68f93d9e7c2db824c8af6df978aa1 @@ -10,4 +10,4 @@ SHA1 (patch-ad) = 4bd73dea4770c7f5a43be0d096c26e7d6728dd2c SHA1 (patch-ae) = 1d8c1c3baf9575631c23d3ced7b12fab1df95cd6 SHA1 (patch-af) = b52c15a507960ecf33a61a3cbd608a92ebac1188 SHA1 (patch-ag) = 945d233d94a42510c47709554040534024f72926 -SHA1 (patch-ah) = f7bee41b341e500bb8c802f9a5862dd64c30a38c +SHA1 (patch-ah) = 2de22b9a3733f958298af5e33b66c0653c320f59 diff --git a/sysutils/lsof/patches/patch-ah b/sysutils/lsof/patches/patch-ah index f5fb04f0ed2..1df39ef2f44 100644 --- a/sysutils/lsof/patches/patch-ah +++ b/sysutils/lsof/patches/patch-ah @@ -1,4 +1,4 @@ -$NetBSD: patch-ah,v 1.4 2009/08/11 20:53:06 apb Exp $ +$NetBSD: patch-ah,v 1.5 2011/03/21 00:22:02 jym Exp $ --- dialects/n+obsd/dproc.c.orig 2005-05-11 14:54:00.000000000 +0200 +++ dialects/n+obsd/dproc.c @@ -27,7 +27,7 @@ $NetBSD: patch-ah,v 1.4 2009/08/11 20:53:06 apb Exp $ + */ +# define HAVE_STRUCT_FDTAB 1 +# define NFILES(fd,dt) ((dt).dt_nfiles) -+# define OFILES(fd,dt) ((dt).dt_ff) ++# define OFILES(fd,dt) ((fd).fd_dt->dt_ff) +#else +# undef HAVE_STRUCT_FDTAB +# define NFILES(fd,dt) ((fd).fd_nfiles) |