This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
STABLE2 - dlmtop: Add usage message
- From: Christine Caulfield <chrissie at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Tue, 21 Oct 2008 07:53:20 +0000 (UTC)
- Subject: STABLE2 - dlmtop: Add usage message
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=43a9fba5000a2a869a41f435fa088204abdab83c
Commit: 43a9fba5000a2a869a41f435fa088204abdab83c
Parent: 812f002364f33eb634f24cb2c5205570dc23cd04
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Tue Oct 21 08:52:34 2008 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Tue Oct 21 08:52:34 2008 +0100
dlmtop: Add usage message
And also allow port to be specified for odd installations.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
dlm/tests/tcpdump/dlmtop.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlm/tests/tcpdump/dlmtop.c b/dlm/tests/tcpdump/dlmtop.c
index 38cf4e5..8ae3f19 100644
--- a/dlm/tests/tcpdump/dlmtop.c
+++ b/dlm/tests/tcpdump/dlmtop.c
@@ -34,7 +34,7 @@
static char *dlm_filter = "port 21064";
-#define VERSION "v0.1"
+#define VERSION "v0.2"
#define MAX_PROCESSES 512
#define NAME_LENGTH 1024
@@ -523,10 +523,27 @@ static void my_callback(u_char *useless,const struct pcap_pkthdr* pkthdr,
}
}
+static void usage(char *cmd, FILE *f)
+{
+ fprintf(f, "Usage:\n");
+ fprintf(f, "%s [hVrladi]\n", cmd);
+ fprintf(f, "\n");
+ fprintf(f, "Options\n");
+ fprintf(f, " -r Sort output by resources (default lock ops)\n");
+ fprintf(f, " -l Sort by lock operations (default)\n");
+ fprintf(f, " -a Show accumulated counters rather than per <interval> operations\n");
+ fprintf(f, " -i <secs> Set the refresh interval (default 1 second)\n");
+ fprintf(f, " -p <port> Change the TCP port to listen on (default 21064)\n");
+ fprintf(f, " -d[ddd] Enable/increase debugging messages to stderr\n");
+ fprintf(f, " -h Show this help message\n");
+ fprintf(f, "\n");
+}
+
int main(int argc,char **argv)
{
char *dev;
char errbuf[PCAP_ERRBUF_SIZE];
+ char bpf_text[132];
pcap_t* descr;
struct bpf_program fp; /* hold compiled program */
signed char opt;
@@ -536,12 +553,12 @@ int main(int argc,char **argv)
/* Deal with command-line arguments */
opterr = 0;
optind = 0;
- while ((opt=getopt(argc,argv,"?hVrladi:")) != EOF)
+ while ((opt=getopt(argc,argv,"?hVrladi:p:")) != EOF)
{
switch(opt)
{
case 'h':
-// usage(argv[0], stdout);
+ usage(argv[0], stdout);
exit(0);
case 'V':
fprintf(stderr, "dlmtop version 0.1\n");
@@ -558,9 +575,16 @@ int main(int argc,char **argv)
case 'i':
interval = atoi(optarg);
break;
+ case 'p':
+ sprintf(bpf_text, "port %d", atoi(optarg));
+ dlm_filter = bpf_text;
+ break;
case 'd':
debug++;
break;
+ default:
+ usage(argv[0], stderr);
+ exit(0);
}
}