From 38975255091d0c6bc33ae3c6907bb7886b70598d Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 25 Feb 2010 16:29:50 -0600 Subject: Fixed pr 10690 by adding '.maxsize(NNN)' procfs read probe parameter. * tapset-procfs.cxx (procfs_derived_probe::procfs_derived_probe): Added 'maxsize_val' initialization. (procfs_derived_probe::join_group): Updated '_stp_procfs_data' definition and added STP_PROCFS_BUFSIZE. (procfs_derived_probe_group::emit_module_decls): Emits structure to contain procfs file buffers. Initializes '.bufsize' structure member. (procfs_var_expanding_visitor::visit_target_symbol): Uses 'bufsize' for maximum buffer size instead of using MAXSTRINGLEN. (procfs_builder::build): Looks for '.maxsize(NNN)' parameter. (register_tapset_procfs): Added '.maxsize(NNN)' parameter binding. * runtime/procfs-probes.c (stap_procfs_probe): Converted 'buffer' to a pointer and added 'bufsize' member. * testsuite/semko/procfs13.stp: New testcase. * testsuite/semko/procfs14.stp: Ditto. * testsuite/semko/procfs15.stp: Ditto. * testsuite/systemtap.base/procfs_maxsize.exp: Ditto. * testsuite/systemtap.base/procfs.exp: Minor fix. * stapprobes.3stap.in: Added '.maxsize(NNN)' documentation. * stap.1.in: Added STP_PROCFS_BUFSIZE documentation. --- runtime/procfs-probes.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/procfs-probes.c b/runtime/procfs-probes.c index 73aa7e5f..8f9ff113 100644 --- a/runtime/procfs-probes.c +++ b/runtime/procfs-probes.c @@ -9,7 +9,8 @@ // translation process. It really should go here. struct _stp_procfs_data { char *buffer; - unsigned long count; + size_t bufsize; + size_t count; }; #endif @@ -20,10 +21,8 @@ struct stap_procfs_probe { const char *write_pp; void (*write_ph) (struct context*); - // FIXME: Eventually, this could get bigger than MAXSTRINGLEN - // when we support 'probe procfs("file").read.maxbuf(8192)' - // (bug 10690). - string_t buffer; + char *buffer; + const size_t bufsize; size_t count; int needs_fill; -- cgit