我有一个家庭作业,我必须向 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 *p
由 p = dup_task_struct(current, node);
创建 - 此后,copy_process()
将是您添加内容的好地方。所有这些都在文件 kernel/fork.c
中.
关于linux内核,task_struct(进程)初始化在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40949954/