Re: Walking the task list from a kext
Re: Walking the task list from a kext
- Subject: Re: Walking the task list from a kext
- From: Steven Bytnar <email@hidden>
- Date: Thu, 1 Feb 2007 12:54:09 -0600
I think you want the shell command "vmmap".
$ vmmap
no process id or name specified
syntax: vmmap [-d <secs>] [-w] [-wide] [-resident] [-pages] [-interleaved] [-submap] [-allSplitLibs] <pid/partial name>
Gives you an indication of the VM used by a process
-d print delta between 2 snapshots
-w or -wide print wide output
-resident print amount of memory region that is resident
-pages print region sizes in page counts rather than kilobytes
-interleaved print all regions in order, rather than non-writable then writable
-submap print info about submaps
-allSplitLibs print info about all system split libraries, even those not loaded by this process
--Steve
On Thu, Feb 01, 2007 at 11:28:53AM -0700, 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.
> 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
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden