- 论坛徽章:
- 0
|
各位大虾:
小弟最近在学习内核编程, 并且动手修改了一个函数--kernel/printk.c中的tty_write_message函数:
/**
* tty_write_message - write a message to a certain tty, not just the console.
*
* This is used for messages that need to be redirected to a specific tty.
* We don't put it into the syslog queue right now maybe in the future if
* really needed.
*/
void tty_write_message(struct tty_struct *tty, char *msg)
{
/* 添加的部分 */
int t_length = strlen(msg);
msg[t_length] = 'H';t_length++;
msg[t_length] = 'e';t_length++;
msg[t_length] = 'l';t_length++;
msg[t_length] = 'l';t_length++;
msg[t_length] = 'o';t_length++;
msg[t_length] = '\0';
/* 添加的部分到此结束, 相当于在原msg后连接上"Hello" */
if (tty && tty->driver->write)
tty->driver->write(tty, msg, strlen(msg));
return;
}
不知道怎样才能让这个改动生效? 比如输出到控制台, 从而让我可以看到效果?
希望大家不吝赐教,谢啦~~ |
|