diff options
author | kenistoj <kenistoj> | 2007-10-08 21:52:12 +0000 |
---|---|---|
committer | kenistoj <kenistoj> | 2007-10-08 21:52:12 +0000 |
commit | 6274464ec4e095cd42238d0b4b5dc1d45bf100da (patch) | |
tree | e640a94f014c692f57e95ce087e87e1b2b301779 /runtime/staprun/staprun_funcs.c | |
parent | a9e8f7e0533811be2cd7c9a88d9058da8caa1d11 (diff) | |
download | systemtap-steved-6274464ec4e095cd42238d0b4b5dc1d45bf100da.tar.gz systemtap-steved-6274464ec4e095cd42238d0b4b5dc1d45bf100da.tar.xz systemtap-steved-6274464ec4e095cd42238d0b4b5dc1d45bf100da.zip |
PR 5709
* main.cxx: Add pass 4.5: make uprobes.ko in runtime/uprobes
* buildrun.cxx: Add uprobes_enabled() and make_uprobes().
Factor run_make_cmd() out of compile_pass().
* buildrun.h: Add uprobes_enabled and make_uprobes decls.
* tapsets.cxx: Do correct #include for modprobed uprobes.ko;
set need_uprobes in pass 2.
* session.h: Add need_uprobes
* runtime/staprun/common.c: Add -u option -> need_uprobes
* runtime/staprun/staprun_funcs.c: Generalize insert_module()
to support inserting uprobes.ko.
* runtime/staprun/staprun.c: Add enable_uprobes(). insert_module
call becomes insert_stap_module().
* runtime/staprun/staprun.h: Reflect insert_module() and
need_uprobes changes
* runtime/uprobes/*.[c,h]: uprobes is built as a module,
rather than included into the source of the stap-generated
module.
* runtime/uprobes/Makefile: Added
Diffstat (limited to 'runtime/staprun/staprun_funcs.c')
-rw-r--r-- | runtime/staprun/staprun_funcs.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/runtime/staprun/staprun_funcs.c b/runtime/staprun/staprun_funcs.c index 0747b530..eec4ae63 100644 --- a/runtime/staprun/staprun_funcs.c +++ b/runtime/staprun/staprun_funcs.c @@ -47,7 +47,7 @@ const char *moderror(int err) } } -int insert_module(void) +int insert_module(const char *path, const char *special_options, char **options) { int i; long ret; @@ -58,34 +58,35 @@ int insert_module(void) dbug(2, "inserting module\n"); - opts = malloc(128); + if (special_options) + opts = strdup(special_options); + else + opts = strdup(""); if (opts == NULL) { _perr("allocating memory failed"); return -1; } - if (snprintf_chk(opts, 128, "_stp_bufsize=%d", buffer_size)) - return -1; - for (i = 0; modoptions[i] != NULL; i++) { - opts = realloc(opts, strlen(opts) + strlen(modoptions[i]) + 2); + for (i = 0; options[i] != NULL; i++) { + opts = realloc(opts, strlen(opts) + strlen(options[i]) + 2); if (opts == NULL) { - _perr("reallocating memory failed"); + _perr("[re]allocating memory failed"); return -1; } strcat(opts, " "); - strcat(opts, modoptions[i]); + strcat(opts, options[i]); } dbug(2, "module options: %s\n", opts); /* Open the module file. */ - fd = open(modpath, O_RDONLY); + fd = open(path, O_RDONLY); if (fd < 0) { - perr("Error opening '%s'", modpath); + perr("Error opening '%s'", path); return -1; } /* Now that the file is open, figure out how big it is. */ if (fstat(fd, &sbuf) < 0) { - _perr("Error stat'ing '%s'", modpath); + _perr("Error stat'ing '%s'", path); close(fd); return -1; } @@ -93,7 +94,7 @@ int insert_module(void) /* mmap in the entire module. */ file = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (file == MAP_FAILED) { - _perr("Error mapping '%s'", modpath); + _perr("Error mapping '%s'", path); close(fd); free(opts); return -1; @@ -109,7 +110,7 @@ int insert_module(void) close(fd); if (ret != 0) { - err("Error inserting module '%s': %s\n", modpath, moderror(saved_errno)); + err("Error inserting module '%s': %s\n", path, moderror(saved_errno)); return -1; } return 0; |