Skip to content

Using dtrace to remove automounted lofi devices

April 25, 2005

While having the lofi devices hanging around after they get automounted is perfectly acceptable on a laptop it is still not right. So I have added a call to this dtrace script to the end of the mount command in /usr/lib/fs/isofs. Like this:

: principia IA 3 $; tail -3 /usr/lib/fs/isofs/mount
/usr/local/sbin/lofid $dir $lofidev  &
exit 0
: principia IA 4 $;

Then save this d script as /usr/local/sbin/lofid and make it executable.

#!/usr/sbin/dtrace -s
#pragma D option destructive
#pragma D option quiet  

/copyinstr(arg0) == $1/
      self->x = 1;
/arg1 == 0 && self->x != 0/
       system("/usr/sbin/lofiadm -d %s", $2);

Technorati Tag:


From → Solaris

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: