2 * Copyright (c) 2001 by Sun Microsystems, Inc.
7 * Copyright (c) 1982, 1986 Regents of the University of California.
8 * All rights reserved. The Berkeley software License Agreement
9 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 #include <sys/types.h>
25 * Descriptor table entry.
26 * One for each kernel object.
29 int f_flag
; /* see below */
30 short f_type
; /* descriptor type */
31 short f_count
; /* reference count */
32 short f_msgcount
; /* references from message queue */
39 caddr_t f_data
; /* ptr to file specific struct (vnode/socket) */
41 struct ucred
*f_cred
; /* credentials of user who opened file */
44 struct file
*file
, *fileNFILE
;
47 struct file
*falloc();
50 #include <sys/fcntlcom.h>
53 * bits to save after an open. The no delay bits mean "don't wait for
54 * carrier at open" in all cases. Sys5 & POSIX save the no delay bits,
55 * using them to also mean "don't block on reads"; BSD has you reset it
56 * with an fcntl() if you want the "don't block on reads" behavior.
58 #define FMASK (FREAD|FWRITE|FAPPEND|FSYNC|FNBIO|FNONBIO)
59 #define FCNTLCANT (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK)
68 #define LOCK_SH 1 /* shared lock */
69 #define LOCK_EX 2 /* exclusive lock */
70 #define LOCK_NB 4 /* don't block when locking */
71 #define LOCK_UN 8 /* unlock */
74 * Access call. Also maintained in unistd.h
76 #define F_OK 0 /* does file exist */
77 #define X_OK 1 /* is it executable by caller */
78 #define W_OK 2 /* writable by caller */
79 #define R_OK 4 /* readable by caller */
82 * Lseek call. Also maintained in 5include/stdio.h and sys/unistd.h as SEEK_*
84 #define L_SET 0 /* absolute offset */
85 #define L_INCR 1 /* relative to current offset */
86 #define L_XTND 2 /* relative to end of file */
89 #define GETF(fp, fd) { \
90 if ((fd) < 0 || (fd) > u.u_lastfile || \
91 ((fp) = u.u_ofile[fd]) == NULL) { \
97 #define DTYPE_VNODE 1 /* file */
98 #define DTYPE_SOCKET 2 /* communications endpoint */
105 #endif /* __SYS_FILE_H */