摘要: //m3.c#include <string.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <sys/syscall.h> //定义宏 #define gettid() syscall(__NR_ge 阅读全文
posted @ 2021-06-25 17:27 nanfengnan 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 1.引言(proface) 从源程序到可执行程序要经历:编译->链接->装入,再多道程序环境下,程序要想运行必须先创建进程,创建进程就必须先将程序和数据加载到内存中编译:通过编译程序Compiler将源程序编译成目标模块链接:通过链接程序Linker将目标模块和库函数链接到一起形成装入模块Load 阅读全文
posted @ 2021-06-25 17:01 nanfengnan 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 废话不多说,直接上源代码:这个程序是加载进内核的模块,作用是:打印系统中所有进程的一些信息,注意:这是ubuntu系统下的操作 #include <linux/kernel.h> #include <linux/sched.h> //这个文件定义了linux下的task_struct数据结构 #in 阅读全文
posted @ 2021-06-25 16:35 nanfengnan 阅读(537) 评论(0) 推荐(0) 编辑
摘要: 问题描述:这类问题的解决办法,提示少什么我们直接用sudo apt-get install 安装缺少的东西即可 如果使用make menuconfig的方式配置内核,又碰巧系统没有安装ncurses库(ubuntu系统 默认就没有安装此库),就会出现错误,错误信息大体上如下: kent@hu:~/w 阅读全文
posted @ 2021-06-25 00:10 nanfengnan 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 编译时失败是因为: 缺少lpthread该库支持 所以编译时,这样编译即可解决线程创建函数为定义的引用 c语言:gcc xx.c -lpthread -o xx c++语言:g++ xx.cpp -lpthread -o xx 阅读全文
posted @ 2021-06-25 00:02 nanfengnan 阅读(1344) 评论(0) 推荐(1) 编辑