• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: libtop.c: two questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtop.c: two questions


  • Subject: Re: libtop.c: two questions
  • From: "email@hidden" <email@hidden>
  • Date: Sun, 29 Apr 2012 02:45:37 -0400


Jimgreen

On Apr 28, 2012, at 19:55, "Gerriet M. Denkmann" <email@hidden> wrote:

> Reading <http://www.opensource.apple.com/source/top/top-73/libtop.c> I got two questions:
>
>
> 1.
> static void
> libtop_p_fw_scan
> (task_t task, mach_vm_address_t region_base, mach_vm_size_t region_size) {
> [...]
> kr = mach_vm_region_recurse(task, &addr, &size, &depth,(vm_region_recurse_info_t)&sinfo, &count);
> [...]
> switch (sinfo.share_mode) {
>    case SM_SHARED:
>    case SM_COW:
>    case SM_TRUESHARED:
>        if (sinfo.max_protection & VM_PROT_EXECUTE) {
>            // CODE
>            code += sinfo.pages_resident;
>            tsamp.fw_count++;
>        } else if (sinfo.max_protection & VM_PROT_WRITE) {
>            // DATA
>            data += sinfo.pages_resident;
>        } else {
>            // LINKEDIT
>            linkedit += sinfo.pages_resident;
>        }
>        break;
> }
> [...]
>
> But when I look at the results of mach_vm_region_recurse I find that protection/max_protection of:
> __TEXT is r-x/r-x
> __DATA, __OBJC have rw-/rwx
> __LINKEDIT has r--/rwx
>
> So the above code (which checks max_protection) either does make no sense, or I am misunderstanding something.
>
>
> 2.
> In libtop_update_vm_regions (task_t task, libtop_pinfo_t* pinfo)
> I see:
> mach_vm_region(...)
> case SM_PRIVATE:
>    rprvt += info.private_pages_resident * pagesize;
>    rprvt += info.shared_pages_resident * pagesize;
>
> But looking at the results of mach_vm_region(VM_REGION_TOP_INFO) I see that while private_pages_resident, shared_pages_resident ≤ size, quite often private_pages_resident + shared_pages_resident > size.
>
> Does this code really count rprvt correctly?
>
>
> Kind regards,
>
> Gerriet.
>
>
> _______________________________________________
> 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


References: 
 >libtop.c: two questions (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: libtop.c: two questions
  • Next by Date: Max udp buffer size
  • Previous by thread: libtop.c: two questions
  • Next by thread: Max udp buffer size
  • Index(es):
    • Date
    • Thread