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