code:issig - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

  • 检查 并 处理当前进程信号
  • 返回值
    • 没有信号,返回0
    • 有信号,返回信号值

3979

3980 /*

3981  * Returns true if the current

3982  * process has a signal to process.

3983  * This is asked at least once

3984  * each time a process enters the

3985  * system.

3986  * A signal does not do anything

3987  * directly to a process; it sets

3988  * a flag that asks the process to

3989  * do something to itself.

3990  */

3991 issig()

3992 {

3993     register n;

3994     register struct proc *p;

3995

3996     p = u.u_procp;

3997     if(n = p->p_sig) {

3998          if (p->p_flag&STRC) {

3999           stop();

  • 现行进程 带 跟踪标志(STRC),执行stop
  • 参看跟踪
4000           if ((n = p->p_sig) == 0)

4001                return(0);

  • 信号 为 0,不做处理
4002          }

4003      if((u.u_signal[n]&1) == 0)

4004           return(n);

  • 信号处理方式
    • 为 奇数,不做处理
    • 为 偶数,返回信号值
4005     }

4006     return(0);

4007 }

4008 /* ------------------------- */

Ref

Caller

⚠️ **GitHub.com Fallback** ⚠️