1/*-
2 * Copyright (c) 1998 Mark Newton
3 * Copyright (c) 1994 Christos Zoulas
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 *    derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30
31#ifndef	_SVR4_FCNTL_H_
32#define	_SVR4_FCNTL_H_
33
34#include <compat/svr4/svr4_types.h>
35#include <sys/fcntl.h>
36
37#define	SVR4_O_RDONLY		0x0000
38#define	SVR4_O_WRONLY		0x0001
39#define	SVR4_O_RDWR		0x0002
40#define	SVR4_O_ACCMODE		0x0003
41#define	SVR4_O_NDELAY		0x0004
42#define	SVR4_O_APPEND		0x0008
43#define	SVR4_O_SYNC		0x0010
44#define	SVR4_O_NONBLOCK		0x0080
45#define	SVR4_O_CREAT		0x0100
46#define	SVR4_O_TRUNC		0x0200
47#define	SVR4_O_EXCL		0x0400
48#define	SVR4_O_NOCTTY		0x0800
49#define	SVR4_O_PRIV		0x1000
50
51
52#define	SVR4_FD_CLOEXEC		1
53
54#define	SVR4_F_DUPFD		0
55#define	SVR4_F_GETFD		1
56#define	SVR4_F_SETFD		2
57#define	SVR4_F_GETFL		3
58#define	SVR4_F_SETFL		4
59#define	SVR4_F_GETLK_SVR3	5
60#define	SVR4_F_SETLK		6
61#define	SVR4_F_SETLKW		7
62#define	SVR4_F_CHKFL		8
63#define SVR4_F_DUP2FD		9
64#define	SVR4_F_ALLOCSP		10
65#define	SVR4_F_FREESP		11
66
67#define SVR4_F_ISSTREAM		13
68#define	SVR4_F_GETLK		14
69#define	SVR4_F_PRIV		15
70#define	SVR4_F_NPRIV		16
71#define	SVR4_F_QUOTACTL		17
72#define	SVR4_F_BLOCKS		18
73#define	SVR4_F_BLKSIZE		19
74#define SVR4_F_RSETLK		20
75#define SVR4_F_RGETLK		21
76#define SVR4_F_RSETLKW		22
77#define	SVR4_F_GETOWN		23
78#define	SVR4_F_SETOWN		24
79#define	SVR4_F_REVOKE		25
80#define SVR4_F_HASREMOTELOCKS	26
81#define SVR4_F_FREESP64		27
82
83#define SVR4_F_GETLK64		33
84#define SVR4_F_SETLK64		34
85#define SVR4_F_SETLKW64		35
86
87#define SVR4_F_SHARE		40
88#define SVR4_F_UNSHARE		41
89
90#define SVR4_F_CHSIZE_XENIX	0x6000
91#define SVR4_F_RDCHK_XENIX	0x6001
92#define SVR4_F_LK_UNLCK_XENIX	0x6300
93#define SVR4_F_LK_LOCK_XENIX	0x7200
94#define SVR4_F_LK_NBLCK_XENIX	0x6200
95#define SVR4_F_LK_RLCK_XENIX	0x7100
96#define SVR4_F_LK_NBRLCK_XENIX	0x6100
97
98#define SVR4_LK_CMDTYPE(x)   (((x) >> 12) & 0x7)
99#define SVR4_LK_LCKTYPE(x)   (((x) >> 8) & 0x7)
100
101#define	SVR4_F_RDLCK	1
102#define	SVR4_F_WRLCK	2
103#define	SVR4_F_UNLCK	3
104
105struct svr4_flock_svr3 {
106	short		l_type;
107	short		l_whence;
108	svr4_off_t	l_start;
109	svr4_off_t	l_len;
110	short		l_sysid;
111	svr4_o_pid_t	l_pid;
112};
113
114
115struct svr4_flock {
116	short		l_type;
117	short		l_whence;
118	svr4_off_t	l_start;
119	svr4_off_t	l_len;
120	long		l_sysid;
121	svr4_pid_t	l_pid;
122	long		pad[4];
123};
124
125struct svr4_flock64 {
126	short		l_type;
127	short		l_whence;
128	svr4_off64_t	l_start;
129	svr4_off64_t	l_len;
130	long		l_sysid;
131	svr4_pid_t	l_pid;
132	long		pad[4];
133};
134#endif /* !_SVR4_FCNTL_H_ */
135