Josh Stone [Fri, 11 Mar 2011 00:43:53 +0000 (16:43 -0800)]
remote: Split preparation from the actual start
* remote.h (remote::prepare): New, get ready to run.
* remote.cxx (stapsh::start, stapsh::prepare): Split the file-upload into
the prepare step, so we're ready to go sooner.
(remote::run): Let remotes prepare first, so they can all start as
close together as possible.
Josh Stone [Fri, 11 Mar 2011 00:35:42 +0000 (16:35 -0800)]
stapsh: Use quoted-printable args in the run command
Per Frank's suggestion, discard the separate "arg" command and just add
arguments directly in the run command. The quoted-printable encoding is
used for whitespace and characters that aren't printable ASCII.
* runtime/staprun/stapsh.c (do_arg): Remove.
(qpdecode): New, decode quoted-printable.
(do_run): Read and QP-decode arguments for staprun.
* remote.cxx (stapsh::send_arg): Remove.
(stapsh::qpencode): New, encode a string with QP escapes.
(stapsh::start): Build the run command with QP-encoded arguments.
Josh Stone [Wed, 9 Mar 2011 18:24:12 +0000 (10:24 -0800)]
stapsh: A systemtap "shell" to aid remote execution
This stapsh agent is a wrapper meant to be automatically invoked through
an ssh connection to transfer systemtap modules to remotes hosts and
invoke staprun on them. The primary motivation of stapsh is make sure
all the exit cases can happen cleanly, especially with sending signals
to the remote and cleaning up the processes and temporary files.
This is meant to replace the code based on multiple connections with an
ssh ControlMaster. For now, that code has only been #if'ed out in
case we still want it for talking with "legacy" remotes.
* runtime/staprun/stapsh.c: New, a basic command shell for uploading and
remotely launching systemtap scripts.
* runtime/staprun/Makefile.am: Add stapsh.
* runtime/staprun/Makefile.in: Regen.
* systemtap.spec: Package stapsh in systemtap-runtime.
* remote.cxx (class stapsh): New, handle communication with a stapsh
remote via any given file descriptors.
(class direct_stapsh): New, launch a direct stapsh instance to run
through. This way we can add stapsh to the testsuite without
requiring any remote access configuration.
(class ssh_remote): Block out the old implementation, and rewrite
as an inheritor of stapsh.
(remote::create): Create direct_stapsh for "--remote stapsh".
(remote::run): Add a polling loop during runtime, where each remote
can add fds to watch and then respond.
* util.cxx (stap_spawn_piped): Allow piped stdin too.
(stap_system_read): Update call to stap_spawn_piped.
Josh Stone [Fri, 11 Mar 2011 02:45:35 +0000 (18:45 -0800)]
Build -u and uprobes_path in a single argument
Optional arguments in getopt have to be part of the same word, so this
lets staprun read the uprobes_path correctly. This was a regression
from the change to vectorized commands.
* buildrun.cxx (make_run_command): Append uprobes_path to -u.
David Smith [Thu, 10 Mar 2011 19:29:18 +0000 (13:29 -0600)]
Fixed several problems with usymbols.exp (BZ639344).
* testsuite/systemtap.context/usymbols.exp: Fixed several problems.
(1) For ppc64/s390x, the test script wouldn't compile since syscall
wrappers turned the probe arguments into 'long int's. This problem was
fixed by using @cast(). (BZ639344)
(2) On some platforms, such as f12 ppc64, gcc defaults to outputting
32-bit executables, even though the system has a 64-bit kernel. Now the
testcase always forces 64-bit compile when needed (to ensure we're
testing what we think we're testing).
(3) If the full path to the test executable gets too long, systemtap
will truncate the start of the path in the script output. This caused
the test to fail. Now we check for a path ending in the correct
filename.
(4) On a system with 64-bit and 32-bit support, if the 64-bit test
failed, the 32-bit test wasn't executed. Now both tests are always
executed.
(5) For readability's sake, the main loop was reindented properly.
Dave Brolley [Tue, 8 Mar 2011 16:38:55 +0000 (11:38 -0500)]
PR 12543 - PKGLIBEXECDIR undefined, causing uprobes.ko build to fail
Always substitute the correct path for PKGLIBEXECDIR in client/server cert
management scripts when installing; not just when --enable-server is
configured.
David Smith [Wed, 2 Mar 2011 18:12:13 +0000 (12:12 -0600)]
Logger PMDA can now handle multiple clients.
* pcp/src/pmdas/logger/event.c (ctx_start_callback): New function.
(ctx_end_callback): Ditto.
(event_init): Register callbacks.
(event_fetch): Call event_create to get new data.
* pcp/src/pmdas/logger/event.h: Removed event_create() prototype.
* pcp/src/pmdas/logger/logger.c (logger_end_contextCallBack): No longer
call event_cleanup(), which is now called in ctx_end_callback().
* pcp/src/pmdas/logger/logger.h: Added get_monitor_fd() prototype.
* pcp/src/pmdas/logger/loggerMain.c (get_monitor_fd): New function.
(loggerMain): Open the logfile with O_NONBLOCK. Let event_fetch() call
event_create().
* pcp/src/pmdas/logger/percontext.h: Update comment.
David Smith [Fri, 25 Feb 2011 17:30:59 +0000 (11:30 -0600)]
Handle the case better when there isn't any data to read.
* pcp/src/pmdas/logger/event.c (event_fetch): When there isn't any logfile
data to fetch, return NULL instead of an empty event record.
* pcp/src/pmdas/logger/logger.c (logger_fetchCallBack): If event_fetch()
returned NULL, return PMDA_FETCH_NOVALUES.
David Smith [Fri, 25 Feb 2011 16:20:53 +0000 (10:20 -0600)]
First PMDA version that can correctly output event records.
* pcp/src/pmdas/logger/GNUmakefile.in: Updated dependency list.
* pcp/src/pmdas/logger/event.c (event_create): Handles EOF.
(event_cleanup): New function.
* pcp/src/pmdas/logger/event.h: Added event_cleanup() declaration.
* pcp/src/pmdas/logger/help: Updated.
* pcp/src/pmdas/logger/logger.c (logger_end_contextCallBack): Calls
event_cleanup() when we lose a client.
(logger_fetchCallBack): Handles fetching event data properly.
* pcp/src/pmdas/logger/loggerMain.c (loggerMain): Instead of calling
select() on the logfile, read it when we get a control message.
* pcp/src/pmdas/logger/pmns: Added logger.event description.
William Cohen [Thu, 24 Feb 2011 19:02:21 +0000 (14:02 -0500)]
Disable systemtap.examples/process/noptrace.stp on RHEL4 systems (PR12498)
The debug information on RHEL4 kernels appears to be wrong. This causes
the noptrace.stp example to write into the wrong location. Rather than the
ptrace syscall exiting immediately, the ptrace syscall continues and the
test hangs on RHEL4 systems. The noptrace.stp test is disabled on RHEL4
systems to work around this issue.
David Smith [Thu, 17 Feb 2011 17:02:31 +0000 (11:02 -0600)]
Adjust configury to handle building/installing out of the source tree.
* pcp/src/include/builddefs.in: Adjust a few variables so that you can
build out of the source tree.
* pcp/configure.in: Generates src/pmdas/logger/GNUmakefile.
* pcp/src/pmdas/logger/GNUmakefile.in: Renamed from GNUmakefile and
adjusted variables to build/install out of the source tree.
Josh Stone [Wed, 16 Feb 2011 20:44:42 +0000 (12:44 -0800)]
Add _F() and _NF() for formatted translations
These are wrappers around autosprintf which pass their format strings
through _() and _N() for gettext translation. All existing autosprintf
calls are now updated to these macros.
William Cohen [Tue, 15 Feb 2011 22:46:01 +0000 (17:46 -0500)]
Add information about Red Hat Enterprise Linux 6 to Beginner Guide
Things works a bit differently in RHEL6 with the RHN channels. This
describes the RHN channels and provides some information on how to
add them to the system.
Josh Stone [Mon, 14 Feb 2011 23:15:43 +0000 (15:15 -0800)]
Move multi-target pass-5 into the remote class
* remote.cxx (remote::run): New, handle pass-5 for multiple targets.
(remote::start, remote::finish): Make these private.
* main.cxx (pass_5): Use remote::run.
Frank Ch. Eigler [Sat, 12 Feb 2011 20:46:37 +0000 (15:46 -0500)]
PR3823: use our own autosprintf()
* configure.ac, Makefile.am: Forget about libasprintf.
* main.cxx, session.cxx, session.h: Likewise.
* util.h, util.cxx: Define workalike autosprintf(), with a fresh
new look, and with no added memory leaks! WOW!
Frank Ch. Eigler [Sat, 12 Feb 2011 20:17:45 +0000 (15:17 -0500)]
PR3823: redo autoconfigury with gettextize
* Makefile.am, configure.ac: Use autoconf/automake gettext support.
* config.rpath, config.sub, ABOUT.NLS: New files.
* m4/*. Many new files, copied by gettextize.
* po/*. Many new files, mostly from gettextize.
* po/LINGUAS, po/POTFILES.in, po/systemtap.pot, po/en.po, po/en.gmo: New files.
Josh Stone [Sat, 12 Feb 2011 01:32:16 +0000 (17:32 -0800)]
Silence the closing of the ssh control master
* remote.cxx (ssh_remote::close_control_master): Tell stap_system to
redirect stdout and stderr to /dev/null, so we don't see the insistent
"Exit request sent" message.
Josh Stone [Sat, 12 Feb 2011 00:29:18 +0000 (16:29 -0800)]
Build the staprun command as an argument vector
* buildrun.cxx (make_run_command): Build the command as a vector.
* util.cxx (cmdstr_join): New, join a vector as quoted strings.
* remote.cxx (direct::start): Use make_run_command directly.
(ssh_remote::start): Pass cmdstr_join(make_run_command(...)) to
ssh, so all args survive intact to the remote side.
Josh Stone [Fri, 11 Feb 2011 23:17:24 +0000 (15:17 -0800)]
Remove the flat-string stap_system altogether
* util.cxx (stap_system): Remove the flat-string version. Add
booleans to the vectored version for whether stdout/err should
be redirected to /dev/null.
* buildrun.cxx (run_make_cmd): Take the cmd as a vector, and use the
same nulling flags to pass along to stap_system.
(compile_pass): Build a vectored make_cmd.
(verify_uprobes_uptodate): Ditto.
(make_uprobes): Ditto.
(make_tracequery): Ditto.
(make_typequery_kmod): Ditto.
(make_typequery_umod): Build a vectored gcc command.
* csclient.cxx (compile_server_client::package_request): Manually wrap
this compound command with an sh -c vector. Add quoting to the client
tmpdir and zipfile, just in case.
David Smith [Fri, 11 Feb 2011 17:16:57 +0000 (11:16 -0600)]
The logger pmda now asks for a logfile to monitor.
* pcp/src/pmdas/logger/logger.h: New file.
* pcp/src/pmdas/logger/loggerMain.c: New custom main loop.
* pcp/src/pmdas/logger/logger.c (main): Added option for logfile to
monitor and calls new custom main loop.
* pcp/src/pmdas/logger/Install: Asks for logfile name to monitor.
* pcp/src/pmdas/logger/GNUmakefile: Added loggerMain.c and logger.h.
Josh Stone [Fri, 11 Feb 2011 02:46:19 +0000 (18:46 -0800)]
Start using arg vectors for stap_system and friends
Instead of worrying about quoting properly in every command string, we
can rest easier by launching processes with a proper argv[]. All of the
stap_system-like functions are converted, but a flat-string stap_system
is also kept around for now while callers are converted.
* util.cxx (stap_spawn): Take a vector<string> for command arguments,
convert that to an argv[], and use that for posix_spawnp. Note the
conversion to spawnp as well so PATH-searching is still performed.
(stap_system, stap_system_read): Convert to vectors, but keep a flat
version of the former for compatibility.
(probe stap_system__start): Move to stap_spawn, to probe all flavors.
(probe stap_system__complete): Likewise, move to stap_waitpid, to
probe when any process is finished; add a pid to track who's done.
* remote.cxx (direct, ssh_remote): Convert all calls to vector form.
Josh Stone [Fri, 11 Feb 2011 00:43:55 +0000 (16:43 -0800)]
Use posix_spawn_file_actions for stap_system_read
The file actions can handle the dup2 necessary to hook a pipe onto the
child's stdout. It could do the necessary closing too, but we'll just
use FD_CLOEXEC for that.
* util.cxx (stap_spawn): Take file_actions for the posix_spawn.
(pipe_child_fd): New, open a pipe and set the dup2 action for it.
(stap_system_read): Let stap_spawn and pipe_child_fd do the hard part.
Josh Stone [Tue, 8 Feb 2011 23:06:25 +0000 (15:06 -0800)]
Clean up exit paths
We need to strive not to leave files/processes around, so exit() calls
are reduced to only places where nothings been allocated yet. Errors
are rarely so fatal to require immediate exit.
Josh Stone [Tue, 8 Feb 2011 23:06:25 +0000 (15:06 -0800)]
Use a ControlMaster for ssh remotes
We can start the ssh remote with a ControlMaster connection, using a
unique socket in the tmpdir, and then each subsequent remote command can
reuse that connection.
* remote.cxx (ssh_remote::open_control_master): Connect to the remote
host with a ControlPath that later commands can reuse. The relevant
options are saved in member ssh_opts.
(ssh_remote::close_control_master): Ask the control process to exit.
(ssh_remote::get_uname, ::start, ::finish): Start using ssh_opts, so
the ControlPath is always specified.