xref: /original-bsd/sys/sys/file.h (revision 6c57d260)
1 /*	file.h	4.7	81/05/12	*/
2 
3 /*
4  * One file structure is allocated
5  * for each open/creat/pipe call.
6  * Main use is to hold the read/write
7  * pointer associated with each open
8  * file.
9  */
10 struct	file
11 {
12 	short	f_flag;
13 	short	f_count;		/* reference count */
14 	struct inode *f_inode;		/* pointer to inode structure */
15 	union {
16 		off_t	f_offset;	/* read/write character pointer */
17 		struct chan *f_chan;	/* mpx channel pointer */
18 		struct port *f_port;	/* port (used for pipes, too) */
19 #ifdef CHAOS
20 		struct connection *f_conn;
21 #endif
22 #ifdef BBNNET
23 		struct ucb *f_ucb;      /* net connection block pointer */
24 #endif BBNNET
25 	} f_un;
26 };
27 
28 #ifdef	KERNEL
29 struct	file *file, *fileNFILE;	/* the file table itself */
30 int	nfile;
31 
32 struct	file *getf();
33 struct	file *falloc();
34 #endif
35 
36 /* flags */
37 #define	FREAD	01
38 #define	FWRITE	02
39 #define	FPIPE	04
40 #define	FMPX	010
41 #define	FMPY	020
42 #define	FMP	030
43 #define	FPORT	040
44 #define FNET    0100    /* this is a network entry */
45