摘要 |
A scheme for enabling I/O control ("ioctl") commands to be dynamically added to and removed from a file, in particular, a pseudo device driver ("PDD") in a Unix kernel, without requiring the kernel subsequently to be recompiled and rebooted. In one embodiment, this is accomplished by providing an ioctl table in the file for storing one or more ioctl commands. The ioctl table is indexed by ioctl command and each table entry comprises a function pointer that is called when the corresponding ioctl command is issued. Additionally, two functions are added to the PDD, including a register_cmd(cmd, fn( )) function, which adds an ioctl command ("cmd") and its corresponding function pointer ("fn( )")to the ioctl table, and an unregister_cmd(cmd) function, which removes an ioctl command and its corresponding function pointer from the ioctl table.
|