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

📄 portdat.h

📁 在x86平台上运行不可信任代码的sandbox。
💻 H
📖 第 1 页 / 共 2 页
字号:
// Plan 9 VXstruct vxseg;struct vxproc;typedef struct Alarms	Alarms;typedef struct Block	Block;typedef struct Chan	Chan;typedef struct Cmdbuf	Cmdbuf;typedef struct Cmdtab	Cmdtab;typedef struct Dev	Dev;typedef struct Dirtab	Dirtab;typedef struct Edf	Edf;typedef struct Egrp	Egrp;typedef struct Evalue	Evalue;typedef struct Fgrp	Fgrp;typedef struct DevConf	DevConf;typedef struct Image	Image;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 Path	Path;typedef struct Palloc	Palloc;typedef struct Pallocmem	Pallocmem;typedef struct Perf	Perf;typedef struct PhysUart	PhysUart;typedef struct Pgrp	Pgrp;typedef struct Physseg	Physseg;typedef struct Pte	Pte;typedef struct QLock	QLock;typedef struct Queue	Queue;typedef struct Ref	Ref;typedef struct Rendez	Rendez;typedef struct Rgrp	Rgrp;typedef struct RWlock	RWlock;typedef struct Sargs	Sargs;typedef struct Schedq	Schedq;typedef struct Segment	Segment;typedef struct Sema	Sema;typedef struct Timer	Timer;typedef struct Timers	Timers;typedef struct Uart	Uart;typedef struct Waitq	Waitq;typedef struct Walkqid	Walkqid;typedef struct Watchdog	Watchdog;typedef int    Devgen(Chan*, char*, Dirtab*, int, int, Dir*);#include "fcall.h"struct Ref{	Lock lk;	long	ref;};struct Rendez{	Lock lk;	Proc	*p;};struct QLock{	Lock	use;		/* to access Qlock structure */	Proc	*head;		/* next process waiting for object */	Proc	*tail;		/* last process waiting for object */	int	locked;		/* flag */};struct RWlock{	Lock	use;	Proc	*head;		/* list of waiting processes */	Proc	*tail;	ulong	wpc;		/* pc of writer */	Proc	*wproc;		/* writing proc */	int	readers;	/* number of readers */	int	writer;		/* number of writers */};struct Alarms{	QLock lk;	Proc	*head;};struct Sargs{	ulong	args[MAXSYSARG];};/* * Access types in namec & channel flags */enum{	Aaccess,			/* as in stat, wstat */	Abind,				/* for left-hand-side of bind */	Atodir,				/* as in chdir */	Aopen,				/* for i/o */	Amount,				/* to be mounted or mounted upon */	Acreate,			/* is to be created */	Aremove,			/* will be removed by caller */	COPEN	= 0x0001,		/* for i/o */	CMSG	= 0x0002,		/* the message channel for a mount */	CCEXEC	= 0x0008,		/* close on exec */	CFREE	= 0x0010,		/* not in use */	CRCLOSE	= 0x0020,		/* remove on close */	CCACHE	= 0x0080,		/* client cache */};/* flag values */enum{	BINTR	=	(1<<0),	BFREE	=	(1<<1),	Bipck	=	(1<<2),		/* ip checksum */	Budpck	=	(1<<3),		/* udp checksum */	Btcpck	=	(1<<4),		/* tcp checksum */	Bpktck	=	(1<<5),		/* packet checksum */};struct Block{	long	ref;	Block*	next;	Block*	list;	uchar*	rp;			/* first unconsumed byte */	uchar*	wp;			/* first empty byte */	uchar*	lim;			/* 1 past the end of the buffer */	uchar*	base;			/* start of the buffer */	void	(*free)(Block*);	ushort	flag;	ushort	checksum;		/* IP checksum of complete packet (minus media header) */};#define BLEN(s)	((s)->wp - (s)->rp)#define BALLOC(s) ((s)->lim - (s)->base)struct Chan{	Ref ref;				/* the Lock in this Ref is also Chan's lock */	Chan*	next;			/* allocation */	Chan*	link;	vlong	offset;			/* in fd */	vlong	devoffset;		/* in underlying device; see read */	ushort	type;	ulong	dev;	ushort	mode;			/* read/write */	ushort	flag;	Qid	qid;	int	fid;			/* for devmnt */	ulong	iounit;			/* chunk size for i/o; 0==default */	Mhead*	umh;			/* mount point that derived Chan; used in unionread */	Chan*	umc;			/* channel in union; held for union read */	QLock	umqlock;		/* serialize unionreads */	int	uri;			/* union read index */	int	dri;			/* devdirread index */	uchar*	dirrock;		/* directory entry rock for translations */	int	nrock;	int	mrock;	QLock	rockqlock;	int	ismtpt;	Mntcache*mcp;			/* Mount cache pointer */	Mnt*	mux;			/* Mnt for clients using me for messages */	union {		void*	aux;		Qid	pgrpid;		/* for #p/notepg */		ulong	mid;		/* for ns in devproc */	};	Chan*	mchan;			/* channel to mounted server */	Qid	mqid;			/* qid of root of mount point */	Path*	path;};struct Path{	Ref ref;	char	*s;	Chan	**mtpt;			/* mtpt history */	int	len;			/* strlen(s) */	int	alen;			/* allocated length of s */	int	mlen;			/* number of path elements */	int	malen;			/* allocated length of mtpt */};struct Dev{	int	dc;	char*	name;	void	(*reset)(void);	void	(*init)(void);	void	(*shutdown)(void);	Chan*	(*attach)(char*);	Walkqid*(*walk)(Chan*, Chan*, char**, int);	int	(*stat)(Chan*, uchar*, int);	Chan*	(*open)(Chan*, int);	void	(*create)(Chan*, char*, int, ulong);	void	(*close)(Chan*);	long	(*read)(Chan*, void*, long, vlong);	Block*	(*bread)(Chan*, long, ulong);	long	(*write)(Chan*, void*, long, vlong);	long	(*bwrite)(Chan*, Block*, ulong);	void	(*remove)(Chan*);	int	(*wstat)(Chan*, uchar*, int);	void	(*power)(int);	/* power mgt: power(1) => on, power (0) => off */	int	(*config)(int, char*, DevConf*);	/* returns nil on error */};struct Dirtab{	char	name[KNAMELEN];	Qid	qid;	vlong	length;	long	perm;};struct Walkqid{	Chan	*clone;	int	nqid;	Qid	qid[1];};enum{	NSMAX	=	1000,	NSLOG	=	7,	NSCACHE	=	(1<<NSLOG),};struct Mntwalk				/* state for /proc/#/ns */{	int	cddone;	Mhead*	mh;	Mount*	cm;};struct Mount{	ulong	mountid;	Mount*	next;	Mhead*	head;	Mount*	copy;	Mount*	order;	Chan*	to;			/* channel replacing channel */	int	mflag;	char	*spec;};struct Mhead{	Ref ref;	RWlock	lock;	Chan*	from;			/* channel mounted upon */	Mount*	mount;			/* what's mounted upon it */	Mhead*	hash;			/* Hash chain */};struct Mnt{	Lock lk;	/* references are counted using c->ref; channels on this mount point incref(c->mchan) == Mnt.c */	Chan	*c;		/* Channel to file service */	Proc	*rip;		/* Reader in progress */	Mntrpc	*queue;		/* Queue of pending requests on this channel */	ulong	id;		/* Multiplexer id for channel check */	Mnt	*list;		/* Free list */	int	flags;		/* cache */	int	msize;		/* data + IOHDRSZ */	char	*version;	/* 9P version */	Queue	*q;		/* input queue */};enum{	NUser,				/* note provided externally */	NExit,				/* deliver note quietly */	NDebug,				/* print debug message */};struct Note{	char	msg[ERRMAX];	int	flag;			/* whether system posted it */};enum{	PG_NOFLUSH	= 0,	PG_TXTFLUSH	= 1,		/* flush dcache and invalidate icache */	PG_DATFLUSH	= 2,		/* flush both i & d caches (UNUSED) */	PG_NEWCOL	= 3,		/* page has been recolored */	PG_MOD		= 0x01,		/* software modified bit */	PG_REF		= 0x02,		/* software referenced bit */};struct Page{	Lock lk;	ulong	pa;			/* Physical address in memory */	ulong	va;			/* Virtual address for user */	ulong	daddr;			/* Disc address on swap */	ushort	ref;			/* Reference count */	char	modref;			/* Simulated modify/reference bits */	char	color;			/* Cache coloring */	Image	*image;			/* Associated text or swap image */	Page	*next;			/* Lru free list */	Page	*prev;	Page	*hash;			/* Image hash chains */};struct Swapalloc{	Lock lk;				/* Free map lock */	int	free;			/* currently free swap pages */	uchar*	swmap;			/* Base of swap map in memory */	uchar*	alloc;			/* Round robin allocator */	uchar*	last;			/* Speed swap allocation */	uchar*	top;			/* Top of swap map */	Rendez	r;			/* Pager kproc idle sleep */	ulong	highwater;		/* Pager start threshold */	ulong	headroom;		/* Space pager frees under highwater */}swapalloc;struct Image{	Ref ref;	Chan	*c;			/* channel to text file */	Qid 	qid;			/* Qid for page cache coherence */	Qid	mqid;	Chan	*mchan;	ushort	type;			/* Device type of owning channel */	Segment *s;			/* TEXT segment for image if running */	Image	*hash;			/* Qid hash chains */	Image	*next;			/* Free list */	int	notext;			/* no file associated */};struct Pte{	Page	*pages[PTEPERTAB];	/* Page map for this chunk of pte */	Page	**first;		/* First used entry */	Page	**last;			/* Last used entry */};/* Segment types */enum{	SG_TYPE		= 07,		/* Mask type of segment */	SG_TEXT		= 00,	SG_DATA		= 01,	SG_BSS		= 02,	SG_STACK	= 03,	SG_SHARED	= 04,	SG_PHYSICAL	= 05,	SG_RONLY	= 0040,		/* Segment is read only */	SG_CEXEC	= 0100,		/* Detach at exec */};#define PG_ONSWAP	1#define onswap(s)	(((ulong)s)&PG_ONSWAP)#define pagedout(s)	(((ulong)s)==0 || onswap(s))#define swapaddr(s)	(((ulong)s)&~PG_ONSWAP)#define SEGMAXSIZE	(SEGMAPSIZE*PTEMAPMEM)struct Physseg{	ulong	attr;			/* Segment attributes */	char	*name;			/* Attach name */	ulong	pa;			/* Physical address */	ulong	size;			/* Maximum segment size in pages */	Page	*(*pgalloc)(Segment*, ulong);	/* Allocation if we need it */	void	(*pgfree)(Page*);};struct Sema{	Rendez rendez;	long	*addr;	int	waiting;	Sema	*next;	Sema	*prev;};struct Segment{	Ref ref;	QLock	lk;	ushort	steal;		/* Page stealer lock */	ushort	type;		/* segment type */	ulong	base;		/* virtual base */	ulong	top;		/* virtual top */	ulong	size;		/* size in pages */	ulong	fstart;		/* start address in file for demand load */	ulong	flen;		/* length of segment in file */	int	flushme;	/* maintain icache for this segment */	Image	*image;		/* text in file attached to this segment */	Physseg *pseg;	ulong*	profile;	/* Tick profile area */	Pte	**map;	int	mapsize;	Pte	*ssegmap[SSEGMAPSIZE];	Lock	semalock;	Sema	sema;	ulong	mark;		/* portcountrefs */};enum{	RENDLOG	=	5,	RENDHASH =	1<<RENDLOG,	/* Hash to lookup rendezvous tags */	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)])struct Pgrp{	Ref ref;				/* also used as a lock when mounting */	int	noattach;	ulong	pgrpid;	QLock	debug;			/* single access via devproc.c */	RWlock	ns;			/* Namespace n read/one write lock */	Mhead	*mnthash[MNTHASH];};struct Rgrp{	Ref ref;				/* the Ref's lock is also the Rgrp's lock */	Proc	*rendhash[RENDHASH];	/* Rendezvous tag hash */};struct Egrp{	Ref ref;	RWlock lk;	Evalue	**ent;	int	nent;	int	ment;	ulong	path;	/* qid.path of next Evalue to be allocated */	ulong	vers;	/* of Egrp */};struct Evalue{	char	*name;	char	*value;	int	len;	Evalue	*link;	Qid	qid;};struct Fgrp{	Ref ref;	Chan	**fd;	int	nfd;			/* number allocated */	int	maxfd;			/* highest fd in use */	int	exceed;			/* debugging */};enum{	DELTAFD	= 20		/* incremental increase in Fgrp.fd's */};struct Pallocmem

⌨️ 快捷键说明

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