xref: /titanic_51/usr/src/boot/sys/sys/fcntl.h (revision 4a5d661a82b942b6538acd26209d959ce98b593a)
1*4a5d661aSToomas Soome /*-
2*4a5d661aSToomas Soome  * Copyright (c) 1983, 1990, 1993
3*4a5d661aSToomas Soome  *	The Regents of the University of California.  All rights reserved.
4*4a5d661aSToomas Soome  * (c) UNIX System Laboratories, Inc.
5*4a5d661aSToomas Soome  * All or some portions of this file are derived from material licensed
6*4a5d661aSToomas Soome  * to the University of California by American Telephone and Telegraph
7*4a5d661aSToomas Soome  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8*4a5d661aSToomas Soome  * the permission of UNIX System Laboratories, Inc.
9*4a5d661aSToomas Soome  *
10*4a5d661aSToomas Soome  * Redistribution and use in source and binary forms, with or without
11*4a5d661aSToomas Soome  * modification, are permitted provided that the following conditions
12*4a5d661aSToomas Soome  * are met:
13*4a5d661aSToomas Soome  * 1. Redistributions of source code must retain the above copyright
14*4a5d661aSToomas Soome  *    notice, this list of conditions and the following disclaimer.
15*4a5d661aSToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
16*4a5d661aSToomas Soome  *    notice, this list of conditions and the following disclaimer in the
17*4a5d661aSToomas Soome  *    documentation and/or other materials provided with the distribution.
18*4a5d661aSToomas Soome  * 4. Neither the name of the University nor the names of its contributors
19*4a5d661aSToomas Soome  *    may be used to endorse or promote products derived from this software
20*4a5d661aSToomas Soome  *    without specific prior written permission.
21*4a5d661aSToomas Soome  *
22*4a5d661aSToomas Soome  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*4a5d661aSToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*4a5d661aSToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*4a5d661aSToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*4a5d661aSToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*4a5d661aSToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*4a5d661aSToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*4a5d661aSToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*4a5d661aSToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*4a5d661aSToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*4a5d661aSToomas Soome  * SUCH DAMAGE.
33*4a5d661aSToomas Soome  *
34*4a5d661aSToomas Soome  *	@(#)fcntl.h	8.3 (Berkeley) 1/21/94
35*4a5d661aSToomas Soome  * $FreeBSD$
36*4a5d661aSToomas Soome  */
37*4a5d661aSToomas Soome 
38*4a5d661aSToomas Soome #ifndef _SYS_FCNTL_H_
39*4a5d661aSToomas Soome #define	_SYS_FCNTL_H_
40*4a5d661aSToomas Soome 
41*4a5d661aSToomas Soome /*
42*4a5d661aSToomas Soome  * This file includes the definitions for open and fcntl
43*4a5d661aSToomas Soome  * described by POSIX for <fcntl.h>; it also includes
44*4a5d661aSToomas Soome  * related kernel definitions.
45*4a5d661aSToomas Soome  */
46*4a5d661aSToomas Soome 
47*4a5d661aSToomas Soome #include <sys/cdefs.h>
48*4a5d661aSToomas Soome #include <sys/_types.h>
49*4a5d661aSToomas Soome 
50*4a5d661aSToomas Soome #ifndef _MODE_T_DECLARED
51*4a5d661aSToomas Soome typedef	__mode_t	mode_t;
52*4a5d661aSToomas Soome #define	_MODE_T_DECLARED
53*4a5d661aSToomas Soome #endif
54*4a5d661aSToomas Soome 
55*4a5d661aSToomas Soome #ifndef _OFF_T_DECLARED
56*4a5d661aSToomas Soome typedef	__off_t		off_t;
57*4a5d661aSToomas Soome #define	_OFF_T_DECLARED
58*4a5d661aSToomas Soome #endif
59*4a5d661aSToomas Soome 
60*4a5d661aSToomas Soome #ifndef _PID_T_DECLARED
61*4a5d661aSToomas Soome typedef	__pid_t		pid_t;
62*4a5d661aSToomas Soome #define	_PID_T_DECLARED
63*4a5d661aSToomas Soome #endif
64*4a5d661aSToomas Soome 
65*4a5d661aSToomas Soome /*
66*4a5d661aSToomas Soome  * File status flags: these are used by open(2), fcntl(2).
67*4a5d661aSToomas Soome  * They are also used (indirectly) in the kernel file structure f_flags,
68*4a5d661aSToomas Soome  * which is a superset of the open/fcntl flags.  Open flags and f_flags
69*4a5d661aSToomas Soome  * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
70*4a5d661aSToomas Soome  * Open/fcntl flags begin with O_; kernel-internal flags begin with F.
71*4a5d661aSToomas Soome  */
72*4a5d661aSToomas Soome /* open-only flags */
73*4a5d661aSToomas Soome #define	O_RDONLY	0x0000		/* open for reading only */
74*4a5d661aSToomas Soome #define	O_WRONLY	0x0001		/* open for writing only */
75*4a5d661aSToomas Soome #define	O_RDWR		0x0002		/* open for reading and writing */
76*4a5d661aSToomas Soome #define	O_ACCMODE	0x0003		/* mask for above modes */
77*4a5d661aSToomas Soome 
78*4a5d661aSToomas Soome /*
79*4a5d661aSToomas Soome  * Kernel encoding of open mode; separate read and write bits that are
80*4a5d661aSToomas Soome  * independently testable: 1 greater than the above.
81*4a5d661aSToomas Soome  *
82*4a5d661aSToomas Soome  * XXX
83*4a5d661aSToomas Soome  * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
84*4a5d661aSToomas Soome  * which was documented to use FREAD/FWRITE, continues to work.
85*4a5d661aSToomas Soome  */
86*4a5d661aSToomas Soome #if __BSD_VISIBLE
87*4a5d661aSToomas Soome #define	FREAD		0x0001
88*4a5d661aSToomas Soome #define	FWRITE		0x0002
89*4a5d661aSToomas Soome #endif
90*4a5d661aSToomas Soome #define	O_NONBLOCK	0x0004		/* no delay */
91*4a5d661aSToomas Soome #define	O_APPEND	0x0008		/* set append mode */
92*4a5d661aSToomas Soome #if __BSD_VISIBLE
93*4a5d661aSToomas Soome #define	O_SHLOCK	0x0010		/* open with shared file lock */
94*4a5d661aSToomas Soome #define	O_EXLOCK	0x0020		/* open with exclusive file lock */
95*4a5d661aSToomas Soome #define	O_ASYNC		0x0040		/* signal pgrp when data ready */
96*4a5d661aSToomas Soome #define	O_FSYNC		0x0080		/* synchronous writes */
97*4a5d661aSToomas Soome #endif
98*4a5d661aSToomas Soome #define	O_SYNC		0x0080		/* POSIX synonym for O_FSYNC */
99*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809
100*4a5d661aSToomas Soome #define	O_NOFOLLOW	0x0100		/* don't follow symlinks */
101*4a5d661aSToomas Soome #endif
102*4a5d661aSToomas Soome #define	O_CREAT		0x0200		/* create if nonexistent */
103*4a5d661aSToomas Soome #define	O_TRUNC		0x0400		/* truncate to zero length */
104*4a5d661aSToomas Soome #define	O_EXCL		0x0800		/* error if already exists */
105*4a5d661aSToomas Soome #ifdef _KERNEL
106*4a5d661aSToomas Soome #define	FHASLOCK	0x4000		/* descriptor holds advisory lock */
107*4a5d661aSToomas Soome #endif
108*4a5d661aSToomas Soome 
109*4a5d661aSToomas Soome /* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
110*4a5d661aSToomas Soome #define	O_NOCTTY	0x8000		/* don't assign controlling terminal */
111*4a5d661aSToomas Soome 
112*4a5d661aSToomas Soome #if __BSD_VISIBLE
113*4a5d661aSToomas Soome /* Attempt to bypass buffer cache */
114*4a5d661aSToomas Soome #define	O_DIRECT	0x00010000
115*4a5d661aSToomas Soome #endif
116*4a5d661aSToomas Soome 
117*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809
118*4a5d661aSToomas Soome #define	O_DIRECTORY	0x00020000	/* Fail if not directory */
119*4a5d661aSToomas Soome #define	O_EXEC		0x00040000	/* Open for execute only */
120*4a5d661aSToomas Soome #endif
121*4a5d661aSToomas Soome #ifdef	_KERNEL
122*4a5d661aSToomas Soome #define	FEXEC		O_EXEC
123*4a5d661aSToomas Soome #endif
124*4a5d661aSToomas Soome 
125*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809
126*4a5d661aSToomas Soome /* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
127*4a5d661aSToomas Soome #define	O_TTY_INIT	0x00080000	/* Restore default termios attributes */
128*4a5d661aSToomas Soome 
129*4a5d661aSToomas Soome #define	O_CLOEXEC	0x00100000
130*4a5d661aSToomas Soome #endif
131*4a5d661aSToomas Soome 
132*4a5d661aSToomas Soome #if __BSD_VISIBLE
133*4a5d661aSToomas Soome #define	O_VERIFY	0x00200000	/* open only after verification */
134*4a5d661aSToomas Soome #endif
135*4a5d661aSToomas Soome 
136*4a5d661aSToomas Soome /*
137*4a5d661aSToomas Soome  * XXX missing O_DSYNC, O_RSYNC.
138*4a5d661aSToomas Soome  */
139*4a5d661aSToomas Soome 
140*4a5d661aSToomas Soome #ifdef _KERNEL
141*4a5d661aSToomas Soome 
142*4a5d661aSToomas Soome /* Only for devfs d_close() flags. */
143*4a5d661aSToomas Soome #define	FLASTCLOSE	O_DIRECTORY
144*4a5d661aSToomas Soome #define	FREVOKE		O_VERIFY
145*4a5d661aSToomas Soome /* Only for fo_close() from half-succeeded open */
146*4a5d661aSToomas Soome #define	FOPENFAILED	O_TTY_INIT
147*4a5d661aSToomas Soome 
148*4a5d661aSToomas Soome /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
149*4a5d661aSToomas Soome #define	FFLAGS(oflags)	((oflags) & O_EXEC ? (oflags) : (oflags) + 1)
150*4a5d661aSToomas Soome #define	OFLAGS(fflags)	((fflags) & O_EXEC ? (fflags) : (fflags) - 1)
151*4a5d661aSToomas Soome 
152*4a5d661aSToomas Soome /* bits to save after open */
153*4a5d661aSToomas Soome #define	FMASK	(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
154*4a5d661aSToomas Soome /* bits settable by fcntl(F_SETFL, ...) */
155*4a5d661aSToomas Soome #define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT)
156*4a5d661aSToomas Soome 
157*4a5d661aSToomas Soome #if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \
158*4a5d661aSToomas Soome     defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4)
159*4a5d661aSToomas Soome /*
160*4a5d661aSToomas Soome  * Set by shm_open(3) in older libc's to get automatic MAP_ASYNC
161*4a5d661aSToomas Soome  * behavior for POSIX shared memory objects (which are otherwise
162*4a5d661aSToomas Soome  * implemented as plain files).
163*4a5d661aSToomas Soome  */
164*4a5d661aSToomas Soome #define	FPOSIXSHM	O_NOFOLLOW
165*4a5d661aSToomas Soome #undef FCNTLFLAGS
166*4a5d661aSToomas Soome #define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \
167*4a5d661aSToomas Soome 			 O_DIRECT)
168*4a5d661aSToomas Soome #endif
169*4a5d661aSToomas Soome #endif
170*4a5d661aSToomas Soome 
171*4a5d661aSToomas Soome /*
172*4a5d661aSToomas Soome  * The O_* flags used to have only F* names, which were used in the kernel
173*4a5d661aSToomas Soome  * and by fcntl.  We retain the F* names for the kernel f_flag field
174*4a5d661aSToomas Soome  * and for backward compatibility for fcntl.  These flags are deprecated.
175*4a5d661aSToomas Soome  */
176*4a5d661aSToomas Soome #if __BSD_VISIBLE
177*4a5d661aSToomas Soome #define	FAPPEND		O_APPEND	/* kernel/compat */
178*4a5d661aSToomas Soome #define	FASYNC		O_ASYNC		/* kernel/compat */
179*4a5d661aSToomas Soome #define	FFSYNC		O_FSYNC		/* kernel */
180*4a5d661aSToomas Soome #define	FNONBLOCK	O_NONBLOCK	/* kernel */
181*4a5d661aSToomas Soome #define	FNDELAY		O_NONBLOCK	/* compat */
182*4a5d661aSToomas Soome #define	O_NDELAY	O_NONBLOCK	/* compat */
183*4a5d661aSToomas Soome #endif
184*4a5d661aSToomas Soome 
185*4a5d661aSToomas Soome /*
186*4a5d661aSToomas Soome  * We are out of bits in f_flag (which is a short).  However,
187*4a5d661aSToomas Soome  * the flag bits not set in FMASK are only meaningful in the
188*4a5d661aSToomas Soome  * initial open syscall.  Those bits can thus be given a
189*4a5d661aSToomas Soome  * different meaning for fcntl(2).
190*4a5d661aSToomas Soome  */
191*4a5d661aSToomas Soome #if __BSD_VISIBLE
192*4a5d661aSToomas Soome /* Read ahead */
193*4a5d661aSToomas Soome #define	FRDAHEAD	O_CREAT
194*4a5d661aSToomas Soome #endif
195*4a5d661aSToomas Soome 
196*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809
197*4a5d661aSToomas Soome /*
198*4a5d661aSToomas Soome  * Magic value that specify the use of the current working directory
199*4a5d661aSToomas Soome  * to determine the target of relative file paths in the openat() and
200*4a5d661aSToomas Soome  * similar syscalls.
201*4a5d661aSToomas Soome  */
202*4a5d661aSToomas Soome #define	AT_FDCWD		-100
203*4a5d661aSToomas Soome 
204*4a5d661aSToomas Soome /*
205*4a5d661aSToomas Soome  * Miscellaneous flags for the *at() syscalls.
206*4a5d661aSToomas Soome  */
207*4a5d661aSToomas Soome #define	AT_EACCESS		0x100	/* Check access using effective user and group ID */
208*4a5d661aSToomas Soome #define	AT_SYMLINK_NOFOLLOW	0x200   /* Do not follow symbolic links */
209*4a5d661aSToomas Soome #define	AT_SYMLINK_FOLLOW	0x400	/* Follow symbolic link */
210*4a5d661aSToomas Soome #define	AT_REMOVEDIR		0x800	/* Remove directory instead of file */
211*4a5d661aSToomas Soome #endif
212*4a5d661aSToomas Soome 
213*4a5d661aSToomas Soome /*
214*4a5d661aSToomas Soome  * Constants used for fcntl(2)
215*4a5d661aSToomas Soome  */
216*4a5d661aSToomas Soome 
217*4a5d661aSToomas Soome /* command values */
218*4a5d661aSToomas Soome #define	F_DUPFD		0		/* duplicate file descriptor */
219*4a5d661aSToomas Soome #define	F_GETFD		1		/* get file descriptor flags */
220*4a5d661aSToomas Soome #define	F_SETFD		2		/* set file descriptor flags */
221*4a5d661aSToomas Soome #define	F_GETFL		3		/* get file status flags */
222*4a5d661aSToomas Soome #define	F_SETFL		4		/* set file status flags */
223*4a5d661aSToomas Soome #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
224*4a5d661aSToomas Soome #define	F_GETOWN	5		/* get SIGIO/SIGURG proc/pgrp */
225*4a5d661aSToomas Soome #define	F_SETOWN	6		/* set SIGIO/SIGURG proc/pgrp */
226*4a5d661aSToomas Soome #endif
227*4a5d661aSToomas Soome #if __BSD_VISIBLE
228*4a5d661aSToomas Soome #define	F_OGETLK	7		/* get record locking information */
229*4a5d661aSToomas Soome #define	F_OSETLK	8		/* set record locking information */
230*4a5d661aSToomas Soome #define	F_OSETLKW	9		/* F_SETLK; wait if blocked */
231*4a5d661aSToomas Soome #define	F_DUP2FD	10		/* duplicate file descriptor to arg */
232*4a5d661aSToomas Soome #endif
233*4a5d661aSToomas Soome #define	F_GETLK		11		/* get record locking information */
234*4a5d661aSToomas Soome #define	F_SETLK		12		/* set record locking information */
235*4a5d661aSToomas Soome #define	F_SETLKW	13		/* F_SETLK; wait if blocked */
236*4a5d661aSToomas Soome #if __BSD_VISIBLE
237*4a5d661aSToomas Soome #define	F_SETLK_REMOTE	14		/* debugging support for remote locks */
238*4a5d661aSToomas Soome #define	F_READAHEAD	15		/* read ahead */
239*4a5d661aSToomas Soome #define	F_RDAHEAD	16		/* Darwin compatible read ahead */
240*4a5d661aSToomas Soome #endif
241*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809
242*4a5d661aSToomas Soome #define	F_DUPFD_CLOEXEC	17		/* Like F_DUPFD, but FD_CLOEXEC is set */
243*4a5d661aSToomas Soome #endif
244*4a5d661aSToomas Soome #if __BSD_VISIBLE
245*4a5d661aSToomas Soome #define	F_DUP2FD_CLOEXEC 18		/* Like F_DUP2FD, but FD_CLOEXEC is set */
246*4a5d661aSToomas Soome #endif
247*4a5d661aSToomas Soome 
248*4a5d661aSToomas Soome /* file descriptor flags (F_GETFD, F_SETFD) */
249*4a5d661aSToomas Soome #define	FD_CLOEXEC	1		/* close-on-exec flag */
250*4a5d661aSToomas Soome 
251*4a5d661aSToomas Soome /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
252*4a5d661aSToomas Soome #define	F_RDLCK		1		/* shared or read lock */
253*4a5d661aSToomas Soome #define	F_UNLCK		2		/* unlock */
254*4a5d661aSToomas Soome #define	F_WRLCK		3		/* exclusive or write lock */
255*4a5d661aSToomas Soome #if __BSD_VISIBLE
256*4a5d661aSToomas Soome #define	F_UNLCKSYS	4		/* purge locks for a given system ID */
257*4a5d661aSToomas Soome #define	F_CANCEL	5		/* cancel an async lock request */
258*4a5d661aSToomas Soome #endif
259*4a5d661aSToomas Soome #ifdef _KERNEL
260*4a5d661aSToomas Soome #define	F_WAIT		0x010		/* Wait until lock is granted */
261*4a5d661aSToomas Soome #define	F_FLOCK		0x020	 	/* Use flock(2) semantics for lock */
262*4a5d661aSToomas Soome #define	F_POSIX		0x040	 	/* Use POSIX semantics for lock */
263*4a5d661aSToomas Soome #define	F_REMOTE	0x080		/* Lock owner is remote NFS client */
264*4a5d661aSToomas Soome #define	F_NOINTR	0x100		/* Ignore signals when waiting */
265*4a5d661aSToomas Soome #endif
266*4a5d661aSToomas Soome 
267*4a5d661aSToomas Soome /*
268*4a5d661aSToomas Soome  * Advisory file segment locking data type -
269*4a5d661aSToomas Soome  * information passed to system by user
270*4a5d661aSToomas Soome  */
271*4a5d661aSToomas Soome struct flock {
272*4a5d661aSToomas Soome 	off_t	l_start;	/* starting offset */
273*4a5d661aSToomas Soome 	off_t	l_len;		/* len = 0 means until end of file */
274*4a5d661aSToomas Soome 	pid_t	l_pid;		/* lock owner */
275*4a5d661aSToomas Soome 	short	l_type;		/* lock type: read/write, etc. */
276*4a5d661aSToomas Soome 	short	l_whence;	/* type of l_start */
277*4a5d661aSToomas Soome 	int	l_sysid;	/* remote system id or zero for local */
278*4a5d661aSToomas Soome };
279*4a5d661aSToomas Soome 
280*4a5d661aSToomas Soome #if __BSD_VISIBLE
281*4a5d661aSToomas Soome /*
282*4a5d661aSToomas Soome  * Old advisory file segment locking data type,
283*4a5d661aSToomas Soome  * before adding l_sysid.
284*4a5d661aSToomas Soome  */
285*4a5d661aSToomas Soome struct __oflock {
286*4a5d661aSToomas Soome 	off_t	l_start;	/* starting offset */
287*4a5d661aSToomas Soome 	off_t	l_len;		/* len = 0 means until end of file */
288*4a5d661aSToomas Soome 	pid_t	l_pid;		/* lock owner */
289*4a5d661aSToomas Soome 	short	l_type;		/* lock type: read/write, etc. */
290*4a5d661aSToomas Soome 	short	l_whence;	/* type of l_start */
291*4a5d661aSToomas Soome };
292*4a5d661aSToomas Soome #endif
293*4a5d661aSToomas Soome 
294*4a5d661aSToomas Soome #if __BSD_VISIBLE
295*4a5d661aSToomas Soome /* lock operations for flock(2) */
296*4a5d661aSToomas Soome #define	LOCK_SH		0x01		/* shared file lock */
297*4a5d661aSToomas Soome #define	LOCK_EX		0x02		/* exclusive file lock */
298*4a5d661aSToomas Soome #define	LOCK_NB		0x04		/* don't block when locking */
299*4a5d661aSToomas Soome #define	LOCK_UN		0x08		/* unlock file */
300*4a5d661aSToomas Soome #endif
301*4a5d661aSToomas Soome 
302*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112
303*4a5d661aSToomas Soome /*
304*4a5d661aSToomas Soome  * Advice to posix_fadvise
305*4a5d661aSToomas Soome  */
306*4a5d661aSToomas Soome #define	POSIX_FADV_NORMAL	0	/* no special treatment */
307*4a5d661aSToomas Soome #define	POSIX_FADV_RANDOM	1	/* expect random page references */
308*4a5d661aSToomas Soome #define	POSIX_FADV_SEQUENTIAL	2	/* expect sequential page references */
309*4a5d661aSToomas Soome #define	POSIX_FADV_WILLNEED	3	/* will need these pages */
310*4a5d661aSToomas Soome #define	POSIX_FADV_DONTNEED	4	/* dont need these pages */
311*4a5d661aSToomas Soome #define	POSIX_FADV_NOREUSE	5	/* access data only once */
312*4a5d661aSToomas Soome #endif
313*4a5d661aSToomas Soome 
314*4a5d661aSToomas Soome #ifndef _KERNEL
315*4a5d661aSToomas Soome __BEGIN_DECLS
316*4a5d661aSToomas Soome int	open(const char *, int, ...);
317*4a5d661aSToomas Soome int	creat(const char *, mode_t);
318*4a5d661aSToomas Soome int	fcntl(int, int, ...);
319*4a5d661aSToomas Soome #if __BSD_VISIBLE
320*4a5d661aSToomas Soome int	flock(int, int);
321*4a5d661aSToomas Soome #endif
322*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809
323*4a5d661aSToomas Soome int	openat(int, const char *, int, ...);
324*4a5d661aSToomas Soome #endif
325*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112
326*4a5d661aSToomas Soome int	posix_fadvise(int, off_t, off_t, int);
327*4a5d661aSToomas Soome int	posix_fallocate(int, off_t, off_t);
328*4a5d661aSToomas Soome #endif
329*4a5d661aSToomas Soome __END_DECLS
330*4a5d661aSToomas Soome #endif
331*4a5d661aSToomas Soome 
332*4a5d661aSToomas Soome #endif /* !_SYS_FCNTL_H_ */
333