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