ref: 89a36a09f2bbc83e2b0e9feb870c85d3fc75e485
parent: bae8b3192d1a8c55ffecfa4c17fd326c9ceed299
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Wed Sep 7 00:27:00 EDT 2011
cwfs: fix race between cmd_exec("users") and serve processes, cleanup portfns.h
--- a/sys/src/cmd/cwfs/con.c
+++ b/sys/src/cmd/cwfs/con.c
@@ -6,7 +6,6 @@
static int whoflag;
static void consserve1(void *);
-static void installcmds(void);
void
consserve(void)
@@ -14,12 +13,7 @@
int i;
strncpy(cons.chan->whochan, "console", sizeof(cons.chan->whochan));
- installcmds();
con_session();
- cmd_exec("cfs");
- cmd_exec("users");
- cmd_exec("version");
-
for(i = 0; command[i].arg0; i++)
if(strcmp("cwcmd", command[i].arg0) == 0){
cmd_exec("cwcmd touchsb");
@@ -750,7 +744,7 @@
chatty = atoi(argv[1]);
}
-static void
+void
installcmds(void)
{
cmd_install("allow", "-- disable permission checking", cmd_allow);
--- a/sys/src/cmd/cwfs/main.c
+++ b/sys/src/cmd/cwfs/main.c
@@ -373,6 +373,11 @@
sysinit();
srvinit();
+ installcmds();
+ cmd_exec("cfs");
+ cmd_exec("users");
+ cmd_exec("version");
+
/*
* post filedescriptors to /srv
*/
--- a/sys/src/cmd/cwfs/portfns.h
+++ b/sys/src/cmd/cwfs/portfns.h
@@ -9,7 +9,6 @@
void cdiag(char*, int);
int cnumb(void);
Device* config(void);
-int rawchar(int);
Off bufalloc(Device*, int, long, int);
void buffree(Device*, Off, int, Truncstate *);
int byuid(void*, void*);
@@ -30,9 +29,7 @@
int cksum0(int, int);
void cyclstart(void);
void dotrace(int);
-int conschar(void);
-void consinit(void (*)(char*, int));
-void consstart(int);
+void installcmds(void);
void consserve(void);
int conslock(void);
int con_attach(int, char*, char*);
@@ -92,7 +89,6 @@
void fworminit(Device*);
int fwormread(Device*, Off, void*);
int fwormwrite(Device*, Off, void*);
-char* getauthlist(void);
Iobuf* getbuf(Device*, Off, int);
char* getwrd(char*, char*);
int getc(void);