4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
43 #pragma ident "%Z%%M% %I% %E% SMI"
46 #include <sys/types.h>
54 * One file structure is allocated for each open/creat/pipe call.
55 * Main use is to hold the read/write pointer associated with
61 struct file
*f_next
; /* pointer to next entry */
62 struct file
*f_prev
; /* pointer to previous entry */
64 cnt_t f_count
; /* reference count */
65 struct vnode
*f_vnode
; /* pointer to vnode structure */
66 off_t f_offset
; /* read/write character pointer */
67 struct cred
*f_cred
; /* credentials of user who opened it */
68 struct aioreq
*f_aiof
; /* aio file list forward link */
69 struct aioreq
*f_aiob
; /* aio file list backward link */
71 struct file
*f_slnk
; /* XENIX semaphore queue */
77 #include <sys/fcntl.h>
80 /* flags - see also fcntl.h */
83 #define FOPEN 0xFFFFFFFF
89 #define FNONBLOCK 0x80 /* Non-blocking flag (POSIX). */
91 #define FMASK 0xff /* should be disjoint from FASYNC */
98 #define FNOCTTY 0x800 /* don't allocate controlling tty (POSIX). */
99 #define FASYNC 0x1000 /* asyncio is in progress */
100 #define FPRIV 0x1000 /* open with private access */
102 /* file descriptor flags */
103 #define FCLOSEXEC 001 /* close on exec */
106 /* record-locking options. */
107 #define F_ULOCK 0 /* Unlock a previously locked region */
108 #define F_LOCK 1 /* Lock a region for exclusive use */
109 #define F_TLOCK 2 /* Test and lock a region for exclusive use */
110 #define F_TEST 3 /* Test a region for other processes locks */
115 #define LOCK_SH 1 /* shared lock */
116 #define LOCK_EX 2 /* exclusive lock */
117 #define LOCK_NB 4 /* don't block when locking */
118 #define LOCK_UN 8 /* unlock */
123 #define F_OK 0 /* does file exist */
124 #define X_OK 1 /* is it executable by caller */
125 #define W_OK 2 /* writable by caller */
126 #define R_OK 4 /* readable by caller */
132 #define L_SET 0 /* absolute offset */
133 #define L_INCR 1 /* relative to current offset */
134 #define L_XTND 2 /* relative to end of file */
138 /* miscellaneous defines */
140 #define NULLFP ((struct file *)0)
143 * Count of number of entries in file list.
145 extern unsigned int filecnt
;
148 * routines dealing with user per-open file flags and
149 * user open files. getf() is declared in systm.h. It
150 * probably belongs here.
152 #if defined(__STDC__)
153 extern void setf(int, file_t
*);
154 extern void setpof(int, char);
155 extern char getpof(int);
156 extern int fassign(struct vnode
**, int, int *);
158 extern void setf(), setpof();
159 extern char getpof();
160 extern int fassign();
163 extern off_t
lseek();
165 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
166 !defined(__PRAGMA_REDEFINE_EXTNAME))
167 #if defined(__STDC__)
168 extern off64_t
lseek64(int, off64_t
, int);
170 extern off64_t
llseek64();
172 #endif /* _LARGEFILE64_SOURCE... */
178 #endif /* _SYS_FILE_H */