linux内核,task_struct(进程)初始化在哪里

标签 linux process linux-kernel kernel

我有一个家庭作业,我必须向 task_struct 添加一些条目并用它们做一些事情。此外,我必须在 task_struct 初始化时将一个条目初始化为特定的 int。

task_struct 第一次初始化的文件/代码在哪里?

我找到了INIT_TASK.h但是有task_struct表的第一个进程。我想找到每个 task_struct 初始化并定义其起始值的位置,以便为我插入的新条目定义一些数字。

最佳答案

I tried fork, do_fork, init_task but I could not find something except init_task.h as I said in my first post. Could you please just tell me either the syscall either the file that I can find the code for task_struct initialization?

您已经在正确的轨道上。现在 do_fork() 以及 SYSCALL_DEFINE0(fork) 背后的函数调用 _do_fork(),后者调用 copy_process(),其中新的 struct task_struct *pp = dup_task_struct(current, node); 创建 - 此后,copy_process()将是您添加内容的好地方。所有这些都在文件 kernel/fork.c 中.

关于linux内核,task_struct(进程)初始化在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40949954/

相关文章:

memory-management - 已分配给定物理地址的进程的信息?

linux - 无法在 Centos 8 上安装回 yum

c - 一个基本的 "mount"问题

node.js - NodeJs : running spawn process memory usage is growing

linux - su之后如何找到进程的真正所有者

linux - 捕捉持续不到一秒的过程

linux - 从虚拟 Linux 网络设备驱动程序发送的 RX 数据包被丢弃

linux - 如何使脚本在 init 后作为启动脚本在 buildroot 中运行

python - 如何将Linux命令转换为Python脚本?

php - 消息 : fsockopen(): unable to connect to ssl://smtp. googlemail.com:465(权限被拒绝)