summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in2
-rw-r--r--cache.cxx57
-rw-r--r--cache.h1
-rw-r--r--runtime/ChangeLog4
-rw-r--r--runtime/autoconf-oneachcpu-retry.c8
-rw-r--r--runtime/staprun/ChangeLog4
-rw-r--r--runtime/staprun/mainloop.c12
-rw-r--r--runtime/task_finder_vma.c2
-rw-r--r--session.h1
-rwxr-xr-xstap-report10
-rw-r--r--stap.1.in4
-rw-r--r--systemtap.spec5
14 files changed, 73 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index ba5fa7d7..de4e934b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2008-10-17 Frank Ch. Eigler <fche@elastic.org>
+
+ * stap-report: Add kernel config extracts. Generate to stdout.
+ * Makefile.am (bin_SCRIPTS): Install it.
+ * systemtap.spec: Package it.
+ * Makefile.in: Regenerated.
+
+2008-10-17 Jim Keniston <jkenisto@us.ibm.com>
+
+ PR6923
+ * runtime/autoconf-oneachcpu-retry.c: Compiles successfully on
+ old kernels.
+
+2008-10-14 Kent Sebastian <ksebasti@redhat.com>
+
+ * cache.cxx (cache_clean): Minor changes, mainly stylistic.
+ * session.h: remove cache_max member var (used only in cache.cxx now)
+
2008-10-10 Frank Ch. Eigler <fche@elastic.org>
PR6749
diff --git a/Makefile.am b/Makefile.am
index 1e356a4f..b3a4801e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 stap-s
# see also configure.ac
bin_PROGRAMS = stap staprun
-bin_SCRIPTS = stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server
+bin_SCRIPTS = stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server stap-report
stap_SOURCES = main.cxx \
parse.cxx staptree.cxx elaborate.cxx translate.cxx \
tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
diff --git a/Makefile.in b/Makefile.in
index 22336ec0..d43fde6f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -261,7 +261,7 @@ AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR=
AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W
AM_CXXFLAGS = -Wall -Werror
man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 stap-server.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5
-bin_SCRIPTS = stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server
+bin_SCRIPTS = stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server stap-report
stap_SOURCES = main.cxx \
parse.cxx staptree.cxx elaborate.cxx translate.cxx \
tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
diff --git a/cache.cxx b/cache.cxx
index 19334114..acab0b84 100644
--- a/cache.cxx
+++ b/cache.cxx
@@ -1,5 +1,5 @@
// systemtap cache manager
-// Copyright (C) 2006-2007 Red Hat Inc.
+// Copyright (C) 2006-2008 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
@@ -149,32 +149,24 @@ clean_cache(systemtap_session& s)
string cache_max_filename = s.cache_path + "/";
cache_max_filename += SYSTEMTAP_CACHE_MAX_FILENAME;
ifstream cache_max_file(cache_max_filename.c_str(), ios::in);
+ unsigned long cache_mb_max;
if (cache_max_file.is_open())
{
- cache_max_file >> s.cache_max;
+ cache_max_file >> cache_mb_max;
cache_max_file.close();
- s.cache_max *= 1024 * 1024; //convert to bytes
-
- //bad content in the file?
- if (s.cache_max < 0)
- s.cache_max = 0;
}
else
{
- //file doesnt exist or error
- s.cache_max = 0;
- }
+ //file doesnt exist, create a default size
+ ofstream default_cache_max(cache_max_filename.c_str(), ios::out);
+ default_cache_max << SYSTEMTAP_CACHE_DEFAULT_MB << endl;
+ cache_mb_max = SYSTEMTAP_CACHE_DEFAULT_MB;
- if (s.cache_max == 0)
- {
if (s.verbose > 1)
- clog << "Missing cache limit file " << s.cache_path << "/" << SYSTEMTAP_CACHE_MAX_FILENAME << ", I/O error or invalid content." << endl;
-
- return;
+ clog << "Cache limit file " << s.cache_path << "/" << SYSTEMTAP_CACHE_MAX_FILENAME << " missing, creating default." << endl;
}
-
//glob for all kernel modules in the cache dir
glob_t cache_glob;
string glob_str = s.cache_path + "/*/*.ko";
@@ -182,7 +174,7 @@ clean_cache(systemtap_session& s)
set<struct cache_ent_info, struct weight_sorter> cache_contents;
- long cache_size = 0;
+ unsigned long cache_size_b = 0;
//grab info for each cache entry (.ko and .c)
for (unsigned int i = 0; i < cache_glob.gl_pathc; i++)
@@ -197,7 +189,7 @@ clean_cache(systemtap_session& s)
cur_size = get_cache_file_size(cache_ent_path);
cur_info.size = cur_size;
- cache_size += cur_size;
+ cache_size_b += cur_size;
if (cur_info.size != 0 && cur_info.weight != 0)
{
@@ -208,35 +200,28 @@ clean_cache(systemtap_session& s)
globfree(&cache_glob);
set<struct cache_ent_info, struct weight_sorter>::iterator i;
- long r_cache_size = cache_size;
+ unsigned long r_cache_size = cache_size_b;
string removed_dirs = "";
//unlink .ko and .c until the cache size is under the limit
for (i = cache_contents.begin(); i != cache_contents.end(); ++i)
{
- if (r_cache_size < s.cache_max)
+ if ( (r_cache_size / 1024 / 1024) < cache_mb_max) //convert r_cache_size to MiB
break;
- //delete this (*i) cache_entry, add to removed list
- r_cache_size -= (*i).size;
- unlink_cache_entry((*i).path);
- removed_dirs += (*i).path + ", ";
+ //remove this (*i) cache_entry, add to removed list
+ r_cache_size -= i->size;
+ unlink_cache_entry(i->path);
+ removed_dirs += i->path + ", ";
}
cache_contents.clear();
- if (s.verbose > 1)
+ if (s.verbose > 1 && removed_dirs != "")
{
- if (removed_dirs == "")
- {
- clog << "Cache size under limit, no entries removed." << endl;
- }
- else
- {
- //remove trailing ", "
- removed_dirs = removed_dirs.substr(0, removed_dirs.length() - 2);
- clog << "Cache cleaning successful, removed entries: " << removed_dirs << endl;
- }
+ //remove trailing ", "
+ removed_dirs = removed_dirs.substr(0, removed_dirs.length() - 2);
+ clog << "Cache cleaning successful, removed entries: " << removed_dirs << endl;
}
}
else
@@ -268,7 +253,7 @@ get_cache_file_size(const string &cache_ent_path)
cache_ent_size += file_info.st_size;
- return cache_ent_size;
+ return cache_ent_size; // / 1024 / 1024; //convert to MiB
}
//Assign a weight to this cache entry. A lower weight
diff --git a/cache.h b/cache.h
index f5256518..0cd433e4 100644
--- a/cache.h
+++ b/cache.h
@@ -1,4 +1,5 @@
#define SYSTEMTAP_CACHE_MAX_FILENAME "cache_mb_limit"
+#define SYSTEMTAP_CACHE_DEFAULT_MB 64
struct cache_ent_info {
std::string path;
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index f40ff6ee..8aea0411 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-17 Wenji Huang <wenji.huang@oracle.com>
+
+ * task_finder_vma.c (__stp_tf_vma_get_free_entry): Initialize entry.
+
2008-10-07 Frank Ch. Eigler <fche@elastic.org>
PR 4886.
diff --git a/runtime/autoconf-oneachcpu-retry.c b/runtime/autoconf-oneachcpu-retry.c
index 304d9842..d4745a48 100644
--- a/runtime/autoconf-oneachcpu-retry.c
+++ b/runtime/autoconf-oneachcpu-retry.c
@@ -1,7 +1,13 @@
+#include <linux/stddef.h>
+#include <linux/irqflags.h>
#include <linux/smp.h>
+static void no_op(void *arg)
+{
+}
+
void ____autoconf_func(void)
{
/* Older on_each_cpu() calls had a "retry" parameter */
- (void)on_each_cpu(NULL, NULL, 0, 0);
+ (void)on_each_cpu(no_op, NULL, 0, 0);
}
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
index c6d75106..6e8a49f6 100644
--- a/runtime/staprun/ChangeLog
+++ b/runtime/staprun/ChangeLog
@@ -1,3 +1,7 @@
+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.
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index 6fc061ae..8db42d7d 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -126,9 +126,15 @@ void start_cmd(void)
work well if target_cmd is a shell builtin. We really want to
probe a new child process, not a mishmash of shell-interpreted
stuff. */
- rc = wordexp (target_cmd, & words, WRDE_NOCMD);
- if (rc != 0) { _perr ("wordexp parsing error"); _exit (1); }
- if (words.we_wordc < 1) { _perr ("empty target_cmd"); _exit (1); }
+ rc = wordexp (target_cmd, & words, WRDE_NOCMD|WRDE_UNDEF);
+ switch (rc)
+ {
+ case 0: break;
+ case WRDE_BADCHAR: _err ("wordexp: invalid shell meta-character in -c COMMAND\n"); _exit(1);
+ case WRDE_SYNTAX: _err ("wordexp: syntax error (unmatched quotes?) in -c COMMAND\n"); _exit(1);
+ default: _err ("wordexp: parsing error (%d)\n", rc); _exit (1);
+ }
+ if (words.we_wordc < 1) { _err ("empty -c COMMAND"); _exit (1); }
rc = ptrace (PTRACE_TRACEME, 0, 0, 0);
if (rc < 0) perror ("ptrace me");
diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c
index 8c60175e..4dce4be8 100644
--- a/runtime/task_finder_vma.c
+++ b/runtime/task_finder_vma.c
@@ -60,7 +60,7 @@ __stp_tf_vma_get_free_entry(void)
{
struct hlist_head *head = &__stp_tf_vma_free_list[0];
struct hlist_node *node;
- struct __stp_tf_vma_entry *entry;
+ struct __stp_tf_vma_entry *entry = NULL;
if (hlist_empty(head))
return NULL;
diff --git a/session.h b/session.h
index a848a8e5..4746422f 100644
--- a/session.h
+++ b/session.h
@@ -110,7 +110,6 @@ struct systemtap_session
bool use_cache;
std::string cache_path;
std::string hash_path;
- long cache_max;
// dwarfless operation
bool consult_symtab;
diff --git a/stap-report b/stap-report
index c2a5d070..e6503b31 100755
--- a/stap-report
+++ b/stap-report
@@ -4,8 +4,7 @@ import sys
import time
import subprocess
-ofname = "/tmp/stapreport-" + time.strftime("%Y%m%d%H%M%S") + ".txt"
-ofile = open(ofname, "w")
+ofile = sys.stdout
def run(command):
ofile.write("== " + command + " ==\n")
@@ -13,20 +12,15 @@ def run(command):
p = subprocess.Popen(command, shell=True, stdout=ofile, stderr=ofile)
p.wait()
ofile.write("\n")
- sys.stdout.write(".")
- sys.stdout.flush()
if __name__ == "__main__":
- sys.stdout.write("Collecting data")
- sys.stdout.flush()
run("stap -V")
run("which stap")
run("ls -ald `locate -r '/stap$'` `locate -r '/staprun$'`")
run("printenv | egrep '^PATH=|^LD_LIBRARY_PATH=|^SYSTEMTAP_.*='")
run("gcc -v")
run("uname -a")
- run("dmesg | grep 'gcc'")
run("dmesg | egrep 'stap|systemtap' | tail -n 10")
run("cat /proc/cpuinfo | egrep 'processor|vendor_id|model name'")
run(r"rpm -qa --qf %{name}-%{version}-%{release}.%{arch}\\n | egrep 'systemtap|elfutils|kernel|gcc' | sort")
- print "\nPlease include the following file in your bug report:", ofname
+ run(r"egrep 'PROBE|TRACE|MARKER' /lib/modules/`uname -r`/build/.config | grep -v not.set | sort | fmt -w 80")
diff --git a/stap.1.in b/stap.1.in
index b7c116ca..cc414418 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -870,8 +870,8 @@ directory. The cache can be limited by having the file
placed in the cache directory (shown above) containing only an ASCII
integer representing how many MiB the cache should not exceed. Note that
this is a 'soft' limit in that the cache will be cleaned after a new entry
-is added, so the cache size may temporarily exceed this limit. In the
-absence of this file, cache cleaning is up to the user.
+is added, so the total cache size may temporarily exceed this limit. In the
+absence of this file, a default will be created with the limit set to 64MiB.
.SH SAFETY AND SECURITY
Systemtap is an administrative tool. It exposes kernel internal data
diff --git a/systemtap.spec b/systemtap.spec
index 1a967cf1..9327b4ad 100644
--- a/systemtap.spec
+++ b/systemtap.spec
@@ -169,9 +169,6 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/examples examples
# Fix paths in the example & testsuite scripts
find examples testsuite -type f -name '*.stp' -print0 | xargs -0 sed -i -r -e '1s@^#!.+stap@#!%{_bindir}/stap@'
-# To avoid perl dependency, make perl sample script non-executable
-#chmod -x examples/samples/kmalloc-top
-
# Because "make install" may install staprun with mode 04111, the
# post-processing programs rpmbuild runs won't be able to read it.
# So, we change permissions so that they can read it. We'll set the
@@ -207,6 +204,7 @@ exit 0
%endif
%{_bindir}/stap
+%{_bindir}/stap-report
%{_mandir}/man1/*
%{_mandir}/man5/*
@@ -227,6 +225,7 @@ exit 0
%files runtime
%defattr(-,root,root)
%attr(4111,root,root) %{_bindir}/staprun
+%{_bindir}/stap-report
%{_libexecdir}/%{name}
%{_mandir}/man8/staprun.8*