首页 > 代码库 > 进程控制块 与 task_struct
进程控制块 与 task_struct
http://blog.csdn.net/qq_26768741/article/details/54348586
- struct task_struct {
- volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
- struct thread_info *thread_info;
- atomic_t usage;
- unsigned long flags; /* per process flags, defined below */
- unsigned long ptrace;
- int lock_depth; /* Lock depth */
- int prio, static_prio;
- struct list_head run_list;
- prio_array_t *array;
- unsigned long sleep_avg;
- long interactive_credit;
- unsigned long long timestamp;
- int activated;
- unsigned long policy;
- cpumask_t cpus_allowed;
- unsigned int time_slice, first_time_slice;
- struct list_head tasks;
- struct list_head ptrace_children;
- struct list_head ptrace_list;
- struct mm_struct *mm, *active_mm;
- /* task state */
- struct linux_binfmt *binfmt;
- int exit_code, exit_signal;
- int pdeath_signal; /* The signal sent when the parent dies */
- /* ??? */
- unsigned long personality;
- int did_exec:1;
- pid_t pid;
- pid_t __pgrp; /* Accessed via process_group() */
- pid_t tty_old_pgrp;
- pid_t session;
- pid_t tgid;
- /* boolean value for session group leader */
- int leader;
- /*
- * pointers to (original) parent process, youngest child, younger sibling,
- * older sibling, respectively. (p->father can be replaced with
- * p->parent->pid)
- */
- struct task_struct *real_parent; /* real parent process (when being debugged) */
- struct task_struct *parent; /* parent process */
- struct list_head children; /* list of my children */
- struct list_head sibling; /* linkage in my parent‘s children list */
- struct task_struct *group_leader; /* threadgroup leader */
- /* PID/PID hash table linkage. */
- struct pid_link pids[PIDTYPE_MAX];
- wait_queue_head_t wait_chldexit; /* for wait4() */
- struct completion *vfork_done; /* for vfork() */
- int __user *set_child_tid; /* CLONE_CHILD_SETTID */
- int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */
- unsigned long rt_priority;
- unsigned long it_real_value, it_prof_value, it_virt_value;
- unsigned long it_real_incr, it_prof_incr, it_virt_incr;
- struct timer_list real_timer;
- struct list_head posix_timers; /* POSIX.1b Interval Timers */
- unsigned long utime, stime, cutime, cstime;
- unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; /* context switch counts */
- u64 start_time;
- /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
- unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
- /* process credentials */
- uid_t uid,euid,suid,fsuid;
- gid_t gid,egid,sgid,fsgid;
- int ngroups;
- gid_t groups[NGROUPS];
- kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
- int keep_capabilities:1;
- struct user_struct *user;
- /* limits */
- struct rlimit rlim[RLIM_NLIMITS];
- unsigned short used_math;
- char comm[16];
- /* file system info */
- int link_count, total_link_count;
- struct tty_struct *tty; /* NULL if no tty */
- /* ipc stuff */
- struct sysv_sem sysvsem;
- /* CPU-specific state of this task */
- struct thread_struct thread;
- /* filesystem information */
- struct fs_struct *fs;
- /* open file information */
- struct files_struct *files;
- /* namespace */
- struct namespace *namespace;
- /* signal handlers */
- struct signal_struct *signal;
- struct sighand_struct *sighand;
- sigset_t blocked, real_blocked;
- struct sigpending pending;
- unsigned long sas_ss_sp;
- size_t sas_ss_size;
- int (*notifier)(void *priv);
- void *notifier_data;
- sigset_t *notifier_mask;
- void *security;
- /* Thread group tracking */
- u32 parent_exec_id;
- u32 self_exec_id;
- /* Protection of (de-)allocation: mm, files, fs, tty */
- spinlock_t alloc_lock;
- /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
- spinlock_t proc_lock;
- /* context-switch lock */
- spinlock_t switch_lock;
- /* journalling filesystem info */
- void *journal_info;
- /* VM state */
- struct reclaim_state *reclaim_state;
- struct dentry *proc_dentry;
- struct backing_dev_info *backing_dev_info;
- struct io_context *io_context;
- unsigned long ptrace_message;
- siginfo_t *last_siginfo; /* For ptrace use. */
- };
进程控制块 与 task_struct
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。