xref: /original-bsd/sys/sys/file.h (revision 95a66346)
1 /*
2  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)file.h	7.7 (Berkeley) 03/17/91
8  */
9 
10 #include <sys/fcntl.h>
11 #include <sys/unistd.h>
12 
13 #ifdef KERNEL
14 /*
15  * Kernel descriptor table entry;
16  * one for each open kernel vnode and socket.
17  */
18 struct file {
19 	int	f_flag;		/* see below */
20 #define	DTYPE_VNODE	1	/* file */
21 #define	DTYPE_SOCKET	2	/* communications endpoint */
22 	short	f_type;		/* descriptor type */
23 	short	f_count;	/* reference count */
24 	short	f_msgcount;	/* references from message queue */
25 	struct	ucred *f_cred;	/* credentials associated with descriptor */
26 	struct	fileops {
27 		int	(*fo_read)();
28 		int	(*fo_write)();
29 		int	(*fo_ioctl)();
30 		int	(*fo_select)();
31 		int	(*fo_close)();
32 	} *f_ops;
33 	caddr_t	f_data;		/* inode */
34 	off_t	f_offset;
35 };
36 
37 struct file *file, *fileNFILE;
38 int nfile;
39 
40 #endif /* KERNEL */
41