xref: /xnu-8792.41.9/bsd/dev/dtrace/scripts/vm_object_ownership.d (revision 5c2921b07a2480ab43ec66f5b9e41cb872bc554f)
1*5c2921b0SApple OSS Distributions #!/usr/sbin/dtrace -s
2*5c2921b0SApple OSS Distributions 
3*5c2921b0SApple OSS Distributions vminfo:::object_ownership_change
4*5c2921b0SApple OSS Distributions {
5*5c2921b0SApple OSS Distributions 	old_owner = (task_t)arg1;
6*5c2921b0SApple OSS Distributions 	if (old_owner == 0) {
7*5c2921b0SApple OSS Distributions 		old_pid = -1;
8*5c2921b0SApple OSS Distributions 		old_name = "(nil)";
9*5c2921b0SApple OSS Distributions 	} else {
10*5c2921b0SApple OSS Distributions 		old_proc = xlate <psinfo_t *>((proc_t)old_owner->t_tro->tro_proc);
11*5c2921b0SApple OSS Distributions 		old_pid = old_proc->pr_pid;
12*5c2921b0SApple OSS Distributions 		old_name = old_proc->pr_fname;
13*5c2921b0SApple OSS Distributions 	}
14*5c2921b0SApple OSS Distributions 	new_owner = (task_t)arg4;
15*5c2921b0SApple OSS Distributions 	if (new_owner == 0) {
16*5c2921b0SApple OSS Distributions 		new_pid = -1;
17*5c2921b0SApple OSS Distributions 		new_name = "(nil)";
18*5c2921b0SApple OSS Distributions 	} else {
19*5c2921b0SApple OSS Distributions 		new_proc = xlate <psinfo_t *>((proc_t)new_owner->t_tro->tro_proc);
20*5c2921b0SApple OSS Distributions 		new_pid = new_proc->pr_pid;
21*5c2921b0SApple OSS Distributions 		new_name = new_proc->pr_fname;
22*5c2921b0SApple OSS Distributions 	}
23*5c2921b0SApple OSS Distributions 
24*5c2921b0SApple 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*5c2921b0SApple OSS Distributions 	       pid, execname, arg0, arg7, ((vm_object_t)arg0)->purgable,
26*5c2921b0SApple OSS Distributions 	       old_owner, old_pid, old_name,
27*5c2921b0SApple OSS Distributions 	       arg2, arg3,
28*5c2921b0SApple OSS Distributions 	       new_owner, new_pid, new_name,
29*5c2921b0SApple OSS Distributions 	       arg5, arg6);
30*5c2921b0SApple OSS Distributions 	stack();
31*5c2921b0SApple OSS Distributions 	ustack();
32*5c2921b0SApple OSS Distributions }
33