pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/sysutils/lsof



Module Name:    pkgsrc
Committed By:   jym
Date:           Mon Mar 21 00:22:02 UTC 2011

Modified Files:
        pkgsrc/sysutils/lsof: Makefile distinfo
        pkgsrc/sysutils/lsof/patches: patch-ah

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 pkgsrc/sysutils/lsof/Makefile
cvs rdiff -u -r1.79 -r1.80 pkgsrc/sysutils/lsof/distinfo
cvs rdiff -u -r1.4 -r1.5 pkgsrc/sysutils/lsof/patches/patch-ah

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Home | Main Index | Thread Index | Old Index