summaryrefslogtreecommitdiffstats
path: root/runtime/staprun
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/staprun')
-rw-r--r--runtime/staprun/ChangeLog904
-rw-r--r--runtime/staprun/mainloop.c47
2 files changed, 47 insertions, 904 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
deleted file mode 100644
index 6c2304ce..00000000
--- a/runtime/staprun/ChangeLog
+++ /dev/null
@@ -1,904 +0,0 @@
-2008-01-11 Mark Wielaard <mjw@redhat.com>
-
- * staprun.h: include config.h for dependency.
-
-2008-12-08 Frank Ch. Eigler <fche@elastic.org>
-
- PR7062
- * staprun.c (enable_uprobes): Find uprobes.ko based on
- SYSTEMTAP_RUNTIME.
- (main): Unset SYSTEMTAP_* environment vars if setuid.
-
-2008-12-03 Roland McGrath <roland@redhat.com>
-
- PR7063
- * staprun.c (main): Use $SYSTEMTAP_STAPIO instead of hard-coded path.
- Remove SYSTEMTAP_STAPRUN and SYSTEMTAP_STAPIO
- environment variables when setuid is in effect.
- * mainloop.c (cleanup_and_exit): Use $SYSTEMTAP_STAPRUN to re-exec,
- not hard-coded path.
-
-2008-12-03 Frank Ch. Eigler <fche@elastic.org>
-
- PR6925
- * staprun (init_staprun): If a stap_* module load fails, try
- to unload possible leftover, and try again.
-
-2008-11-28 Frank Ch. Eigler <fche@elastic.org>
-
- PR4783
- * staprun.c (remove_module): Don't reset with setpriority(0),
- as we never set it to high-priority any more anyway.
- * mainloop.c (system_cmd): Ditto.
-
-2008-11-12 Frank Ch. Eigler <fche@elastic.org>
-
- PR6964 redux.
- * mainloop (WORKAROUND_BZ467568): New macro to control
- behavior.
- (start_cmd, stp_main_loop): Use signal/pause-based
- synchronization as a fallback for rhbz 467568.
-
-2008-10-28 Frank Ch. Eigler <fche@elastic.org>
-
- PR6964, from Wenji Huang <wenji.huang@oracle.com>:
- * mainloop.c (start_cmd, stp_main_loop): Temporarily
- disable ptrace calls.
-
-2008-10-15 Frank Ch. Eigler <fche@elastic.org>
-
- * mainloop.c (start_cmd): Fix wordexp error handling.
-
-2008-09-18 David Smith <dsmith@redhat.com>
-
- PR 6903.
- * staprun_funcs.c (check_permissions): Instead of checking the
- effective uid, check the real uid for root permissions.
-
-2008-09-06 Frank Ch. Eigler <fche@elastic.org>
-
- * mainloop.c (start_cmd): Rewrite to use wordexp/execvp/ptrace.
- (stp_main_loop): Use ptrace detach to resume target process.
-
-2008-09-05 Frank Ch. Eigler <fche@elastic.org>
-
- * staprun.c (run_as): Teach it to exec too. Update callers.
- Always do set[ug]id as dictated.
- * staprun.h (do_cap): Remove. Update all callers.
- * staprun_funcs.c: Ditto.
- * cap.c: Removed. Update headers.
-
-2008-07-10 Frank Ch. Eigler <fche@elastic.org>
-
- PR 6736.
- * common.c (send_request): Move here ...
- * mainloop.c: from here.
- * staprun.c (send_relocations): New function to send kernel
- and module relocation bases to probe module.
- * staprun.h: Corresponding changes.
-
-2008-06-03 Frank Ch. Eigler <fche@elastic.org>
-
- PR 6429.
- * mainloop.c (stp_main_loop): Remove STP_UNWIND message support.
-
-2008-05-05 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (child_proc): Handle sig_chld
- in the proper thread.
- (signal_thread): Don't call send_request()
- because it isn't thread-safe.
-
-2008-05-05 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (signal_thread): New thread to handle signals
- better.
- (setup_main_signals): Create signal thread.
-
-2008-04-30 Masami Hiramatsu <mhiramat@redhat.com>
-
- PR 6008
- * common.c (parse_args): Increase the limitation of the buffer size
- to 4095MB.
- * common.c (usage): Ditto.
-
-2008-04-30 Masami Hiramatsu <mhiramat@redhat.com>
-
- * stapio.c (main): Fix a typo in a debug message.
- * staprun.c (main): Ditto.
-
-2008-04-24 Frank Ch. Eigler <fche@elastic.org>
-
- PR 6451.
- * common.c (control_channel): Initialize to -1.
- * ctl.c (close_ctl_channel): Tolerate fd=0.
-
-2008-04-22 Martin Hunt <hunt@redhat.com>
-
- * cap.c (init_cap): Detect capabilities failure and
- run with them disabled.
-
-2008-04-22 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (send_request): Move here from common.c
- staprun no longer send any messages.
-
-2008-04-22 hunt <hunt@redhat.com>
-
- * common.c (usage): Add -d option.
-
-2008-04-21 Martin Hunt <hunt@redhat.com>
-
- * staprun.c, stapio.c, staprun.h, mainloop.c, staprun_funcs.c,
- ctl.c, common.c: Add "-d" option to have staprun remove
- modules. Have staprun exec stapio and then have stapio
- exec "staprun -d" to remove the module when finished.
-
-2008-04-16 Martin Hunt <hunt@redhat.com>
-
- * ctl.c (init_ctl_channel): Remove unused parameter.
- Just opens one channel now.
-
-2008-02-21 David Smith <dsmith@redhat.com>
-
- * staprun_funcs.c (check_path): Small security fix.
-
-2008-01-21 Martin Hunt <hunt@redhat.com>
-
- * symbols.c (send_module): Simplify and use new send_data()
- function to keep longword alignment.
-
-2008-01-14 Martin Hunt <hunt@redhat.com>
-
- PR4037 and fixes to better synchronize staprun and stapio.
- * symbols.c (send_data): Send header and data seperately, saving
- a memcpy and avoiding any alignment issues.
- (get_sections): Return -1 on error instead of just exiting
- and leaving stapio hanging. Send data in proper format even if kernel
- pointers are different size.
- (send_module): Return -1 on error instead of just exiting
- and leaving stapio hanging.
- (do_module): Ditto.
- (compar): Removed.
- (do_kernel_symbols): Rewrite to be more robust. Return -1 on
- error instead of just exiting and leaving stapio hanging.
-
- * staprun_funcs.c (handle_symbols): Signal stapio if we error out.
- Set kernel_ptr_size;
-
- * staprun.h (kernel_ptr_size): Declare.
-
- * mainloop.c (stp_main_loop): When ready, send STP_READY.
-
-2008-01-12 Frank Ch. Eigler <fche@elastic.org>
-
- PR 5603 horrible hack.
- * symbols.c (do_kernel_symbols): Make buf[256] instead of [128].
-
-2007-12-11 Martin Hunt <hunt@redhat.com>
- PR5368
- * relay_old.c (init_oldrelayfs): Don't start threads
- if load_only.
- * relay.c (init_relayfs): Ditto.
-
-2007-11-09 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (stp_main_loop): Bump recvbuf to 8196 for
- compatibility with old transport.
-
-2007-10-26 Martin Hunt <hunt@redhat.com>
- PR5218
- * stapio.c (main): Set initialized properly when
- attached.
-
-2007-10-12 Martin Hunt <hunt@redhat.com>
- Changes to separate the symbols from the command channel.
-
- * cap.c (init_cap): Add CAP_DAC_OVERRIDE.
- * staprun.h: Change init_ctl_channel prototype.
- * ctl.c (init_ctl_channel): Modify to open either
- a command or symbol channel. Use ".cmd" and ".symbols"
- as the new names.
- * mainloop.c (init_stapio): Call init_ctl_channel(0);
- * staprun.c (cleanup): Call stop_symbol_thread().
- (main): Call start_symbol_thread().
- * staprun_funcs.c (handle_symbols): Make a thread.
- (start_symbol_thread): New.
- (stop_symbol_thread): New.
-
-2007-10-11 Frank Ch. Eigler <fche@elastic.org>
-
- * staprun.c (main): Move checks for init_cap and getuid
- from just before command line argument parsing to just after.
-
-2007-10-09 Martin Hunt <hunt@redhat.com>
-
- * common.c (set_clexec): New.
- * staprun.h: Add prototype for set_clexec.
- * relay*.c, ctl.c: Call set_clexec after
- file opens.
-
-2007-09-14 Martin Hunt <hunt@redhat.com>
-
- * ctl.c (init_ctl_channel): Return 1 if the ctl file opened
- was for the old relayfs transport.
-
- * mainloop.c (init_stapio): Don't call using_old_transport().
- Use the return of init_ctl_channel() instead.
- (using_old_transport): Deleted.
-
-2007-08-31 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (start_cmd): Set the priority to
- forked processes back to normal.
- (system_cmd): Ditto.
-
-2007-08-21 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (start_cmd): Send SIGINT to target_cmd,
- not stapio.
-
-2007-08-20 David Smith <dsmith@redhat.com>
-
- From Lai Jiangshan <laijs@cn.fujitsu.com>
- * common.c (parse_args): Make sure the '-c' and '-x' options can't
- be specified together.
-
-2007-08-15 David Smith <dsmith@redhat.com>
-
- * staprun.c (main): Quit if effective uid is not root.
-
-2007-08-15 Martin Hunt <hunt@redhat.com>
- PR4736
- * staprun.c (cleanup): Set priority back to normal
- before removing module.
-
-2007-08-15 Martin Hunt <hunt@redhat.com>
-
- * stap_merge.tcl: New.
-
-2007-08-14 David Smith <dsmith@redhat.com>
-
- Merge from setuid-branch. Changes also by Martin Hunt
- <hunt@redhat.com>.
-
- * staprun.c (init_staprun): Drop CAP_SYS_ADMIN when we're done
- with it.
- (main): Calls parse_modpath instead of path_parse_modname. Just
- call parse_modpath with argv[optind]. Let it allocate and set
- modpath and modname. If no modulename was given, display usage
- and exit. Drop CAP_SYS_NICE when we're done with it. Set
- atexit(exit_cleanup) so cleanup always gets called and modules get
- removed. Call handle_symbols.
- (run_stapio): Set argv[0] to stapio so that it executes as itself
- instead of staprun.
- (cleanup): Only do cleanups once and only try to remove module
- when appropriate.
- (exit_cleanup): New. Calls cleanup().
- (mountfs): Sets uid to root before making directory and then
- restores uid.
- (setup_ctl_channel): Uses DEBUGFS define and improved
- error message.
- (setup_relayfs): Ditto.
- (setup_oldrelayfs): Uses DEBUGFS and RELAYFS defines.
- (run_stp_check): Replaced by mountfs().
- (mountfs): New function. Replaces an external script with C code.
- (init_staprun): Calls mountfs() instead of run_stp_check().
-
- * staprun.h: Renamed path_parse_modname to parse_modpath. Added
- MODULE_NAME_LEN define. Added [_][p]err macros. Removed
- VERSION_CMD.
-
- * mainloop.c (cleanup_and_exit): Make sure initialized is 2
- before exiting with code 2.
- (stp_main_loop): Set initialized to 2 when STP_TRANSPORT
- is received. Call cleanup_and_exit() with proper status.
- (start_cmd): exit 1 instead of -1.
- (system_cmd): Ditto.
- (init_staprun): Renamed init_stapio.
- (cleanup_and_exit): Set exit status.
-
- * cap.c: New file.
- * common.c: New file.
- * stapio.c: New file.
- * staprun_funcs.c: New file.
- * Makefile: Removed.
-
- * symbols.c (get_sections): Move the filter code up so that
- uninteresting section names are filtered out before
- attempting to open them.
- (do_kernel_symbols): Better detect overfow conditions and realloc
- new space.
- (do_module): After sending all modules, send a null message to
- indicate we are finished.
-
- * ctl.c (init_ctl_channel): When attempting to attach, if the
- control channel doesn't exist, print a better error message.
-
- * relay_old.c (init_oldrelayfs): Errors out if
- open_relayfs_files() couldn't open any files.
-
- PR 4795
- * mainloop.c (send_request): Fixed buffer overflow check.
- * staprun.h: Added buffer overflow checking versions of
- strcpy/sprintf/snprintf.
- * common.c (path_parse_modname): Checks for overflows on
- strcpy/sprintf/snprintf.
- (read_buffer_info): Ditto.
- * ctl.c (init_ctl_channel): Ditto.
- * relay.c (init_relayfs): Ditto.
- * relay_old.c (open_relayfs_files): Ditto.
- (init_oldrelayfs): Ditto.
- * staprun_funcs.c (insert_module): Ditto.
- (check_path): Ditto.
- * symbols.c (get_sections): Ditto.
-
-2007-07-09 David Smith <dsmith@redhat.com>
-
- * relay.c (init_relayfs): Fixed a buffer size bug introduced by
- the last change.
-
-2007-07-09 David Smith <dsmith@redhat.com>
-
- * relay.c (init_relayfs): Make sure buffers are big enough to hold
- a full path.
- * relay_old.c (init_oldrelayfs): Ditto.
-
-2007-07-09 David Smith <dsmith@redhat.com>
-
- * ctl.c (read_buffer_info): Make sure buffer is big enough to hold
- a full path.
- (init_ctl_channel): Ditto.
-
-2007-07-02 Martin Hunt <hunt@redhat.com>
-
- * symbols.c (get_sections): Set data pointer to the lowest address
- of any data section.
-
-2007-06-21 Martin Hunt <hunt@redhat.com>
-
- * relay.c (init_relayfs): Send message to check for bulkmode.
-
-2007-06-20 Martin Hunt <hunt@redhat.com>
-
- * stap_merge.c (main): Add verbose option. Will realloc
- buffer if current size is too small. Check return codes
- from writes so gcc won't complain.
-
-2007-06-07 Martin Hunt <hunt@redhat.com>
-
- * relay_old.c (open_relayfs_files): Add support for
- output file names (-o) with bulk (relayfs) mode.
-
-2007-06-04 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (cleanup_and_exit): Disable signals
- while exiting.
- (fatal_handler): Use return values from write() to
- avoid warnings.
-
-2007-05-24 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (cleanup_and_exit): Fix typo.
-
-2007-05-22 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (init_staprun): Change dbug() call.
-
- * relay.c: Fix ppoll() call and some race conditions involving
- signals.
-
-2007-05-10 Martin Hunt <hunt@redhat.com>
-
- * relay.c (reader_thread): Set timeout for streaming to
- 200ms.
-
-2007-05-09 Martin Hunt <hunt@redhat.com>
-
- * relay.c (reader_thread): For bulk mode, set timeout to NULL
- so ppoll never times out.
-
-2007-05-08 Martin Hunt <hunt@redhat.com>
-
- * relay.c (ppoll): Add a compatibility function for
- glibc < 2.4.
-
-2007-05-08 Martin Hunt <hunt@redhat.com>
- Signal handler cleanup.
- * mainloop.c (fatal_handler): New. Cleanly handle
- unexpected fatal signals.
- (setup_main_signals): New. Set signals once mainloop
- is entered.
- (setup_signals): New. Block certain signals during initialization.
- Set handler for fatal signals.
- * relay.c (reader_thread): Use ppoll(). Terminate on
- SIGUSR2 after reading any remaining data.
- (close_relayfs): Remove sleep hack. Send SIGUSR2 to all threads.
-
- Runtime debug messages.
- * staprun.h: Change dbug() to accept a debuglevel and
- enable it.
- * *.c: Modify dbug() calls.
-
-2007-05-07 Martin Hunt <hunt@redhat.com>
- Patch from David Smith
- * mainloop.c (stp_main_loop): Properly handle write()
- return value. Fixes build problem with some compilers.
-
-2007-04-10 Martin Hunt <hunt@redhat.com>
-
- * relay.c (close_relayfs): Give threads some time to
- run before closing.
-
-2007-04-06 Martin Hunt <hunt@redhat.com>
-
- * stp_merge.c (main): Remove extra newline in output.
- * stap_merge.c: Renamed from stp_merge.c.
- * Makefile: Updated.
-
-2007-04-02 Martin Hunt <hunt@redhat.com>
-
- * relay_old.c (close_oldrelayfs): If just detaching, call
- pthread_cancel.
- (open_relayfs_files): Just return 0 if relay_fd[cpu] not opened.
- (init_oldrelayfs): Scan percpu files to calculate ncpus.
-
- * mainloop.c (init_staprun): Call old transport init when necessary.
- (cleanup_and_exit): Ignore signals when cleaning up.
-
- * ctl.c (read_buffer_info): For old transport, need to read transport
- parameters.
-
-2007-03-26 Martin Hunt <hunt@redhat.com>
-
- * mainloop.c (run_stp_check): Just use system() call.
- (init_staprun): Remove _stp_pid module parameter.
- (cleanup_and_exit): If closed==2, just exit without removing module.
- (driver_poll): Remove. We no longer require stap running.
- (_stp_main_loop): Remove call to driver_poll.
-
- * ctl.c (init_ctl_channel): Don't put files in systemtap_pid,
- revert back to systemtap/modulename.
-
- * relay.c: Revert back to systemtap/modulename paths.
- * relay_old.c: Ditto.
-
- * staprun.c: Add -L and -A args.
-
-2007-03-20 Martin Hunt <hunt@redhat.com>
-
- * symbols.c (send_module): If send returns < 0 then
- cleanup and exit.
- (do_kernel_symbols): Ditto.
-
-2007-03-18 Martin Hunt <hunt@redhat.com>
- * staprun.h (err): Define.
- * symbols.c (get_sections): More overflow checking.
-
-2007-03-18 Martin Hunt <hunt@redhat.com>
- * symbols.c (get_sections): Filter out .gnu.linkonce.* sections
- except for .gnu.linkonce.this_module.
-
-2007-03-18 Martin Hunt <hunt@redhat.com>
- * staprun.h (VERSION_CMD): Command to use for version check.
- Changes to support runtime decision on new or old transport.
- * mainloop.c (init_staprun): Check the kernel version at runtime
- instead of at compile time.
- (cleanup_and_exit): Call the correct relayfs close function.
- (stp_main_loop): Call the correct relayfs init function.
- * relay.c: Remove ifdef wrapper. File is always compiled and used
- if the kernel version is appropriate.
- * relay_old.c: Ditto.
-
-2007-03-14 Martin Hunt <hunt@redhat.com>
-
- * staprun.c: Renamed from stpd.c. Removed quiet and print_only
- options. Added "-x" option as an alias for "-t". Removed "-m"
- option. Updated arg processing to leave 4 slots for modoptions[].
- Bump the priority of staprun.
- * ctl.c: New. Transport control channel functions.
- * relay.c: New. Relayfs control functions for new transport.
- * relay_old.c: New. Relayfs control functions for older
- versions of relayfs.
- * mainloop.c: New. Staprun main loop.
- * staprun.h: Renamed from librelay.h. Cleaned up.
-
- * stap_merge.c: Renamed. Updated for modified save format.
-
-
-2006-12-11 Martin Hunt <hunt@redhat.com>
-
- * symbols.c (get_sections): Set buffer sizes to large enough
- sizes to hold all possible values, but also include checks in case
- we are wrong.
-
-2006-11-15 Martin Hunt <hunt@redhat.com>
-
- * symbols.c (do_kernel_symbols): Add sizeof(long) to sym_base
- to preserve 64-bit alignment.
-
-2006-11-09 Martin Hunt <hunt@redhat.com>
-
- * librelay.c: Change all references to transport messages
- to use the new names with "_stp" prefix.
- (stp_main_loop): For STP_SYMBOLS, check pointer size and
- endianess to confirm staprun is compatible with the kernel.
-
- * librelay.h: Move a bunch of common includes here.
- * stpd.c: Cleanup includes.
- * symbols.c: Ditto.
-
-2006-11-02 Martin Hunt <hunt@redhat.com>
-
- * symbols.c: New file. Sends symbol and module information to
- the systemtap module.
-
- * librelay.c (stp_main_loop): Add STP_MODULE and STP_SYMBOLS
- message handling.
-
- * librelay.h: Add some new function prototypes.
-
- * Makefile (CFLAGS): Set to be the same as for building modules.
- Added symbols.c to sources.
-
-2006-10-10 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (merge_output): Add check for min when writing
- output, otherwise last write happens twice.
-
-2006-09-26 David Smith <dsmith@redhat.com>
-
- * Makefile: Changed 'stpd' references to 'staprun'.
- * librelay.c: Ditto.
- * stpd.c: Ditto.
-
-2006-09-25 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (kill_percpu_threads): Remove printf.
- (wait_for_percpu_threads): New.
- (process_subbufs): Remove processing, processing_mutex, exit
- thread if exiting flag set.
- (read_last_buffers): Removed.
- (cleanup_and_exit): Remove call to read_last_buffers, wait for
- threads to read flushed buffers instead.
- (stp_main_loop): Remove mutex init.
-
-2006-09-22 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (init_relayfs): Cleanup if stp_check fails.
-
-2006-09-19 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (init_relayfs): Add debugfs path to relay files and
- add new systemtap directory to path.
- (init_stp): rmmod module on failure.
- (merge_output): Remove debugging printfs left in code.
- (close_relay_files): Clear relay_file descriptor after close.
- (cleanup_and_exit): Allow cleanup and exit even if there was an
- error opening relay files.
- (stp_main_loop): Call cleanup_and_exit() if init_relayfs() fails.
-
-2006-09-18 Martin Hunt <hunt@redhat.com>
-
- * stpd.c (usage): Remove "-m" option.
- (main): Print warning if "-m" is used.
- * librelay.c (merge_output): Rewrite to handle
- new format that support binary.
- (stp_main_loop): Read merge option from the
- transport info message.
-
-2006-09-13 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (init_relayfs): Exec stp_check and find
- relay_filebase.
-
- * librelay.h (stp_main_loop): Fix declaration of init_stp().
-
- * stpd.c (usage): Remove "-r" option.
- (main): Don't find stpd_filebase and don't send it to init_stp().
-
-
-2006-08-02 Tom Zanussi <zanussi@us.ibm.com>
-
- * stpd.c (main): Use modname rather than driver_pid in
- stpd_filebase.
-
-2006-07-20 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (stp_main_loop): If module doesn't start, kill any
- target command.
-
-2006-06-23 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (cleanup_and_exit): Close relay files even if
- not merging.
-
-2006-06-13 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (start_cmd): Rewrite using sigwait() to eliminate
- a race.
-
-2006-05-18 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (stp_main_loop): Set output to always be line
- buffered.
-
-2006-04-08 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (stp_main_loop): Write with fwrite() instead
- of fputs() so we can write binary data.
-
-2006-04-05 Martin Hunt <hunt@redhat.com>
- * librelay.c (merge_output): Remove ANSI codes and write
- warning to stderr.
-
-2006-04-05 Martin Hunt <hunt@redhat.com>
- * librelay.c (merge_output): Set the output filename if necessary.
- (merge_output):
-
- * stpd.c (main): Don't reset output_filename just because
- relayfs is possible. Move that code to librelay.c.
-
-2006-04-04 Roland McGrath <roland@redhat.com>
-
- * stpd.c (main): Cast f_type when comparing; type differs by machine.
-
-2006-04-04 Tom Zanussi <zanussi@us.ibm.com>
-
- * stpd.c (main): Check that /mnt/relay is actually relayfs.
-
-2006-03-15 Tom Zanussi <zanussi@us.ibm.com>
-
- * stpd.c (main): Add runtime check for relayfs vs relay-on-proc.
-
-2006-03-06 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (start_cmd): Set proper uid/gid before execing
- command.
- (system_cmd): New function.
- (cleanup_and_exit): Wait for any child processes to complete.
- (stp_main_loop): Recognize STP_SYSTEM message.
-
- * stpd.c (main): Add support for "-u username".
-
-2006-02-25 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (init_stp): Better error handling and cleanup.
-
-2006-02-23 Frank Ch. Eigler <fche@elastic.org>
-
- PR 1304
- * stpd.c (mdooptions): New array.
- (main): Populate it with leftover arguments.
- * librelay.c (init_stp): Pass it to execve().
-
-2005-12-08 Frank Ch. Eigler <fche@elastic.org>
-
- PR 1937
- * stpd.c (main): Support new "-d" option.
- (usage): Document it.
- * librelay.c (driver_poll): New function to react to death of
- driver process.
- (stp_main_loop): Call it if "-d PID" given. Treat SIGHUP like others.
-
-2005-10-19 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c: Move output_file var to stpd.c.
- (stp_main_loop): If the output_file option was specified,
- and streaming mode is being used, send output to the file
- instead of stdout. If !streaming, send output to the file
- instead of probe.out.
- * stpd.c (usage): Add comment for -o option.
- (main): Add -o option.
-
-2005-10-19 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (merge_output): Switch to binary TIMESTAMP.
- * stp_dump.c (main): Switch to binary TIMESTAMP.
- * stp_merge.c (main): Switch to binary TIMESTAMP.
-
-2005-10-14 Tom Zanussi <zanussi@us.ibm.com>
-
- PR 1476
- * librelay.c: Add flag for buffer processing.
- (reader_thread): Disable/enable cancel state around buffer
- processing, and update flag to show we're busy processing.
- (cleanup_and_exit): Wait for any threads busy processing.
- (stp_main_loop): Initialize processing mutex.
-
-2005-09-06 Martin Hunt <hunt@redhat.com>
-
- * librelay.c: Remove all USE_PROCFS ifdefs.
- (sig_usr): Signal handler for SIGUSR1.
- (start_cmd): New function to handle "-c" option, forks()
- off a new process then waits for SIGUSR1 to exec it.
- (init_stp): Call start_cmd().
- (stp_main_loop): Set a signal handler for SIGCHLD.
-
- * stpd.c (main): Add "-t" and "-c" options.
- (usage): Update with new options.
-
-2005-08-29 Martin Hunt <hunt@redhat.com>
-
- * stpd.c main): Add enable_relayfs flag.
- Turn it off with "-r".
-
-2005-08-24 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (sigproc): Removed the "Exiting..."
- message for now.
-
-2005-08-24 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (sigproc): Reestablish signal handler so
- impatient people don't hit ^C twice and terminate the
- program before it saves the data and removes the module.
- Also print a message to stderr that it is exiting.
- (stp_main_loop): Write OOB data (warnings, errors, etc)
- to stderr instead of stdout.
- * librelay.h: Write debug info to stderr.
- * Makefile: add librelay.h to dependencies.
-
-2005-08-23 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (merge_output): Don't add an extra \n.
-
-2005-08-23 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (read_last_buffers): New function. Directly grab the
- last buffers.
- (info_pending): Deleted.
- (request_last_buffers): Deleted.
-
-2005-08-22 Martin Hunt <hunt@redhat.com>
-
- * Makefile (debug): Add debug target.
- * librelay.h (dbug): Define.
- * librelay.c: Enable some dbug lines.
-
-2005-08-19 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (reader_thread): Check the return value for write().
-
-2005-08-19 Frank Ch. Eigler <fche@elastic.org>
-
- * librelay.c (modpath): New global. Use it for insmod only.
- * stpd.c (main): Set both modpath and modname, to support
- modules specified by full path name.
-
-2005-08-19 Martin Hunt <hunt@redhat.com>
-
- * stpd.c (main): Simplify buffer size code.
- * librelay.c: Major changes to support procfs instead of netlink.
-
-2005-08-03 Tom Zanussi <trz@us.ibm.com>
-
- * librelay.c: Track subbuf info requests/replies
- so we know unequivocally when it's ok to do final
- processing.
- (reader_thread): Remove buffer-full warning.
-
-2005-08-03 Martin Hunt <hunt@redhat.com>
- * librelay.c (init_stp): Change variable name to eliminate shadow warning.
-
-2005-08-03 Martin Hunt <hunt@redhat.com>
- * librelay.c (open_control_channel): Set the receive buffer
- to 512K, or the max allowed.
-
- * stpd.c: Remove "-n" subbug option and change "-b" option
- so you can specify buffering in different ways. Add a verbose option.
- Exec the "stp_check" script.
-
-2005-08-01 Frank Ch. Eigler <fche@redhat.com>
-
- * librelay.c: Correct fwrite api usage.
- * all: Correct copyright holder name.
-
-2005-08-01 Martin Hunt <hunt@redhat.com>
-
- * librelay.h: Get structs and enums from
- ../transport/transport_msgs.h to eliminate duplication.
-
- * librelay.c (send_request): Retry if send fails.
- (open_relayfs_files): Use fopen() instead of open() for the
- percpu tmpfiles.
- (request_last_buffers): Just send cpu number for STP_BUF_INFO request.
- (reader_thread): Ditto.
- (process_subbufs): Use fwrite_unlocked() instead of write().
- (sigchld): Removed.
- (init_stp): Go back to using system() instead of fork and exec
- to load module. When done, send a TRANSPORT_INFO request.
- (cleanup_and_exit): Change parameter to simple flag to
- indicate if the module needs removing.
- (sigproc): Remove complicated logic and just send STP_EXIT.
- (stp_main_loop): When receiving STP_TRANSPORT_INFO, set
- the local params and reply with a STP_START. When
- receiving STP_START, there was an error, so cleanup and exit.
-
- * stpd.c (main): Added new options to set number of
- buffers and their size.
-
-2005-07-29 Roland McGrath <roland@redhat.com>
-
- * librelay.c (process_subbufs): Use unsigned for I.
- (sigproc): Add __attribute__((unused)) on parameter.
- (sigchld): Likewise. Avoid shadowing global variable name.
- (stp_main_loop): Add a cast.
-
-2005-07-18 Martin Hunt <hunt@redhat.com>
-
- * stp_merge.c (main): Fix dropped count calculation.
-
-2005-07-14 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c (reader_thread): Add missing pthread_mutex_lock
-
-2005-07-14 Frank Ch. Eigler <fche@redhat.com>
-
- * stpd.c (main): Pass !quiet mode to init_stp().
- * librelay.c (init_relayfs): Be quiet if !print_totals.
-
-2005-07-13 Martin Hunt <hunt@redhat.com>
-
- * stpd.c (usage): Fix usage string.
-
- * librelay.c (init_stp): Change last arg to NULL, not 0.
-
-2005-07-08 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (sigchld): Signal handler to detect
- completion of module loading.
- (init_stp): Use fork/exec instead of system() so
- we can get async signal of module load success/failure.
- (cleanup_and_exit): New function.
- (sigproc): If module is not loaded, don't send message to it.
- (stp_main_loop): Call cleanup_and_exit() when STP_EXIT
- is received. Don't send a request for the transport
- mode. The module will send notification to the daemon
- when it is ready.
-
- * stpd.c (main): Don't print message until module
- is loaded.
-
-2005-07-01 Martin Hunt <hunt@redhat.com>
-
- * librelay.c: Removed the color coding of cpu output.
-
-2005-06-28 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (merge_output): Use unlocked stdio
- to improve speed.
-
- * stp_merge.c: New file.
-
- * Makefile: Add stp_merge.
-
-2005-06-27 Martin Hunt <hunt@redhat.com>
-
- * stpd.c (main): Add new command line arg, "-m"
- to disable the per-cpu merging.
-
- * librelay.c (merge_output): Replacement for sort_output().
- Efficiently merges per-cpu streams.
-
-
-2005-06-20 Tom Zanussi <zanussi@us.ibm.com>
-
- * librelay.c: Large refactoring, important changes are
- added transport_mode command, for relayfs transport
- display results only when probe completes and/or write
- output file, merge, sort and delete the per-cpu files
- in postprocessing, refactor so that relayfs files aren't
- created until transport command received, removed sigalrm,
- read the final subbuffers on exit
-
- * stpd.c: Remove all command-line args except for -p
- and -q as well as all code related to buffer sizes.
-
- * librelay.h: Add transport mode command and struct.
-
-2005-05-16 Martin Hunt <hunt@redhat.com>
-
- * librelay.c (sigproc): If STP_EXIT send fails, keep retrying
- every 10ms.
- (init_stp): Don't set n_subbufs and subbuf_size params.
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index 2fb049b0..29eb4f1f 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -357,6 +357,8 @@ void cleanup_and_exit(int detach)
err("\nDisconnecting from systemtap module.\n" "To reconnect, type \"staprun -A %s\"\n", modname);
} else {
const char *staprun = getenv ("SYSTEMTAP_STAPRUN") ?: BINDIR "/staprun";
+#define BUG9788_WORKAROUND
+#ifndef BUG9788_WORKAROUND
dbug(2, "removing %s\n", modname);
if (execlp(staprun, basename (staprun), "-d", modname, NULL) < 0) {
if (errno == ENOEXEC) {
@@ -368,6 +370,51 @@ void cleanup_and_exit(int detach)
perror(staprun);
_exit(1);
}
+#else
+ pid_t pid;
+ int rstatus;
+ struct sigaction sa;
+
+ dbug(2, "removing %s\n", modname);
+
+ // So that waitpid() below will work correctly, we need to clear
+ // out our SIGCHLD handler.
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGCHLD, &sa, NULL);
+
+ pid = fork();
+ if (pid < 0) {
+ _perr("fork");
+ _exit(-1);
+ }
+
+ if (pid == 0) { /* child process */
+ /* Run the command. */
+ if (execlp(staprun, basename (staprun), "-d", modname, NULL) < 0) {
+ if (errno == ENOEXEC) {
+ char *cmd;
+ if (asprintf(&cmd, "%s -d '%s'", staprun, modname) > 0)
+ execl("/bin/sh", "sh", "-c", cmd, NULL);
+ free(cmd);
+ }
+ perror(staprun);
+ _exit(1);
+ }
+ }
+
+ /* parent process */
+ if (waitpid(pid, &rstatus, 0) < 0) {
+ _perr("waitpid");
+ _exit(-1);
+ }
+
+ if (WIFEXITED(rstatus)) {
+ _exit(WEXITSTATUS(rstatus));
+ }
+ _exit(-1);
+#endif
}
_exit(0);
}