summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/relay.c
Commit message (Collapse)AuthorAgeFilesLines
* PR11020: Check switch_file global flag inside inner loop for busy scriptsMasami Hiramatsu2009-12-031-2/+4
| | | | | * runtime/staprun/relay.c (reader_thread): Check switch_file thread flags inside inner read-write loop. And clear the flags after switching file.
* Fixed relay_old.c by providing ppoll().David Smith2009-09-181-9/+2
| | | | | | | * runtime/staprun/staprun.h: Put ppoll() declaration here (so that relay_old.c can use it). * runtime/staprun/relay.c (ppoll): Made ppoll() non-static so that relay_old.c can use it.
* Signal-based file switching support for relay/ring buffer.Masami Hiramatsu2009-09-161-22/+61
| | | | | | | | | | * runtime/staprun/relay.c (switch_outfile): New function for file switching. (reader_thread): Don't assign empty_handler to SIGUSR2, and switch output file when receiving signal(SIGUSR2) on ppoll. (switchfile_handler): Send SIGUSR2 signal to reader threads for file switching. (init_relayfs): Assign switchfile_handler to SIGUSR2. * staprun.1.in: Add FILE SWITCHING BY SIGNAL section.
* Fix on-file flight recorder mode bugs on old kernel.Masami Hiramatsu2009-06-191-27/+3
| | | | | | | | * runtime/staprun/common.c (make_outfile_name): Moved from relay.c, fix not to open /dev/null.XXX output files, and add 'bulk' argument for bulkmode. * runtime/staprun/relay.c (make_outfile_name): Moved to common.c. * runtime/staprun/relay_old.c (open_oldoutfile): Fix to use fopen() and store FILE * to percpu_tmpfile[cpu].
* PR10032: Trigger cleanup after relay thread errorsJosh Stone2009-04-031-5/+12
| | | | | | When the relay threads encounter an error, they now send SIGTERM to the rest of the process before the thread exit, so we get a clean shutdown. For EPIPE in particular, error messages are also suppressed.
* Fix a bug in file size limitation code.Masami Hiramatsu2009-04-021-1/+1
| | | | | | | | | This fixes a bug in stapio, which checks written data size and switches new file when it exceeds a limit. The problem is that written-data-size counter ignores the first written-data size when switching files. So, actual file size always exceeds the limit. This changes stapio to initialize written-data-size counter with the size of the data which will be written in new file.
* PR9821: staprun supports subset of strftime.Masami Hiramatsu2009-03-201-16/+73
| | | | | Add strftime subset format support for output file name to systemtap. This format will be evaluated when opening a new output file.
* PR6930: stapio: support file switchingMasami Hiramatsu2009-03-201-1/+68
| | | | | | | | | | | | | | | Add file-switching option(-S size[,N]) to stapio. This option has two arguments, 'size' and 'N', and requires -o option. - When the size of output file exceeds specified 'size'MB, staprun switches output file to the next file. For this purpose, all output file has a serial number as a suffix only when user specifies this option. - Using this option in bulk mode, the output file name will be 'FILE_cpuX.SERIAL'. - When the number of files exceeds specified N, staprun removes the oldest file. This argument can be omitted.
* 2007-12-11 Martin Hunt <hunt@redhat.com>hunt2007-12-111-9/+10
| | | | | | | PR5368 * relay_old.c (init_oldrelayfs): Don't start threads if load_only. * relay.c (init_relayfs): Ditto.
* 2007-10-09 Martin Hunt <hunt@redhat.com>hunt2007-10-091-1/+5
| | | | | | | * common.c (set_clexec): New. * staprun.h: Add prototype for set_clexec. * relay*.c, ctl.c: Call set_clexec after file opens.
* 2007-08-14 David Smith <dsmith@redhat.com>dsmith2007-08-141-25/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>dsmith2007-07-091-1/+2
| | | | | * relay.c (init_relayfs): Fixed a buffer size bug introduced by the last change.
* 2007-07-09 David Smith <dsmith@redhat.com>dsmith2007-07-091-1/+1
| | | | | | * relay.c (init_relayfs): Make sure buffers are big enough to hold a full path. * relay_old.c (init_oldrelayfs): Ditto.
* *** empty log message ***hunt2007-06-211-1/+1
|
* 2007-06-21 Martin Hunt <hunt@redhat.com>hunt2007-06-211-3/+8
| | | | * relay.c (init_relayfs): Send message to check for bulkmode.
* 2007-05-22 Martin Hunt <hunt@redhat.com>hunt2007-05-221-13/+30
| | | | | * relay.c: Fix ppoll() call and some race conditions involving signals.
* 2007-05-10 Martin Hunt <hunt@redhat.com>hunt2007-05-101-1/+1
| | | | | * relay.c (reader_thread): Set timeout for streaming to 200ms.
* 2007-05-09 Martin Hunt <hunt@redhat.com>hunt2007-05-091-1/+1
| | | | | * relay.c (reader_thread): For bulk mode, set timeout to NULL so ppoll never times out.
* 2007-05-08 Martin Hunt <hunt@redhat.com>hunt2007-05-081-1/+23
| | | | | * relay.c (ppoll): Add a compatibility function for glibc < 2.4.
* 2007-05-08 Martin Hunt <hunt@redhat.com>hunt2007-05-081-32/+31
| | | | | | | | | | | | | | | | | | 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>hunt2007-05-071-1/+1
| | | | | | 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>hunt2007-04-101-0/+1
| | | | | * relay.c (close_relayfs): Give threads some time to run before closing.
* 2007-03-26 Martin Hunt <hunt@redhat.com>hunt2007-03-261-25/+23
| | | | | | | | | | | | | | | | * 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-18 Martin Hunt <hunt@redhat.com>hunt2007-03-181-3/+0
| | | | | | | | | | | | * 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>hunt2007-03-141-0/+189
* 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.