home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man2 / signal.2 < prev    next >
Encoding:
Text File  |  1975-06-26  |  2.9 KB  |  152 lines

  1. .th SIGNAL II 8/5/73
  2. .sh NAME
  3. signal \*- catch or ignore signals
  4. .sh SYNOPSIS
  5. (signal = 48.)
  6. .br
  7. .ft B
  8. sys  signal; sig; label
  9. .ft R
  10. .br
  11. (old value in r0)
  12. .s3
  13. .ft B
  14. signal(sig, func)
  15. .br
  16. int (*func)( );
  17. .ft R
  18. .sh DESCRIPTION
  19. A
  20. .it signal
  21. is generated by some abnormal event,
  22. initiated either by user at a typewriter (quit, interrupt),
  23. by a program error (bus error, etc.),
  24. or by request of another program (kill).
  25. Normally all signals
  26. cause termination of the receiving process,
  27. but this call allows them either to be ignored
  28. or to cause an interrupt to a specified location.
  29. Here is the list of signals:
  30. .s3
  31. .lp +10 5
  32. 1    hangup
  33. .lp +10 5
  34. 2    interrupt
  35. .lp +10 5
  36. 3*    quit
  37. .lp +10 5
  38. 4*    illegal instruction (not reset when caught)
  39. .lp +10 5
  40. 5*    trace trap (not reset when caught)
  41. .lp +10 5
  42. 6*    IOT instruction
  43. .lp +10 5
  44. 7*    EMT instruction
  45. .lp +10 5
  46. 8*    floating point exception
  47. .lp +10 5
  48. 9    kill (cannot be caught or ignored)
  49. .lp +10 5
  50. 10*    bus error
  51. .lp +10 5
  52. 11*    segmentation violation
  53. .lp +10 5
  54. 12*    bad argument to system call
  55. .lp +10 5
  56. 13    write on a pipe with no one to read it
  57. .s3
  58. .i0
  59. In the assembler call, if
  60. .it label
  61. is 0,
  62. the process is terminated
  63. when the signal occurs; this is the default action.
  64. If
  65. .it label
  66. is odd, the signal is ignored.
  67. Any other even
  68. .it label
  69. specifies an address in the process
  70. where an interrupt is simulated.
  71. An RTI or RTT instruction will return from the
  72. interrupt.
  73. Except as indicated,
  74. a signal is reset to 0 after being caught.
  75. Thus if it is desired to
  76. catch every such signal,
  77. the catching routine must
  78. issue another
  79. .it signal
  80. call.
  81. .s3
  82. In C,
  83. if
  84. .it func
  85. is 0, the default action
  86. for signal
  87. .it sig
  88. (termination)
  89. is reinstated.
  90. If
  91. .it func
  92. is 1,
  93. the signal is ignored.
  94. If
  95. .it func
  96. is non-zero and
  97. even, it is assumed to be the address
  98. of a function entry point.
  99. When the signal occurs,
  100. the function will be called.
  101. A return from the function will
  102. continue the process at the point it was interrupted.
  103. As in the assembler call,
  104. .it signal
  105. must in general be called again to catch subsequent signals.
  106. .s3
  107. When a caught signal occurs
  108. during certain system calls, the call terminates prematurely.
  109. In particular this can occur
  110. during a
  111. .it read
  112. or
  113. .it write
  114. on a slow device (like a typewriter; but not a file);
  115. and during
  116. .sleep
  117. or
  118. .it wait.
  119. When such a signal occurs, the saved user status
  120. is arranged in such a way that when return from the
  121. signal-catching takes place, it will appear that the
  122. system call returned a characteristic error status.
  123. The user's program may then, if it wishes,
  124. re-execute the call.
  125. .s3
  126. The starred signals in the list above cause a core image
  127. if not caught or ignored.
  128. .s3
  129. The value of the call is the old action defined for the signal.
  130. .s3
  131. After a
  132. .it fork
  133. (II)
  134. the child inherits
  135. all signals.
  136. .it Exec
  137. (II)
  138. resets all
  139. caught signals to default action.
  140. .sh "SEE ALSO"
  141. kill (I), kill (II),
  142. ptrace (II),
  143. reset (III)
  144. .sh DIAGNOSTICS
  145. The error bit
  146. (c-bit)
  147. is set if the
  148. given signal is out of range.
  149. In C, a \*-1 indicates an error;
  150. 0 indicates success.
  151. .sh BUGS
  152.