|
|
1.1 ! root 1: .TH SIGSYS 2J ! 2: .UC 4 ! 3: .ie t .ds d \(dg ! 4: .el .ds d \z'|+' ! 5: .ie t .ds b \(bu ! 6: .el .ds b @ ! 7: .SH NAME ! 8: sigsys \- catch or ignore signals ! 9: .SH SYNOPSIS ! 10: .nf ! 11: .B #include <signal.h> ! 12: .PP ! 13: .B (*sigsys(sig, func))() ! 14: .B void (*func)(); ! 15: .PP ! 16: .B cc ... \-ljobs ! 17: .fi ! 18: .SH DESCRIPTION ! 19: .IR N.B. : ! 20: The system currently supports two signal implementations. ! 21: The one described in ! 22: .IR signal (2) ! 23: is standard in version 7 UNIX systems, ! 24: and retained for backward compatibility ! 25: as it is different ! 26: in a number of ways. ! 27: The one described here (with the interface in ! 28: .IR sigset (3)) ! 29: provides for the needs of the job control mechanisms (see ! 30: .IR jobs (3)) ! 31: used by ! 32: .IR csh (1), ! 33: and corrects the bugs in the standard implementation of signals, ! 34: allowing programs which process interrupts to be written reliably. ! 35: .PP ! 36: The routine ! 37: .I sigsys ! 38: is not normally called directly; rather the routines of ! 39: .IR sigset (3) ! 40: should be used. ! 41: These routines are kept in the ``jobs'' library, accessible by ! 42: giving the loader option ! 43: .B \-ljobs. ! 44: The features described here are less portable then those of ! 45: .IR signal (2) ! 46: and should not be used in programs which are ! 47: to be moved to other versions of UNIX. ! 48: .PP ! 49: A signal ! 50: is generated by some abnormal event, ! 51: initiated by a user at a terminal (quit, interrupt, stop), ! 52: by a program error (bus error, etc.), ! 53: by request of another program (kill), ! 54: or when a process is stopped because it wishes to access ! 55: its control terminal while in the background (see ! 56: .IR tty (4)). ! 57: Signals are optionally generated ! 58: when a process resumes after being stopped, ! 59: when the status of child processes changes, ! 60: or when input is ready at the control terminal. ! 61: Most signals cause termination of the receiving process if no action ! 62: is taken; some signals instead cause the process receiving them ! 63: to be stopped, or are simply discarded if the process has not ! 64: requested otherwise. ! 65: Except for the SIGKILL and SIGSTOP ! 66: signals which cannot be blocked, the ! 67: .I sigsys ! 68: call allows signals either to be ignored, ! 69: held until a later time (protecting critical sections in the process), ! 70: or to cause an interrupt to a specified location. ! 71: Here is the list of all signals with names as in the include file. ! 72: .LP ! 73: .nf ! 74: .ta \w'SIGMMMM 'u +\w'15* 'u ! 75: SIGHUP 1 hangup ! 76: SIGINT 2 interrupt ! 77: SIGQUIT 3* quit ! 78: SIGILL 4* illegal instruction (not reset when caught) ! 79: SIGTRAP 5* trace trap (not reset when caught) ! 80: SIGIOT 6* IOT instruction ! 81: SIGEMT 7* EMT instruction ! 82: SIGFPE 8* floating point exception ! 83: SIGKILL 9 kill (cannot be caught, held or ignored) ! 84: SIGBUS 10* bus error ! 85: SIGSEGV 11* segmentation violation ! 86: SIGSYS 12* bad argument to system call ! 87: SIGPIPE 13 write on a pipe with no one to read it ! 88: SIGALRM 14 alarm clock ! 89: SIGTERM 15 software termination signal ! 90: 16 unassigned ! 91: SIGSTOP 17\*d stop (cannot be caught, held or ignored) ! 92: SIGTSTP 18\*d stop signal generated from keyboard ! 93: SIGCONT 19\*b continue after stop ! 94: SIGCHLD 20\*b child status has changed ! 95: SIGTTIN 21\*d background read attempted from control terminal ! 96: SIGTTOU 22\*d background write attempted to control terminal ! 97: SIGTINT 23\*b input record is available at control terminal ! 98: SIGXCPU 24 cpu time limit exceeded (see \fIvlimit\fR(2)) ! 99: SIGXFSZ 25 file size limit exceeded (see \fIvlimit\fR(2)) ! 100: .fi ! 101: .PP ! 102: The starred signals in the list above cause a core image ! 103: if not caught, held or ignored. ! 104: .PP ! 105: If ! 106: .I func ! 107: is SIG_DFL, the default action ! 108: for signal ! 109: .I sig ! 110: is reinstated; this default is termination ! 111: (with a core image for starred signals) ! 112: except for signals marked with \*b or \*d. ! 113: Signals marked with \*b are discarded if the action is SIG_DFL; signals marked ! 114: with \*d cause the process to stop. ! 115: If ! 116: .I func ! 117: is SIG_HOLD ! 118: the signal is remembered if it occurs, but not presented to the process; ! 119: it may be presented later if the process changes the action for the signal. ! 120: If ! 121: .I func ! 122: is SIG_IGN the signal is subsequently ignored, ! 123: and pending instances of the signal are discarded (i.e. if the ! 124: action was previously SIG_HOLD.) ! 125: Otherwise ! 126: when the signal occurs ! 127: .I func ! 128: will be called. ! 129: .PP ! 130: A return from the function will ! 131: continue the process at the point it was interrupted. ! 132: Except as indicated, ! 133: a signal, set with ! 134: .I sigsys, ! 135: is reset to SIG_DFL after being caught. However by ! 136: specifying DEFERSIG(func) as the last argument to ! 137: .I sigsys, ! 138: one causes the action to be set to ! 139: SIG_HOLD before the interrupt is taken, so that recursive instances ! 140: of the signal cannot occur during handling of the signal. ! 141: .PP ! 142: When a caught signal occurs ! 143: during certain system calls, the call terminates prematurely. ! 144: In particular this can occur ! 145: during a ! 146: .I read ! 147: or ! 148: .IR write (2) ! 149: on a slow device (like a terminal; but not a file) ! 150: and during a ! 151: .I pause ! 152: or ! 153: .IR wait (2). ! 154: When a signal occurs ! 155: during one of these calls, ! 156: the saved user status ! 157: is arranged in such a way that, ! 158: when return from the ! 159: signal-catching takes place, it will appear that the ! 160: system call returned an error status. ! 161: The user's program may then, if it wishes, ! 162: re-execute the call. ! 163: .I Read ! 164: and ! 165: .I write ! 166: calls which have done no I/O, ! 167: .IR ioctl s ! 168: blocked with SIGTTOU, ! 169: and ! 170: .I wait3 ! 171: calls are restarted. ! 172: .PP ! 173: The value of ! 174: .I sigsys ! 175: is the previous (or initial) ! 176: value of ! 177: .I func ! 178: for the particular signal. ! 179: .PP ! 180: The system provides two other functions by oring bits into the ! 181: signal number: ! 182: SIGDOPAUSE causes the process to ! 183: .I pause ! 184: after changing the signal action. It can be used to atomically ! 185: re-enable a held signal which was being processed and wait for ! 186: another instance of the signal. ! 187: SIGDORTI causes the system to simulate an ! 188: .I rei ! 189: instruction ! 190: clearing the mark the system placed on the stack at the point of ! 191: interrupt before checking for further signals to be presented due ! 192: to the specified change in signal actions. This allows a ! 193: signal package such as ! 194: .IR sigset (3) ! 195: to dismiss from interrupts cleanly removing the old state from ! 196: the stack before another instance of the interrupt is presented. ! 197: .PP ! 198: After a ! 199: .IR fork (2) ! 200: or ! 201: .IR vfork (2) ! 202: the child inherits ! 203: all signals. ! 204: .IR Exec (2) ! 205: resets all ! 206: caught signals to default action; held signals remain held ! 207: and ignored signals remain ignored. ! 208: .SH "SEE ALSO" ! 209: kill(1), ! 210: ptrace(2), kill(2), ! 211: jobs(3), sigset(3), setjmp(3), ! 212: tty(4) ! 213: .SH DIAGNOSTICS ! 214: The value BADSIG is returned if the ! 215: given signal is out of range. ! 216: .SH BUGS ! 217: The job control facilities are not available in standard version 7 UNIX. ! 218: These facilities are still under development and may change in future ! 219: releases of the system as better inter-process communication facilities ! 220: and support for virtual terminals become available. The options and ! 221: specifications of this facility and the system calls supporting it ! 222: are thus subject to change. ! 223: .PP ! 224: Since only one signal action can be changed at a time, it is not ! 225: possible to get the effect of SIGDOPAUSE for more than one signal ! 226: at a time. ! 227: .PP ! 228: The traps (listed below) should be distinguishable by extra arguments ! 229: to the signal handler, and all hardware supplied parameters should ! 230: be made available to the signal routine. ! 231: .SH "ASSEMBLER (PDP-11)" ! 232: (signal = 48.) ! 233: .br ! 234: .B sys signal; sig; label ! 235: .br ! 236: (old label in r0) ! 237: .PP ! 238: If ! 239: .I label ! 240: is 0, ! 241: default action is reinstated. ! 242: If ! 243: .I label ! 244: is 1, the signal is ignored. ! 245: If ! 246: .I label ! 247: is 3, the signal is held. ! 248: Any other even ! 249: .I label ! 250: specifies an address in the process ! 251: where an interrupt is simulated. ! 252: If label is otherwise odd, the signal is sent to the function ! 253: whose address is the label with the low bit cleared ! 254: with the action set to SIG_HOLD. ! 255: (Thus DEFERSIG is indicated by the low bit of a signal catch address. ! 256: An RTI or RTT instruction will return from the ! 257: interrupt.) ! 258: .SH "NOTES (VAX-11)" ! 259: The following defines the mapping of hardware traps to signals: ! 260: .LP ! 261: .ta \w' Floating/decimal divide by zero 'u +\w'15* 'u +8n ! 262: .nf ! 263: Arithmetic traps: ! 264: Integer overflow SIGFPE ! 265: Integer division by zero SIGFPE ! 266: Floating overflow SIGFPE ! 267: Floating underflow SIGFPE ! 268: Floating/decimal division by zero SIGFPE ! 269: Decimal overflow SIGFPE ! 270: Subscript-range SIGFPE ! 271: Length access control SIGSEGV ! 272: Protection violation SIGBUS ! 273: Reserved instruction SIGILL ! 274: Customer-reserved instr. SIGEMT ! 275: Reserved operand SIGILL ! 276: Reserved addressing SIGILL ! 277: Trace pending SIGTRAP ! 278: Bpt instruction SIGTRAP ! 279: Compatibility-mode SIGEMT ! 280: Chme SIGILL ! 281: Chms SIGILL ! 282: Chmu SIGILL ! 283: .fi
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.