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

Source

2826

2827 /*

2828  * Call the system-entry routine f (out of the

2829  * sysent table). This is a subroutine for trap, and

2830  * not in-line, because if a signal occurs

2831  * during processing, an (abnormal) return is simulated from

2832  * the last caller to savu(qsav); if this took place

2833  * inside of trap, it wouldn’t have a chance to clean up.

2834  *

2835  * If this occurs, the return takes place without

2836  * clearing u_intflg; if it’s still set, trap

2837  * marks an error which means that a system

2838  * call (like read on a typewrite) got interrupted

2839  * by a signal.

2840  */

2841 trap1(f)

2842 int (*f)();

2843 {

2844

2845     u.u_intflg = 1;

  • u.u_intflg(系统调用 出错标志)
  • 参看 后面的注释
2846     savu(u.u_qsav);
2847     (*f)();

2848     u.u_intflg = 0;

关于此处的说明
  • 如果 系统调用处理函数 正常,则u.u_intflg=0
  • 若 系统调用处理函数 运行中 收到信号
2849 }

2850 /* ------------------------- */

Ref

Caller

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