[CPP]View Plaincopy
- struct Task_struct {
- volatile long state; /*-1 not operational, 0 can run, >0 means stop */
- void *stack;
- atomic_t usage;
- unsigned long flags; /* per Process flag */
- unsigned long ptrace;
- int lock_depth; / * Large kernel lock depth * /
- int Prio, Static_prio, Normal_prio;
- struct List_head run_list;
- const struct sched_class *sched_class;
- struct sched_entity se;
- unsigned short ioprio;
- unsigned long policy;
- cpumask_t cpus_allowed;
- unsigned int time_slice;
- #if defined (config_schedstats) | | Defined (CONFIG_TASK_DELAY_ACCT)
- struct Sched_info sched_info;
- #endif
- struct list_head tasks;
- /*
- * Ptrace_list/ptrace_children forms the list of my children
- * That's were stolen by a ptracer.
- */
- struct List_head ptrace_children;
- struct List_head ptrace_list;
- struct mm_struct *mm, *active_mm;
- /* Process Status */
- struct LINUX_BINFMT *binfmt;
- long exit_state;
- int Exit_code, exit_signal;
- int pdeath_signal; / * Signal sent at the end of the parent process * /
- unsigned int personality;
- unsigned did_exec:1;
- pid_t pid;
- pid_t Tgid;
- struct task_struct *real_parent; /* Real parent process (in case of being debugged) */
- struct task_struct *parent; /* Parental process, parent and real_parent differences: Real_parent is the father, the fork, the parent is the father, most of the time the father-in-God is a person, PS see is the father-in-god, when the father-in-the-fathers are not the same, For example, there is a situation, such as a father died, but also have a parent process, such as the 1th process will be treated as a parent process. But the process is not the number 1th fork out. */
- struct list_head children; / * Child process Chain list * /
- struct list_head sibling; / * The linked list of child processes connected to the parent process * /
- struct task_struct *group_leader; / * Thread Group leader * /
- /* PID and PID hash list contact */
- struct Pid_link Pids[pidtype_max];
- struct List_head thread_group;
- 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;
- cputime_t Utime, Stime, utimescaled, stimescaled;
- Unsigned long NVCSW, NIVCSW; / * Context Switch Count * /
- struct Timespec start_time; / * Monotone time * /
- struct Timespec real_start_time; / * Time since startup * /
- Unsigned long min_flt, Maj_flt;
- cputime_t It_prof_expires, It_virt_expires;
- Unsigned long long it_sched_expires;
- struct List_head cpu_timers[3];
- /* Process Identity credentials */
- uid_t Uid,euid,suid,fsuid;
- gid_t Gid,egid,sgid,fsgid;
- struct Group_info *group_info;
- kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
- unsigned keep_capabilities:1;
- struct user_struct *user;
- Char Comm[task_comm_len]; / * The name of the executable file after removing the path * /
- /* File System Information */
- int Link_count, total_link_count;
- /* IPC Stuff */
- struct Sysv_sem Sysvsem;
- /* Current process-specific CPU information */
- struct thread_struct thread;
- /* FileSystem information */
- struct fs_struct *fs;
- /* Open File Information */
- struct files_struct *files;
- /* Namespace */
- struct Nsproxy *nsproxy;
- /* Signal handlers */
- struct signal_struct *signal;
- struct sighand_struct *sighand;
- sigset_t blocked, real_blocked;
- sigset_t Saved_sigmask; /* To is restored with tif_restore_sigmask * /
- struct sigpending pending;
- unsigned long sas_ss_sp;
- size_t sas_ss_size;
- Int (*notifier) (void *priv);
- void *notifier_data;
- sigset_t *notifier_mask;
- #ifdef config_security
- V OID *security;
- #endif
- /* Thread Group Tracking */
- U32 parent_exec_id;
- U32 self_exec_id;
- /* Log File System Information */
- void *journal_info;
- /* Virtual Memory status */
- struct reclaim_state *reclaim_state;
- struct Backing_dev_info *backing_dev_info;
- struct Io_context *io_context;
- unsigned long ptrace_message;
- siginfo_t *last_siginfo; / * for ptrace use. * /
- ...
- };
atomic_t usage; There are several processes that are using this structure
[Linux] Process (12)--TASK_STRUCT structure