diff options
author | amavect <amavect@gmail.com> | 2021-08-18 17:51:40 +0000 |
---|---|---|
committer | amavect <amavect@gmail.com> | 2021-08-18 17:51:40 +0000 |
commit | 0f58e47551345d7c48c9404bc4188f7fc195e51a (patch) | |
tree | 3c6487a3aaf48d05382687a500589967fa5bd94b /sys/src/cmd/exportfs/oexportfs.c | |
parent | 8c228a123fa0c6062570964011854302bbf57242 (diff) |
exportfs, oexportfs, iostats: make -d log to stderr
exportfs -d logs 9p traffic to /tmp/exportdb.
-f allows writing to a different file.
exportfs silently continues if it doesn't have
permissions to create or write to /tmp/exportdb.
These are poor behaviors.
A better default is to write to stderr, since it
is 9P debug info that is better immediately printed,
and not user info that is better handled by syslog().
As a result, -f is obsolete and thus removed.
Redirect responsibility is now on rc.
As a side effect, rc will fail if it doesn't
have permissions to write.
exportfs(4) is updated to reflect all changes
and with a better Synopsis.
oexportfs is changed to match exportfs.
oexportfs(4) is updated to reflect all changes.
The Synopsis is not changed due to the number of flags.
Removed -f from iostats.
iostats(4) is updated to reflect all changes.
---
Diffstat (limited to 'sys/src/cmd/exportfs/oexportfs.c')
-rw-r--r-- | sys/src/cmd/exportfs/oexportfs.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/sys/src/cmd/exportfs/oexportfs.c b/sys/src/cmd/exportfs/oexportfs.c index c6683a174..105c30447 100644 --- a/sys/src/cmd/exportfs/oexportfs.c +++ b/sys/src/cmd/exportfs/oexportfs.c @@ -59,7 +59,7 @@ filter(int fd, char *cmd, char *host) strecpy(strrchr(addr, '!'), addr+sizeof(addr), s); } - DEBUG(DFD, "filter: %s\n", addr); + DEBUG(2, "filter: %s\n", addr); snprint(buf, sizeof(buf), "%s", cmd); argc = tokenize(buf, argv, nelem(argv)-3); @@ -108,7 +108,7 @@ mksecret(char *t, uchar *f) void usage(void) { - fprint(2, "usage: %s [-adnsR] [-f dbgfile] [-m msize] [-r root] " + fprint(2, "usage: %s [-adnsR] [-m msize] [-r root] " "[-S srvfile] [-e 'crypt hash'] [-P exclusion-file] " "[-A announce-string] [-B address]\n", argv0); fatal("usage"); @@ -118,12 +118,11 @@ void main(int argc, char **argv) { char buf[ERRMAX], ebuf[ERRMAX], initial[4], *ini, *srvfdfile; - char *dbfile, *srv, *na, *nsfile, *keyspec; + char *srv, *na, *nsfile, *keyspec; int doauth, n, fd; AuthInfo *ai; Fsrpc *r; - dbfile = "/tmp/exportdb"; srv = nil; srvfd = -1; srvfdfile = nil; @@ -148,10 +147,6 @@ main(int argc, char **argv) ealgs = nil; break; - case 'f': - dbfile = EARGF(usage()); - break; - case 'k': keyspec = EARGF(usage()); break; @@ -254,18 +249,12 @@ main(int argc, char **argv) exclusions(); - if(dbg) { - n = create(dbfile, OWRITE|OTRUNC, 0666); - dup(n, DFD); - close(n); - } - if(srvfd >= 0 && srv != nil){ fprint(2, "%s: -S cannot be used with -r or -s\n", argv0); usage(); } - DEBUG(DFD, "%s: started\n", argv0); + DEBUG(2, "%s: started\n", argv0); rfork(RFNOTEG|RFREND); @@ -289,10 +278,10 @@ main(int argc, char **argv) if(chdir(srv) < 0) { ebuf[0] = '\0'; errstr(ebuf, sizeof ebuf); - DEBUG(DFD, "chdir(\"%s\"): %s\n", srv, ebuf); + DEBUG(2, "chdir(\"%s\"): %s\n", srv, ebuf); mounterror(ebuf); } - DEBUG(DFD, "invoked as server for %s", srv); + DEBUG(2, "invoked as server for %s", srv); strncpy(buf, srv, sizeof buf); } else { @@ -301,22 +290,22 @@ main(int argc, char **argv) if(n < 0) { errstr(buf, sizeof buf); fprint(0, "read(0): %s\n", buf); - DEBUG(DFD, "read(0): %s\n", buf); + DEBUG(2, "read(0): %s\n", buf); exits(buf); } buf[n] = 0; if(chdir(buf) < 0) { errstr(ebuf, sizeof ebuf); fprint(0, "chdir(%d:\"%s\"): %s\n", n, buf, ebuf); - DEBUG(DFD, "chdir(%d:\"%s\"): %s\n", n, buf, ebuf); + DEBUG(2, "chdir(%d:\"%s\"): %s\n", n, buf, ebuf); exits(ebuf); } } - DEBUG(DFD, "\niniting root\n"); + DEBUG(2, "\niniting root\n"); initroot(); - DEBUG(DFD, "%s: %s\n", argv0, buf); + DEBUG(2, "%s: %s\n", argv0, buf); if(srv == nil && srvfd == -1 && write(0, "OK", 2) != 2) fatal("open ack write"); @@ -436,7 +425,7 @@ main(int argc, char **argv) if(convM2S(r->buf, n, &r->work) != n) fatal("convM2S format error"); - DEBUG(DFD, "%F\n", &r->work); + DEBUG(2, "%F\n", &r->work); (fcalls[r->work.type])(r); } io(); |