Permalink
Browse files

Allow utils to take standard -s server arg

The server name may be in IP[:PORT], HOST[:PORT], or /path/to/socket
form.
  • Loading branch information...
1 parent c289f62 commit 53f65493322621004d8ccff24bc19f77ec32a11c @garlick garlick committed May 22, 2012
Showing with 32 additions and 29 deletions.
  1. +5 −1 libdiod/diod_sock.c
  2. +4 −5 utils/diodcat.8.in
  3. +3 −3 utils/diodcat.c
  4. +4 −4 utils/diodload.8.in
  5. +2 −2 utils/diodload.c
  6. +4 −4 utils/diodls.8.in
  7. +3 −3 utils/diodls.c
  8. +3 −3 utils/diodshowmount.8.in
  9. +3 −3 utils/diodshowmount.c
  10. +1 −1 utils/dtop.8.in
View
@@ -446,8 +446,12 @@ diod_sock_connect (char *name, int flags)
char *host = NULL;
char *port;
- if (name[0] == '/')
+ if (!name)
+ fd = diod_sock_connect_inet ("localhost", "564", flags);
+ else if (name[0] == '/')
fd = diod_sock_connect_unix (name, flags);
+ else if (!strchr (name, ':'))
+ fd = diod_sock_connect_inet (name, "564", flags);
else {
if (!(host = strdup (name))) {
errno = ENOMEM;
View
@@ -2,19 +2,18 @@
.SH NAME
diodcat \- cat files by attaching directly to diod server
.SH SYNOPSIS
-\fBdiodcat\fR \fI[OPTIONS] [-s IP:PORT] [-a aname] [file [file...]]\fR
+\fBdiodcat\fR \fI[OPTIONS] [-s NAME] [-a aname] [file [file...]]\fR
.SH DESCRIPTION
.B diodcat
-connects to a \fBdiod\fR server on \fIIP:PORT\fR, attaches to
-the mount point \fIaname\fR, and concatenates the contents of
-the specified files on stdout.
+connects to a \fBdiod\fR server, attaches to the mount point \fIaname\fR,
+and concatenates the contents of the specified files on stdout.
.SH OPTIONS
.TP
.I "-a, --aname NAME"
The file system name on the server (default ctl).
.TP
.I "-s, --server NAME"
-The server in IP:PORT, HOST:PORT, or /path/to/unix_domain_socket form
+The server in IP[:PORT], HOST[:PORT], or /path/to/socket form
(default localhost:564).
.TP
.I "-m, --msize SIZE"
View
@@ -75,7 +75,7 @@ static void
usage (void)
{
fprintf (stderr,
-"Usage: diodcat [OPTIONS] [-s HOST:PORT] [-a aname] [file [file...]]\n"
+"Usage: diodcat [OPTIONS] [-s HOST[:PORT]] [-a aname] [file [file...]]\n"
" -a,--aname NAME file system (default ctl)\n"
" -s,--server HOST:PORT server (default localhost:564)\n"
" -m,--msize msize (default 65536)\n"
@@ -89,7 +89,7 @@ int
main (int argc, char *argv[])
{
char *aname = NULL;
- char *server = "localhost:564";
+ char *server = NULL;
int msize = 65536;
uid_t uid = geteuid ();
int topt = 0;
@@ -103,7 +103,7 @@ main (int argc, char *argv[])
case 'a': /* --aname NAME */
aname = optarg;
break;
- case 's': /* --server HOST:PORT or /path/to/socket */
+ case 's': /* --server HOST[:PORT] or /path/to/socket */
server = optarg;
break;
case 'm': /* --msize SIZE */
View
@@ -2,16 +2,16 @@
.SH NAME
diodload \- create artificial diod load
.SH SYNOPSIS
-\fBdiodload\fR \fI[OPTIONS] [-s IP:PORT]\fR
+\fBdiodload\fR \fI[OPTIONS] [-s NAME]\fR
.SH DESCRIPTION
.B diodload
-connects to a \fBdiod\fR server on \fIIP:PORT\fR and issues requests.
+connects to a \fBdiod\fR server and issues requests.
Unless changed with \fI-g\fR, each thread copies from
\fIctl:zero\fR to \fIctl:null\fR.
.SH OPTIONS
.TP
-.I "-s, --server IP:PORT"
-The server in IP:PORT, HOST:PORT, or /path/to/unix_domain_socket form
+.I "-s, --server NAME"
+The server in IP[:PORT], HOST[:PORT], or /path/to/socket form
default localhost:564).
.TP
.I "-m, --msize SIZE"
View
@@ -125,7 +125,7 @@ main (int argc, char *argv[])
opterr = 0;
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
switch (c) {
- case 's': /* --server HOST:PORT or /path/to/unix_domain_socket */
+ case 's': /* --server HOST[:PORT] or /path/to/socket */
server = optarg;
break;
case 'm': /* --msize SIZE */
@@ -152,7 +152,7 @@ main (int argc, char *argv[])
msg_exit ("out of memory");
for (i = 0; i < numthreads; i++) {
- t[i].server = server ? server : "localhost:564";
+ t[i].server = server;
t[i].msize = msize;
t[i].stoptime = now + runtime;
t[i].fd = -1;
View
@@ -2,18 +2,18 @@
.SH NAME
diodls \- list files by attaching directly to diod server
.SH SYNOPSIS
-\fBdiodls\fR \fI[OPTIONS] [-s IP:PORT] [-a aname] [file [file...]]\fR
+\fBdiodls\fR \fI[OPTIONS] [-s NAME] [-a aname] [file [file...]]\fR
.SH DESCRIPTION
.B diodls
-connects to a \fBdiod\fR server on \fIIP:PORT\fR, attaches to
-the mount point \fIaname\fR, and lists the specified files or directories.
+connects to a \fBdiod\fR server, attaches to the mount point \fIaname\fR,
+and lists the specified files or directories.
.SH OPTIONS
.TP
.I "-a, --aname NAME"
The file system name on the server (default ctl).
.TP
.I "-s, --server NAME"
-The server in IP:PORT, HOST:PORT, or /path/to/unix_domain_socket form
+The server in IP[:PORT], HOST[:PORT], or /path/to/socket form
(default localhost:564).
.TP
.I "-m, --msize SIZE"
View
@@ -79,7 +79,7 @@ static void
usage (void)
{
fprintf (stderr,
-"Usage: diodcat [OPTIONS] [-s HOST:PORT] [-a aname] [file [file...]]\n"
+"Usage: diodcat [OPTIONS] [-s HOST[:PORT]] [-a aname] [file [file...]]\n"
" -a,--aname NAME file system (default ctl)\n"
" -s,--server HOST:PORT server (default localhost:564)\n"
" -l,--long show stat information too\n"
@@ -94,7 +94,7 @@ int
main (int argc, char *argv[])
{
char *aname = NULL;
- char *server = "localhost:564";
+ char *server = NULL;
int msize = 65536;
uid_t uid = geteuid ();
int topt = 0;
@@ -109,7 +109,7 @@ main (int argc, char *argv[])
case 'a': /* --aname NAME */
aname = optarg;
break;
- case 's': /* --server HOST:PORT or /path/to/socket */
+ case 's': /* --server HOST[:PORT] or /path/to/socket */
server = optarg;
break;
case 'm': /* --msize SIZE */
View
@@ -2,16 +2,16 @@
.SH NAME
diodshowmount \- list diod server connections
.SH SYNOPSIS
-\fBdiodshowmount\fR \fI[OPTIONS] [-s IP:PORT]\fR
+\fBdiodshowmount\fR \fI[OPTIONS] [-s NAME]\fR
.SH DESCRIPTION
.B diodshowmount
-connects to a \fBdiod\fR server on \fIIP:PORT\fR and displays a list of
+connects to a \fBdiod\fR server and displays a list of
clients connected to that server in hostlist format, with domain name
suffixes stripped.
.SH OPTIONS
.TP
.I "-s, --server NAME"
-The server in IP:PORT, HOST:PORT, or /path/to/unix_domain_socket form
+The server in IP[:PORT], HOST[:PORT], or /path/to/socket form
(default localhost:564).
.TP
.I "-m, --msize SIZE"
View
@@ -74,7 +74,7 @@ static void
usage (void)
{
fprintf (stderr,
-"Usage: diodshowmount [OPTIONS] [-s HOST:PORT]\n"
+"Usage: diodshowmount [OPTIONS] [-s HOST[:PORT]]\n"
" -s,--server HOST:PORT server (default localhost:564)\n"
" -m,--msize msize (default 65536)\n"
" -u,--uid authenticate as uid (default is your euid)\n"
@@ -87,7 +87,7 @@ usage (void)
int
main (int argc, char *argv[])
{
- char *server = "localhost:564";
+ char *server = NULL;
int msize = 65536;
uid_t uid = geteuid ();
int topt = 0;
@@ -104,7 +104,7 @@ main (int argc, char *argv[])
opterr = 0;
while ((c = GETOPT (argc, argv, OPTIONS, longopts)) != -1) {
switch (c) {
- case 's': /* --server HOST:PORT or /path/to/socket */
+ case 's': /* --server HOST[:PORT] or /path/to/socket */
server = optarg;
break;
case 'm': /* --msize SIZE */
View
@@ -2,7 +2,7 @@
.SH NAME
dtop \- display diod performance
.SH SYNOPSIS
-\fBdtop\fR \fI[-h hostlist] [-p pool_period]\fR
+\fBdtop\fR \fI[-h hostlist] [OPTIONS]\fR
.SH DESCRIPTION
.B dtop
connects to \fBdiod\fR servers and displays performance information.

0 comments on commit 53f6549

Please sign in to comment.