Subject: Re: PT_MEMMAP
To: Gregory McGarry <g.mcgarry@ieee.org>
From: Love <lha@stacken.kth.se>
List: tech-kern
Date: 07/25/2002 07:16:21
Gregory McGarry <g.mcgarry@ieee.org> writes:
> > I can see why you think this is useful. This exists in the linux procfs
> > support, if you just the filename. I don't really care about if it should
> > be included or not, so its up to others to say so. It should be somewhat
> > easy to add.
>
> I think it is useful.
I did add support for this [1], I guess I should also store fsid/fileid
with the path. (the proc_vnode_to_path is shared with procfs). See comment
below.
> > I don't really like cache_revlookup(), mostly since it only might work. On
> > my laptop the failure rate is 0.3%.
>
> getcwd_scandir() should do want you want, shouldn't it? Seems like
> reasonable functionality to factor out, to a function called, say,
> vn_scandir().
getcwd_scandir() only works for directories, you can't make VOP_LOOKUP(vp,
"..") if vp is !VDIR.
If the kernel is compiled with NAMECACHE_ENTER_REVERSE, you can get path
for a !VDIR vnodes. If not, the best you can get is the fsid/fileid.
Love
[1]
http://www.e.kth.se/~lha/patches/netbsd/gdb-core/ptrace-patch2
: lha@nutcracker ; od &
[1] 303
: lha@nutcracker ; ./pmap 303
start: 08048000 end: 0804c000 r-x rwx COW NC obj 0 1 0 /usr/bin/od
start: 0804c000 end: 0804d000 rw- rwx COW NNC anon 0 1 0
start: 0804d000 end: 0805f000 rwx rwx COW NNC anon 0 1 0
start: 4804c000 end: 48055000 r-x rwx COW NC obj 0 1 0 /usr/libexec/ld.elf_so
start: 48055000 end: 48056000 rw- rwx COW NNC obj 0 1 0 /usr/libexec/ld.elf_so
start: 48056000 end: 4805f000 rw- rwx COW NNC anon 0 1 0
start: 4805f000 end: 480ec000 r-x rwx COW NC obj 0 1 0 /usr/lib/libc.so.12.85
start: 480ec000 end: 480f1000 rw- rwx COW NNC obj 0 1 0 /usr/lib/libc.so.12.85
start: 480f1000 end: 480ff000 rw- rwx COW NNC anon 0 1 0
start: bdbfe000 end: bf9fe000 --- rwx COW NC anon 0 1 0
start: bf9fe000 end: bfbf0000 rwx rwx COW NC anon 0 1 0