wait_queue_head_t wait_chldexit; /* for wait4() */ //在系统调用wait4()中睡眠的进程的等待队列
/* current thread group signal load-balancing target: */
task_t *curr_target; //接收信号的线程组中最后一个进程的描述符
/* shared signal handling: */
struct sigpending shared_pending; //存放共享挂起信号的数据结构
/* thread group exit support */
int group_exit_code; //线程组的进程终止代码
/* overloaded:
* - notify group_exit_task when ->count is equal to notify_count
* - everyone except group_exit_task is stopped during signal delivery
* of fatal signals, group_exit_task processes the signal.
*/
struct task_struct *group_exit_task; //在杀死整个线程组的时候使用
int notify_count; //在杀死整个线程组的时候使用
/* thread group stop support, overloads group_exit_code too */
int group_stop_count; //在停止整个线程组的时候使用
unsigned int flags; /* see SIGNAL_* flags below */ //在传递修改进程状态的信号时使用的标志
/* job control IDs */
pid_t pgrp; //P所在进程组的领头进程PID
pid_t tty_old_pgrp; //
pid_t session; //
/* boolean value for session group leader */
int leader;
struct tty_struct *tty; /* NULL if no tty *//*与进程相关的tty*/
/*
* Cumulative resource counters for dead threads in the group,
* and for reaped dead child processes forked by this group.
* Live threads maintain their own counters and add to these
* in __exit_signal, except for the group leader.
*/
cputime_t utime, stime, cutime, cstime;
unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
/*
* We don‘t bother to synchronize most readers of this at all,
* because there is no reader checking a limit that actually needs
* to get both rlim_cur and rlim_max atomically, and either one
* alone is a single word that can safely be read normally.
* getrlimit/setrlimit use task_lock(current->group_leader) to
* protect this instead of the siglock, because they really
* have no need to disable irqs.
*/
struct rlimit rlim[RLIM_NLIMITS];
};
除了信号描述符以外,每个进程还引用一个信号处理程序描述符(signal handler deseriptor),它是一个sighand_struct类型的结构,用来描述每个信号必须怎样被线程组处理。
struct sighand_struct {
atomic_t count; //信号处理程序描述符的使用计数器
struct k_sigaction action[_NSIG]; //说明在所传递信号上执行操作的结构数组
spinlock_t siglock; //保护信号描述符和信号处理程序描述符的自旋锁
};
sigaction数据结构
一些体系结构把特性赋给仅对内核可见的信号。
struct sigaction {
__sighandler_t sa_handler; //指定要执行操作的类型。
unsigned long sa_flags; //指定必须怎样处理信号。
__sigrestore_t sa_restorer;
sigset_t sa_mask; //指定当运行信号处理程序时要屏蔽的信号。
};
挂起信号队列
为了跟踪当前的挂起信号是什么,内核把两个挂起信号队列与每个进程相关联:
共享挂起信号队列:位于信号描述符的shared_pending字段,存放整个线程组的挂起信号。
私有挂起信号队列:位于进程描述符的pending字段,存放特定进程(轻量级进程)的挂起信号。