M gnot/devduart.c => gnot/devduart.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "io.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M gnot/devincon.c => gnot/devincon.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "io.h"
M gnot/devport.c => gnot/devport.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M gnot/disk.c => gnot/disk.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
D gnot/errno.h => gnot/errno.h +0 -64
@@ 1,64 0,0 @@
-enum{
- Enoerror, /* no error */
- Enofd, /* no free file descriptors */
- Ebadfd, /* fd out of range or not open */
- Ebadusefd, /* inappropriate use of fd */
- Ebadarg, /* bad arg in system call */
- Enonexist, /* file does not exist */
- Efilename, /* file name syntax */
- Ebadchar, /* bad character in file name */
- Ebadsharp, /* unknown device in # filename */
- Ebadexec, /* a.out header invalid */
- Eioload, /* i/o error in demand load */
- Eperm, /* permission denied */
- Enotdir, /* not a directory */
- Enochild, /* no living children */
- Enoseg, /* no free segments */
- Ebadmount, /* inconsistent mount */
- Enomount, /* mount table full */
- Enomntdev, /* no free mount devices */
- Eshutdown, /* mounted device shut down */
- Einuse, /* device or object already in use */
- Eio, /* i/o error */
- Eisdir, /* file is a directory */
- Ebaddirread, /* directory read not quantized */
- Esegaddr, /* illegal segment addresses or size */
- Enoenv, /* no free environment resources */
- Eprocdied, /* process exited */
- Enocreate, /* mounted directory forbids creation */
- Enotunion, /* attempt to union with non-mounted directory */
- Emount, /* inconsistent mount */
- Enosrv, /* no free server slots */
- Enoqueue, /* no free stream queues */
- Ebadld, /* illegal line discipline */
- Enostream, /* no free stream heads */
- Etoobig, /* read or write too large */
- Etoosmall, /* read or write too small */
- Ehungup, /* write to hungup stream */
- Ebadnet, /* illegal network address */
- Enoifc, /* bad interface or no free interface slots */
- Enodev, /* no free devices */
- Ebadctl, /* bad process or stream control request */
- Enonote, /* note overflow */
- Eintr, /* interrupted */
- Edestbusy, /* datakit destination busy */
- Enetbusy, /* datakit controller busy */
- Edestotl, /* datakit destination out to lunch */
- Enetotl, /* datakit controller out to lunch */
- Erejected, /* datakit destination rejected call */
- Ebadblt, /* bad bitblt or bitmap request */
- Enobitmap, /* out of bitmap descriptors */
- Enobitstore, /* out of bitmap storage */
- Ebadbitmap, /* unallocated bitmap */
- Ebadfont, /* unallocated font */
- Eshortmsg, /* short message */
- Ebadmsg, /* format error or mismatch in message */
- Ebadcnt, /* read count greater than requested */
- Enofont, /* out of font descriptors */
- Enovmem, /* virtual memory allocation failed */
- Enoasync, /* out of async stream modules */
- Enopipe, /* out of pipes */
- Enofilsys, /* out of filsys resources */
- Eisstream, /* seek on a stream */
- Egreg, /* ken has implemented datakit */
-};
M gnot/fault68020.c => gnot/fault68020.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#define FORMAT(ur) ((((ur)->vo)>>12)&0xF)
#define OFFSET(ur) (((ur)->vo)&0xFFF)
M gnot/lock.c => gnot/lock.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#define PCOFF -1
M gnot/screen.c => gnot/screen.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "io.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#include <libg.h>
#include <gnot.h>
M gnot/trap.c => gnot/trap.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "ureg.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
void noted(Ureg*, ulong);
void rfnote(Ureg*);
M pc/devfloppy.c => pc/devfloppy.c +2 -2
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
/* Intel 82077A (8272A compatible) floppy controller */
@@ 770,7 770,7 @@ floppythrice(Drive *dp, int cmd, void *a, long off, long n)
for(tries = 0; ; tries++){
if(waserror()){
- if(strcmp(u->error, errstrtab[Eintr])==0 || tries > 3)
+ if(strcmp(u->error, Eintr)==0 || tries > 3)
nexterror();
} else {
rv = floppyxfer(dp, cmd, a, off, n);
M pc/devhard.c => pc/devhard.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
typedef struct Drive Drive;
typedef struct Ident Ident;
M pc/devlpt.c => pc/devlpt.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
/* Centronix parallel (printer) port */
M pc/devrtc.c => pc/devrtc.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
/*
M pc/devuart.c => pc/devuart.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M pc/trap.c => pc/trap.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "io.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
void noted(Ureg*, ulong);
M port/chan.c => port/chan.c +4 -4
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
struct{
Lock;
@@ 223,7 223,7 @@ unmount(Chan *mnt, Chan *mounted)
if(m == 0) {
wunlock(&pg->ns);
- errors("not mounted");
+ error(Eunmount);
}
if(mounted == 0) {
@@ 254,7 254,7 @@ unmount(Chan *mnt, Chan *mounted)
p = &f->next;
}
wunlock(&pg->ns);
- errors("not in union");
+ error(Eunion);
}
Chan*
@@ 600,7 600,7 @@ namec(char *name, int amode, int omode, ulong perm)
strcpy(createerr, u->error);
nc = walk(c, elem, 1);
if(nc == 0)
- errors(createerr);
+ error(createerr);
c = nc;
omode |= OTRUNC;
goto Open;
M port/dev.c => port/dev.c +2 -2
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#define DEVTAB
#include "devtab.h"
@@ 98,7 98,7 @@ devwalk(Chan *c, char *name, Dirtab *tab, int ntab, Devgen *gen)
for(i=0;; i++)
switch((*gen)(c, tab, ntab, i, &dir)){
case -1:
- strncpy(u->error, errstrtab[Enonexist], NAMELEN);
+ strncpy(u->error, Enonexist, NAMELEN);
return 0;
case 0:
continue;
M port/devXXX.c => port/devXXX.c +1 -1
@@ 7,7 7,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devarp.c => port/devarp.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
M port/devbit.c => port/devbit.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devboot.c => port/devboot.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
enum{
M port/devcons.c => port/devcons.c +2 -2
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
@@ 818,7 818,7 @@ conswrite(Chan *c, void *va, long n, ulong offset)
error(Ebadarg);
decrypt(evekey, a, n);
if(memcmp(u->p->pgrp->crypt->chal, a, 8) != 0)
- errors("authentication failure");
+ error(Eauth);
strncpy(u->p->user, a+8, NAMELEN);
u->p->user[NAMELEN-1] = '\0';
memmove(u->p->pgrp->crypt->key, a+NAMELEN+DESKEYLEN, DESKEYLEN);
M port/devdk.c => port/devdk.c +5 -9
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#define DPRINT if(0) print
@@ 241,14 241,10 @@ dkalloc(char *name, int ncsc, int lines)
if(dp->name[0] == 0 && dp->ref == 0)
freep = dp;
}
- if(freep == 0){
+ if(freep == 0 || lines == 0){
unlock(&dklock);
error(Enoifc);
}
- if(lines == 0){
- unlock(&dklock);
- errors("unknown dk interface");
- }
/*
* init the structures
@@ 267,7 263,7 @@ dkalloc(char *name, int ncsc, int lines)
bp = allocb(n);
if(bp->lim - bp->base < n){
unlock(&dklock);
- errors("too many lines");
+ error(Ebadarg);
}
memset(bp->base, 0, bp->lim-bp->base);
dp->linep = (Line **)bp->base;
@@ 1118,9 1114,9 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine)
DPRINT("got reply %d\n", lp->state);
if(lp->state != Lconnected) {
if(lp->err >= DKERRS)
- errors(dkerr[0]);
+ error(dkerr[0]);
else
- errors(dkerr[lp->err]);
+ error(dkerr[lp->err]);
}
/*
M port/devdup.c => port/devdup.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devenv.c => port/devenv.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devip.c => port/devip.c +4 -4
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
@@ 234,12 234,12 @@ ipwrite(Chan *c, char *a, long n, ulong offset)
m = getfields(buf, field, 5, ' ');
if(m < 1)
- errors("bad ip control");
+ error(Ebadarg);
if(strcmp(field[0], "connect") == 0) {
if((cp->stproto == &tcpinfo && cp->tcpctl.state != Closed) ||
(cp->stproto == &ilinfo && cp->ilctl.state != Ilclosed))
- error(Edevbusy);
+ error(Enetbusy);
if(m != 2)
error(Ebadarg);
@@ 281,7 281,7 @@ ipwrite(Chan *c, char *a, long n, ulong offset)
else if(strcmp(field[0], "announce") == 0) {
if((cp->stproto == &tcpinfo && cp->tcpctl.state != Closed) ||
(cp->stproto == &ilinfo && cp->ilctl.state != Ilclosed))
- error(Edevbusy);
+ error(Enetbusy);
if(m != 2)
error(Ebadarg);
M port/deviproute.c => port/deviproute.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
M port/devkprof.c => port/devkprof.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devlance.c => port/devlance.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
enum {
M port/devmnt.c => port/devmnt.c +3 -3
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "fcall.h"
@@ 482,7 482,7 @@ mountrpc(Mnt *m, Mntrpc *r)
if(r->reply.type == Rerror)
errors(r->reply.ename);
if(r->reply.type == Rflush)
- errors(errstrtab[Eintr]);
+ error(Eintr);
if(r->reply.type != r->request.type+1) {
print("devmnt: mismatched reply 0x%lux T%d R%d tags req %d fls %d rep %d\n",
@@ 670,7 670,7 @@ mntflush(Mnt *m, Mntrpc *r)
if(waserror()) {
if(!m->mux)
qunlock(&m->c->wrl);
- if(strcmp(u->error, errstrtab[Eintr]) == 0)
+ if(strcmp(u->error, Eintr) == 0)
return 1;
mntqrm(m, r);
return 0;
M port/devmux.c => port/devmux.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "fcall.h"
#include "devtab.h"
M port/devnonet.c => port/devnonet.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "../port/nonet.h"
#define DPRINT if(pnonet)print
M port/devpipe.c => port/devpipe.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "fcall.h"
M port/devproc.c => port/devproc.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "fcall.h"
#include "ureg.h"
M port/devroot.c => port/devroot.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
enum{
M port/devscc.c => port/devscc.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devscsi.c => port/devscsi.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "io.h"
M port/devsrv.c => port/devsrv.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
M port/devwren.c => port/devwren.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "io.h"
A port/error.h => port/error.h +73 -0
@@ 0,0 1,73 @@
+extern char Enoerror[]; /* no error */
+extern char Emount[]; /* inconsistent mount */
+extern char Eunmount[]; /* not mounted */
+extern char Eunion[]; /* not in union */
+extern char Enocreate[]; /* mounted directory forbids creation */
+extern char Enonexist[]; /* file does not exist */
+extern char Ebadsharp[]; /* unknown device in # filename */
+extern char Enotdir[]; /* not a directory */
+extern char Eisdir[]; /* file is a directory */
+extern char Ebadchar[]; /* bad character in file name */
+extern char Efilename[]; /* file name syntax */
+extern char Eperm[]; /* permission denied */
+extern char Ebadusefd[]; /* inappropriate use of fd */
+extern char Ebadarg[]; /* bad arg in system call */
+extern char Einuse[]; /* device or object already in use */
+extern char Eio[]; /* i/o error */
+extern char Etoobig[]; /* read or write too large */
+extern char Etoosmall[]; /* read or write too small */
+extern char Ebadblt[]; /* bad bitblt or bitmap request */
+extern char Ebadbitmap[]; /* unallocated bitmap */
+extern char Enobitmap[]; /* out of bitmap descriptors */
+extern char Enobitstore[]; /* out of bitmap storage */
+extern char Ebadfont[]; /* unallocated font */
+extern char Enofont[]; /* out of font descriptors */
+extern char Eauth[]; /* authentication failure */
+extern char Eaddrnotfound[]; /* network address not found */
+extern char Emsgsize[]; /* message is too big for protocol */
+extern char Enetbusy[]; /* network device is busy or allocated */
+extern char Enoifc[]; /* bad interface or no free interface slots */
+extern char Ehungup[]; /* write to hungup stream */
+extern char Enodev[]; /* no free devices */
+extern char Enoenv[]; /* no free environment resources */
+
+extern char Enofd[]; /* no free file descriptors */
+extern char Ebadfd[]; /* fd out of range or not open */
+extern char Ebadexec[]; /* a.out header invalid */
+extern char Eioload[]; /* i/o error in demand load */
+extern char Enochild[]; /* no living children */
+extern char Enoseg[]; /* no free segments */
+extern char Ebadmount[]; /* inconsistent mount */
+extern char Enomount[]; /* mount table full */
+extern char Enomntdev[]; /* no free mount devices */
+extern char Eshutdown[]; /* mounted device shut down */
+extern char Ebaddirread[]; /* directory read not quantized */
+extern char Esegaddr[]; /* illegal segment addresses or size */
+extern char Eprocdied[]; /* process exited */
+extern char Enosrv[]; /* no free server slots */
+extern char Enoqueue[]; /* no free stream queues */
+extern char Ebadld[]; /* illegal line discipline */
+extern char Enostream[]; /* no free stream heads */
+extern char Ebadnet[]; /* illegal network address */
+extern char Ebadctl[]; /* bad process or stream control request */
+extern char Enonote[]; /* note overflow */
+extern char Eintr[]; /* interrupted */
+extern char Edestbusy[]; /* datakit destination busy */
+extern char Edestotl[]; /* datakit destination out to lunch */
+extern char Enetotl[]; /* datakit controller out to lunch */
+extern char Erejected[]; /* datakit destination rejected call */
+extern char Eshortmsg[]; /* short message */
+extern char Ebadmsg[]; /* format error or mismatch in message */
+extern char Ebadcnt[]; /* read count greater than requested */
+extern char Enovmem[]; /* virtual memory allocation failed */
+extern char Enoasync[]; /* out of async stream modules */
+extern char Enopipe[]; /* out of pipes */
+extern char Enoport[]; /* network port not available */
+extern char Enetunreach[]; /* network unreachable */
+extern char Etimedout[]; /* connection timed out */
+extern char Econrefused[]; /* connection refused */
+extern char Enoproto[]; /* network protocol not supported */
+extern char Eprotonosup[]; /* operation not supported by network protocol */
+extern char Eisstream[]; /* seek on a stream */
+extern char Enofilsys[]; /* out of filsys resources */
+extern char Egreg[]; /* it's a thermal problem */
M port/fault.c => port/fault.c +2 -2
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#define DPRINT
@@ 185,7 185,7 @@ pio(Segment *s, ulong addr, ulong soff, Page **p)
c = s->image->c;
qlock(&c->rdl);
while(waserror()) {
- if(strcmp(u->error, errstrtab[Eintr]) == 0)
+ if(strcmp(u->error, Eintr) == 0)
continue;
qunlock(&c->rdl);
kunmap(k);
M port/ipdat.h => port/ipdat.h +2 -3
@@ 281,7 281,7 @@ struct Ipconv
QLock listenq; /* List of people waiting incoming cons */
Rendez listenr; /* Some where to sleep while waiting */
- char err; /* Async protocol error */
+ char *err; /* Async protocol error */
int backlog; /* Maximum number of waiting connections */
int curlog; /* Number of waiting connections */
int newcon; /* Flags that this is the start of a connection */
@@ 449,7 449,7 @@ int seq_within(int, int, int);
void update(Ipconv *, Tcp *);
int trim(Tcpctl *, Tcp *, Block **, ushort *);
void add_reseq(Tcpctl *, char, Tcp *, Block *, ushort);
-void close_self(Ipconv *, int);
+void close_self(Ipconv *, char []);
int seq_gt(int, int);
Ipconv *ip_conn(Ipconv *, Port, Port, Ipaddr dest, char proto);
void ipmkdir(Qinfo *, Dirtab *, Ipconv *);
@@ 460,7 460,6 @@ void start_timer(Timer *);
void stop_timer(Timer *);
int copyupb(Block **, uchar *, int);
void init_tcpctl(Ipconv *);
-void close_self(Ipconv *, int);
int iss(void);
int seq_within(int, int, int);
int seq_lt(int, int);
M port/net.c => port/net.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "fcall.h"
M port/netXXX.c => port/netXXX.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
static void nulloput(Queue*, Block*);
static void protooput(Queue*, Block*);
M port/page.c => port/page.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#define PGHFUN(x, y) (((ulong)x^(ulong)y)%PGHSIZE)
#define pghash(s) palloc.hash[PGHFUN(s->image, p->daddr)]
M port/pgrp.c => port/pgrp.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
struct
{
M port/portdat.h => port/portdat.h +0 -1
@@ 670,7 670,6 @@ extern ulong initcode[];
extern Dev devtab[];
extern char devchar[];
extern char *conffile;
-extern char *errstrtab[];
extern char *statename[];
extern Palloc palloc;
extern Image swapimage;
M port/portfns.h => port/portfns.h +1 -1
@@ 59,7 59,7 @@ void envpgclose(Env*);
void envpgcopy(Env*, Env*);
int eqchan(Chan*, Chan*, long);
int eqqid(Qid, Qid);
-void error(int);
+void error(char []);
void errors(char*);
long execregs(ulong, ulong, ulong);
void exit(void);
M port/proc.c => port/proc.c +3 -3
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
struct
{
@@ 764,9 764,9 @@ procctl(Proc *p)
#include "errstr.h"
void
-error(int code)
+error(char err[])
{
- strncpy(u->error, errstrtab[code], ERRLEN);
+ strncpy(u->error, err, ERRLEN);
nexterror();
}
M port/segment.c => port/segment.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
Page *lkpage(ulong addr);
Page *snewpage(ulong addr);
M port/stasync.c => port/stasync.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#define DPRINT if(asyncdebug)kprint
M port/stfcall.c => port/stfcall.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "fcall.h"
M port/stil.c => port/stil.c +1 -1
@@ 7,7 7,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
M port/stip.c => port/stip.c +1 -1
@@ 10,7 10,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
M port/stnoether.c => port/stnoether.c +1 -1
@@ 10,7 10,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "../port/nonet.h"
#define DPRINT if(pnonet)print
M port/stream.c => port/stream.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "fcall.h"
M port/sturp.c => port/sturp.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
enum {
MSrexmit= 1000,
M port/swap.c => port/swap.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
/* Predeclaration */
void pageout(Proc *p, Segment*);
M port/sysfile.c => port/sysfile.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "fcall.h"
/*
M port/sysproc.c => port/sysproc.c +2 -2
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#include <a.out.h>
@@ 454,7 454,7 @@ syserrstr(ulong *arg)
validaddr(arg[0], ERRLEN, 1);
memmove((char*)arg[0], u->error, ERRLEN);
- strncpy(u->error, errstrtab[0], ERRLEN);
+ strncpy(u->error, Enoerror, ERRLEN);
return 0;
}
M port/tcpif.c => port/tcpif.c +4 -4
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
@@ 16,7 16,7 @@ state_upcall(Ipconv *s, char oldstate, char newstate)
Block *bp;
int len;
- DPRINT("state_upcall: %s -> %s err %d\n",
+ DPRINT("state_upcall: %s -> %s err %s\n",
tcpstate[oldstate], tcpstate[newstate], s->err);
if(oldstate == newstate)
@@ 33,9 33,9 @@ state_upcall(Ipconv *s, char oldstate, char newstate)
break;
if(s->err) {
- len = strlen(errstrtab[s->err]);
+ len = strlen(s->err);
bp = allocb(len);
- strcpy((char *)bp->wptr, errstrtab[s->err]);
+ strcpy((char *)bp->wptr, s->err);
bp->wptr += len;
}
else
M port/tcpinput.c => port/tcpinput.c +3 -3
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
@@ 261,7 261,7 @@ process:
case Last_ack:
update(s, &seg);
if(tcb->sndcnt == 0) {
- close_self(s, 0);
+ close_self(s, Enoerror);
goto done;
}
case Time_wait:
@@ 849,7 849,7 @@ init_tcpctl(Ipconv *s)
}
void
-close_self(Ipconv *s, int reason)
+close_self(Ipconv *s, char reason[])
{
Reseq *rp,*rp1;
Tcpctl *tcb = &s->tcpctl;
M port/tcpoutput.c => port/tcpoutput.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
M port/tcptimer.c => port/tcptimer.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "arp.h"
#include "ipdat.h"
M power/boot.c => power/boot.c +3 -1
@@ 608,8 608,10 @@ passtokey(char *key, char *p, int n)
int c;
memset(t, ' ', sizeof t);
- if(n > 10 || n < 5)
+ if(n < 5)
return 0;
+ if(n > 10)
+ n = 10;
strncpy((char*)t, p, n);
if(n >= 9){
c = p[8] & 0xf;
M power/devbit3.c => power/devbit3.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "io.h"
M power/devduart.c => power/devduart.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
int duartacr;
int duartimr;
M power/devhotrod.c => power/devhotrod.c +1 -1
@@ 4,7 4,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "fcall.h"
M power/devhs.c => power/devhs.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "io.h"
M power/devrtc.c => power/devrtc.c +1 -1
@@ 3,7 3,7 @@
#include "mem.h"
#include "dat.h"
#include "fns.h"
-#include "errno.h"
+#include "../port/error.h"
#include "devtab.h"
#include "io.h"
D power/errno.h => power/errno.h +0 -67
@@ 1,67 0,0 @@
-enum{
- Enoerror, /* no error */
- Enofd, /* no free file descriptors */
- Ebadfd, /* fd out of range or not open */
- Ebadusefd, /* inappropriate use of fd */
- Ebadarg, /* bad arg in system call */
- Enonexist, /* file does not exist */
- Efilename, /* file name syntax */
- Ebadchar, /* bad character in file name */
- Ebadsharp, /* unknown device in # filename */
- Ebadexec, /* a.out header invalid */
- Eioload, /* i/o error in demand load */
- Eperm, /* permission denied */
- Enotdir, /* not a directory */
- Enochild, /* no living children */
- Enoseg, /* no free segments */
- Ebadmount, /* inconsistent mount */
- Enomount, /* mount table full */
- Enomntdev, /* no free mount devices */
- Eshutdown, /* mounted device shut down */
- Einuse, /* device or object already in use */
- Eio, /* i/o error */
- Eisdir, /* file is a directory */
- Ebaddirread, /* directory read not quantized */
- Esegaddr, /* illegal segment addresses or size */
- Enoenv, /* no free environment resources */
- Eprocdied, /* process exited */
- Enocreate, /* mounted directory forbids creation */
- Enotunion, /* attempt to union with non-mounted directory */
- Emount, /* inconsistent mount */
- Enosrv, /* no free server slots */
- Enoqueue, /* no free stream queues */
- Ebadld, /* illegal line discipline */
- Enostream, /* no free stream heads */
- Etoobig, /* read or write too large */
- Etoosmall, /* read or write too small */
- Ehungup, /* write to hungup stream */
- Ebadnet, /* illegal network address */
- Enoifc, /* bad interface or no free interface slots */
- Enodev, /* no free devices */
- Ebadctl, /* bad process or stream control request */
- Enonote, /* note overflow */
- Eintr, /* interrupted */
- Edestbusy, /* datakit destination busy */
- Enetbusy, /* datakit controller busy */
- Edestotl, /* datakit destination out to lunch */
- Enetotl, /* datakit controller out to lunch */
- Erejected, /* datakit destination rejected call */
- Eshortmsg, /* short message */
- Ebadmsg, /* format error or mismatch in message */
- Ebadcnt, /* read count greater than requested */
- Enoannounce, /* listening on an unannounced network connection */
- Enovmem, /* virtual memory allocation failed */
- Enoasync, /* out of async stream modules */
- Enopipe, /* out of pipes */
- Emsgsize, /* message is too big for protocol */
- Enoport, /* network port not available */
- Edevbusy, /* network device is busy or allocated */
- Eaddrnotfound, /* network address not found */
- Enetunreach, /* network unreachable */
- Etimedout, /* connection timed out */
- Econrefused, /* connection refused */
- Enoproto, /* network protocol not supported */
- Eprotonosup, /* operation not supported by network protocol */
- Eisstream, /* seek on a stream */
- Egreg, /* ken has implemented datakit */
-};
M power/faultmips.c => power/faultmips.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
/*
* find out fault address and type of access.
M power/lock.c => power/lock.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
/*
* The hardware semaphores are strange. 64 per page, replicated 16 times
M power/trap.c => power/trap.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "ureg.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
/*
* vme interrupt routines
M ss/faultsparc.c => ss/faultsparc.c +1 -1
@@ 4,7 4,7 @@
#include "dat.h"
#include "fns.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
void
faultsparc(Ureg *ur)
M ss/screen.c => ss/screen.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "io.h"
#include "ureg.h"
-#include "errno.h"
+#include "../port/error.h"
#include <libg.h>
#include <gnot.h>
M ss/trap.c => ss/trap.c +1 -1
@@ 5,7 5,7 @@
#include "fns.h"
#include "ureg.h"
#include "io.h"
-#include "errno.h"
+#include "../port/error.h"
void noted(Ureg**, ulong);
void rfnote(Ureg**);