Device Driver Tutorial

Removing the Template Driver

Make sure you are user root when you unload the driver. Use the rem_drv(1M) command to unload the driver and remove the device from the /devices directory:


# rem_drv dummy

You should see the following messages in the window where you are viewing /var/adm/messages:


date time machine dummy: [ID 513080 kern.notice] NOTICE: Inside _info
date time machine dummy: [ID 617648 kern.notice] NOTICE: Inside dummy_detach
date time machine dummy: [ID 812373 kern.notice] NOTICE: Inside _fini

The dummy device is no longer in the /devices directory:


# ls /devices/pseudo/dummy*
/devices/pseudo/dummy*: No such file or directory

The next time you want to read from or write to the dummy device, you must load the driver again using add_drv(1M).

You can use the modunload(1M) command to unload the driver but not remove the device from /devices. Then the next time you read from or write to the dummy device, the driver is automatically loaded.

Press Control-C to stop tailing the /var/adm/messages messages.