libs, kernel and commands: re-enable -Werror

This commit is contained in:
Giacomo Tesio 2020-11-15 13:30:09 +01:00
parent 81679f2408
commit 922e993c41
41 changed files with 125 additions and 107 deletions

View File

@ -8,6 +8,7 @@
"-mcmodel=small", "-mcmodel=small",
"-O0", "-O0",
"-Wall", "-Wall",
"-Werror",
"-Wno-main", "-Wno-main",
"-Wno-missing-braces", "-Wno-missing-braces",
"-Wno-parentheses", "-Wno-parentheses",

View File

@ -17,6 +17,7 @@
#define nelem(x) (sizeof(x)/sizeof((x)[0])) #define nelem(x) (sizeof(x)/sizeof((x)[0]))
#define offsetof(s, m) (uintptr_t)(&(((s*)0)->m)) #define offsetof(s, m) (uintptr_t)(&(((s*)0)->m))
#define assert(x) if(x){}else jehanne__assert(#x) #define assert(x) if(x){}else jehanne__assert(#x)
#define jehanne_getcallerpc() ((uintptr_t)__builtin_return_address(0))
extern void (*_abort)(void); extern void (*_abort)(void);
#define abort() if(_abort){_abort();}else{while(*(int*)0);} #define abort() if(_abort){_abort();}else{while(*(int*)0);}
@ -324,7 +325,7 @@ extern int jehanne_enc16(char*, int, const uint8_t*, int);
extern int jehanne_encodefmt(Fmt*); extern int jehanne_encodefmt(Fmt*);
extern void jehanne_exits(const char*) __attribute__ ((noreturn)); extern void jehanne_exits(const char*) __attribute__ ((noreturn));
extern double jehanne_frexp(double, int*); extern double jehanne_frexp(double, int*);
extern uintptr_t jehanne_getcallerpc(void); //extern uintptr_t jehanne_getcallerpc(void);
extern int jehanne_getfields(char*, char**, int, int, const char*); extern int jehanne_getfields(char*, char**, int, int, const char*);
extern int jehanne_gettokens(char *, char **, int, const char *); extern int jehanne_gettokens(char *, char **, int, const char *);
extern char* jehanne_getuser(void); extern char* jehanne_getuser(void);

View File

@ -64,10 +64,10 @@ main(int argc, char **argv)
addns(getuser(), nsfile); addns(getuser(), nsfile);
else else
newns(getuser(), nsfile); newns(getuser(), nsfile);
sys_exec(argv[0], argv); sys_exec(argv[0], (const char **)argv);
if(!rooted(argv[0])){ if(!rooted(argv[0])){
rerrstr(err, sizeof err); rerrstr(err, sizeof err);
sys_exec(smprint("/cmd/%s", argv[0]), argv); sys_exec(smprint("/cmd/%s", argv[0]), (const char **)argv);
sys_errstr(err, sizeof err); sys_errstr(err, sizeof err);
} }
sysfatal("exec: %s: %r", argv[0]); sysfatal("exec: %s: %r", argv[0]);

View File

@ -55,12 +55,12 @@ main(int argc, char *argv[])
if (argc > 0) { if (argc > 0) {
strecpy(cmd, cmd+sizeof cmd, argv[0]); strecpy(cmd, cmd+sizeof cmd, argv[0]);
sys_exec(cmd, &argv[0]); sys_exec(cmd, (const char **)(&argv[0]));
if (strncmp(cmd, "/", 1) != 0 if (strncmp(cmd, "/", 1) != 0
&& strncmp(cmd, "./", 2) != 0 && strncmp(cmd, "./", 2) != 0
&& strncmp(cmd, "../", 3) != 0) { && strncmp(cmd, "../", 3) != 0) {
snprint(cmd, sizeof cmd, "/bin/%s", argv[0]); snprint(cmd, sizeof cmd, "/bin/%s", argv[0]);
sys_exec(cmd, &argv[0]); sys_exec(cmd, (const char **)(&argv[0]));
} }
} else { } else {
strcpy(cmd, "/bin/rc"); strcpy(cmd, "/bin/rc");

View File

@ -275,7 +275,7 @@ main(int argc, char **argv)
av[ac++] = patternfile; av[ac++] = patternfile;
} }
av[ac] = nil; av[ac] = nil;
sys_exec(exportfs, av); sys_exec(exportfs, (const char **)av);
fatal(1, "starting exportfs"); fatal(1, "starting exportfs");
} }

View File

@ -1043,7 +1043,7 @@ putline(void)
} }
void void
blkio(int b, uint8_t *buf, int32_t (*iofcn)(int, void *, int32_t)) blkio(int b, uint8_t *buf, long (*iofcn)(int, void *, int32_t))
{ {
sys_seek(tfile, b*BLKSIZE, 0); sys_seek(tfile, b*BLKSIZE, 0);
if((*iofcn)(tfile, buf, BLKSIZE) != BLKSIZE) { if((*iofcn)(tfile, buf, BLKSIZE) != BLKSIZE) {
@ -1051,7 +1051,7 @@ blkio(int b, uint8_t *buf, int32_t (*iofcn)(int, void *, int32_t))
} }
} }
static int32_t static long
writewrap(int a, void *b, int32_t c) writewrap(int a, void *b, int32_t c)
{ {
return jehanne_write(a, (const void *)b, c); return jehanne_write(a, (const void *)b, c);

View File

@ -947,7 +947,7 @@ filter(int fd, char *cmd)
fatal("filter: cannot dup to 0; %r\n"); fatal("filter: cannot dup to 0; %r\n");
sys_close(p[0]); sys_close(p[0]);
sys_close(p[1]); sys_close(p[1]);
sys_exec(file, argv); sys_exec(file, (const char **)argv);
fatal("exec record module"); fatal("exec record module");
default: default:
sys_close(fd); sys_close(fd);

View File

@ -464,6 +464,8 @@ slave(Fsrpc *f)
if(readonly){ if(readonly){
switch(f->work.type){ switch(f->work.type){
default:
break;
case Twrite: case Twrite:
reply(&f->work, &rhdr, Ereadonly); reply(&f->work, &rhdr, Ereadonly);
f->busy = 0; f->busy = 0;
@ -606,7 +608,7 @@ openmount(int sfd)
sys_close(1); sys_close(1);
dup(p[0], 0); dup(p[0], 0);
dup(p[0], 1); dup(p[0], 1);
sys_exec("/cmd/exportfs", arg); sys_exec("/cmd/exportfs", (const char**)arg);
sys__exits("whoops: exec failed"); sys__exits("whoops: exec failed");
return -1; return -1;
} }

View File

@ -60,11 +60,11 @@ main(int argc, char **argv)
nargv[i] = argv[i]; nargv[i] = argv[i];
} }
} }
sys_exec(*nargv, nargv); sys_exec(*nargv, (const char **)nargv);
if(**nargv != '/' && strncmp(*nargv, "./", 2) != 0 && if(**nargv != '/' && strncmp(*nargv, "./", 2) != 0 &&
strncmp(*nargv, "../", 3) != 0){ strncmp(*nargv, "../", 3) != 0){
*nargv = smprint("/cmd/%s", *nargv); *nargv = smprint("/cmd/%s", *nargv);
sys_exec(*nargv, nargv); sys_exec(*nargv, (const char **)nargv);
} }
sysfatal("exec: %r"); sysfatal("exec: %r");
} }

View File

@ -88,7 +88,7 @@ main(int argc, char *argv[])
fd = sys_open("/dev/cons", OWRITE); fd = sys_open("/dev/cons", OWRITE);
if(dup(fd, 2) != 2) if(dup(fd, 2) != 2)
sysfatal("bad FDs: %r"); sysfatal("bad FDs: %r");
sys_exec(argv[1], argv+1); sys_exec(argv[1], (const char**)(argv+1));
sysfatal("exec %s: %r", argv[1]); sysfatal("exec %s: %r", argv[1]);
} }
} }

View File

@ -249,7 +249,7 @@ main(int argc, char **argv)
sys_alarm(0); sys_alarm(0);
if(backwards && argc > 1){ if(backwards && argc > 1){
sys_exec(argv[1], &argv[1]); sys_exec(argv[1], (const char **)&argv[1]);
sysfatal("exec: %r"); sysfatal("exec: %r");
} }
exits(0); exits(0);
@ -429,7 +429,7 @@ filter(int fd, char *cmd, char *host)
dup(p[0], 0); dup(p[0], 0);
sys_close(p[0]); sys_close(p[0]);
sys_close(p[1]); sys_close(p[1]);
sys_exec(file, argv); sys_exec(file, (const char**)argv);
sysfatal("exec record module: %r"); sysfatal("exec record module: %r");
default: default:
sys_close(fd); sys_close(fd);

View File

@ -45,8 +45,8 @@ pppbinddev(void)
av[ac++] = conf.baud; av[ac++] = conf.baud;
} }
av[ac] = nil; av[ac] = nil;
sys_exec("/bin/ip/ppp", av); sys_exec("/bin/ip/ppp", (const char**)av);
sys_exec("/ppp", av); sys_exec("/ppp", (const char**)av);
sysfatal("execing /ppp: %r"); sysfatal("execing /ppp: %r");
} }

View File

@ -124,9 +124,9 @@ main(int argc, char **argv)
dup(fd, 1); dup(fd, 1);
dup(fd, 2); dup(fd, 2);
sys_close(fd); sys_close(fd);
sys_exec(argv[1], argv+1); sys_exec(argv[1], (const char **)(argv+1));
if(argv[1][0] != '/') if(argv[1][0] != '/')
sys_exec(smprint("/cmd/%s", argv[1]), argv+1); sys_exec(smprint("/cmd/%s", argv[1]), (const char**)(argv+1));
fprint(2, "%s: exec: %r\n", argv0); fprint(2, "%s: exec: %r\n", argv0);
exits(nil); exits(nil);
default: default:

View File

@ -134,10 +134,10 @@ main(int argc, char *argv[])
jehanne_fprint(fd, "%s%% ", lock); jehanne_fprint(fd, "%s%% ", lock);
sys_close(fd); sys_close(fd);
} }
sys_exec(cmd, args); sys_exec(cmd, (const char**)args);
if(cmd[0] != '/' && jehanne_strncmp(cmd, "./", 2) != 0 && if(cmd[0] != '/' && jehanne_strncmp(cmd, "./", 2) != 0 &&
jehanne_strncmp(cmd, "../", 3) != 0) jehanne_strncmp(cmd, "../", 3) != 0)
sys_exec(jehanne_smprint("/cmd/%s", cmd), args); sys_exec(jehanne_smprint("/cmd/%s", cmd), (const char**)args);
error(cmd); error(cmd);
} }

View File

@ -44,7 +44,7 @@ main(int argc, char *argv[])
args = &argv[2]; args = &argv[2];
if(cmd[0] == '/' if(cmd[0] == '/'
||(cmd[0] == '.' && (cmd[1] == '/' || (cmd[1] == '.' && cmd[2] == '/')))){ ||(cmd[0] == '.' && (cmd[1] == '/' || (cmd[1] == '.' && cmd[2] == '/')))){
sys_exec(cmd, args); sys_exec(cmd, (const char**)args);
sysfatal("exec %s failed: %r", cmd); sysfatal("exec %s failed: %r", cmd);
} }

View File

@ -331,7 +331,7 @@ Execute(word *args, word *path)
file[nc++] = '/'; file[nc++] = '/';
} }
memmove(file+nc, argv[1], mc); memmove(file+nc, argv[1], mc);
sys_exec(file, argv+1); sys_exec(file, (const char**)(argv+1));
} }
rerrstr(file, sizeof file); rerrstr(file, sizeof file);
setstatus(file); setstatus(file);

View File

@ -195,7 +195,7 @@ bootterm(char *machine, char **argv)
sys_close(remotefd0); sys_close(remotefd0);
sys_close(remotefd1); sys_close(remotefd1);
argv[0] = "samterm"; argv[0] = "samterm";
sys_exec(samterm, argv); sys_exec(samterm, (const char**)argv);
fprint(2, "can't exec: "); fprint(2, "can't exec: ");
perror(samterm); perror(samterm);
sys__exits("damn"); sys__exits("damn");
@ -211,7 +211,7 @@ bootterm(char *machine, char **argv)
sys_close(pt2h[0]); sys_close(pt2h[0]);
sys_close(pt2h[1]); sys_close(pt2h[1]);
argv[0] = "samterm"; argv[0] = "samterm";
sys_exec(samterm, argv); sys_exec(samterm, (const char**)argv);
fprint(2, "can't exec: "); fprint(2, "can't exec: ");
perror(samterm); perror(samterm);
sys__exits("damn"); sys__exits("damn");
@ -263,7 +263,7 @@ connectto(char *machine, char **argv)
sys_close(p1[1]); sys_close(p1[1]);
sys_close(p2[0]); sys_close(p2[0]);
sys_close(p2[1]); sys_close(p2[1]);
sys_exec(RXPATH, av); sys_exec(RXPATH, (const char**)av);
dprint("can't exec %s\n", RXPATH); dprint("can't exec %s\n", RXPATH);
exits("exec"); exits("exec");

View File

@ -66,7 +66,7 @@ main(int argc, char **argv)
dup(pipefd[0], 1); dup(pipefd[0], 1);
sys_close(pipefd[0]); sys_close(pipefd[0]);
sys_close(pipefd[1]); sys_close(pipefd[1]);
sys_exec(ename, arglist); sys_exec(ename, (const char**)arglist);
fprint(2, "can't exec exportfs: %r\n"); fprint(2, "can't exec exportfs: %r\n");
exits("exec"); exits("exec");
default: default:

View File

@ -236,9 +236,9 @@ ParseArguments:
sysfatal("fork failed: %r"); sysfatal("fork failed: %r");
if(pid == 0) { if(pid == 0) {
jehanne_write(sys_open(smprint("/proc/%d/ctl", getpid()), OWRITE|OCEXEC), "hang", 4); jehanne_write(sys_open(smprint("/proc/%d/ctl", getpid()), OWRITE|OCEXEC), "hang", 4);
sys_exec(cmd, args); sys_exec(cmd, (const char**)args);
if(cmd[0] != '/') if(cmd[0] != '/')
sys_exec(smprint("/cmd/%s", cmd), args); sys_exec(smprint("/cmd/%s", cmd), (const char**)args);
sysfatal("exec %s failed: %r", cmd); sysfatal("exec %s failed: %r", cmd);
} }
} else { } else {

View File

@ -33,11 +33,11 @@ main(int argc, char *argv[])
case -1: case -1:
error("fork"); error("fork");
case 0: case 0:
sys_exec(argv[1], &argv[1]); sys_exec(argv[1], (const char**)&argv[1]);
if(argv[1][0] != '/' && jehanne_strncmp(argv[1], "./", 2) && if(argv[1][0] != '/' && jehanne_strncmp(argv[1], "./", 2) &&
jehanne_strncmp(argv[1], "../", 3)){ jehanne_strncmp(argv[1], "../", 3)){
jehanne_sprint(output, "/cmd/%s", argv[1]); jehanne_sprint(output, "/cmd/%s", argv[1]);
sys_exec(output, &argv[1]); sys_exec(output, (const char**)&argv[1]);
} }
error(argv[1]); error(argv[1]);
} }

View File

@ -71,11 +71,11 @@ main(int argc, char **argv)
case -1: case -1:
sysfatal("fork: %r"); sysfatal("fork: %r");
case 0: case 0:
sys_exec(*nargv, nargv); sys_exec(*nargv, (const char**)nargv);
if(**nargv != '/' && strncmp(*nargv, "./", 2) != 0 && if(**nargv != '/' && strncmp(*nargv, "./", 2) != 0 &&
strncmp(*nargv, "../", 3) != 0){ strncmp(*nargv, "../", 3) != 0){
*nargv = smprint("/cmd/%s", *nargv); *nargv = smprint("/cmd/%s", *nargv);
sys_exec(*nargv, nargv); sys_exec(*nargv, (const char**)nargv);
} }
sysfatal("exec: %r"); sysfatal("exec: %r");
} }

View File

@ -387,7 +387,7 @@ vgactl(Cmdbuf *cb)
deletescreenimage(); deletescreenimage();
if(screensize(x, y, z, chan)) if(screensize(x, y, z, chan))
error(Egreg); error(Egreg);
/* no break */ /* fall through */
case CMdrawinit: case CMdrawinit:
if(scr->gscreen == nil) if(scr->gscreen == nil)
error("drawinit: no gscreen"); error("drawinit: no gscreen");

View File

@ -2068,7 +2068,7 @@ epopen(Ep *ep)
break; break;
case Tbulk: case Tbulk:
ep->pollival = 1; /* assume this; doesn't really matter */ ep->pollival = 1; /* assume this; doesn't really matter */
/* and fall... */ /* fall through */
case Tintr: case Tintr:
io = ep->aux = smalloc(sizeof(Qio)*3); io = ep->aux = smalloc(sizeof(Qio)*3);
io[OREAD].debug = io[OWRITE].debug = ep->debug; io[OREAD].debug = io[OWRITE].debug = ep->debug;

View File

@ -2255,6 +2255,7 @@ reset:
} }
update(s, &seg); update(s, &seg);
tcpsetstate(s, Established); tcpsetstate(s, Established);
/* fall through */
case Established: case Established:
case Close_wait: case Close_wait:
update(s, &seg); update(s, &seg);
@ -2291,6 +2292,7 @@ reset:
localclose(s, nil); localclose(s, nil);
goto raise; goto raise;
} }
/* fall through */
case Time_wait: case Time_wait:
tcb->flags |= FORCE; tcb->flags |= FORCE;
if(tcb->timer.state != TcptimerON) if(tcb->timer.state != TcptimerON)

View File

@ -824,6 +824,8 @@ mountio(Mnt *mnt, Mntrpc *r)
if(strcmp(up->errstr, Eintr) != 0 || waserror()){ if(strcmp(up->errstr, Eintr) != 0 || waserror()){
r = mntflushfree(mnt, r); r = mntflushfree(mnt, r);
switch(r->request.type){ switch(r->request.type){
default:
break;
case Tremove: case Tremove:
case Tclunk: case Tclunk:
/* botch, abandon fid */ /* botch, abandon fid */

View File

@ -202,7 +202,7 @@ addkbdq(Queue *q, int i)
kbdq = qopen(4*1024, 0, 0, 0); kbdq = qopen(4*1024, 0, 0, 0);
if(kbdq == nil) if(kbdq == nil)
panic("no kbdq"); panic("no kbdq");
/* fall */ /* fall through */
default: default:
kickkbdq(); kickkbdq();
} }
@ -870,6 +870,7 @@ consread(Chan *c, void *buf, long n, int64_t off)
case '\n': case '\n':
case 0x04: /* ^D */ case 0x04: /* ^D */
send = 1; send = 1;
/* fall through */
default: default:
if(ch != 0x04) if(ch != 0x04)
kbd.line[kbd.x++] = ch; kbd.line[kbd.x++] = ch;

View File

@ -1355,7 +1355,7 @@ drawwrite(Chan *c, void *a, long n, int64_t _)
uint8_t* uint8_t*
drawcoord(uint8_t *p, uint8_t *maxp, int oldx, int *newx) drawcoord(uint8_t *p, uint8_t *maxp, int oldx, int *newx)
{ {
int b, x; uint32_t b, x;
if(p >= maxp) if(p >= maxp)
error(Eshortdraw); error(Eshortdraw);
@ -1367,13 +1367,13 @@ drawcoord(uint8_t *p, uint8_t *maxp, int oldx, int *newx)
x |= *p++ << 7; x |= *p++ << 7;
x |= *p++ << 15; x |= *p++ << 15;
if(x & (1<<22)) if(x & (1<<22))
x |= ~0<<23; x |= ~0U<<23;
}else{ }else{
if(b & 0x40) if(b & 0x40)
x |= ~0<<7; x |= ~0U<<7;
x += oldx; x += oldx;
} }
*newx = x; *newx = (int)x;
return p; return p;
} }

View File

@ -213,7 +213,7 @@ mouseopen(Chan *c, unsigned long omode)
mouse.lastcounter = mouse.counter; mouse.lastcounter = mouse.counter;
mouse.resize = 0; mouse.resize = 0;
mousetime = seconds(); mousetime = seconds();
/* wet floor */ /* fall through */
case Qcursor: case Qcursor:
incref(&mouse); incref(&mouse);
} }
@ -237,7 +237,7 @@ mouseclose(Chan *c)
case Qmouse: case Qmouse:
mouse.open = 0; mouse.open = 0;
mouseblankscreen(0); mouseblankscreen(0);
/* wet floor */ /* fall through */
case Qcursor: case Qcursor:
if(decref(&mouse) != 0) if(decref(&mouse) != 0)
return; return;
@ -427,7 +427,7 @@ mousewrite(Chan *c, void *va, long n, int64_t _)
case CMblanktime: case CMblanktime:
blanktime = strtoul(cb->f[1], 0, 0); blanktime = strtoul(cb->f[1], 0, 0);
/* wet floor */ /* fall through */
case CMtwitch: case CMtwitch:
mousetime = seconds(); mousetime = seconds();
mouseblankscreen(0); mouseblankscreen(0);

View File

@ -1079,7 +1079,7 @@ usbread(Chan *c, void *a, long n, int64_t offset)
n = nr; n = nr;
break; break;
} }
/* else fall */ /* else fall through */
default: default:
ddeprint("\nusbread q %#x fid %d cnt %ld off %lld\n",q,c->fid,n,offset); ddeprint("\nusbread q %#x fid %d cnt %ld off %lld\n",q,c->fid,n,offset);
n = ep->hp->epread(ep, a, n); n = ep->hp->epread(ep, a, n);
@ -1445,7 +1445,7 @@ usbwrite(Chan *c, void *a, long n, int64_t off)
n = nr; n = nr;
break; break;
} }
/* else fall */ /* else fall through */
default: default:
ddeprint("\nusbwrite q %#x fid %d cnt %ld off %lld\n",q, c->fid, n, off); ddeprint("\nusbwrite q %#x fid %d cnt %ld off %lld\n",q, c->fid, n, off);
ep->hp->epwrite(ep, a, n); ep->hp->epwrite(ep, a, n);

View File

@ -14,6 +14,7 @@
#define nelem(x) (sizeof(x)/sizeof((x)[0])) #define nelem(x) (sizeof(x)/sizeof((x)[0]))
#define offsetof(s, m) (uintptr_t)(&(((s*)0)->m)) #define offsetof(s, m) (uintptr_t)(&(((s*)0)->m))
#define assert(x) if(x){}else jehanne__assert(#x) #define assert(x) if(x){}else jehanne__assert(#x)
#define getcallerpc() ((uintptr_t)__builtin_return_address(0))
extern void jehanne__assert(const char*) __attribute__ ((noreturn)); extern void jehanne__assert(const char*) __attribute__ ((noreturn));
/* /*
@ -179,7 +180,7 @@ extern int jehanne_dec16(uint8_t*, int, char*, int);
extern int jehanne_enc16(char*, int, uint8_t*, int); extern int jehanne_enc16(char*, int, uint8_t*, int);
extern int jehanne_encodefmt(Fmt*); extern int jehanne_encodefmt(Fmt*);
extern int jehanne_dec64(uint8_t*, int, char*, int); extern int jehanne_dec64(uint8_t*, int, char*, int);
#define getcallerpc() ((uintptr_t)__builtin_return_address(0)) //#define getcallerpc() ((uintptr_t)__builtin_return_address(0))
extern int jehanne_getfields(char*, char**, int, int, char*); extern int jehanne_getfields(char*, char**, int, int, char*);
extern int jehanne_gettokens(char *, char **, int, char *); extern int jehanne_gettokens(char *, char **, int, char *);
extern void jehanne_qsort(void*, long, long, int (*)(void*, void*)); extern void jehanne_qsort(void*, long, long, int (*)(void*, void*));

View File

@ -1486,7 +1486,7 @@ procctl(Proc *p)
case Proc_traceme: case Proc_traceme:
if(p->nnote == 0) if(p->nnote == 0)
return; return;
/* No break */ /* fall through */
case Proc_stopme: case Proc_stopme:
p->procctl = 0; p->procctl = 0;

View File

@ -444,7 +444,7 @@ segment_release(ProcSegment** s)
if(segment->image > 1 if(segment->image > 1
||(up->parentpid == 1 && up->text[0] != '*')) ||(up->parentpid == 1 && up->text[0] != '*'))
image_release(segment->image/NLOAD); image_release(segment->image/NLOAD);
/* wet floor */ /* fall through */
case SgBSS: case SgBSS:
case SgShared: case SgShared:
case SgStack: case SgStack:

View File

@ -2929,7 +2929,7 @@ epopen(Ep *ep)
break; break;
case Tbulk: case Tbulk:
ep->pollival = 1; /* assume this; doesn't really matter */ ep->pollival = 1; /* assume this; doesn't really matter */
/* and fall... */ /* fall through */
case Tintr: case Tintr:
io = ep->aux = smalloc(sizeof(Qio)*3); io = ep->aux = smalloc(sizeof(Qio)*3);
io[OREAD].debug = io[OWRITE].debug = ep->debug; io[OREAD].debug = io[OWRITE].debug = ep->debug;

View File

@ -12,8 +12,8 @@ increqref(void *v)
r = v; r = v;
if(r){ if(r){
if(chatty9p > 1) if(chatty9p > 1)
fprint(2, "increfreq %p %ld\n", r, r->ref.ref); fprint(2, "increfreq %p %ld\n", r, r->ref.ref);
incref(&r->ref); incref(&r->ref);
} }
} }
@ -59,8 +59,8 @@ allocreq(Reqpool *pool, uint32_t tag)
Req* Req*
lookupreq(Reqpool *pool, uint32_t tag) lookupreq(Reqpool *pool, uint32_t tag)
{ {
if(chatty9p > 1) if(chatty9p > 1)
fprint(2, "lookupreq %lud\n", tag); fprint(2, "lookupreq %lud\n", tag);
return lookupkey(pool->map, tag); return lookupkey(pool->map, tag);
} }
@ -87,14 +87,12 @@ if(chatty9p > 1)
for(i=0; i<r->nflush; i++) for(i=0; i<r->nflush; i++)
respond(r->flush[i], nil); respond(r->flush[i], nil);
free(r->flush); free(r->flush);
switch(r->ifcall.type){ if(r->ifcall.type == Tstat){
case Tstat:
free(r->ofcall.stat); free(r->ofcall.stat);
free(r->d.name); free(r->d.name);
free(r->d.uid); free(r->d.uid);
free(r->d.gid); free(r->d.gid);
free(r->d.muid); free(r->d.muid);
break;
} }
if(r->pool->destroy) if(r->pool->destroy)
r->pool->destroy(r); r->pool->destroy(r);
@ -107,7 +105,7 @@ if(chatty9p > 1)
Req* Req*
removereq(Reqpool *pool, uint32_t tag) removereq(Reqpool *pool, uint32_t tag)
{ {
if(chatty9p > 1) if(chatty9p > 1)
fprint(2, "removereq %lud\n", tag); fprint(2, "removereq %lud\n", tag);
return deletekey(pool->map, tag); return deletekey(pool->map, tag);
} }

View File

@ -101,8 +101,8 @@ getreq(Srv *s)
r->type = 0; r->type = 0;
r->srv = s; r->srv = s;
r->pool = nil; r->pool = nil;
if(chatty9p) if(chatty9p)
fprint(2, "<-%d- %F: dup tag\n", s->infd, &f); fprint(2, "<-%d- %F: dup tag\n", s->infd, &f);
return r; return r;
} }
@ -113,11 +113,11 @@ if(chatty9p)
memset(&r->ofcall, 0, sizeof r->ofcall); memset(&r->ofcall, 0, sizeof r->ofcall);
r->type = r->ifcall.type; r->type = r->ifcall.type;
if(chatty9p) if(chatty9p)
if(r->error) if(r->error)
fprint(2, "<-%d- %F: %s\n", s->infd, &r->ifcall, r->error); fprint(2, "<-%d- %F: %s\n", s->infd, &r->ifcall, r->error);
else else
fprint(2, "<-%d- %F\n", s->infd, &r->ifcall); fprint(2, "<-%d- %F\n", s->infd, &r->ifcall);
return r; return r;
} }
@ -879,18 +879,45 @@ respond(Req *r, char *error)
if(rflush(r, error)<0) if(rflush(r, error)<0)
return; return;
break; break;
case Tversion: rversion(r, error); break; case Tversion:
case Tauth: rauth(r, error); break; rversion(r, error);
case Tattach: rattach(r, error); break; break;
case Twalk: rwalk(r, error); break; case Tauth:
case Topen: ropen(r, error); break; rauth(r, error);
case Tcreate: rcreate(r, error); break; break;
case Tread: rread(r, error); break; case Tattach:
case Twrite: rwrite(r, error); break; rattach(r, error);
case Tclunk: rclunk(r, error); break; break;
case Tremove: rremove(r, error, errbuf); break; case Twalk:
case Tstat: rstat(r, error); break; rwalk(r, error);
case Twstat: rwstat(r, error); break; break;
case Topen:
ropen(r, error);
break;
case Tcreate:
rcreate(r, error);
break;
case Tread:
rread(r, error);
break;
case Twrite:
rwrite(r, error);
break;
case Tclunk:
rclunk(r, error);
break;
case Tremove:
rremove(r, error, errbuf);
break;
case Tstat:
rstat(r, error);
break;
case Twstat:
rwstat(r, error);
break;
default:
/* nothing to do */
break;
} }
r->ofcall.tag = r->ifcall.tag; r->ofcall.tag = r->ifcall.tag;
@ -898,8 +925,8 @@ respond(Req *r, char *error)
if(r->error) if(r->error)
setfcallerror(&r->ofcall, r->error); setfcallerror(&r->ofcall, r->error);
if(chatty9p) if(chatty9p)
fprint(2, "-%d-> %F\n", srv->outfd, &r->ofcall); fprint(2, "-%d-> %F\n", srv->outfd, &r->ofcall);
qlock(&srv->wlock); qlock(&srv->wlock);
n = convS2M(&r->ofcall, srv->wbuf, srv->msize); n = convS2M(&r->ofcall, srv->wbuf, srv->msize);

View File

@ -21,10 +21,11 @@ auth_getkey(char *params)
werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params); werrstr("auth_getkey: no /factotum or /boot/factotum: didn't get key %s", params);
return -1; return -1;
} }
if(0) if(d->type != '/'){ if(0)
werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params); if(d->type != '/'){
return -1; werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
} return -1;
}
switch(pid = fork()){ switch(pid = fork()){
case -1: case -1:
werrstr("can't fork for %s: %r", name); werrstr("can't fork for %s: %r", name);

View File

@ -147,7 +147,6 @@
"port/fmod.c", "port/fmod.c",
"port/frand.c", "port/frand.c",
"port/frexp.c", "port/frexp.c",
"port/getcallerpc.c",
"port/getfields.c", "port/getfields.c",
"port/getuser.c", "port/getuser.c",
"port/hangup.c", "port/hangup.c",

View File

@ -64,7 +64,6 @@
"port/fmod.c", "port/fmod.c",
"port/frand.c", "port/frand.c",
"port/frexp.c", "port/frexp.c",
"port/getcallerpc.c",
"port/getfields.c", "port/getfields.c",
"port/hypot.c", "port/hypot.c",
"port/lnrand.c", "port/lnrand.c",

View File

@ -1,17 +0,0 @@
/*
* This file is part of the UCB release of Plan 9. It is subject to the license
* terms in the LICENSE file found in the top-level directory of this
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
* part of the UCB release of Plan 9, including this file, may be copied,
* modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/
#include <u.h>
#include <libc.h>
uintptr_t
jehanne_getcallerpc(void)
{
return (uintptr_t)__builtin_return_address(2);
}

View File

@ -13,6 +13,8 @@
#include <memdraw.h> #include <memdraw.h>
#include <memlayer.h> #include <memlayer.h>
#define DBG if(drawdebug)
struct Draw struct Draw
{ {
Point deltas; Point deltas;
@ -66,14 +68,13 @@ memdraw(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Poi
Rectangle srcr, tr, mr; Rectangle srcr, tr, mr;
Memlayer *dl, *sl; Memlayer *dl, *sl;
if(drawdebug) DBG iprint("memdraw %p %R %p %P %p %P\n", dst, r, src, p0, mask, p1);
iprint("memdraw %p %R %p %P %p %P\n", dst, r, src, p0, mask, p1);
if(mask == nil) if(mask == nil)
mask = memopaque; mask = memopaque;
if(mask->layer){ if(mask->layer){
if(drawdebug) iprint("mask->layer != nil\n"); DBG iprint("mask->layer != nil\n");
return; /* too hard, at least for now */ return; /* too hard, at least for now */
} }
@ -84,7 +85,7 @@ if(drawdebug) iprint("mask->layer != nil\n");
} }
if(drawclip(dst, &r, src, &p0, mask, &p1, &srcr, &mr) == 0){ if(drawclip(dst, &r, src, &p0, mask, &p1, &srcr, &mr) == 0){
if(drawdebug) iprint("drawclip dstcr %R srccr %R maskcr %R\n", dst->clipr, src->clipr, mask->clipr); DBG iprint("drawclip dstcr %R srccr %R maskcr %R\n", dst->clipr, src->clipr, mask->clipr);
return; return;
} }

View File

@ -79,7 +79,7 @@ efork(Execargs *e)
_threaddebug(DBGEXEC, "_schedexec %s", e->prog); _threaddebug(DBGEXEC, "_schedexec %s", e->prog);
sys_close(e->fd[0]); sys_close(e->fd[0]);
sys_exec(e->prog, e->args); sys_exec(e->prog, (const char **)e->args);
_threaddebug(DBGEXEC, "_schedexec failed: %r"); _threaddebug(DBGEXEC, "_schedexec failed: %r");
jehanne_rerrstr(buf, sizeof buf); jehanne_rerrstr(buf, sizeof buf);
if(buf[0]=='\0') if(buf[0]=='\0')