⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portdat.h

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 H
📖 第 1 页 / 共 2 页
字号:
{	Fbuf	fbuf;	Super1;};struct	Label{	ulong	pc;	ulong	sp;};struct	Alarm{	Lock;	Alarm*	next;	int	busy;	int	dt;		/* in ticks */	void	(*f)(Alarm*, void*);	void*	arg;};struct Talarm{	Lock;	User	*list;};struct	Conf{	ulong	nmach;		/* processors */	ulong	nproc;		/* processes */	ulong	mem;		/* total physical bytes of memory */	ulong	sparemem;	/* memory left for check/dump and chans */	ulong	nalarm;		/* alarms */	ulong	nuid;		/* distinct uids */	ulong	nserve;		/* server processes */	ulong	nfile;		/* number of fid -- system wide */	ulong	nwpath;		/* number of active paths, derived from nfile */	ulong	gidspace;	/* space for gid names -- derived from nuid */	ulong	nlgmsg;		/* number of large message buffers */	ulong	nsmmsg;		/* number of small message buffers */	Off	recovcw;	/* recover addresses */	Off	recovro;	Off	firstsb;	Off	recovsb;	ulong	nauth;		/* number of Auth structs */	uchar	nodump;		/* no periodic dumps */	uchar	ripoff;	uchar	dumpreread;	/* read and compare in dump copy */	short	minuteswest;	/* minutes west of Greenwich */	short	dsttime;	/* dst correction */	ulong	npage0;		/* total physical pages of memory */	ulong	npage1;		/* total physical pages of memory */	ulong	base0;		/* base of bank 0 */	ulong	base1;		/* base of bank 1 */	ulong	idedma;		/* flag: use DMA & RWM on IDE disks? */};/* * message buffers * 2 types, large and small *//* flags from cpu kernel; not implemented in fs kernel yet */enum {	Bipck	=	(1<<6),		/* ip checksum */	Budpck	=	(1<<3),		/* udp checksum */	Btcpck	=	(1<<4),		/* tcp checksum */	Bpktck	=	(1<<5),		/* packet checksum */};struct	Msgbuf{	short	count;	short	flags;		#define	LARGE	(1<<0)		#define	FREE	(1<<1)		#define BFREE	(1<<2)		#define BTRACE	(1<<7)		#define Mbrcvbuf (1<<15) /* to free, call (*free)(this) */	Chan*	chan;	Msgbuf*	next;	ulong	param;	int	category;	uchar*	data;		/* rp or wp: current processing point */	uchar*	xdata;		/* base of allocation */	/* added for cpu kernel compatibility - geoff */	void	(*free)(Msgbuf *);};/* * message buffer categories */enum{	Mxxx		= 0,	Mbreply1,	Mbreply2,	Mbreply3,	Mbreply4,	Mbarp1,	Mbarp2,	Mbip1,	Mbip2,	Mbip3,	Mbil1,	Mbil2,	Mbil3,	Mbil4,	Mbilauth,	Maeth1,	Maeth2,	Maeth3,	Mbeth1,	Mbeth2,	Mbeth3,	Mbeth4,	Mbsntp,	MAXCAT,};struct	Mach{	int	machno;		/* physical id of processor */	int	mmask;		/* 1<<m->machno */	Timet	ticks;		/* of the clock since boot time */	int	lights;		/* light lights, this processor */	User*	proc;		/* current process on this processor */	Label	sched;		/* scheduler wakeup */	Lock	alarmlock;	/* access to alarm list */	void*	alarm;		/* alarms bound to this clock */	void	(*intr)(Ureg*, ulong);	/* pending interrupt */	User*	intrp;		/* process that was interrupted */	ulong	cause;		/* arg to intr */	Ureg*	ureg;		/* arg to intr */#ifdef CPU	int	loopconst;	Lock	apictimerlock;	int	cpumhz;	uvlong	cyclefreq;		/* Frequency of user readable cycle counter */	uvlong	cpuhz;	int	cpuidax;	int	cpuiddx;	char	cpuidid[16];	char*	cpuidtype;	int	havetsc;	int	havepge;	uvlong	tscticks;#endif	uchar	stack[1];};#define	MAXSTACK 16000#define	NHAS	300struct	User{	Label	sched;	Mach*	mach;		/* machine running this proc */	User*	rnext;		/* next process in run queue */	User*	qnext;		/* next process on queue for a QLock */	void	(*start)(void);	/* startup function */	char*	text;		/* name of this process */	void*	arg;	Filter	time[3];	/* cpu time used */	int	exiting;	int	pid;	int	state;	Rendez	tsleep;	Timet	twhen;	Rendez	*trend;	User	*tlink;	int	(*tfn)(void*);	struct	{		ulong	pc[NHAS];	/* list of pcs for locks this process has */		QLock*	q[NHAS];/* list of locks this process has */		QLock*	want;	/* lock waiting */	} has;	uchar	stack[MAXSTACK];};#define	PRINTSIZE	256struct{	Lock;	int	machs;	int	exiting;} active;struct	Command{	char*	arg0;	char*	help;	void	(*func)(int, char*[]);};struct	Flag{	char*	arg0;	char*	help;	ulong	flag;};struct	Tm{	/* see ctime(3) */	int	sec;	int	min;	int	hour;	int	mday;	int	mon;	int	year;	int	wday;	int	yday;	int	isdst;};struct	Rtc{	int	sec;	int	min;	int	hour;	int	mday;	int	mon;	int	year;};typedef struct{	/* constants during a given truncation */	Dentry	*d;	Iobuf	*p;			/* the block containing *d */	int	uid;	Off	newsize;	Off	lastblk;		/* last data block of file to keep */	/* variables */	Off	relblk;			/* # of current data blk within file */	int	pastlast;		/* have we walked past lastblk? */	int	err;} Truncstate;/* * cw device *//* DONT TOUCH, this is the disk structure */struct	Cache{	Off	maddr;		/* cache map addr */	Off	msize;		/* cache map size in buckets */	Off	caddr;		/* cache addr */	Off	csize;		/* cache size */	Off	fsize;		/* current size of worm */	Off	wsize;		/* max size of the worm */	Off	wmax;		/* highwater write */	Off	sbaddr;		/* super block addr */	Off	cwraddr;	/* cw root addr */	Off	roraddr;	/* dump root addr */	Timet	toytime;	/* somewhere convienent */	Timet	time;};/* DONT TOUCH, this is the disk structure */struct	Centry{	ushort	age;	short	state;	Off	waddr;		/* worm addr */};/* DONT TOUCH, this is the disk structure */struct	Bucket{	long	agegen;		/* generator for ages in this bkt */	Centry	entry[CEPERBK];};/* * scsi i/o */enum{	SCSIread = 0,	SCSIwrite = 1,};/* * Process states */enum{	Dead = 0,	Moribund,	Zombie,	Ready,	Scheding,	Running,	Queueing,	Sending,	Recving,	MMUing,	Exiting,	Inwait,	Wakeme,	Broken,};/* * Lights */enum{	Lreal	= 0,	/* blink in clock interrupt */	Lintr,		/* on while in interrupt */	Lpanic,		/* in panic */	Lcwmap,		/* in cw lookup */};/* * devnone block numbers */enum{	Cwio1 	= 1,	Cwio2,	Cwxx1,	Cwxx2,	Cwxx3,	Cwxx4,	Cwdump1,	Cwdump2,	Cuidbuf,	Cckbuf,};/* * error codes generated from the file server */enum{	Ebadspc = 1,	Efid,	Echar,	Eopen,	Ecount,	Ealloc,	Eqid,	Eaccess,	Eentry,	Emode,	Edir1,	Edir2,	Ephase,	Eexist,	Edot,	Eempty,	Ebadu,	Enoattach,	Ewstatb,	Ewstatd,	Ewstatg,	Ewstatl,	Ewstatm,	Ewstato,	Ewstatp,	Ewstatq,	Ewstatu,	Ewstatv,	Ename,	Ewalk,	Eronly,	Efull,	Eoffset,	Elocked,	Ebroken,	Eauth,	Eauth2,	Efidinuse,	Etoolong,	Econvert,	Eversion,	Eauthdisabled,	Eauthnone,	Eauthfile,	Eedge,	MAXERR};/* * device types */enum{	Devnone 	= 0,	Devcon,			/* console */	Devwren,		/* scsi disk drive */	Devworm,		/* scsi video drive */	Devlworm,		/* scsi video drive (labeled) */	Devfworm,		/* fake read-only device */	Devjuke,		/* jukebox */	Devcw,			/* cache with worm */	Devro,			/* readonly worm */	Devmcat,		/* multiple cat devices */	Devmlev,		/* multiple interleave devices */	Devil,			/* internet link */	Devpart,		/* partition */	Devfloppy,		/* floppy drive */	Devide,			/* IDE drive */	Devswab,		/* swab data between mem and device */	Devmirr,		/* mirror devices */	Devmarvsata,		/* Marvell sata disk drive */	MAXDEV};/* * tags on block *//* DONT TOUCH, this is in disk structures *//* also, the order from Tdir to Tind4 (Tmaxind) is exploited in indirck() */enum{	Tnone		= 0,	Tsuper,			/* the super block */#ifdef OLD	Tdir,			/* directory contents */	Tind1,			/* points to blocks */	Tind2,			/* points to Tind1 */#else	Tdirold,	Tind1old,	Tind2old,#endif	Tfile,			/* file contents */	Tfree,			/* in free list */	Tbuck,			/* cache fs bucket */	Tvirgo,			/* fake worm virgin bits */	Tcache,			/* cw cache things */	Tconfig,		/* configuration block */#ifndef OLD	/* Tdir & indirect blocks are last to allow for greater depth */	Tdir,			/* directory contents */	Tind1,			/* points to blocks */	Tind2,			/* points to Tind1 */	Tind3,			/* points to Tind2 */	Tind4,			/* points to Tind3 */	Maxtind,#endif	MAXTAG,#ifdef OLD	Tmaxind = Tind2,#else	Tmaxind = Maxtind - 1,#endif};/* * flags to getbuf */enum{	Bread	= (1<<0),	/* read the block if miss */	Bprobe	= (1<<1),	/* return null if miss */	Bmod	= (1<<2),	/* buffer is dirty, needs writing */	Bimm	= (1<<3),	/* write immediately on putbuf */	Bres	= (1<<4),	/* reserved, never renamed */};extern	register	Mach*	m;extern	register	User*	u;extern  Talarm		talarm;Conf	conf;Cons	cons;#define	MACHP(n)	((Mach*)(MACHADDR+n*BY2PG))#pragma	varargck	type	"Z"	Device*#pragma	varargck	type	"T"	Timet#pragma	varargck	type	"I"	uchar*#pragma	varargck	type	"E"	uchar*#pragma	varargck	type	"W"	Filter*#pragma	varargck	type	"G"	intextern int (*fsprotocol[])(Msgbuf*);extern Rendez dawnrend;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -