標籤:blog http io ar 使用 for strong sp 檔案
[cpp] view plaincopy
- struct task_struct {
- volatile long state; /* -1 不可運行, 0 可運行, >0 表示停止 */
- void *stack;
- atomic_t usage;
- unsigned long flags; /* 每進程標誌 */
- unsigned long ptrace;
- int 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 were stolen by a ptracer.
- */
- struct list_head ptrace_children;
- struct list_head ptrace_list;
- struct mm_struct *mm, *active_mm;
- /* 進程狀態 */
- struct linux_binfmt *binfmt;
- long exit_state;
- int exit_code, exit_signal;
- int pdeath_signal; /* 在父進程終止的時候發送的訊號 */
- unsigned int personality;
- unsigned did_exec:1;
- pid_t pid;
- pid_t tgid;
- struct task_struct *real_parent; /* 真正的父進程(被調試的情況下) */
- struct task_struct *parent; /* 父進程 ,parent和real_parent的區別:real_parent是親爹,調fork的那個,parent呢是乾爹,大部分情況下親爹乾爹是一個人,ps看到的是乾爹,什麼時候親爹乾爹不一樣的,比如有一種情況,比如親爹死了,但是呢又得有一個父進程,比如1號進程就會被當成父進程。但進程不是1號fork出來的。*/
- struct list_head children; /* 子進程鏈表 */
- struct list_head sibling; /* 串連到父進程的子進程的鏈表 */
- struct task_struct *group_leader; /* 線程組組長 */
- /* PID與PID散列表的聯絡*/
- struct pid_link pids[PIDTYPE_MAX];
- struct list_head thread_group;
- struct completion *vfork_done; /* 用於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; /* 環境切換計數 */
- struct timespec start_time; /* 單調時間 */
- struct timespec real_start_time; /* 啟動以來的時間 */
- 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];
- /* 進程身份憑據 */
- 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]; /* 去除路徑後的可執行檔名稱*/
- /* 檔案系統資訊 */
- int link_count, total_link_count;
- /* ipc stuff */
- struct sysv_sem sysvsem;
- /* 當前進程特定的cpu資訊 */
- 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 be 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
- /* 線程組跟蹤 */
- u32 parent_exec_id;
- u32 self_exec_id;
- /* 記錄檔系統資訊 */
- void *journal_info;
- /* 虛擬記憶體狀態 */
- 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; 有幾個進程正在使用此結構
[Linux]進程(十二)--task_struct結構體