ref: c928f5c09c91766150fdaeb1a9e0b99b6a8d9439
parent: 04e6c5fd2e8f43f21f0ce6f9903a755b54deea34
author: cinap_lenrek <[email protected]>
date: Sun Jan 15 17:13:40 EST 2017
remove old unused cruft
--- a/kern/chan.c
+++ b/kern/chan.c
@@ -247,7 +247,6 @@
c->dri = 0;
c->aux = 0;
c->mchan = 0;
- c->mcp = 0;
c->mux = 0;
memset(&c->mqid, 0, sizeof(c->mqid));
c->name = 0;
--- a/kern/dat.h
+++ b/kern/dat.h
@@ -2,9 +2,7 @@
#define BLOCKALIGN 8
-typedef struct Alarms Alarms;
typedef struct Block Block;
-typedef struct CSN CSN;
typedef struct Chan Chan;
typedef struct Cmdbuf Cmdbuf;
typedef struct Cmdtab Cmdtab;
@@ -12,46 +10,26 @@
typedef struct Conf Conf;
typedef struct Dev Dev;
typedef struct Dirtab Dirtab;
-typedef struct Edfinterface Edfinterface;
typedef struct Egrp Egrp;
typedef struct Evalue Evalue;
typedef struct Fgrp Fgrp;
-typedef struct FPsave FPsave;
typedef struct DevConf DevConf;
typedef struct Label Label;
-typedef struct List List;
typedef struct Log Log;
typedef struct Logflag Logflag;
-typedef struct Mntcache Mntcache;
typedef struct Mount Mount;
typedef struct Mntrpc Mntrpc;
typedef struct Mntwalk Mntwalk;
typedef struct Mnt Mnt;
typedef struct Mhead Mhead;
-typedef struct Note Note;
-typedef struct Page Page;
-typedef struct Palloc Palloc;
-typedef struct Perf Perf;
typedef struct Pgrps Pgrps;
-typedef struct PhysUart PhysUart;
typedef struct Pgrp Pgrp;
-typedef struct Physseg Physseg;
typedef struct Proc Proc;
-typedef struct Pte Pte;
-typedef struct Pthash Pthash;
typedef struct Queue Queue;
typedef struct Ref Ref;
typedef struct Rendez Rendez;
typedef struct Rgrp Rgrp;
typedef struct RWlock RWlock;
-typedef struct Schedq Schedq;
-typedef struct Segment Segment;
-typedef struct Session Session;
-typedef struct Task Task;
-typedef struct Talarm Talarm;
-typedef struct Timer Timer;
-typedef struct Uart Uart;
-typedef struct Ureg Ureg;
typedef struct Waitq Waitq;
typedef struct Walkqid Walkqid;
typedef int Devgen(Chan*, char*, Dirtab*, int, int, Dir*);
@@ -187,7 +165,6 @@
int uri; /* union read index */
int dri; /* devdirread index */
ulong mountid;
- Mntcache *mcp; /* Mount cache pointer */
Mnt *mux; /* Mnt for clients using me for messages */
void* aux;
Qid pgrpid; /* for #p/notepg */
@@ -194,7 +171,6 @@
ulong mid; /* for ns in devproc */
Chan* mchan; /* channel to mounted server */
Qid mqid; /* qid of root of mount point */
- Session*session;
Cname *name;
};
@@ -303,12 +279,6 @@
NDebug, /* print debug message */
};
-struct Note
-{
- char msg[ERRMAX];
- int flag; /* whether system posted it */
-};
-
enum
{
RENDLOG = 5,
@@ -316,8 +286,6 @@
MNTLOG = 5,
MNTHASH = 1<<MNTLOG, /* Hash to walk mount table */
NFD = 100, /* per process file descriptors */
- PGHLOG = 9,
- PGHSIZE = 1<<PGHLOG, /* Page hash for image lookup */
};
#define REND(p,s) ((p)->rendhash[(s)&((1<<RENDLOG)-1)])
#define MOUNTH(p,qid) ((p)->mnthash[(qid).path&((1<<MNTLOG)-1)])
@@ -435,26 +403,16 @@
READSTR = 1000, /* temporary buffer size for device reads */
};
-extern char* conffile;
extern int cpuserver;
extern Dev* devtab[];
extern char *eve;
extern char hostdomain[];
-extern uchar initcode[];
extern Queue* kbdq;
extern Queue* kprintoq;
-extern Ref noteidalloc;
-extern Palloc palloc;
-extern Queue *serialoq;
extern char* statename[];
-extern int nsyscall;
extern char *sysname;
extern uint qiomaxatomic;
extern Conf conf;
-enum
-{
- LRESPROF = 3,
-};
/*
* action log
--- a/kern/data.c
+++ b/kern/data.c
@@ -4,7 +4,6 @@
#include "fns.h"
#include "error.h"
-Proc *up;
Conf conf =
{
1,
--- a/kern/dev.c
+++ b/kern/dev.c
@@ -161,7 +161,6 @@
nc->pgrpid = c->pgrpid;
nc->mid = c->mid;
nc->mqid = c->mqid;
- nc->mcp = c->mcp;
return nc;
}
--- a/kern/devcons.c
+++ b/kern/devcons.c
@@ -58,7 +58,7 @@
};
char *sysname;
-vlong fasthz;
+vlong fasthz = 1000;
static int readtime(ulong, char*, int);
static int readbintime(char*, int);
@@ -384,7 +384,6 @@
static void
consinit(void)
{
- todinit();
randominit();
}
@@ -648,8 +647,6 @@
char buf[256];
long l, bp;
char *a = va;
- int fd;
- Chan *swc;
ulong offset = off;
Cmdbuf *cb;
Cmdtab *ct;
@@ -758,22 +755,7 @@
break;
case Qswap:
- if(n >= sizeof buf)
- error(Egreg);
- memmove(buf, va, n); /* so we can NUL-terminate */
- buf[n] = 0;
- /* start a pager if not already started */
- if(strncmp(buf, "start", 5) == 0){
- kickpager();
- break;
- }
- if(cpuserver && !iseve())
- error(Eperm);
- if(buf[0]<'0' || '9'<buf[0])
- error(Ebadarg);
- fd = strtoul(buf, 0, 0);
- swc = fdtochan(fd, -1, 1, 1);
- setswapchan(swc);
+ error(Egreg);
break;
case Qsysname:
@@ -819,19 +801,6 @@
static uvlong uvorder = (uvlong) 0x0001020304050607ULL;
static uchar*
-le2vlong(vlong *to, uchar *f)
-{
- uchar *t, *o;
- int i;
-
- t = (uchar*)to;
- o = (uchar*)&uvorder;
- for(i = 0; i < sizeof(vlong); i++)
- t[o[i]] = f[i];
- return f+sizeof(vlong);
-}
-
-static uchar*
vlong2le(uchar *t, vlong from)
{
uchar *f, *o;
@@ -844,36 +813,6 @@
return t+sizeof(vlong);
}
-static long order = 0x00010203;
-
-static uchar*
-le2long(long *to, uchar *f)
-{
- uchar *t, *o;
- int i;
-
- t = (uchar*)to;
- o = (uchar*)ℴ
- for(i = 0; i < sizeof(long); i++)
- t[o[i]] = f[i];
- return f+sizeof(long);
-}
-
-/*
-static uchar*
-long2le(uchar *t, long from)
-{
- uchar *f, *o;
- int i;
-
- f = (uchar*)&from;
- o = (uchar*)ℴ
- for(i = 0; i < sizeof(long); i++)
- t[i] = f[o[i]];
- return t+sizeof(long);
-}
-*/
-
char *Ebadtimectl = "bad time control";
/*
@@ -884,18 +823,16 @@
static int
readtime(ulong off, char *buf, int n)
{
- vlong nsec, ticks;
- long sec;
+ vlong nsec;
+ ulong sec;
char str[7*NUMSIZE];
- nsec = todget(&ticks);
- if(fasthz == (vlong)0)
- fastticks((uvlong*)&fasthz);
- sec = nsec/((uvlong) 1000000000);
+ sec = seconds();
+ nsec = (vlong)sec*1000000000LL;
snprint(str, sizeof(str), "%*.0lud %*.0llud %*.0llud %*.0llud ",
NUMSIZE-1, sec,
VLNUMSIZE-1, nsec,
- VLNUMSIZE-1, ticks,
+ VLNUMSIZE-1, ticks(),
VLNUMSIZE-1, fasthz);
return readstr(off, buf, n, str);
}
@@ -906,20 +843,10 @@
static int
writetime(char *buf, int n)
{
- char b[13];
- long i;
- vlong now;
-
- if(n >= sizeof(b))
- error(Ebadtimectl);
- strncpy(b, buf, n);
- b[n] = 0;
- i = strtol(b, 0, 0);
- if(i <= 0)
- error(Ebadtimectl);
- now = i*((vlong) 1000000000);
- todset(now, 0, 0);
- return n;
+ USED(buf);
+ USED(n);
+ error(Egreg);
+ return 0;
}
/*
@@ -930,19 +857,17 @@
readbintime(char *buf, int n)
{
int i;
- vlong nsec, ticks;
+ vlong nsec;
uchar *b = (uchar*)buf;
i = 0;
- if(fasthz == (vlong)0)
- fastticks((uvlong*)&fasthz);
- nsec = todget(&ticks);
+ nsec = (ulong)seconds()*1000000000LL;
if(n >= 3*sizeof(uvlong)){
vlong2le(b+2*sizeof(uvlong), fasthz);
i += sizeof(uvlong);
}
if(n >= 2*sizeof(uvlong)){
- vlong2le(b+sizeof(uvlong), ticks);
+ vlong2le(b+sizeof(uvlong), ticks());
i += sizeof(uvlong);
}
if(n >= 8){
@@ -961,34 +886,10 @@
static int
writebintime(char *buf, int n)
{
- uchar *p;
- vlong delta;
- long period;
-
- n--;
- p = (uchar*)buf + 1;
- switch(*buf){
- case 'n':
- if(n < sizeof(vlong))
- error(Ebadtimectl);
- le2vlong(&delta, p);
- todset(delta, 0, 0);
- break;
- case 'd':
- if(n < sizeof(vlong)+sizeof(long))
- error(Ebadtimectl);
- p = le2vlong(&delta, p);
- le2long(&period, p);
- todset(-1, delta, period);
- break;
- case 'f':
- if(n < sizeof(uvlong))
- error(Ebadtimectl);
- le2vlong(&fasthz, p);
- todsetfreq(fasthz);
- break;
- }
- return n;
+ USED(buf);
+ USED(n);
+ error(Egreg);
+ return 0;
}
--- a/kern/fns.h
+++ b/kern/fns.h
@@ -1,21 +1,11 @@
#define ROUND(s, sz) (((s)+((sz)-1))&~((sz)-1))
-void accounttime(void);
-void addclock0link(void (*)(void), int);
-int addphysseg(Physseg*);
-void addbootfile(char*, uchar*, ulong);
Block* adjustblock(Block*, int);
-void alarmkproc(void*);
Block* allocb(int);
-int anyhigher(void);
-int anyready(void);
-Page* auxpage(void);
int blocklen(Block*);
-void callwithureg(void(*)(Ureg*));
char* chanpath(Chan*);
int cangetc(void*);
int canlock(Lock*);
-int canpage(Proc*);
int canputc(void*);
int canqlock(QLock*);
int canrlock(RWlock*);
@@ -24,7 +14,6 @@
void chandevshutdown(void);
void chanfree(Chan*);
void chanrec(Mnt*);
-void checkalarms(void);
void checkb(Block*, char*);
Chan* cclone(Chan*);
void cclose(Chan*);
@@ -35,22 +24,15 @@
void closemount(Mount*);
void closepgrp(Pgrp*);
void closergrp(Rgrp*);
-long clrfpintr(void);
void cmderror(Cmdbuf*, char*);
int cmount(Chan**, Chan*, int, char*);
void cnameclose(Cname*);
void confinit(void);
void confinit1(int);
-int consactive(void);
-extern void (*consdebug)(void);
Block* concatblock(Block*);
Block* copyblock(Block*, int);
-void copypage(Page*, Page*);
void cunmount(Chan*, Chan*);
-ulong dbgpc(Proc*);
int decref(Ref*);
-int decrypt(void*, void*, int);
-void delay(int);
Chan* devattach(int, char*);
Block* devbread(Chan*, long, ulong);
long devbwrite(Chan*, Block*, ulong);
@@ -72,70 +54,36 @@
Walkqid* devwalk(Chan*, Chan*, char**, int, Dirtab*, int, Devgen*);
int devwstat(Chan*, uchar*, int);
void drawcmap(void);
-void dumpaproc(Proc*);
-void dumpqueues(void);
-void dumpregs(Ureg*);
-void dumpstack(void);
Fgrp* dupfgrp(Fgrp*);
-void duppage(Page*);
-void dupswap(Page*);
int emptystr(char*);
-int encrypt(void*, void*, int);
void envcpy(Egrp*, Egrp*);
int eqchan(Chan*, Chan*, int);
int eqqid(Qid, Qid);
void error(char*);
-long execregs(ulong, ulong, ulong);
void exhausted(char*);
void exit(int);
-uvlong fastticks(uvlong*);
-int fault(ulong, int);
Chan* fdtochan(int, int, int, int);
-int fixfault(Segment*, ulong, int, int);
-void flushmmu(void);
-void forkchild(Proc*, Ureg*);
-void forkret(void);
void free(void*);
void freeb(Block*);
void freeblist(Block*);
-int freebroken(void);
-void freepte(Segment*, Pte*);
-void freesegs(int);
-void freesession(Session*);
uintptr getmalloctag(void*);
uintptr getrealloctag(void*);
void gotolabel(Label*);
char* getconfenv(void);
-int haswaitq(void*);
long hostdomainwrite(char*, int);
long hostownerwrite(char*, int);
-void hzsched(void);
void iallocinit(void);
Block* iallocb(int);
-long ibrk(ulong, int);
void ilock(Lock*);
void iunlock(Lock*);
int incref(Ref*);
-void initseg(void);
int iprint(char*, ...);
void isdir(Chan*);
int iseve(void);
#define islo() (0)
-Segment* isoverlap(Proc*, ulong, int);
-int ispages(void*);
-int isphysseg(char*);
-void ixsummary(void);
-void kbdclock(void);
-int kbdcr2nl(Queue*, int);
int kbdputc(Queue*, int);
void kbdkey(Rune, int);
-void kbdrepeat(int);
-long keyread(char*, int, long);
-void kickpager(void);
-void killbig(void);
int kproc(char*, void(*)(void*), void*);
-void kprocchild(Proc*, void (*)(void*), void*);
-extern void (*kproftimer)(ulong);
void ksetenv(char*, char*, int);
void kstrcpy(char*, char*, int);
void kstrdup(char**, char*);
@@ -149,23 +97,14 @@
long logread(Log*, void*, ulong, long);
void log(Log*, int, char*, ...);
Cmdtab* lookupcmd(Cmdbuf*, Cmdtab*, int);
-void machinit(void);
void* mallocz(ulong, int);
#define malloc kmalloc
void* malloc(ulong);
-void mfreeseg(Segment*, ulong, int);
-void microdelay(int);
void mkqid(Qid*, vlong, ulong, int);
-void mmurelease(Proc*);
-void mmuswitch(Proc*);
Chan* mntauth(Chan*, char*);
void mntdump(void);
long mntversion(Chan*, char*, int, int);
void mountfree(Mount*);
-ulong ms2tk(ulong);
-ulong msize(void*);
-ulong ms2tk(ulong);
-uvlong ms2fastticks(ulong);
void muxclose(Mnt*);
Chan* namec(char*, int, int, ulong);
Chan* newchan(void);
@@ -172,7 +111,6 @@
int newfd(Chan*);
Mhead* newmhead(Chan*);
Mount* newmount(Mhead*, Chan*, int, char*);
-Page* newpage(int, Segment **, ulong);
Pgrp* newpgrp(void);
Rgrp* newrgrp(void);
Proc* newproc(void);
@@ -179,54 +117,32 @@
char* nextelem(char*, char*);
void nexterror(void);
Cname* newcname(char*);
-int notify(Ureg*);
-int okaddr(ulong, ulong, int);
int openmode(ulong);
void oserrstr(void);
void oserror(void);
Block* packblock(Block*);
Block* padblock(Block*, int);
-void pagechainhead(Page*);
-void pageinit(void);
-void pagersummary(void);
void panic(char*, ...);
Cmdbuf* parsecmd(char *a, int n);
-ulong perfticks(void);
void pexit(char*, int);
-int preempted(void);
void printinit(void);
int procindex(ulong);
void pgrpcpy(Pgrp*, Pgrp*);
void pgrpnote(ulong, char*, long, int);
Pgrp* pgrptab(int);
-void pio(Segment *, ulong, ulong, Page **);
#define poperror() up->nerrlab--
-void portclock(Ureg*);
int postnote(Proc*, int, char*, int);
int pprint(char*, ...);
-ulong procalarm(ulong);
-int proccounter(char *name);
-void procctl(Proc*);
-void procdump(void);
int procfdprint(Chan*, int, int, char*, int);
void procinit0(void);
-void procflushseg(Segment*);
-void procpriority(Proc*, int, int);
Proc* proctab(int);
void procwired(Proc*, int);
-Pte* ptealloc(void);
-Pte* ptecpy(Pte*);
int pullblock(Block**, int);
Block* pullupblock(Block*, int);
Block* pullupqueue(Queue*, int);
void putmhead(Mhead*);
-void putmmu(ulong, ulong, Page*);
-void putpage(Page*);
-void putseg(Segment*);
void putstr(char*);
void putstrn(char*, int);
-void putswap(Page*);
-ulong pwait(Waitmsg*);
Label* pwaserror(void);
long readblist(Block*, uchar*, long, ulong);
int qaddlist(Queue*, Block*);
@@ -263,39 +179,21 @@
void qnoblock(Queue*, int);
void randominit(void);
ulong randomread(void*, ulong);
-void rdb(void);
int readnum(ulong, char*, ulong, ulong, int);
int readstr(ulong, char*, ulong, char*);
-void ready(Proc*);
void rebootcmd(int, char**);
void reboot(void*, void*, ulong);
-void relocateseg(Segment*, ulong);
void renameuser(char*, char*);
-void resched(char*);
-void resrcwait(char*);
int return0(void*);
void rlock(RWlock*);
-long rtctime(void);
void runlock(RWlock*);
-Proc* runproc(void);
-void savefpregs(FPsave*);
-extern void (*saveintrts)(void);
-void sched(void);
-void scheddump(void);
-void schedinit(void);
extern void (*screenputs)(char*, int);
void* secalloc(ulong);
void secfree(void*);
long seconds(void);
-ulong segattach(Proc*, ulong, char *, ulong, ulong);
-void segclock(ulong);
-void segpage(Segment*, Page*);
-void setkernur(Ureg*, Proc*);
int setlabel(Label*);
void setmalloctag(void*, uintptr);
void setrealloctag(void*, uintptr);
-void setregisters(Ureg*, char*, char*, int);
-void setswapchan(Chan*);
long showfilewrite(char*, int);
char* skipslash(char*);
void sleep(Rendez*, int(*)(void*), void*);
@@ -305,44 +203,13 @@
void splx(int);
void splxpc(int);
char* srvname(Chan*);
-int swapcount(ulong);
-int swapfull(void);
-void swapinit(void);
-void timeradd(Timer*);
-void timerdel(Timer*);
-void timersinit(void);
-void timerintr(Ureg*, uvlong);
-void timerset(uvlong);
-ulong tk2ms(ulong);
-#define TK2MS(x) ((x)*(1000/HZ))
-vlong todget(vlong*);
-void todfix(void);
-void todsetfreq(vlong);
-void todinit(void);
-void todset(vlong, vlong, int);
Block* trimblock(Block*, int, int);
-void tsleep(Rendez*, int (*)(void*), void*, int);
-int uartctl(Uart*, char*);
-int uartgetc(void);
-void uartkick(void*);
-void uartmouse(Uart*, int (*)(Queue*, int), int);
-void uartputc(int);
-void uartputs(char*, int);
-void uartrecv(Uart*, char);
-Uart* uartsetup(Uart*);
-int uartstageoutput(Uart*);
-void unbreak(Proc*);
-void uncachepage(Page*);
long unionread(Chan*, void*, long);
void unlock(Lock*);
-Proc** uploc(void);
-void userinit(void);
-ulong userpc(void);
long userwrite(char*, int);
#define validaddr(a, b, c)
void validname(char*, int);
void validstat(uchar*, int);
-void vcacheinval(Page*, ulong);
void* vmemchr(void*, int, int);
Proc* wakeup(Rendez*);
int walk(Chan**, char**, int, int, int*);
@@ -349,20 +216,8 @@
#define waserror() (setjmp(pwaserror()->buf))
void wlock(RWlock*);
void wunlock(RWlock*);
-void* xalloc(ulong);
-void* xallocz(ulong, int);
-void xfree(void*);
-void xhole(ulong, ulong);
-void xinit(void);
-int xmerge(void*, void*);
-void* xspanalloc(ulong, int, ulong);
-void xsummary(void);
void osyield(void);
void osmsleep(int);
-Segment* data2txt(Segment*);
-Segment* dupseg(Segment**, int, int);
-Segment* newseg(int, ulong, ulong);
-Segment* seg(Proc*, ulong, int);
ulong ticks(void);
void osproc(Proc*);
void osnewproc(Proc*);
@@ -372,4 +227,3 @@
void screeninit(void);
extern void terminit(void);
extern void setterm(int);
-
--- a/kern/pgrp.c
+++ b/kern/pgrp.c
@@ -250,23 +250,3 @@
m = f;
}
}
-
-#ifdef NOTDEF
-void
-resrcwait(char *reason)
-{
- char *p;
-
- if(up == 0)
- panic("resrcwait");
-
- p = up->psstate;
- if(reason) {
- up->psstate = reason;
- print("%s\n", reason);
- }
-
- tsleep(&up->sleep, return0, 0, 300);
- up->psstate = p;
-}
-#endif
--- a/kern/rendez.c
+++ b/kern/rendez.c
@@ -15,7 +15,6 @@
lock(&up->rlock);
if(r->p){
print("double sleep %lud %lud\n", r->p->pid, up->pid);
- dumpstack();
}
/*
--- a/kern/sleep.c
+++ b/kern/sleep.c
@@ -15,7 +15,6 @@
lock(&up->rlock);
if(r->p){
print("double sleep %lud %lud\n", r->p->pid, up->pid);
- dumpstack();
}
/*
--- a/kern/stub.c
+++ b/kern/stub.c
@@ -4,16 +4,6 @@
#include "fns.h"
#include "error.h"
-void
-mallocsummary(void)
-{
-}
-
-void
-pagersummary(void)
-{
-}
-
int
iseve(void)
{
@@ -21,12 +11,6 @@
}
void
-setswapchan(Chan *c)
-{
- USED(c);
-}
-
-void
splx(int x)
{
USED(x);
@@ -45,31 +29,6 @@
}
void
-procdump(void)
-{
-}
-
-void
-scheddump(void)
-{
-}
-
-void
-killbig(void)
-{
-}
-
-void
-dumpstack(void)
-{
-}
-
-void
-xsummary(void)
-{
-}
-
-void
rebootcmd(int argc, char **argv)
{
USED(argc);
@@ -76,11 +35,6 @@
USED(argv);
}
-void
-kickpager(void)
-{
-}
-
int
userwrite(char *a, int n)
{
@@ -88,28 +42,6 @@
return 0;
}
-vlong
-todget(vlong *p)
-{
- if(p)
- *p = 0;
- return 0;
-}
-
-void
-todset(vlong a, vlong b, int c)
-{
- USED(a);
- USED(b);
- USED(c);
-}
-
-void
-todsetfreq(vlong a)
-{
- USED(a);
-}
-
long
hostdomainwrite(char *a, int n)
{
@@ -129,16 +61,6 @@
}
void
-todinit(void)
-{
-}
-
-void
-rdb(void)
-{
-}
-
-void
setmalloctag(void *v, uintptr tag)
{
USED(v);
@@ -167,12 +89,3 @@
{
panic("out of %s", s);
}
-
-uvlong
-fastticks(uvlong *v)
-{
- if(v)
- *v = 1;
- return 0;
-}
-