diff options
author | Kuba Mracek <mracek@apple.com> | 2017-07-13 20:02:45 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-07-13 20:02:45 +0000 |
commit | 4b50dbfc29cbed04215a5c5e062bcfab488b29ec (patch) | |
tree | 4a6c41a3190998977c69d4a38f8dfdb0daaec2b9 /lib/sanitizer_common/sanitizer_mac.cc | |
parent | 5ebaa70bf9a2b2a8faa0cf0c19159d4f8e24c01c (diff) |
For Darwin's GetTaskInfoMaxAddress, define the real structure with real fields to avoid confusion. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_mac.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_mac.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc index 8df01815f..1edd4157f 100644 --- a/lib/sanitizer_common/sanitizer_mac.cc +++ b/lib/sanitizer_common/sanitizer_mac.cc @@ -805,14 +805,35 @@ char **GetArgv() { // fields only available in 10.12+. Declare the struct manually to be able to // build against older SDKs. struct __sanitizer_task_vm_info { - uptr _unused[(SANITIZER_WORDSIZE == 32) ? 20 : 19]; - uptr min_address; - uptr max_address; + mach_vm_size_t virtual_size; + integer_t region_count; + integer_t page_size; + mach_vm_size_t resident_size; + mach_vm_size_t resident_size_peak; + mach_vm_size_t device; + mach_vm_size_t device_peak; + mach_vm_size_t internal; + mach_vm_size_t internal_peak; + mach_vm_size_t external; + mach_vm_size_t external_peak; + mach_vm_size_t reusable; + mach_vm_size_t reusable_peak; + mach_vm_size_t purgeable_volatile_pmap; + mach_vm_size_t purgeable_volatile_resident; + mach_vm_size_t purgeable_volatile_virtual; + mach_vm_size_t compressed; + mach_vm_size_t compressed_peak; + mach_vm_size_t compressed_lifetime; + mach_vm_size_t phys_footprint; + mach_vm_address_t min_address; + mach_vm_address_t max_address; }; +#define __SANITIZER_TASK_VM_INFO_COUNT ((mach_msg_type_number_t) \ + (sizeof(__sanitizer_task_vm_info) / sizeof(natural_t))) uptr GetTaskInfoMaxAddress() { - __sanitizer_task_vm_info vm_info = {{0}, 0, 0}; - mach_msg_type_number_t count = sizeof(vm_info) / sizeof(int); + __sanitizer_task_vm_info vm_info = {}; + mach_msg_type_number_t count = __SANITIZER_TASK_VM_INFO_COUNT; int err = task_info(mach_task_self(), TASK_VM_INFO, (int *)&vm_info, &count); if (err == 0) { return vm_info.max_address - 1; |