*第三章 进程

   

   

   

   

   

   

   

   

   

   

   

   

struct thread_info {

        struct task_struct        *task;                /* main task structure */

        struct exec_domain        *exec_domain;        /* execution domain */

        __u32                        flags;                /* low level flags */

        __u32                        status;                /* thread synchronous flags */

        __u32                        cpu;                /* current CPU */

        int                        preempt_count;        /* 0 => preemptable,

                                                 <0 => BUG */

        mm_segment_t                addr_limit;

        struct restart_block restart_block;

        void __user                *sysenter_return;

#ifdef CONFIG_X86_32

        unsigned long previous_esp; /* ESP of the previous stack in

                                                 case of nested (IRQ) stacks

                                                */

        __u8                        supervisor_stack[0];

#endif

        int                        uaccess_err;

};

   

   

   

   

long do_fork(unsigned long clone_flags,

         unsigned long stack_start,

         struct pt_regs *regs,

         unsigned long stack_size,

         int __user *parent_tidptr,

         int __user *child_tidptr)

{

        struct task_struct *p;

        int trace = 0;

        long nr;

。。。

/*

* When called from kernel_thread, don't do user tracing stuff.

*/

if (likely(user_mode(regs)))

        trace = tracehook_prepare_clone(clone_flags);

   

p = copy_process(clone_flags, stack_start, regs, stack_size,

         child_tidptr, NULL, trace);

。。。

   

   

   

   

posted @ 2022-09-02 14:55  atomxing  阅读(14)  评论(0编辑  收藏  举报