From 70404fc597fe283753bb2f86f95c4c9f008f324d Mon Sep 17 00:00:00 2001 From: hunt Date: Mon, 6 Mar 2006 20:44:29 +0000 Subject: [PATCH] 2006-03-06 Martin Hunt * buildrun.cxx (run_pass): Add "-u username". * stapfuncs.5.in: Document system(). --- ChangeLog | 5 +++++ buildrun.cxx | 7 ++++++- stapfuncs.5.in | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e4f5dde88..853fc83b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-06 Martin Hunt + + * buildrun.cxx (run_pass): Add "-u username". + * stapfuncs.5.in: Document system(). + 2006-03-06 Frank Ch. Eigler * stapex.5.in: Use \[aq] for plain single quotes for encoding diff --git a/buildrun.cxx b/buildrun.cxx index 535e31bc8..c997d125a 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -1,5 +1,5 @@ // build/run probes -// Copyright (C) 2005 Red Hat Inc. +// Copyright (C) 2005, 2006 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -15,6 +15,7 @@ extern "C" { #include "signal.h" #include +#include } @@ -101,11 +102,15 @@ run_pass (systemtap_session& s) { int rc = 0; + struct passwd *pw = getpwuid(getuid()); + string username = string(pw->pw_name); + // for now, just spawn stpd string stpd_cmd = string("sudo ") + string(PKGLIBDIR) + "/stpd " + (s.bulk_mode ? "" : "-r ") + (s.verbose>1 ? "" : "-q ") + + "-u " + username + " " + (s.output_file.empty() ? "" : "-o " + s.output_file + " "); stpd_cmd += "-d " + stringify(getpid()) + " "; diff --git a/stapfuncs.5.in b/stapfuncs.5.in index 433565647..4fc673e3e 100644 --- a/stapfuncs.5.in +++ b/stapfuncs.5.in @@ -243,6 +243,12 @@ Return an absolute timestamp value for use by the indentation function. The default function uses .IR gettimeofday_us +.SS SYSTEM +.TP +system (cmd:string) +Runs a command on the system. The command will run in the background +when the current probe completes. + .SH FILES .nh .IR /usr/share/systemtap/tapset -- 2.43.5