Managing and Developing Dynamically Loadable Kernel Modules

Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12560
4. Execute the following command to generate the dlclass driver: make.
The make (1) command examines the local Makefile and generates
the dlclass driver according to the rules in the Makefile. It
compiles dlclass.c into mod.o. It then installs and configures the
driver. The make command also loads the driver and extracts the
dynamically assigned major number used to create device special file
/dev/dlclass.
You can read a message from dlclass by executing the following
command: cat /dev/dlclass. The following message prints on your
computer screen: “Reading from loadable WSIO driver ‘dlclass’.”
You can write a message to dlclass by executing a command such as
echo Hello Hello > /dev/dlclass. To see the output, execute the
following command: dmesg | tail. The system responds as follows:
dlclass> OPEN -- write buffer size = 40
dlclass> ’Hello Hello’
dlclass> CLOSE
But if you write a message more than 40 characters, (cp master
/dev/dlclass, for example), the write() system call will fail because
dlclass cannot remember such a long word. You can change the
maximum length of the message by using kmtune -s to set the tunable
parameter dlclass_bufsz to a higher value.
NOTE When dlclass is unloaded (kmadmin -U dlclass), you can auto load
dlclass by executing a command such as cat /dev/dlclass.