pcb.txt

Process Control Block - vseloved, 2010-10-02 06:46

Download (4.6 KB)

 
1
<sched.h>
2
struct task_struct {
3
        volatile long state;     /* -1 unrunnable, 0 runnable, >0 stopped */
4
        void *stack;
5
        atomic_t usage;
6
        unsigned long flags;     /* per process flags, defined below */
7
        unsigned long ptrace;
8
        int lock_depth;          /* BKL lock depth */
9
        int prio, static_prio, normal_prio;
10
        struct list_head run_list;
11
        const struct sched_class *sched_class;
12
        struct sched_entity se;
13
        unsigned short ioprio;
14
        unsigned long policy;
15
        cpumask_t cpus_allowed;
16
        unsigned int time_slice;
17
#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
18
        struct sched_info sched_info;
19
#endif
20
        struct list_head tasks;
21
        /*
22
         * ptrace_list/ptrace_children forms the list of my children
23
         * that were stolen by a ptracer.
24
         */
25
        struct list_head ptrace_children;
26
        struct list_head ptrace_list;
27
        struct mm_struct *mm, *active_mm;
28
/* task state */
29
        struct linux_binfmt *binfmt;
30
        long exit_state;
31
        int exit_code, exit_signal;
32
        int pdeath_signal; /* The signal sent when the parent dies    */
33
        unsigned int personality;
34
        unsigned did_exec:1;
35
        pid_t pid;
36
        pid_t tgid;
37
        /*
38
         * pointers to (original) parent process, youngest child, younger sibling,
39
         * older sibling, respectively. (p->father can be replaced with
40
         * p->parent->pid)
41
         */
42
        struct task_struct *real_parent; /* real parent process (when being debugged) */
43
        struct task_struct *parent;     /* parent process */
44
        /*
45
         * children/sibling forms the list of my children plus the
46
         * tasks I’m ptracing.
47
         */
48
        struct list_head children;      /* list of my children */
49
        struct list_head sibling;       /* linkage in my parent’s children list */
50
        struct task_struct *group_leader;       /* threadgroup leader */
51
        /* PID/PID hash table linkage. */
52
        struct pid_link pids[PIDTYPE_MAX];
53
        struct list_head thread_group;
54
        struct completion *vfork_done;          /* for vfork() */
55
        int __user *set_child_tid;              /* CLONE_CHILD_SETTID */
56
        int __user *clear_child_tid;            /* CLONE_CHILD_CLEARTID */
57
        unsigned long rt_priority;
58
        cputime_t utime, stime, utimescaled, stimescaled;;
59
        unsigned long nvcsw, nivcsw; /* context switch counts */
60
        struct timespec start_time; /* monotonic time */
61
        struct timespec real_start_time; /* boot based time */
62
        /* mm fault and swap info: this can arguably be seen as either
63
           mm-specific or thread-specific */
64
        unsigned long min_flt, maj_flt;
65
        cputime_t it_prof_expires, it_virt_expires;
66
        unsigned long long it_sched_expires;
67
        struct list_head cpu_timers[3];
68
/* process credentials */
69
        uid_t uid,euid,suid,fsuid;
70
        gid_t gid,egid,sgid,fsgid;
71
        struct group_info *group_info;
72
        kernel_cap_t   cap_effective, cap_inheritable, cap_permitted;
73
        unsigned keep_capabilities:1;
74
        struct user_struct *user;
75
        char comm[TASK_COMM_LEN]; /* executable name excluding path
76
                                      - access with [gs]et_task_comm (which lock
77
                                        it with task_lock())
78
                                      - initialized normally by flush_old_exec */
79
/* file system info */
80
        int link_count, total_link_count;
81
/* ipc stuff */
82
        struct sysv_sem sysvsem;
83
/* CPU-specific state of this task */
84
        struct thread_struct thread;
85
/* filesystem information */
86
        struct fs_struct *fs;
87
/* open file information */
88
        struct files_struct *files;
89
/* namespace */
90
        struct nsproxy *nsproxy;
91
/* signal handlers */
92
        struct signal_struct *signal;
93
        struct sighand_struct *sighand;
94
        sigset_t blocked, real_blocked;
95
        sigset_t saved_sigmask;          /* To be restored with TIF_RESTORE_SIGMASK */
96
        struct sigpending pending;
97
        unsigned long sas_ss_sp;
98
        size_t sas_ss_size;
99
        int (*notifier)(void *priv);
100
        void *notifier_data;
101
        sigset_t *notifier_mask;
102
#ifdef CONFIG_SECURITY
103
        void *security;
104
#endif
105
/* Thread group tracking */
106
        u32 parent_exec_id;
107
        u32 self_exec_id;
108
/* journalling filesystem info */
109
        void *journal_info;
110
/* VM state */
111
        struct reclaim_state *reclaim_state;
112
        struct backing_dev_info *backing_dev_info;
113
        struct io_context *io_context;
114
        unsigned long ptrace_message;
115
        siginfo_t *last_siginfo; /* For ptrace use.   */
116
...
117
};
118