⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.kthread1

📁 fsmlabs的real time linux的内核
💻 KTHREAD1
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -