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