xref: /xnu-8020.140.41/bsd/dev/dtrace/scripts/vm_object_ownership.d (revision 27b03b360a988dfd3dfdf34262bb0042026747cc)
1*27b03b36SApple OSS Distributions #!/usr/sbin/dtrace -s
2*27b03b36SApple OSS Distributions 
3*27b03b36SApple OSS Distributions vminfo:::object_ownership_change
4*27b03b36SApple OSS Distributions {
5*27b03b36SApple OSS Distributions 	old_owner = (task_t)arg1;
6*27b03b36SApple OSS Distributions 	if (old_owner == 0) {
7*27b03b36SApple OSS Distributions 		old_pid = -1;
8*27b03b36SApple OSS Distributions 		old_name = "(nil)";
9*27b03b36SApple OSS Distributions 	} else {
10*27b03b36SApple OSS Distributions 		old_proc = xlate <psinfo_t *>((proc_t)old_owner->bsd_info);
11*27b03b36SApple OSS Distributions 		old_pid = old_proc->pr_pid;
12*27b03b36SApple OSS Distributions 		old_name = old_proc->pr_fname;
13*27b03b36SApple OSS Distributions 	}
14*27b03b36SApple OSS Distributions 	new_owner = (task_t)arg4;
15*27b03b36SApple OSS Distributions 	if (new_owner == 0) {
16*27b03b36SApple OSS Distributions 		new_pid = -1;
17*27b03b36SApple OSS Distributions 		new_name = "(nil)";
18*27b03b36SApple OSS Distributions 	} else {
19*27b03b36SApple OSS Distributions 		new_proc = xlate <psinfo_t *>((proc_t)new_owner->bsd_info);
20*27b03b36SApple OSS Distributions 		new_pid = new_proc->pr_pid;
21*27b03b36SApple OSS Distributions 		new_name = new_proc->pr_fname;
22*27b03b36SApple OSS Distributions 	}
23*27b03b36SApple OSS Distributions 
24*27b03b36SApple OSS Distributions 	printf("%d[%s] object 0x%p id 0x%x purgeable:%d owner:0x%p (%d[%s]) tag:%d nofootprint:%d -> owner:0x%p (%d[%s]) tag:%d nofootprint:%d",
25*27b03b36SApple OSS Distributions 	       pid, execname, arg0, arg7, ((vm_object_t)arg0)->purgable,
26*27b03b36SApple OSS Distributions 	       old_owner, old_pid, old_name,
27*27b03b36SApple OSS Distributions 	       arg2, arg3,
28*27b03b36SApple OSS Distributions 	       new_owner, new_pid, new_name,
29*27b03b36SApple OSS Distributions 	       arg5, arg6);
30*27b03b36SApple OSS Distributions 	stack();
31*27b03b36SApple OSS Distributions 	ustack();
32*27b03b36SApple OSS Distributions }
33