summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-25 14:32:29 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-25 14:32:29 (GMT)
commit9e1a9858c84142e32b1bc51b23fa06a025f98b46 (patch)
tree4138e6e9ee61f5cfb61d0b8b4569ba6404118f4c /ext/-test-
parentc6eb59c439cf8b6375a2aba18265a06405a5c651 (diff)
memory_status.c: support old Mac OS
* ext/-test-/memory_status/memory_status.c (read_status): use TASK_BASIC_INFO instead of MACH_TASK_BASIC_INFO on old Mac OS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/memory_status/memory_status.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/-test-/memory_status/memory_status.c b/ext/-test-/memory_status/memory_status.c
index 80e2648..23c4806 100644
--- a/ext/-test-/memory_status/memory_status.c
+++ b/ext/-test-/memory_status/memory_status.c
@@ -17,12 +17,19 @@ read_status(VALUE self)
#if defined __APPLE__
VALUE rss;
kern_return_t error;
- mach_msg_type_number_t out_count;
+# if defined MACH_TASK_BASIC_INFO
+ const task_flavor_t flavor = MACH_TASK_BASIC_INFO;
+ mach_msg_type_number_t out_count = MACH_TASK_BASIC_INFO_COUNT;
mach_task_basic_info_data_t taskinfo;
+# else
+ const task_flavor_t flavor = TASK_BASIC_INFO;
+ mach_msg_type_number_t out_count = TASK_BASIC_INFO_COUNT;
+ task_basic_info_data_t taskinfo;
+# endif
taskinfo.virtual_size = 0;
- out_count = MACH_TASK_BASIC_INFO_COUNT;
- error = task_info(mach_task_self(), MACH_TASK_BASIC_INFO,
+ taskinfo.resident_size = 0;
+ error = task_info(mach_task_self(), flavor,
(task_info_t)&taskinfo, &out_count);
if (error != KERN_SUCCESS) return Qnil;
size = ULL2NUM(taskinfo.virtual_size);