plan 9 kernel history: overview | file list | diff list

1992/0902/port/portdat.h (diff list | history)

port/portdat.h on 1991/0513
1991/0513    
typedef struct Alarms	Alarms; 
1991/0428    
typedef struct Block	Block; 
typedef struct Blist	Blist; 
typedef struct Chan	Chan; 
1991/1127    
typedef struct Crypt	Crypt; 
1991/0428    
typedef struct Dev	Dev; 
typedef struct Dirtab	Dirtab; 
1991/0705    
typedef struct Egrp	Egrp; 
1992/0623    
typedef struct Evalue	Evalue; 
1991/0428    
typedef struct Etherpkt	Etherpkt; 
1991/0705    
typedef struct Fgrp	Fgrp; 
typedef struct Image	Image; 
1991/0607    
typedef struct IOQ	IOQ; 
typedef struct KIOQ	KIOQ; 
1991/0428    
typedef struct List	List; 
typedef struct Mount	Mount; 
1992/0620    
typedef struct Mnt	Mnt; 
1991/1011    
typedef struct Mhead	Mhead; 
1991/1115    
typedef struct Netinf	Netinf; 
typedef struct Netprot	Netprot; 
1991/1106    
typedef struct Network	Network; 
1991/0428    
typedef struct Note	Note; 
typedef struct Page	Page; 
1991/0705    
typedef struct Palloc	Palloc; 
1992/0128    
typedef struct Pgrps	Pgrps; 
1991/0428    
typedef struct Pgrp	Pgrp; 
typedef struct Proc	Proc; 
1991/0705    
typedef struct Pte	Pte; 
1991/0428    
typedef struct Qinfo	Qinfo; 
typedef struct QLock	QLock; 
typedef struct Queue	Queue; 
typedef struct Ref	Ref; 
typedef struct Rendez	Rendez; 
1991/1011    
typedef struct RWlock	RWlock; 
1992/0625    
typedef struct Sargs	Sargs; 
1992/0808    
typedef struct Scsi	Scsi; 
typedef struct Scsibuf	Scsibuf; 
typedef struct Scsidata	Scsidata; 
1991/0705    
typedef struct Segment	Segment; 
1991/0428    
typedef struct Stream	Stream; 
1992/0602    
typedef struct Talarm	Talarm; 
1991/0926    
typedef struct Waitq	Waitq; 
1992/0307    
typedef int    Devgen(Chan*, Dirtab*, int, int, Dir*); 
1992/0625    
typedef	void   Streamput(Queue*, Block*); 
typedef	void   Streamopen(Queue*, Stream*); 
typedef	void   Streamclose(Queue*); 
typedef	void   Streamreset(void); 
1991/0428    
 
1992/0619    
#include "fcall.h" 
 
1991/0428    
struct Ref 
{ 
	Lock; 
1992/0309    
	long	ref; 
1991/0428    
}; 
 
struct Rendez 
{ 
	Lock; 
	Proc	*p; 
}; 
 
struct QLock 
{ 
1991/1105    
	Lock	use;			/* to access Qlock structure */ 
1991/0428    
	Proc	*head;			/* next process waiting for object */ 
	Proc	*tail;			/* last process waiting for object */ 
1991/1002    
	int	locked;			/* flag */ 
1991/0428    
}; 
 
1991/1011    
struct RWlock 
{ 
	Lock;				/* Lock modify lock */ 
	QLock	x;			/* Mutual exclusion lock */ 
	QLock	k;			/* Lock for waiting writers held for readers */ 
	int	readers;		/* Count of readers in lock */ 
}; 
 
1992/0602    
struct Talarm 
1991/0428    
{ 
	Lock; 
1992/0602    
	Proc	*list; 
1991/0428    
}; 
 
1991/0513    
struct Alarms 
{ 
1992/0516    
	QLock; 
1991/0513    
	Proc	*head; 
}; 
 
1992/0625    
#define MAXSYSARG	5		/* for mount(fd, mpt, flag, arg, srv) */ 
struct Sargs 
{ 
	ulong	args[MAXSYSARG]; 
}; 
 
1991/0428    
/* Block.flags */ 
#define S_DELIM 0x80 
#define S_CLASS 0x07 
 
/* Block.type */ 
#define M_DATA 0 
#define M_CTL 1 
#define M_HANGUP 2 
 
struct Block 
{ 
	Block	*next; 
1991/10302    
	Block	*list;			/* chain of block lists */ 
1991/0724    
	uchar	*rptr;			/* first unconsumed byte */ 
	uchar	*wptr;			/* first empty byte */ 
	uchar	*lim;			/* 1 past the end of the buffer */ 
	uchar	*base;			/* start of the buffer */ 
1991/0428    
	uchar	flags; 
	uchar	type; 
1992/0222    
	ulong	pc;			/* pc of caller */ 
1991/0428    
}; 
 
1992/0621    
struct Blist 
{ 
1991/0428    
	Lock; 
1991/0724    
	Block	*first;			/* first data block */ 
	Block	*last;			/* last data block */ 
	long	len;			/* length of list in bytes */ 
	int	nb;			/* number of blocks in list */ 
1991/0428    
}; 
 
/* 
 * Access types in namec 
 */ 
enum 
{ 
1991/0724    
	Aaccess,			/* as in access, stat */ 
	Atodir,				/* as in chdir */ 
	Aopen,				/* for i/o */ 
	Amount,				/* to be mounted upon */ 
	Acreate,			/* file is to be created */ 
1991/0428    
}; 
 
/* 
 *  Chan.flags 
 */ 
1991/0724    
#define	COPEN	1			/* for i/o */ 
1991/1011    
#define	CMSG	2			/* is the message channel for a mount */ 
#define	CCREATE	4			/* permits creation if c->mnt */ 
1991/0724    
#define	CCEXEC	8			/* close on exec */ 
#define	CFREE	16			/* not in use */ 
1992/0811    
#define	CRCLOSE	32			/* remove on close */ 
1991/0428    
 
struct Chan 
{ 
	Ref; 
	union{ 
		Chan	*next;		/* allocation */ 
		ulong	offset;		/* in file */ 
	}; 
	ushort	type; 
	ushort	dev; 
	ushort	mode;			/* read/write */ 
	ushort	flag; 
	Qid	qid; 
	Mount	*mnt;			/* mount point that derived Chan */ 
	ulong	mountid; 
	int	fid;			/* for devmnt */ 
1992/0318    
	Stream	*stream;		/* for stream channels */ 
1991/0428    
	union { 
		void	*aux; 
		Qid	pgrpid;		/* for #p/notepg */ 
1992/0620    
		Mnt	*mntptr;	/* for devmnt */ 
1991/0428    
	}; 
	Chan	*mchan;			/* channel to mounted server */ 
	Qid	mqid;			/* qid of root of mount point */ 
}; 
 
1991/1127    
struct Crypt 
{ 
1991/1207    
	char	key[DESKEYLEN];		/* des encryption key */ 
1991/1127    
	char	chal[8];		/* challenge for setting user name */ 
1992/0824    
	Crypt	*next; 
1991/1127    
}; 
 
1991/0428    
struct Dev 
{ 
1992/0824    
	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, ulong); 
	long	(*write)(Chan*, void*, long, ulong); 
	void	(*remove)(Chan*); 
	void	(*wstat)(Chan*, char*); 
1991/0428    
}; 
 
struct Dirtab 
{ 
	char	name[NAMELEN]; 
	Qid	qid; 
	long	length; 
	long	perm; 
}; 
 
/* 
 *  Ethernet packet buffers. 
 */ 
1992/0621    
struct Etherpkt 
{ 
1992/0824    
	uchar	d[6]; 
	uchar	s[6]; 
	uchar	type[2]; 
	uchar	data[1500]; 
	uchar	crc[4]; 
1991/0428    
}; 
 
1992/0808    
enum 
{ 
1992/0824    
	ETHERMINTU =	60,		/* minimum transmit size */ 
	ETHERMAXTU =	1514,		/* maximum transmit size */ 
	ETHERHDRSIZE =	14,		/* size of an ethernet header */ 
}; 
 
/* SCSI devices. */ 
enum 
{ 
1992/0808    
	ScsiTestunit	= 0x00, 
	ScsiExtsens	= 0x03, 
1992/0825    
	ScsiInquiry	= 0x12, 
1992/0808    
	ScsiModesense	= 0x1a, 
	ScsiGetcap	= 0x25, 
	ScsiRead	= 0x08, 
	ScsiWrite	= 0x0a, 
 
1992/0824    
	/* data direction */ 
1992/0808    
	ScsiIn		= 1, 
	ScsiOut		= 0, 
}; 
 
struct Scsibuf 
{ 
1992/0824    
	void*		virt; 
	void*		phys; 
	Scsibuf*	next; 
1992/0808    
}; 
 
struct Scsidata 
{ 
1992/0824    
	uchar*		base; 
	uchar*		lim; 
	uchar*		ptr; 
1992/0808    
}; 
 
struct Scsi 
{ 
	QLock; 
1992/0824    
	ulong		pid; 
	ushort		target; 
	ushort		lun; 
	ushort		rflag; 
	ushort		status; 
	Scsidata 	cmd; 
	Scsidata 	data; 
	Scsibuf*	b; 
	uchar*		save; 
	uchar		cmdblk[16]; 
1992/0808    
}; 
1992/0824    
 
/* character based IO (mouse, keyboard, console screen) */ 
1991/0607    
#define NQ	4096 
struct IOQ 
{ 
	Lock; 
	uchar	buf[NQ]; 
	uchar	*in; 
	uchar	*out; 
	int	state; 
	Rendez	r; 
	union{ 
		void	(*puts)(IOQ*, void*, int);	/* output */ 
		int	(*putc)(IOQ*, int);		/* input */ 
	}; 
1991/0810    
	union{ 
		int	(*gets)(IOQ*, void*, int);	/* input */ 
		int	(*getc)(IOQ*);			/* output */ 
	}; 
1991/0607    
	void	*ptr; 
}; 
1992/0307    
 
1991/0607    
struct KIOQ 
{ 
	QLock; 
	IOQ; 
	int	repeat; 
	int	c; 
	int	count; 
}; 
1992/0307    
 
1991/0428    
struct Mount 
{ 
	ulong	mountid; 
	Mount	*next; 
1991/1011    
	Mhead	*head; 
	Chan	*to;			/* channel replacing underlying channel */ 
1991/0428    
}; 
 
1991/1011    
struct Mhead 
1991/0428    
{ 
1991/1011    
	Chan	*from;			/* channel mounted upon */ 
	Mount	*mount;			/* what's mounted upon it */ 
	Mhead	*hash;			/* Hash chain */ 
1991/0428    
}; 
 
1992/0307    
enum 
{ 
1991/0428    
	NUser,				/* note provided externally */ 
1991/1105    
	NExit,				/* deliver note quietly */ 
	NDebug,				/* print debug message */ 
1991/0428    
}; 
 
struct Note 
{ 
	char	msg[ERRLEN]; 
	int	flag;			/* whether system posted it */ 
}; 
 
1992/0625    
enum 
{ 
	PG_NOFLUSH	= 0,		/* Fields for cache control of pages */ 
	PG_TXTFLUSH	= 1, 
	PG_DATFLUSH	= 2, 
	PG_MOD		= 0x01,		/* Simulated modified and referenced bits */ 
	PG_REF		= 0x02, 
}; 
1991/0428    
 
1991/0705    
struct Page 
1991/0428    
{ 
1992/0625    
	Lock; 
1991/0705    
	ulong	pa;			/* Physical address in memory */ 
	ulong	va;			/* Virtual address for user */ 
	ulong	daddr;			/* Disc address on swap */ 
	ushort	ref;			/* Reference count */ 
	char	lock;			/* Software lock */ 
	char	modref;			/* Simulated modify/reference bits */ 
	char	cachectl[MAXMACH];	/* Cache flushing control for putmmu */ 
	Image	*image;			/* Associated text or swap image */ 
	Page	*next;			/* Lru free list */ 
	Page	*prev; 
	Page	*hash;			/* Image hash chains */ 
}; 
 
struct Swapalloc 
{ 
1991/0724    
	Lock;				/* Free map lock */ 
	int	free;			/* Number of currently free swap pages */ 
	char	*swmap;			/* Base of swap map in memory */ 
	char	*alloc;			/* Round robin allocator */ 
	char	*top;			/* Top of swap map */ 
	Rendez	r;			/* Pager kproc idle sleep */ 
1992/0303    
	ulong	highwater;		/* Threshold beyond which we must page */ 
1992/0824    
	ulong	headroom;		/* Space pager keeps free under highwater */ 
1991/0705    
}swapalloc; 
 
struct Image 
{ 
	Ref; 
	Chan	*c;			/* Channel associated with running image */ 
	Qid 	qid;			/* Qid for page cache coherence checks */ 
1991/0428    
	Qid	mqid; 
1991/0705    
	Chan	*mchan; 
	ushort	type;			/* Device type of owning channel */ 
1992/0824    
	Segment *s;			/* TEXT segment for image if running */ 
1991/0705    
	Image	*hash;			/* Qid hash chains */ 
	Image	*next;			/* Free list */ 
1991/0428    
}; 
 
1991/0705    
struct Pte 
1991/0428    
{ 
1992/0131    
	Page	*pages[PTEPERTAB];	/* Page map for this chunk of pte */ 
	Page	**first;		/* First used entry */ 
	Page	**last;			/* Last used entry */ 
	Pte	*next;			/* Free list */ 
1991/0428    
}; 
 
1991/0705    
/* Segment types */ 
1992/0625    
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_SHDATA	= 06, 
1992/0307    
 
1992/0625    
	SG_RONLY	= 040,		/* Segment is read only */ 
}; 
1991/0705    
 
#define PG_ONSWAP	1 
#define onswap(s)	(((ulong)s)&PG_ONSWAP) 
1992/0805    
#define pagedout(s)	(((ulong)s)==0 || onswap(s)) 
#define swapaddr(s)	(((ulong)s)&~PG_ONSWAP) 
1991/0705    
 
#define SEGMAXSIZE	(SEGMAPSIZE*PTEMAPMEM) 
 
struct Segment 
{ 
	Ref; 
	QLock	lk; 
	ushort	steal;			/* Page stealer lock */ 
	Segment	*next;			/* free list pointers */ 
	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 */ 
1991/0706    
	int	flushme;		/* maintain consistent icache for this segment */ 
1992/0824    
	Image	*image;			/* text in file attached to this segment */ 
1991/0705    
	Page	*(*pgalloc)(ulong addr);/* SG_PHYSICAL page allocator */ 
	void	(*pgfree)(Page *);	/* SG_PHYSICAL page free */ 
	Pte	*map[SEGMAPSIZE];	/* segment pte map */ 
}; 
 
1992/0824    
enum 
{ 
	RENDHASH =	32,		/* Hash to lookup rendezvous tags */ 
	MNTHASH	=	32,		/* Hash to walk mount table */ 
	NFD =		100,		/* Number of per process file descriptors */ 
	PGHSIZE	=	512,		/* Page hash for image lookup */ 
}; 
1991/0806    
#define REND(p,s)	((p)->rendhash[(s)%RENDHASH]) 
1991/1011    
#define MOUNTH(p,s)	((p)->mnthash[(s)->qid.path%MNTHASH]) 
1991/0806    
 
1991/0428    
struct Pgrp 
{ 
	Ref;				/* also used as a lock when mounting */ 
1991/0705    
	Pgrp	*next;			/* free list */ 
1991/0428    
	ulong	pgrpid; 
1991/1127    
	Crypt	*crypt;			/* encryption key and challenge */ 
1991/0428    
	QLock	debug;			/* single access via devproc.c */ 
1991/1011    
	RWlock	ns;			/* Namespace many read/one write lock */ 
	Mhead	*mnthash[MNTHASH]; 
1991/0806    
	Proc	*rendhash[RENDHASH];	/* Rendezvous tag hash */ 
1991/0705    
}; 
 
struct Egrp 
{ 
	Ref; 
1992/0623    
	QLock; 
	Evalue	*entries; 
	ulong	path; 
1991/0428    
}; 
 
1992/0623    
struct Evalue 
{ 
	char	*name; 
	char	*value; 
	int	len; 
	ulong	path; 
	Evalue	*link; 
}; 
 
1991/0705    
struct Fgrp 
{ 
	Ref; 
	Chan	*fd[NFD]; 
	int	maxfd;			/* highest fd in use */ 
}; 
 
struct Palloc 
{ 
	Lock; 
1992/0619    
	ulong	p0, p1;			/* base of pages in bank 0/1 */ 
	ulong	np0, np1;		/* number of pages in bank 0/1 */ 
1991/0724    
	Page	*head;			/* most recently used */ 
	Page	*tail;			/* least recently used */ 
	ulong	freecount;		/* how many pages on free list now */ 
	ulong	user;			/* how many user pages */ 
1991/0705    
	Page	*hash[PGHSIZE]; 
	Lock	hashlock; 
1991/0724    
	Rendez	r;			/* Sleep for free mem */ 
	QLock	pwait;			/* Queue of procs waiting for memory */ 
	int	wanted;			/* Do the wakeup at free */ 
1992/0824    
	ulong	cmembase;		/* Key memory protected from read by devproc */ 
	ulong	cmemtop; 
1991/0705    
}; 
 
1991/0926    
struct Waitq 
{ 
	Waitmsg	w; 
	Waitq	*next; 
}; 
 
1991/0807    
enum 
{ 
1992/0501    
	RFNAMEG		= (1<<0), 
	RFENVG		= (1<<1), 
	RFFDG		= (1<<2), 
	RFNOTEG		= (1<<3), 
	RFPROC		= (1<<4), 
	RFMEM		= (1<<5), 
	RFNOWAIT	= (1<<6), 
	RFCNAMEG	= (1<<10), 
	RFCENVG		= (1<<11), 
	RFCFDG		= (1<<12) 
1991/0807    
}; 
 
1991/0428    
/* 
1991/0605    
 *  process memory segments - NSEG always last ! 
1991/0428    
 */ 
1991/0605    
enum 
{ 
1991/0705    
	SSEG, TSEG, DSEG, BSEG, ESEG, LSEG, SEG1, SEG2, NSEG 
1991/0605    
}; 
1991/0428    
 
enum 
{ 
1992/0625    
	Dead = 0,		/* Process states */ 
1991/0428    
	Moribund, 
	Ready, 
	Scheding, 
	Running, 
	Queueing, 
	Wakeme, 
	Broken, 
1991/0705    
	Stopped, 
1991/0806    
	Rendezvous, 
1991/0428    
 
1992/0625    
	Proc_stopme = 1, 	/* devproc requests */ 
	Proc_exitme, 
	Proc_traceme, 
1991/0705    
 
1992/0625    
	TUser = 0, 		/* Proc.time */ 
1991/0428    
	TSys, 
	TReal, 
	TCUser, 
	TCSys, 
	TCReal, 
}; 
 
struct Proc 
{ 
	Label	sched; 
	Mach	*mach;			/* machine running this proc */ 
	char	text[NAMELEN]; 
1991/1105    
	char	user[NAMELEN]; 
1991/0428    
	Proc	*rnext;			/* next process in run queue */ 
	Proc	*qnext;			/* next process on queue for a QLock */ 
	QLock	*qlock;			/* address of qlock being queued for DEBUG */ 
1991/0830    
	ulong	qlockpc;		/* pc of last call to qlock */ 
1991/0428    
	int	state; 
1992/0428    
	char	*psstate;		/* What /proc/#/status reports */ 
1992/0805    
	Page	*upage;			/* page from palloc */ 
1991/0705    
	Segment	*seg[NSEG]; 
1991/0428    
	ulong	pid; 
1992/0428    
	ulong	noteid;			/* Equivalent of note group */ 
1991/0926    
 
	Lock	exl;			/* Lock count and waitq */ 
	Waitq	*waitq;			/* Exited processes wait children */ 
	int	nchild;			/* Number of living children */ 
	int	nwait;			/* Number of uncollected wait records */ 
	Rendez	waitr;			/* Place to hang out in wait */ 
1991/0428    
	Proc	*parent; 
1991/0705    
 
	Pgrp	*pgrp;			/* Process group for notes and namespace */ 
	Egrp 	*egrp;			/* Environment group */ 
	Fgrp	*fgrp;			/* File descriptor group */ 
 
1991/0428    
	ulong	parentpid; 
	ulong	time[6];		/* User, Sys, Real; child U, S, R */ 
	short	insyscall; 
	int	fpstate; 
1991/1109    
 
1991/1216    
	QLock	debug;			/* to access debugging elements of User */ 
1991/1110    
	Proc	*pdbg;			/* the debugging process */ 
1991/1109    
	ulong	procmode;		/* proc device file mode */ 
1991/1110    
	int	hang;			/* hang at next exec for debug */ 
	int	procctl;		/* Control for /proc debugging */ 
	ulong	pc;			/* DEBUG only */ 
1991/1109    
 
1991/0428    
	Rendez	*r;			/* rendezvous point slept on */ 
1992/0602    
	Rendez	sleep;			/* place for syssleep/debug */ 
1991/0727    
	int	notepending;		/* note issued but not acted on */ 
1991/0428    
	int	kp;			/* true if a kernel process */ 
1991/0513    
	Proc	*palarm;		/* Next alarm time */ 
	ulong	alarm;			/* Time of call */ 
1991/0705    
	int 	hasspin;		/* I hold a spin lock */ 
	int	newtlb;			/* Pager has touched my tables so I must flush */ 
1991/0806    
 
	ulong	rendtag;		/* Tag for rendezvous */  
	ulong	rendval;		/* Value for rendezvous */ 
	Proc	*rendhash;		/* Hash list for tag values */ 
1992/0602    
 
	ulong	twhen; 
	Rendez	*trend; 
	Proc	*tlink; 
1992/0617    
	int	(*tfn)(void*); 
1992/0602    
 
1991/0504    
	/* 
1992/0824    
	 *  machine specific MMU 
1991/0504    
	 */ 
1991/0507    
	PMMU; 
1991/0428    
}; 
 
/* 
 *  operations available to a queue 
 */ 
struct Qinfo 
{ 
1992/0625    
	Streamput	*iput;		/* input routine */ 
	Streamput	*oput;		/* output routine */ 
	Streamopen	*open; 
	Streamclose	*close; 
	char		*name; 
	Streamreset	*reset;		/* initialization */ 
	char		nodelim;	/* True if stream does not preserve delimiters */ 
	Qinfo		*next; 
1991/0428    
}; 
 
1992/0824    
/* Queue.flag */ 
enum 
{ 
	QHUNGUP	=	0x1,	/* stream has been hung up */ 
	QINUSE =	0x2,	/* allocation check */ 
	QHIWAT =	0x4,	/* queue has gone past the high water mark */	 
	QDEBUG =	0x8, 
}; 
1991/0428    
 
1992/0318    
struct Queue 
{ 
1991/0428    
	Blist; 
	int	flag; 
1991/0724    
	Qinfo	*info;			/* line discipline definition */ 
	Queue	*other;			/* opposite direction, same line discipline */ 
	Queue	*next;			/* next queue in the stream */ 
1991/0428    
	void	(*put)(Queue*, Block*); 
1991/0724    
	QLock	rlock;			/* mutex for processes sleeping at r */ 
	Rendez	r;			/* standard place to wait for flow control */ 
	Rendez	*rp;			/* where flow control wakeups go to */ 
	void	*ptr;			/* private info for the queue */ 
1991/0428    
}; 
 
1992/0318    
struct Stream 
{ 
1991/0724    
	QLock;				/* structure lock */ 
1992/0620    
	Stream	*next; 
1991/0724    
	short	inuse;			/* number of processes in stream */ 
	short	opens;			/* number of processes with stream open */ 
	ushort	hread;			/* number of reads after hangup */ 
	ushort	type;			/* correlation with Chan */ 
	ushort	dev;			/* ... */ 
	ushort	id;			/* ... */ 
	QLock	rdlock;			/* read lock */ 
	Queue	*procq;			/* write queue at process end */ 
	Queue	*devq;			/* read queue at device end */ 
	Block	*err;			/* error message from down stream */ 
1991/0809    
	int	flushmsg;		/* flush up till the next delimiter */ 
1991/0428    
}; 
 
/* 
 *  useful stream macros 
 */ 
#define	RD(q)		((q)->other < (q) ? (q->other) : q) 
#define	WR(q)		((q)->other > (q) ? (q->other) : q) 
#define STREAMTYPE(x)	((x)&0x1f) 
#define STREAMID(x)	(((x)&~CHDIR)>>5) 
#define STREAMQID(i,t)	(((i)<<5)|(t)) 
#define PUTNEXT(q,b)	(*(q)->next->put)((q)->next, b) 
#define BLEN(b)		((b)->wptr - (b)->rptr) 
#define QFULL(q)	((q)->flag & QHIWAT) 
1992/0305    
#define FLOWCTL(q,b)	{ if(QFULL(q->next)) flowctl(q,b); else PUTNEXT(q,b);} 
1991/0428    
 
/* 
 *  stream file qid's & high water mark 
 */ 
1992/0621    
enum 
{ 
1992/0824    
	Shighqid	= STREAMQID(1,0) - 1, 
	Sdataqid	= Shighqid, 
	Sctlqid		= Sdataqid-1, 
	Slowqid		= Sctlqid, 
	Streamhi	= (32*1024),	/* byte count high water mark */ 
	Streambhi	= 128,		/* block count high water mark */ 
1991/0428    
}; 
1991/1106    
 
/* 
 *  a multiplexed network 
 */ 
1991/1115    
struct Netprot 
1991/1106    
{ 
1992/0623    
	int	id; 
	Netprot	*next;		/* linked list of protections */ 
1991/1115    
	ulong	mode; 
	char	owner[NAMELEN]; 
}; 
1992/0307    
 
1991/1115    
struct Netinf 
{ 
1991/1106    
	char	*name; 
	void	(*fill)(Chan*, char*, int); 
}; 
1992/0307    
 
1991/1106    
struct Network 
{ 
1991/1115    
	Lock; 
1991/1106    
	char	*name; 
	int	nconv;			/* max # of conversations */ 
	Qinfo	*devp;			/* device end line disc */ 
	Qinfo	*protop;		/* protocol line disc */ 
	int	(*listen)(Chan*); 
	int	(*clone)(Chan*); 
	int	ninfo; 
1991/1115    
	Netinf	info[5]; 
1992/0623    
	Netprot	*prot;			/* linked list of protections */ 
1991/1106    
}; 
1991/0428    
 
1992/0824    
enum 
{ 
	PRINTSIZE =	256, 
1992/0826    
	MAXCRYPT = 	127, 
1992/0824    
	NUMSIZE	=	12,		/* size of formatted number */ 
	MB =		(1024*1024), 
}; 
1991/0428    
 
extern	Conf	conf; 
1992/0625    
extern	char*	conffile; 
extern	int	cpuserver; 
extern	char*	devchar; 
1991/0428    
extern	Dev	devtab[]; 
1991/1109    
extern  char	eve[]; 
1992/0902    
extern	uchar	initcode[]; 
1992/0625    
extern	FPsave	initfp; 
extern  KIOQ	kbdq; 
extern  IOQ	lineq; 
extern  IOQ	mouseq; 
extern  Ref	noteidalloc; 
1991/1112    
extern	int	nrdy; 
1992/0625    
extern  IOQ	printq; 
extern	char*	statename[]; 
extern  Image	swapimage; 
1992/0321    
extern	char	sysname[NAMELEN]; 
1992/0602    
extern	Talarm	talarm; 
1992/0625    
extern	Palloc 	palloc; 
1992/0725    
extern	int	cpuserver; 
1991/0428    
 
1992/0824    
enum 
{ 
	CHDIR =		0x80000000L, 
	CHAPPEND = 	0x40000000L, 
	CHEXCL =	0x20000000L, 
}; 
1992/0318    
 
/* 
 * auth messages 
 */ 
1992/0625    
enum 
{ 
1992/0318    
	FScchal	= 1, 
1992/0321    
	FSschal, 
	FSok, 
1992/0318    
	FSctick, 
1992/0321    
	FSstick, 
	FSerr, 
1992/0318    
 
	RXschal	= 0, 
	RXstick	= 1, 
1992/0625    
 
	AUTHLEN	= 8, 
1992/0318    
}; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)