watch_for_automounts   [plain text]


#!/usr/sbin/dtrace -s
/*
 * Usage: sudo watch_for_automounts
 *
 * Watches for paths that trigger kernel
 * interaction with automountd.
 */
#pragma D option quiet

BEGIN
{
	printf("Watching for automounts - ^C to quit ...\n");
}

fbt::lookup:entry
{
	self->nd = (struct nameidata *) arg0;
}
fbt::lookup:return
{
	self->nd = NULL;
}

fbt::host_get_special_port:entry / self->nd /
{
	printf("\n\t%Y uid=%-4d pid=%-4d %s %s\n", walltimestamp,
		uid, pid, execname, ((struct nameidata *) self->nd)->ni_pathbuf);
	ustack();
}