[前][次][番号順一覧][スレッド一覧]

ruby-changes:45107

From: nobu <ko1@a...>
Date: Sun, 25 Dec 2016 23:32:35 +0900 (JST)
Subject: [ruby-changes:45107] nobu:r57180 (trunk): memory_status.c: support old Mac OS

nobu	2016-12-25 23:32:29 +0900 (Sun, 25 Dec 2016)

  New Revision: 57180

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57180

  Log:
    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.

  Modified files:
    trunk/ext/-test-/memory_status/memory_status.c
Index: ext/-test-/memory_status/memory_status.c
===================================================================
--- ext/-test-/memory_status/memory_status.c	(revision 57179)
+++ ext/-test-/memory_status/memory_status.c	(revision 57180)
@@ -17,12 +17,19 @@ read_status(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/-test-/memory_status/memory_status.c#L17
 #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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]