From 42b75235a537bae856b9ec8b763b5ea5369d7b22 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 15 Oct 2008 10:30:39 -0400 Subject: copyright year tweak --- cache.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cache.cxx b/cache.cxx index 19334114..ce57e2d0 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 -- cgit From 927b945c9ab8060f9929ad72ac126b65c8ee49d3 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 15 Oct 2008 19:08:45 -0400 Subject: fix wordexp error handling, for invalid shell-like stap -c "command > file" Reported-By: Wade Mealing --- runtime/staprun/ChangeLog | 4 ++++ runtime/staprun/mainloop.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) 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 + + * mainloop.c (start_cmd): Fix wordexp error handling. + 2008-09-18 David Smith 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"); -- cgit From 569f88af768ea1224ec536e592f1e16e45c0395d Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Fri, 17 Oct 2008 00:50:28 -0400 Subject: Fix compilation warning of uninitialized value in gcc 3.x. --- runtime/ChangeLog | 4 ++++ runtime/task_finder_vma.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 + + * task_finder_vma.c (__stp_tf_vma_get_free_entry): Initialize entry. + 2008-10-07 Frank Ch. Eigler PR 4886. 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; -- cgit From fffd8e13b84c121be4657a91042d050094fbfb99 Mon Sep 17 00:00:00 2001 From: Kent Sebastian Date: Fri, 17 Oct 2008 14:39:33 -0400 Subject: Minor changes to cache.cxx (cache_clean). --- ChangeLog | 5 +++++ cache.cxx | 47 +++++++++++++++-------------------------------- session.h | 1 - 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba5fa7d7..9d75a951 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-14 Kent Sebastian + + * 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 PR6749 diff --git a/cache.cxx b/cache.cxx index ce57e2d0..750e2309 100644 --- a/cache.cxx +++ b/cache.cxx @@ -149,32 +149,22 @@ 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; - } - - 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; } - //glob for all kernel modules in the cache dir glob_t cache_glob; string glob_str = s.cache_path + "/*/*.ko"; @@ -182,7 +172,7 @@ clean_cache(systemtap_session& s) set 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 +187,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 +198,28 @@ clean_cache(systemtap_session& s) globfree(&cache_glob); set::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 +251,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/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; -- cgit From f604f54a6df38a064787a381852ceb98e229f9e9 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Oct 2008 17:28:46 -0400 Subject: Added creation of a default cache limit file if it doesn't exist. --- cache.cxx | 10 ++++++---- cache.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cache.cxx b/cache.cxx index 750e2309..acab0b84 100644 --- a/cache.cxx +++ b/cache.cxx @@ -158,11 +158,13 @@ clean_cache(systemtap_session& s) } else { - //file doesnt exist or error - if (s.verbose > 1) - clog << "Missing cache limit file " << s.cache_path << "/" << SYSTEMTAP_CACHE_MAX_FILENAME << ", I/O error or invalid content." << endl; + //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; - return; + if (s.verbose > 1) + clog << "Cache limit file " << s.cache_path << "/" << SYSTEMTAP_CACHE_MAX_FILENAME << " missing, creating default." << endl; } //glob for all kernel modules in the cache dir 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; -- cgit From 6820a1cf1e6cb81e562eea0043758283f3e63153 Mon Sep 17 00:00:00 2001 From: Kent Sebastian Date: Fri, 17 Oct 2008 17:32:58 -0400 Subject: Changed stap man page to account for default cache file behaviour. --- stap.1.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- cgit From 52333a6929a036ba787593eb42acab81d11d91b1 Mon Sep 17 00:00:00 2001 From: Jim Keniston Date: Fri, 17 Oct 2008 14:43:40 -0700 Subject: PR6923: Make on_each_cpu() autoconf test work on old kernels. --- ChangeLog | 6 ++++++ runtime/autoconf-oneachcpu-retry.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9d75a951..05834b96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-10-17 Jim Keniston + + PR6923 + * runtime/autoconf-oneachcpu-retry.c: Compiles successfully on + old kernels. + 2008-10-14 Kent Sebastian * cache.cxx (cache_clean): Minor changes, mainly stylistic. 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 +#include #include +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); } -- cgit From b0ff684d5ac5b0ade97a4e508a92a7f743068221 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 17 Oct 2008 22:51:37 -0400 Subject: stap-report script packaging & tweaks --- ChangeLog | 7 +++++++ Makefile.am | 2 +- Makefile.in | 2 +- stap-report | 10 ++-------- systemtap.spec | 5 ++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05834b96..de4e934b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-10-17 Frank Ch. Eigler + + * 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 PR6923 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/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/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* -- cgit