summaryrefslogtreecommitdiff
path: root/sys/src/cmd/exportfs/exportfs.c
diff options
context:
space:
mode:
authoramavect <amavect@gmail.com>2021-08-18 17:51:40 +0000
committeramavect <amavect@gmail.com>2021-08-18 17:51:40 +0000
commit0f58e47551345d7c48c9404bc4188f7fc195e51a (patch)
tree3c6487a3aaf48d05382687a500589967fa5bd94b /sys/src/cmd/exportfs/exportfs.c
parent8c228a123fa0c6062570964011854302bbf57242 (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/exportfs.c')
-rw-r--r--sys/src/cmd/exportfs/exportfs.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/sys/src/cmd/exportfs/exportfs.c b/sys/src/cmd/exportfs/exportfs.c
index b17cec499..86680e1f6 100644
--- a/sys/src/cmd/exportfs/exportfs.c
+++ b/sys/src/cmd/exportfs/exportfs.c
@@ -10,18 +10,16 @@ int readonly;
void
usage(void)
{
- fprint(2, "usage: %s [-dsR] [-f dbgfile] [-m msize] [-r root] "
- "[-S srvfile] [-P exclusion-file]\n", argv0);
+ fprint(2, "usage: %s [-dsR] [-m msize] [-r root] "
+ "[-P patternfile] [-S srvfile]\n", argv0);
fatal("usage");
}
void
main(int argc, char **argv)
{
- char *dbfile, *srv, *srvfdfile;
- int n;
+ char *srv, *srvfdfile;
- dbfile = "/tmp/exportdb";
srv = nil;
srvfd = -1;
srvfdfile = nil;
@@ -31,10 +29,6 @@ main(int argc, char **argv)
dbg++;
break;
- case 'f':
- dbfile = EARGF(usage());
- break;
-
case 'm':
messagesize = strtoul(EARGF(usage()), nil, 0);
break;
@@ -82,13 +76,7 @@ main(int argc, char **argv)
exclusions();
- if(dbg) {
- n = create(dbfile, OWRITE|OTRUNC, 0666);
- dup(n, DFD);
- close(n);
- }
-
- DEBUG(DFD, "exportfs: started\n");
+ DEBUG(2, "exportfs: started\n");
rfork(RFNOTEG|RFREND);
@@ -106,13 +94,13 @@ main(int argc, char **argv)
char ebuf[ERRMAX];
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);
}
- DEBUG(DFD, "\niniting root\n");
+ DEBUG(2, "\niniting root\n");
initroot();
io();
}