On Feb 1, 2007, at 10:28 AM, Yount, Chuck wrote:
Sorry; I'm probably using the wrong terminology for MacOS. (I'm more familiar w/Windows and Linux.) By "modules", I mean the executable images loaded by each process. What I want is something like I can get from /proc/nnn/maps in Linux (where nnn is a pid), e.g.,
>ps
PID TTY TIME CMD
10542 pts/4 00:00:15 csh
>cat /proc/10542/maps
08048000-0808c000 r-xp 00000000 03:01 39144 /bin/tcsh
0808c000-08091000 rw-p 00043000 03:01 39144 /bin/tcsh
08091000-08619000 rwxp 00000000 00:00 0
40000000-40016000 r-xp 00000000 03:01 57570 /lib/ld-2.2.4.so
40016000-40017000 rw-p 00015000 03:01 57570 /lib/ld-2.2.4.so
40017000-40018000 rwxp 00000000 00:00 0
40027000-4003a000 r-xp 00000000 03:01 57588 /lib/libnsl-2.2.4.so
4003a000-4003b000 rw-p 00012000 03:01 57588 /lib/libnsl-2.2.4.so
4003b000-4003e000 rw-p 00000000 00:00 0
4003e000-40041000 r-xp 00000000 03:01 57640 /lib/libtermcap.so.2.0.8
40041000-40042000 rw-p 00002000 03:01 57640 /lib/libtermcap.so.2.0.8
40042000-40047000 r-xp 00000000 03:01 57581 /lib/libcrypt-2.2.4.so
40047000-40048000 rw-p 00004000 03:01 57581 /lib/libcrypt-2.2.4.so
40048000-40070000 rw-p 00000000 00:00 0
40070000-401a8000 r-xp 00000000 03:01 76074 /lib/i686/libc-2.2.4.so
401a8000-401ad000 rw-p 00137000 03:01 76074 /lib/i686/libc-2.2.4.so
401ad000-401b1000 rw-p 00000000 00:00 0
401b1000-401bc000 r-xp 00000000 03:01 57598 /lib/libnss_compat-2.2.4.so
401bc000-401bd000 rw-p 0000a000 03:01 57598 /lib/libnss_compat-2.2.4.so
401bd000-401be000 rw-p 00000000 00:00 0
bffb4000-c0000000 rwxp fffb5000 00:00 0
>
If I can get this from user mode, that would be ok, also.
As others have pointed out, the 'vmmap' tool will allow you to examine the various entries in a process' address map, and depending on what you actually need you can sort/filter them appropriately.
However, the fact that you were asking for this information *inside* the kernel still rings very prominent alarm bells, which is why I was asking *why* you were looking for this information.
= Mike