diff options
author | hunt <hunt> | 2005-08-03 18:52:23 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-08-03 18:52:23 +0000 |
commit | 416730778dd315b64b1f443e5396685c9d0078cd (patch) | |
tree | 5ed5eac193c310978b2cb6697ad6b4c6a2ea5870 /runtime/stpd/librelay.c | |
parent | 27cffb521607b81eec660ab9f5b8b607d014c692 (diff) | |
download | systemtap-steved-416730778dd315b64b1f443e5396685c9d0078cd.tar.gz systemtap-steved-416730778dd315b64b1f443e5396685c9d0078cd.tar.xz systemtap-steved-416730778dd315b64b1f443e5396685c9d0078cd.zip |
2005-08-03 Martin Hunt <hunt@redhat.com>
* librelay.c (open_control_channel): Set the receive buffer
to 512K, or the max allowed.
* stpd.c: Remove "-n" subbug option and change "-b" option
so you can specify buffering in different ways. Add a verbose option.
Exec the "stp_check" script.
Diffstat (limited to 'runtime/stpd/librelay.c')
-rw-r--r-- | runtime/stpd/librelay.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/runtime/stpd/librelay.c b/runtime/stpd/librelay.c index 4fe9d548..bca63e6e 100644 --- a/runtime/stpd/librelay.c +++ b/runtime/stpd/librelay.c @@ -74,9 +74,7 @@ static pthread_t reader[NR_CPUS]; static int control_channel; /* flags */ -extern int print_only; -extern int quiet; -extern int merge; +extern int print_only, quiet, merge, verbose; extern unsigned int opt_subbuf_size; extern unsigned int opt_n_subbufs; extern char *modname; @@ -153,13 +151,29 @@ int send_request(int type, void *data, int len) return err; } +#if 0 +static unsigned int get_rmem(void) +{ + char buf[32]; + FILE *fp = fopen ("/proc/sys/net/core/rmem_max", "r"); + if (fp == NULL) + return 0; + if (fgets (buf, 32, fp) == NULL) { + fclose(fp); + return 0; + } + fclose(fp); + return atoi(buf); +} +#endif + /** * open_control_channel - create netlink channel */ static int open_control_channel() { struct sockaddr_nl snl; - int channel; + int channel, rcvsize = 512*1024; channel = socket(AF_NETLINK, SOCK_RAW, NETLINK_USERSOCK); if (channel < 0) { @@ -167,6 +181,9 @@ static int open_control_channel() return channel; } + if (setsockopt(channel, SOL_SOCKET, SO_RCVBUF, &rcvsize, sizeof(int))) + fprintf(stderr, "WARNING: failed to set socket receive buffer to %d\n", rcvsize); + memset(&snl, 0, sizeof snl); snl.nl_family = AF_NETLINK; snl.nl_pid = getpid(); @@ -451,12 +468,26 @@ int init_stp(const char *relay_filebase, int print_summary) { char buf[1024]; struct transport_info ti; + pid_t pid; + int status; ncpus = sysconf(_SC_NPROCESSORS_ONLN); print_totals = print_summary; - sprintf(buf, "insmod %s _stp_pid=%d", modname, (int)getpid()); - if (system(buf)) { + sprintf(buf, "_stp_pid=%d", (int)getpid()); + if ((pid = vfork()) < 0) { + perror ("vfork"); + exit(-1); + } else if (pid == 0) { + if (execl("/sbin/insmod", "insmod", modname, buf, NULL) < 0) + exit(-1); + } + if (waitpid(pid, &status, 0) < 0) { + perror("waitpid"); + exit(-1); + } + if (WIFEXITED(status) && WEXITSTATUS(status)) { + perror ("insmod"); fprintf(stderr, "ERROR, couldn't insmod probe module %s\n", modname); return -1; } |