10.1. Replacing printk
In Section 1.2.1.2, I said that X and kernel module programming don't mix. That's true for developing kernel modules, but in actual use, you want to be able to send messages to whichever tty[1] the command to load the module came from.The way this is done is by using current, a pointer to the currently running task, to get the current task's tty structure. Then, we look inside that tty structure to find a pointer to a string write function, which we use to write a string to the tty.
Example 10-1. print_string.c
/* print_string.c - Send output to the tty you're running on, regardless of whether it's
* through X11, telnet, etc. We do this by printing the string to the tty associated
* with the current task.
*/
#include
|
By
James Thornton
|
No comments:
Post a Comment