If No: given a pid and an address (pointing to the start of a region as returned by vm_region_64) what to do to get answers to the following questions:
- is this region mapped? If Yes: to what file?
- is this region shared with other pid's ? If Yes: which ones?
Kind regards,
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (Darwin...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/darwin-kernel/darwin-kernel-garchive-95844%40googlegroups.com
This email sent to darwin-kernel-...@googlegroups.com
> Is the source of the Unix tool vmmap available somewhere?
It is not.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> On 23 Mar 2012, at 09:27, Gerriet M. Denkmann wrote:
>
>> Is the source of the Unix tool vmmap available somewhere?
>
> It is not.
Also, are you trying to get this information for debugging purposes, or to make some meaningful runtime decision on an app that you ship to real users? The latter is likely to be a mistake, because binary compatibility at this layer is less than perfect.
>
> On 23 Mar 2012, at 09:55, Quinn The Eskimo! wrote:
>
>> On 23 Mar 2012, at 09:27, Gerriet M. Denkmann wrote:
>>
>>> Is the source of the Unix tool vmmap available somewhere?
>>
>> It is not.
>
> Also, are you trying to get this information for debugging purposes, or to make some meaningful runtime decision on an app that you ship to real users? The latter is likely to be a mistake, because binary compatibility at this layer is less than perfect.
First I want this information for my own entertainment and to educate myself.
Publishing the resulting app for real users might be something to be thought about in the far future.
Kind regards,
Gerriet.
Doing nm /System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication yields interesting functions:
mach_vm_region_recurse
vm_map_page_query
And other functions in mach_vm.def in the kernel source might interest you.
Good luck!
- Antoine
> https://lists.apple.com/mailman/options/darwin-kernel/antoine.missout%40metakine.com
>
> This email sent to antoine...@metakine.com
I can sympathize with Gerriet ... I asked similar questions about HP's MPE/iX operating
system, and that's what led me to be able to write tools that were eventually
products used by users *and* HP.
(With the HP 3000, we had a strong users group ... which helped provide much more
visibility into the kernel and much more interaction with the kernel lab.)
I find memory (real and virtual) to be one of the hardest things to get good
information about on operating systems other than the now-discontinued MPE/iX.
I like asking questions: is this virtual address valid? Is it readable by me? Writable?
Is this virtual page in memory? Is it dirty? Was it referenced recently?
Is it frozen in memory? (Let me freeze, and later unfreeze it.)
(For that matter, let me say "I'm planning to use it in the next few milliseconds...
please fetch it into memory behind my back now, while I do other things").
These are all reasonable questions to ask ... one can easily see how they can lead to
better/faster code in some cases.
Stan
> (For that matter, let me say "I'm planning to use it in the next few milliseconds...
> please fetch it into memory behind my back now, while I do other things").
There is such an API already today: man madvise (I don't know how much is hooked up today though, at least in Mac OS X 10.5 most of those parameters were still no-ops: http://lists.apple.com/archives/PerfOptimization-dev/2009/Apr/msg00024.html )
Jonas
> (For that matter, let me say "I'm planning to use it in the next few milliseconds...
> please fetch it into memory behind my back now, while I do other things").
This one part of your wishes may be possible, but I'm not sure for
what proportion of memory, with madvise(..., MADV_WILLNEED).
Regards,
James.
On Sat, Mar 24, 2012 at 8:00 AM, <darwin-ker...@lists.apple.com> wrote:
<snip>
> ------------------------------
>
> Message: 9
> Date: Fri, 23 Mar 2012 10:44:42 -0700
> From: Stan Sieler <sie...@me.com>
> To: "Gerriet M. Denkmann" <ger...@mdenkmann.de>
> Cc: "darwin...@lists.apple.com Kernel"
> <darwin...@lists.apple.com>
> Subject: Re: vmmap
> Message-ID: <9772AEC8-AC3B-4746...@me.com>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> Re:
>>>>> Is the source of the Unix tool vmmap available somewhere?
>>> Also, are you trying to get this information for debugging purposes, or to make some meaningful runtime decision on an app that you ship to real users?
>> First I want this information for my own entertainment and to educate myself.
>> Publishing the resulting app for real users might be something to be thought about in the far future.
>
> I can sympathize with Gerriet ... I asked similar questions about HP's MPE/iX operating
> system, and that's what led me to be able to write tools that were eventually
> products used by users *and* HP.
>
> (With the HP 3000, we had a strong users group ... which helped provide much more
> visibility into the kernel and much more interaction with the kernel lab.)
>
> I find memory (real and virtual) to be one of the hardest things to get good
> information about on operating systems other than the now-discontinued MPE/iX.
> I like asking questions: is this virtual address valid? Is it readable by me? Writable?
> Is this virtual page in memory? Is it dirty? Was it referenced recently?
> Is it frozen in memory? (Let me freeze, and later unfreeze it.)
> (For that matter, let me say "I'm planning to use it in the next few milliseconds...
> please fetch it into memory behind my back now, while I do other things").
>
> These are all reasonable questions to ask ... one can easily see how they can lead to
> better/faster code in some cases.
>
> Stan
>
_______________________________________________
From the name, I suspected that it might not quite meet some needs
I've had in the past (and the man page confirms it).
I've worked on high-end sorting code that does things like:
prefetch (a virtual address, &request_id, NOWAIT)
(similar to madvise (..., MADV_WILLNEED), but stronger)
(If I wanted to wait for the data to be brought in, I'd
pass WAIT instead of NOWAIT ... a prefetch with WAIT is
presumably a bit faster/cheaper than getting a page fault
on the data.)
... code to do other stuff with other data ...
// see if the prefetch is done yet...
if (is_prefetch_request_done (request_id, NOWAIT))
... do something with that data
else
... do stuff with other data already in memory
I.e., I don't just want to say "hey, I plan to use it" ... I want to say
"absolutely start reading it in now, but don't block my code while you do it".
Still, a good reference, thanks!
You may want to look at proc_regionfilename from libproc.h (and maybe
its implementation).
> - is this region shared with other pid's ? If Yes: which ones?
The former question can be sort of answered by vm_region. I don't
know any easy way to answer the latter.
> On Fri, Mar 23, 2012 at 5:27 AM, Gerriet M. Denkmann
> <ger...@mdenkmann.de> wrote:
>> Is the source of the Unix tool vmmap available somewhere? If Yes: where?
>>
>> If No: given a pid and an address (pointing to the start of a region as returned by vm_region_64) what to do to get answers to the following questions:
>>
>> - is this region mapped? If Yes: to what file?
>
> You may want to look at proc_regionfilename from libproc.h (and maybe
> its implementation).
Thanks. proc_regionfilename() does help a lot. And I would never have found it without your help.
Very much appreciated.
Kind regards,
Gerriet.