--- This patch adds a support of "overwrite" mode of relayfs. When you'd like to use this mode, you just add "-O" to the stap command. hash.cxx | 1 + main.cxx | 8 +++++++- runtime/transport/utt.c | 4 ++++ session.h | 1 + translate.cxx | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) Index: systemtap/runtime/transport/utt.c =================================================================== --- systemtap.orig/runtime/transport/utt.c 2007-06-18 22:26:38.000000000 +0900 +++ systemtap/runtime/transport/utt.c 2007-06-18 22:30:13.000000000 +0900 @@ -129,7 +129,11 @@ utt = buf->chan->private_data; atomic_inc(&utt->dropped); +#ifdef STP_OVERWRITEMODE + return 1; +#else return 0; +#endif } static int utt_remove_buf_file_callback(struct dentry *dentry) Index: systemtap/hash.cxx =================================================================== --- systemtap.orig/hash.cxx 2007-06-18 22:26:38.000000000 +0900 +++ systemtap/hash.cxx 2007-06-18 22:27:24.000000000 +0900 @@ -100,6 +100,7 @@ h.add(s.merge); // '-M' h.add(s.timing); // '-t' h.add(s.prologue_searching); // '-P' + h.add(s.overwrite_mode); // '-O' for (unsigned i = 0; i < s.macros.size(); i++) h.add(s.macros[i]); Index: systemtap/main.cxx =================================================================== --- systemtap.orig/main.cxx 2007-06-18 22:26:38.000000000 +0900 +++ systemtap/main.cxx 2007-06-18 22:27:24.000000000 +0900 @@ -74,6 +74,7 @@ << " -P prologue-searching for function probes" << (s.prologue_searching ? " [set]" : "") << endl << " -b bulk (percpu file) mode" << (s.bulk_mode ? " [set]" : "") << endl + << " -O overwrite buffers mode" << (s.overwrite_mode ? " [set]" : "") << endl << " -s NUM buffer size in megabytes, instead of " << s.buffer_size << endl << " -p NUM stop after pass NUM 1-5, instead of " @@ -205,6 +206,7 @@ s.prologue_searching = false; #endif + s.overwrite_mode = false; s.buffer_size = 0; s.last_pass = 5; s.module_name = "stap_" + stringify(getpid()); @@ -265,7 +267,7 @@ while (true) { // NB: also see find_hash(), help(), switch stmt below, stap.1 man page - int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:u"); + int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uO"); if (grc < 0) break; switch (grc) @@ -377,6 +379,10 @@ s.bulk_mode = true; break; + case 'O': + s.overwrite_mode = true; + break; + case 'u': s.unoptimized = true; break; Index: systemtap/session.h =================================================================== --- systemtap.orig/session.h 2007-06-18 22:26:38.000000000 +0900 +++ systemtap/session.h 2007-06-18 22:27:24.000000000 +0900 @@ -97,6 +97,7 @@ unsigned perfmon; bool symtab; /* true: emit symbol table at translation time; false: let staprun do it. */ bool prologue_searching; + bool overwrite_mode; // Cache data bool use_cache; Index: systemtap/translate.cxx =================================================================== --- systemtap.orig/translate.cxx 2007-06-18 22:26:38.000000000 +0900 +++ systemtap/translate.cxx 2007-06-18 22:27:24.000000000 +0900 @@ -4319,6 +4319,9 @@ if (s.bulk_mode) s.op->newline() << "#define STP_BULKMODE"; + if (s.overwrite_mode) + s.op->newline() << "#define STP_OVERWRITEMODE"; + if (s.timing) s.op->newline() << "#define STP_TIMING";