summaryrefslogtreecommitdiffstats
path: root/runtime/stpd/stpd.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-08-01 21:40:52 +0000
committerhunt <hunt>2005-08-01 21:40:52 +0000
commit3ca3cf924886beab449d85e1232d0936b501c4f0 (patch)
treebaeb55982c4cbd6643f18e5180319584dd50c243 /runtime/stpd/stpd.c
parent3b971328035c179c41e6175a4feb3a5683588adf (diff)
downloadsystemtap-steved-3ca3cf924886beab449d85e1232d0936b501c4f0.tar.gz
systemtap-steved-3ca3cf924886beab449d85e1232d0936b501c4f0.tar.xz
systemtap-steved-3ca3cf924886beab449d85e1232d0936b501c4f0.zip
2005-08-01 Martin Hunt <hunt@redhat.com>
* librelay.h: Get structs and enums from ../transport/transport_msgs.h to eliminate duplication. * librelay.c (send_request): Retry if send fails. (open_relayfs_files): Use fopen() instead of open() for the percpu tmpfiles. (request_last_buffers): Just send cpu number for STP_BUF_INFO request. (reader_thread): Ditto. (process_subbufs): Use fwrite_unlocked() instead of write(). (sigchld): Removed. (init_stp): Go back to using system() instead of fork and exec to load module. When done, send a TRANSPORT_INFO request. (cleanup_and_exit): Change parameter to simple flag to indicate if the module needs removing. (sigproc): Remove complicated logic and just send STP_EXIT. (stp_main_loop): When receiving STP_TRANSPORT_INFO, set the local params and reply with a STP_START. When receiving STP_START, there was an error, so cleanup and exit. * stpd.c (main): Added new options to set number of buffers and their size.
Diffstat (limited to 'runtime/stpd/stpd.c')
-rw-r--r--runtime/stpd/stpd.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/runtime/stpd/stpd.c b/runtime/stpd/stpd.c
index eef662ae..bbcf1954 100644
--- a/runtime/stpd/stpd.c
+++ b/runtime/stpd/stpd.c
@@ -32,25 +32,29 @@ extern int optind;
int print_only = 0;
int quiet = 0;
int merge = 1;
+unsigned int opt_subbuf_size = 0;
+unsigned int opt_n_subbufs = 0;
+char *modname = NULL;
/* relayfs base file name */
static char stpd_filebase[1024];
static void usage(char *prog)
{
- fprintf(stderr, "%s [-m] [-p] [-q] kmod-name\n", prog);
+ fprintf(stderr, "\n%s [-m] [-p] [-q] [-b bufsize] [-n num_subbufs] kmod-name\n", prog);
fprintf(stderr, "-m Don't merge per-cpu files.\n");
fprintf(stderr, "-p Print only. Don't log to files.\n");
fprintf(stderr, "-q Quiet. Don't display trace to stdout.\n");
+ fprintf(stderr, "-b subbuf_size (override the value in the module)\n");
+ fprintf(stderr, "-n subbufs (override the value in the module)\n");
exit(1);
}
int main(int argc, char **argv)
{
int c;
- char *modname = NULL;
- while ((c = getopt(argc, argv, "mpq")) != EOF)
+ while ((c = getopt(argc, argv, "mpqb:n:")) != EOF)
{
switch (c) {
case 'm':
@@ -62,11 +66,25 @@ int main(int argc, char **argv)
case 'q':
quiet = 1;
break;
+ case 'b':
+ opt_subbuf_size = (unsigned)atoi(optarg);
+ if (!opt_subbuf_size)
+ usage(argv[0]);
+ break;
+ case 'n':
+ opt_n_subbufs = (unsigned)atoi(optarg);
+ if (!opt_n_subbufs)
+ usage(argv[0]);
+ break;
default:
usage(argv[0]);
}
}
+ if ((opt_n_subbufs && !opt_subbuf_size) || (opt_subbuf_size && !opt_n_subbufs)) {
+ fprintf (stderr, "You must specify both the number of subbufs and their size.\n");
+ usage(argv[0]);
+ }
if (optind < argc)
modname = argv[optind++];
@@ -81,7 +99,7 @@ int main(int argc, char **argv)
}
sprintf(stpd_filebase, "/mnt/relay/%d/cpu", getpid());
- if (init_stp(modname, stpd_filebase, !quiet)) {
+ if (init_stp(stpd_filebase, !quiet)) {
fprintf(stderr, "Couldn't initialize stpd. Exiting.\n");
exit(1);
}