[MKISOFS]
[reactos.git] / reactos / sdk / tools / mkisofs / schilytools / include / schily / fcntl.h
1 /* @(#)fcntl.h 1.19 11/10/19 Copyright 1996-2011 J. Schilling */
2 /*
3 * Generic header for users of open(), creat() and chmod()
4 *
5 * Copyright (c) 1996-2011 J. Schilling
6 */
7 /*
8 * The contents of this file are subject to the terms of the
9 * Common Development and Distribution License, Version 1.0 only
10 * (the "License"). You may not use this file except in compliance
11 * with the License.
12 *
13 * See the file CDDL.Schily.txt in this distribution for details.
14 *
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file CDDL.Schily.txt from this distribution.
17 */
18
19 #ifndef _SCHILY_FCNTL_H
20 #define _SCHILY_FCNTL_H
21
22 #ifndef _SCHILY_MCONFIG_H
23 #include <schily/mconfig.h>
24 #endif
25
26 #ifndef _SCHILY_TYPES_H
27 #include <schily/types.h> /* Needed for fcntl.h */
28 #endif
29
30 #ifndef _SCHILY_STAT_H
31 #include <schily/stat.h> /* For 3rd arg of open() and chmod() */
32 #endif
33
34 #ifdef HAVE_SYS_FILE_H
35 /*
36 * Historical systems with flock() only need sys/file.h
37 */
38 # ifndef _INCL_SYS_FILE_H
39 # include <sys/file.h>
40 # define _INCL_SYS_FILE_H
41 # endif
42 #endif
43 #ifdef HAVE_FCNTL_H
44 # ifndef _INCL_FCNTL_H
45 # include <fcntl.h>
46 # define _INCL_FCNTL_H
47 #endif
48 #endif
49
50 /*
51 * Do not define more than O_RDONLY / O_WRONLY / O_RDWR / O_BINARY
52 * The values may differ.
53 *
54 * O_BINARY is defined here to allow all applications to compile on a non DOS
55 * environment without repeating this definition.
56 * O_SEARCH, O_DIRECTORY and NOFOLLOW are defined here to allow to compile on
57 * older platforms.
58 * open(name, O_SEARCH) is like UNOS open(name, "") (open neither for read nor
59 * for write). This allows to call fstat() and to get an fd for openat(fd, ...)
60 */
61 #ifndef O_RDONLY
62 # define O_RDONLY 0
63 #endif
64 #ifndef O_WRONLY
65 # define O_WRONLY 1
66 #endif
67 #ifndef O_RDWR
68 # define O_RDWR 2
69 #endif
70 #ifndef O_BINARY /* Only present on DOS or similar */
71 # define O_BINARY 0
72 #endif
73 #ifndef O_NDELAY /* This is undefined on BeOS :-( */
74 # define O_NDELAY 0
75 #endif
76 #ifndef O_EXEC /* Open for exec only (non-directory) */
77 # define O_EXEC O_RDONLY
78 #endif
79 #ifndef O_SEARCH /* Open for search only. */
80 # define O_SEARCH O_RDONLY
81 #endif
82 #ifndef O_DIRECTORY /* Fail if not a directory */
83 # define O_DIRECTORY 0
84 #endif
85 #ifndef O_NOFOLLOW /* Fail if a symlink */
86 # define O_NOFOLLOW 0
87 #endif
88
89 #ifndef O_ACCMODE
90 #define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR|O_EXEC|O_SEARCH)
91 #endif
92
93 #ifdef O_NOATIME /* Allow #ifdef O_NOATIME */
94 #define _O_NOATIME O_NOATIME
95 #else
96 #define _O_NOATIME 0
97 #endif
98
99 #ifndef FD_CLOEXEC
100 #define FD_CLOEXEC 1 /* close on exec flag */
101 #endif
102
103 /*
104 * The following definitions are used for emulating the *at() functions.
105 * We use higher numbers for our definitions, to allow to add emulations
106 * for missing functions without causing a clash with system definitions.
107 */
108 #ifndef HAVE_OPENAT
109 #ifndef AT_FDCWD
110 #define AT_FDCWD 0xffd19553 /* *at() to working dir */
111 #endif
112 #endif
113 #ifndef HAVE_FSTATAT
114 #ifndef AT_SYMLINK_NOFOLLOW
115 #define AT_SYMLINK_NOFOLLOW 0x10000 /* emulate lstat() */
116 #endif
117 #endif
118 #ifndef HAVE_UNLINKAT
119 #ifndef AT_REMOVEDIR
120 #define AT_REMOVEDIR 0x20000 /* emulate rmdir() */
121 #endif
122 #endif
123 #ifndef HAVE_FACCESSAT
124 #ifndef AT_EACCESS
125 #define AT_EACCESS 0x40000 /* EUID access() */
126 #endif
127 #endif
128 #ifndef HAVE_LINKAT
129 #ifndef AT_SYMLINK_FOLLOW
130 #define AT_SYMLINK_FOLLOW 0x80000 /* follow symlinks before link() */
131 #endif
132 #endif
133
134 #endif /* _SCHILY_FCNTL_H */