readme.kthread1
来自「fsmlabs的real time linux的内核」· KTHREAD1 代码 · 共 34 行
KTHREAD1
34 行
A very simple kthread example - a very dangorouse kthread example.The kernel thread is only invoced to call execve and thats it - as it inheritsthe environment of the user that launched the insmod ktherd1.o (you) the echogoes to the this users console. basically this is nothing else than the kthread equivalent of the fairly useless userspace uthread1 (well its not athread but...).---uthread1.c---#include <unistd.h> char cmd_path[256] = "/bin/echo";char main_arg[] ="Hello User World";main(){ static char * envp[] = { "HOME=/root", "TERM=linux", "PATH=/bin", NULL }; char *argv[] = { cmd_path, main_arg, NULL }; int ret; printf("calling execve for %s \n",cmd_path); ret = execve(cmd_path, argv, envp); /* if we ever get here - execve failed */ printf("failed to exec %s, ret = %d\n", cmd_path,ret); return -1;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?