[Linux]进程(十二)--task_struct结构体
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                [Linux]进程(十二)--task_struct结构体
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                
                            
                            
                            [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;?有幾個進程正在使用此結構
轉載于:https://www.cnblogs.com/zhiliao112/p/4051378.html
總結
以上是生活随笔為你收集整理的[Linux]进程(十二)--task_struct结构体的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Kali Linux Web 渗透测试视
- 下一篇: .net framework 2.0 S
