summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/ctl.c
Commit message (Collapse)AuthorAgeFilesLines
* runtime shutdown errors: simplify, improve error specificityFrank Ch. Eigler2009-10-131-4/+5
| | | | | | | | * transport/control.c (*_cmd): Return -Ecodes rather than "-1" from file_operations callbacks. * staprun/ctl.c (init_ctl_channel): Return distinct error codes. * staprun/staprun.c (remove_module): Skip connection attempt to .ctl file; just do delete_module() with O_NONBLOCK.
* PR6451: avoid one class of staprun shutdown deadlock (module/.ctl filehandle ↵Frank Ch. Eigler2008-04-241-2/+2
| | | | = 0)
* Change staprun to exec stapio. Add "-d" option to staprun.Martin Hunt2008-04-211-17/+14
|
* 2007-10-12 Martin Hunt <hunt@redhat.com>hunt2007-10-121-4/+9
| | | | | | | | | | | | | | | | 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-09 Martin Hunt <hunt@redhat.com>hunt2007-10-091-0/+3
| | | | | | | * 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>hunt2007-09-141-1/+3
| | | | | | | | | * 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-14 David Smith <dsmith@redhat.com>dsmith2007-08-141-45/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | * ctl.c (read_buffer_info): Make sure buffer is big enough to hold a full path. (init_ctl_channel): Ditto.
* 2007-05-08 Martin Hunt <hunt@redhat.com>hunt2007-05-081-2/+2
| | | | | | | | | | | | | | | | | | 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-04-02 Martin Hunt <hunt@redhat.com>hunt2007-04-021-0/+36
| | | | | | | | | | | | | * 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>hunt2007-03-261-3/+7
| | | | | | | | | | | | | | | | * 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-14 Martin Hunt <hunt@redhat.com>hunt2007-03-141-0/+40
* 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.