code:signal - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
- 传入两个参数
- tp:终端号
- sig:信号类型号
- 向终端号为tp的所有进程发送类型为sig的信号
3941
3942 /*
3943 * Send the specified signal to
3944 * all processes with 'tp' as its
3945 * controlling teletype.
3946 * Called by tty.c for quits and
3947 * interrupts.
3948 */
3949 signal(tp, sig)
3950 {
3951 register struct proc *p;
3952
3953 for(p = &proc[0]; p < &proc[NPROC]; p++)
3954 if(p->p_ttyp == tp)
3955 psignal(p, sig);
3956 }
- 遍历PROC数组,搜索终端号为tp的进程
- 对于每个搜索到的进程,向其发送sig类型的信号
3957 /* ------------------------- */