A group of changes for usability & stability of the staprun side of
--monitor mode. The gist of it is to let staprun persist awhile after
a script exits (whether interactively commanded with 'q', or with the
script exiting due to an exit/error), so that its outputs can be seen.
* monitor.c (monitor_state): Add new "exited" and "exited_help" states.
(monitor_render): Remove code that reads input from module.
Support exited_help subset text.
(monitor_remember_output_line): New utility function to strndup
module output lines into our circular buffer.
(monitor_input): Revamp logic to use read(2) syscalls instead of
temporary fdopen() FILEs to read from module-output pipe, for
several reasons.
(monitor_exited): New function to enter exited state.
* relay.c (reader_thread): Use write(2) loop when feeding output
pipe/file, in case it gets full.
(init_relayfs): Drop F_SETPIPE_SZ; it is not needed with write loop
here and proper nonblocking read on other side.
* mainloop.c (signal_thread): Keep it running after each signal, just
in case a ^C is repeated. Encode SIGQUIT with a set to 'load_only'
instead of pending_interrupts count.
(stp_main_loop): Treat several startup-time errors as worthy of
stap module removal/cleanup rather than detaching. Within main
loop proper, call cleanup_and_exit upon pending_interrupts, as
the single standard spot where a stap module shutdown from any
cause should come. Redirect warning/error messages to monitor
output buffer. Notify monitor code of received STP_EXIT message.
* staprun.h: Provide inline-void stub functions for the !MONITOR_LIBS
case.