Allow non-YDB main processes to control which signals are forwarded to main routine and which are not
Final Release Note
Description
A default configuration exists where we try to passthru signals we receive to the main routine's handler for that signal (if one exists). This passthru occurs AFTER we do our thing with the signal. Right now we do this for all signals in which YottaDB has an interest with some exceptions - We don't passthru the suspend/resume signals (SIGTTIN, SIGTTOU, SIGTSTP), the timer (SIGALRM), or SIGUSR1 signals. For the remaining signals, we either do not have our own handler and did not override the main routine's handler, or (especially in the case of fatal signals), we drive our handler which, if it is still alive and returns, will call the main routine's handler. For example, for ^C,
The support being added in this issue allows a user to specify which signals to forward or not forward of those that YottaDB cares about. No API available at this time.
Draft Release Note
Define two new envvars - $ydb_signal_fwd and $ydb_signal_nofwd to control the forwarding of signals from the handlers that YottaDB installs when it initializes to any handlers a non-YottaDB main program may have set up. One or more signals can be assigned to these envvars separated by white space. The signals themselves can be in one of 3 forms:
- Numeric (e.g. 14)
- Full signal name case insensitive (e.g. SIGALRM)
- Signal abbreviation - remove SIG from full signal name (e.g. ALRM)
By default, all signals are set to be forwarded with the following exceptions:
- SIGALRM - defaults to no-forward but it can be enabled. Note SIGALRM is used by YDB's timer facility so the handler for the signal should take that into account.
- SIGUSR1 - defaults to no-forward but it can be enabled. This signal is used by MUPIP INTRPT so the handler for this signal should take that into account.
- SIGCONT - Not forwardable so is always disabled.
- SIGKILL - Not catchable so is always disabled.
- SIGSTOP - Not forwardable so is always disabled.
- SIGTSTP - Not forwardable so is always disabled.
- SIGTTIN - Not forwardable so is always disabled.
- SIGTTOU - Not forwardable so is always disabled.
If an non-forwardable or otherwise unknown signal name or number is given (signal number must be within range - e.g. NSIG), an error message is sent to stderr as the process is not yet initialized enough to do full error handling but the process continues (ignores the signal name).
Adds one new error message: INVSIGNM <Invalid signal number/name/abbreviation specified in !AD: !AD>/error/fao=4
Usage note - currently though we can and do forward signals to Go main routines, we have yet to determine why Go does not recognize them. The signals for C main routines are successfully forwarded but handlers setup and registered by Go never get driven.