在 Linux 设备驱动程序开发中使用 MODULE_LICENSE("GPL") 到底有什么好处?我的意思是,如果不使用或不使用它,我们会缺少什么或获得什么。当我们将 MODULE 定义为非 GPL 时,我们将无法使用哪些内核符号。
假设我有一个像Firefox这样的浏览器进程,它有pid = 123. Firefox有5个打开的标签,每个标签都运行在一个单独的线程中,因此它总共有5个线程.
所以我想深入了解内核如何将进程分离到线程中以struct task_struct在thread_info中执行.
Like struct task_struct是任务列表的任务描述符.哪里struct task_struct包含引用或这五个线程的链接.
struct thread_struct像Firefox这样的进程是否包含对所有5个线程的引用
要么
每个线程都被视为Linux内核中的进程.
我基本上想知道两件事
\n\n我从 LKD Robert Love 中得到了以下摘录,任何人都可以更好地解释在给出 __GFP_HIGHMEM 标志时使用 alloc_pages() 的确切问题是什么。
\n\n第 240 页 第 12 章
\n\n\n\n您不能将 __GFP_HIGHMEM 指定为 __get_free_pages() 或 \n kmalloc()。因为它们都返回逻辑地址,而不是页结构,所以这些函数可能会分配当前未映射到内核 xe2x80x99s 虚拟地址空间中的内存,因此不会分配内存。有一个逻辑地址。只有 alloc_pages() 可以分配高内存。但是,大多数分配不会指定区域修饰符,因为 ZONE_NORMAL 就足够了。
\n
内核版本:3.13.0-32-generic
\n\n当我构建模块时出现错误
\n\n\nmake -C /lib/modules/3.13.0-32-generic/build\n M=/home/wipro/Downloads/proc 模块 make[1]: 进入目录\n
/usr/src/linux-headers-3.13.0-32-generic\' CC [M] \n /home/wipro/Downloads/proc/proc.o /home/wipro/Downloads/proc/proc.c:\n In function \xe2\x80\x98proc_win_init\xe2\x80\x99: /home/wipro/Downloads/proc/proc.c:21:5:\n error: implicit declaration of function \xe2\x80\x98create_proc_entry\xe2\x80\x99\n [-Werror=implicit-function-declaration]\n if ((file = create_proc_entry("rel_time", 0666, parent)) == NULL) {\n ^ /home/wipro/Downloads/proc/proc.c:21:15: warning: assignment makes pointer from integer without a cast [enabled by default]\n if ((file = create_proc_entry("rel_time", 0666, parent)) == NULL) {\n ^ /home/wipro/Downloads/proc/proc.c:25:9: error: dereferencing pointer to incomplete type\n file->read_proc = time_read;\n ^ /home/wipro/Downloads/proc/proc.c:26:9: error: dereferencing pointer to incomplete type\n …
为什么与printf不同,Linux 内核模块中的printk缺乏浮点支持