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.
Thanks
again,
Chuck
On Feb 1, 2007, at 6:10 AM, Yount, Chuck wrote:
Does someone have a piece of code that will walk
the list of tasks from a kext? I can call current_task(), which I know returns
a pointer to the task struct that contains the prev and next pointers, but the
struct is apparently not available outside the kernel itself. Anyone know how
to traverse the list cleanly?
BTW, ultimately what I need is a list of all
processes, the modules loaded by each one, and their virtual address
ranges.
What do you mean by "the modules loaded by each one"? And why do you
need this information inside the kernel?
= Mike
|