1 /* $OpenBSD: linux_fcntl.h,v 1.3 2002/02/04 20:04:52 provos Exp $ */
2 /* $NetBSD: linux_fcntl.h,v 1.1 1995/02/28 23:25:40 fvdl Exp $ */
3
4 /*
5 * Copyright (c) 1995 Frank van der Linden
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed for the NetBSD Project
19 * by Frank van der Linden
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /*
36 * Various flag values used in Linux for open(2) and fcntl(2).
37 */
38
39 #ifndef _LINUX_FCNTL_H
40 #define _LINUX_FCNTL_H
41
42 /* read/write mode for open(2) (as usual) */
43 #define LINUX_O_RDONLY 0x0000
44 #define LINUX_O_WRONLY 0x0001
45 #define LINUX_O_RDWR 0x0002
46 #define LINUX_O_ACCMODE 0x0003
47
48 /* flags used in open(2) */
49 #define LINUX_O_CREAT 0x0040
50 #define LINUX_O_EXCL 0x0080
51 #define LINUX_O_NOCTTY 0x0100
52 #define LINUX_O_TRUNC 0x0200
53 #define LINUX_O_APPEND 0x0400
54 #define LINUX_O_NDELAY 0x0800
55 #define LINUX_O_SYNC 0x1000
56
57 #define LINUX_FASYNC 0x2000
58
59 /* fcntl(2) operations */
60 #define LINUX_F_DUPFD 0
61 #define LINUX_F_GETFD 1
62 #define LINUX_F_SETFD 2
63 #define LINUX_F_GETFL 3
64 #define LINUX_F_SETFL 4
65 #define LINUX_F_GETLK 5
66 #define LINUX_F_SETLK 6
67 #define LINUX_F_SETLKW 7
68 #define LINUX_F_SETOWN 8
69 #define LINUX_F_GETOWN 9
70
71 #define LINUX_F_GETLK64 12
72 #define LINUX_F_SETLK64 13
73 #define LINUX_F_SETLKW64 14
74
75 #define LINUX_F_RDLCK 0
76 #define LINUX_F_WRLCK 1
77 #define LINUX_F_UNLCK 2
78
79 #define LINUX_LOCK_EX 4
80 #define LINUX_LOCK_SH 8
81
82 /*
83 * The arguments in the flock structure have a different order from the
84 * BSD structure.
85 */
86
87 struct linux_flock {
88 short l_type;
89 short l_whence;
90 linux_off_t l_start;
91 linux_off_t l_len;
92 linux_pid_t l_pid;
93 };
94
95 struct linux_flock64 {
96 short l_type;
97 short l_whence;
98 linux_loff_t l_start;
99 linux_loff_t l_len;
100 linux_pid_t l_pid;
101 };
102
103 #endif /* _LINUX_FCNTL_H */