| plan 9 kernel history: overview | file list | diff list |
1990/03091/gnot/dat.h (diff list | history)
| 1990/03091/sys/src/9/gnot/dat.h:1,527 – 1990/0312/sys/src/9/gnot/dat.h:1,527 (short | long | prev | next) | ||
| 1990/03091 | typedef struct Alarm Alarm; typedef struct Block Block; typedef struct Blist Blist; typedef struct Chan Chan; typedef struct Conf Conf; typedef struct Dev Dev; typedef struct Dir Dir; typedef struct Dirtab Dirtab; typedef struct Env Env; typedef struct Envp Envp; typedef struct Envval Envval; typedef struct Error Error; typedef struct FFrame FFrame; typedef struct FPsave FPsave; typedef struct Label Label; typedef struct List List; typedef struct Lock Lock; typedef struct Mach Mach; typedef struct Mount Mount; typedef struct Mtab Mtab; typedef struct Note Note; typedef struct Orig Orig; typedef struct PTE PTE; typedef struct Page Page; typedef struct Pgrp Pgrp; typedef struct Proc Proc; typedef struct Qinfo Qinfo; typedef struct QLock QLock; typedef struct Queue Queue; typedef struct Ref Ref; typedef struct Rendez Rendez; typedef struct Seg Seg; typedef struct Stream Stream; typedef struct Ureg Ureg; typedef struct User User; typedef int Devgen(Chan*, Dirtab*, int, int, Dir*); struct List { void *next; }; struct Lock { char key[1]; /* addr of sync bus semaphore */ ulong pc; }; struct Ref { Lock; int ref; }; struct QLock { Proc *head; /* next process waiting for object */ Proc *tail; /* last process waiting for object */ Lock use; /* to use object */ Lock queue; /* to access list */ }; struct Label { ulong sp; ulong pc; ushort sr; }; struct Alarm { List; Lock; int busy; long dt; /* may underflow in clock(); must be signed */ void (*f)(void*); void *arg; }; #define CHDIR 0x80000000L #define QPATH 0x0000FFFFL struct Chan { QLock; /* general access */ Ref; union{ Chan *next; /* allocation */ ulong offset; /* in file */ }; ushort type; ushort dev; ushort mode; /* read/write */ ushort flag; ulong qid; Mount *mnt; /* mount point that derived Chan */ ulong mountid; int fid; /* for devmnt */ Stream *stream; /* for stream channels */ Chan *mchan; /* channel to mounted server */ ulong mqid; /* qid of root of mount point */ }; struct FPsave { long fpreg[32]; long fpstatus; }; struct Conf { int nmach; /* processors */ int nproc; /* processes */ int npgrp; /* process groups */ ulong npage; /* total physical pages of memory */ ulong norig; /* origins */ ulong npte; /* contiguous page table entries */ ulong nmod; /* single (modifying) page table entries */ int nalarm; /* alarms */ int nchan; /* channels */ int nenv; /* distinct environment values */ int nenvchar; /* environment text storage */ int npgenv; /* environment files per process group */ int nmtab; /* mounted-upon channels per process group */ int nmount; /* mounts */ int nmntdev; /* mounted devices (devmnt.c) */ int nmntbuf; /* buffers for devmnt.c messages */ int nmnthdr; /* headers for devmnt.c messages */ int nstream; /* streams */ int nqueue; /* stream queues */ int nblock; /* stream blocks */ int nsrv; /* public servers (devsrv.c) */ }; struct Dev { void (*reset)(void); void (*init)(void); Chan *(*attach)(char*); Chan *(*clone)(Chan*, Chan*); int (*walk)(Chan*, char*); void (*stat)(Chan*, char*); Chan *(*open)(Chan*, int); void (*create)(Chan*, char*, int, ulong); void (*close)(Chan*); long (*read)(Chan*, void*, long); long (*write)(Chan*, void*, long); void (*remove)(Chan*); void (*wstat)(Chan*, char*); void (*errstr)(Error*, char*); void (*userstr)(Error*, char*); }; struct Dirtab { char name[NAMELEN]; long qid; long length; long perm; }; struct Env { Lock; Envval *val; char name[NAMELEN]; Env *next; /* in chain of Envs for a pgrp */ int pgref; /* # pgrps pointing here */ }; struct Envp { Env *env; int chref; /* # chans from pgrp pointing here */ }; struct Mach { int machno; /* physical id of processor */ int mmask; /* 1<<m->machno */ ulong ticks; /* of the clock since boot time */ Proc *proc; /* current process on this processor */ Label sched; /* scheduler wakeup */ Lock alarmlock; /* access to alarm list */ void *alarm; /* alarms bound to this clock */ int stack[1]; }; struct Mount { Ref; /* also used as a lock when playing lists */ short term; /* terminates list */ ulong mountid; Mount *next; Chan *c; /* channel replacing underlying channel */ }; struct Mtab { Chan *c; /* channel mounted upon */ Mount *mnt; /* what's mounted upon it */ }; enum{ NUser, /* note provided externally */ NExit, /* process should exit */ NDebug, /* process should hang */ }; struct Note { char msg[ERRLEN]; int flag; /* whether system posted it */ }; struct Orig { Lock; Orig *next; /* for allocation */ ushort nproc; /* processes using it */ ushort npage; /* sum of refs of pages in it */ ushort flag; ulong va; /* va of 0th pte */ ulong npte; /* #pte's in list */ PTE *pte; Chan *chan; /* channel deriving segment (if open) */ ushort type; /* of channel (which could be non-open) */ ulong qid; Chan *mchan; ulong mqid; ulong minca; /* base of region in chan */ ulong maxca; /* end of region in chan */ }; struct Page { Orig *o; /* origin of segment owning page */ ulong va; /* virtual address */ ulong pa; /* physical address */ ushort ref; Page *next; Page *prev; }; struct Pgrp { Ref; /* also used as a lock when mounting */ Pgrp *next; ulong pgrpid; char user[NAMELEN]; int nmtab; /* highest active mount table entry, +1 */ int nenv; /* highest active env table entry, +1 */ Mtab *mtab; Envp *etab; }; struct PTE { Proc *proc; /* process owning this PTE (0 in Orig) */ PTE *nextmod; /* next at this va */ PTE *nextva; /* next in this proc at higher va */ Page *page; }; struct Rendez { Lock; Proc *p; }; struct Seg { Proc *proc; /* process owning this segment */ Orig *o; /* root list of pte's */ ulong minva; /* va of 0th pte (not necessarily Seg->o->va) */ ulong maxva; /* va of last pte */ PTE *mod; /* list of modified pte's */ ulong pad[3]; /**/ }; struct Proc { Label sched; | |
| 1990/0312 | #define PUTNEXT(q,b) (*(q)->next->put)((q)->next, b) #define BLEN(b) ((b)->wptr - (b)->rptr) | |
| 1990/03091 | /* * stream file qid's & high water mark */ enum { Shighqid = STREAMQID(1,0) - 1, Sdataqid = Shighqid, Sctlqid = Sdataqid-1, Slowqid = Sctlqid, Streamhi= (32*1024), /* stream high water mark */ }; #define PRINTSIZE 256 extern Mach *m; extern User *u; /* * Process states */ enum { Dead = 0, Moribund, Zombie, Ready, Scheding, Running, Queueing, MMUing, Exiting, Inwait, Wakeme, Broken, }; extern char *statename[]; /* * Chan flags */ #define COPEN 1 /* for i/o */ #define CMOUNT 2 /* is result of a mount/bind */ #define CCREATE 4 /* permits creation if CMOUNT */ /* * Proc.time */ enum { TUser, TSys, TReal, TCUser, TCSys, TCReal, }; /* * floating point registers */ enum { FPinit, FPactive, FPinactive, }; /* * Memory management */ #define SSEG 0 #define TSEG 1 #define DSEG 2 #define BSEG 3 #define ESEG 4 /* used by exec to build new stack */ #define OWRPERM 0x01 /* write permission */ #define OPURE 0x02 /* original data mustn't be written */ #define OCACHED 0x04 /* cached; don't discard on exit */ /* * Access types in namec */ enum { Aaccess, /* as in access, stat */ Atodir, /* as in chdir */ Aopen, /* for i/o */ Amount, /* to be mounted upon */ Acreate, /* file is to be created */ }; #define NUMSIZE 12 /* size of formatted number */ #define MACHP(n) (n==0? &mach0 : *(Mach**)0) extern Conf conf; extern ulong initcode[]; extern Dev devtab[]; extern char devchar[]; extern FPsave initfp; extern Mach mach0; | |