2 This file is part of the KDE libraries
3 Copyright (C) 2001 Waldo Bastian <bastian@kde.org>
4 Copyright (C) 2004 Jarosław Staniek <staniek@kde.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
26 * \brief This file provides portable defines for file support.
28 * Use the KDE_xxx defines instead of the normal C
29 * functions and structures.
35 #if defined _WIN32 || defined _WIN64
36 #include <kde_file_win.h>
39 /* added not for Solaris and OpenSolaris platforms */
41 #if (defined _LFS64_LARGEFILE) && (defined _LARGEFILE64_SOURCE) && (!defined _GNU_SOURCE) && (!defined __sun)
43 * This section provides portable defines for large file support.
44 * To use this you must compile your code with _LARGEFILE64_SOURCE
45 * defined and use the KDE_xxx defines instead of the normal
46 * C functions and structures.
48 * Please note that not every platform supports 64 bit file structures,
49 * in that case the normal 32 bit functions will be used.
51 * @see http://www.suse.de/~aj/linux_lfs.html
52 * @see http://ftp.sas.com/standards/large.file/xopen/x_open.05Mar96.html
54 * KDE makes use of the "Transitional Extensions" since we can not ensure
55 * that all modules and libraries used by KDE will be compiled with
57 * (A.3.2.3 Mixed API and Compile Environments within a Single Process)
59 #define KDE_stat ::stat64
60 #define KDE_lstat ::lstat64
61 #define KDE_fstat ::fstat64
62 #define KDE_open ::open64
63 #define KDE_lseek ::lseek64
64 #define KDE_fseek ::fseek64
65 #define KDE_ftell ::ftell64
66 #define KDE_fgetpos ::fgetpos64
67 #define KDE_fsetpos ::fsetpos64
68 #define KDE_readdir ::readdir64
69 #define KDE_sendfile ::sendfile64
70 #define KDE_struct_stat struct stat64
71 #define KDE_struct_dirent struct dirent64
72 #define KDE_rename ::rename
73 #define KDE_mkdir ::mkdir
74 /* TODO: define for win32 */
76 #else /* !_LFS64_LARGEFILE */
79 * This section defines portable defines for standard file support.
83 Platform specific definitions for Solaris and OpenSolaris tested with gcc 4.3.2
86 #define KDE_stat ::stat
87 #define KDE_lstat ::lstat
88 #define KDE_fstat ::fstat
89 #define KDE_open ::open
90 #define KDE_lseek ::lseek
91 #define KDE_fseek ::fseek
92 #define KDE_ftell ::ftell
93 #define KDE_fgetpos ::fgetpos
94 #define KDE_fsetpos ::fsetpos
95 #define KDE_readdir ::readdir
96 #define KDE_sendfile ::sendfile
97 #define KDE_struct_stat struct stat
98 #define KDE_struct_dirent struct dirent
99 #define KDE_rename ::rename
100 #define KDE_mkdir ::mkdir
104 #if defined _WIN32 || defined _WIN64
105 #define KDE_stat kdewin32_stat
106 #define KDE_lstat kdewin32_lstat
107 #define KDE_open kdewin32_open
108 #define KDE_rename kdewin32_rename
109 #define KDE_mkdir kdewin32_mkdir
111 #define KDE_stat ::stat
112 #define KDE_lstat ::lstat
113 #define KDE_open ::open
114 #define KDE_rename ::rename
115 #define KDE_mkdir ::mkdir
118 #define KDE_fstat ::fstat
119 #define KDE_lseek ::lseek
120 #define KDE_fseek ::fseek
121 #define KDE_ftell ::ftell
122 #define KDE_fgetpos ::fgetpos
123 #define KDE_fsetpos ::fsetpos
124 #define KDE_readdir ::readdir
125 #define KDE_sendfile ::sendfile
126 #define KDE_struct_stat struct stat
127 #define KDE_struct_dirent struct dirent
131 #define KDE_fopen ::fopen64
132 #define KDE_freopen ::freopen64
133 /* TODO: define for win32 */
135 #if defined _WIN32 || defined _WIN64
136 #define KDE_fopen kdewin32_fopen
137 #define KDE_freopen kdewin32_freopen
139 #define KDE_fopen ::fopen
144 /* functions without 64-bit version but wrapped for compatibility reasons */
145 #if defined _WIN32 || defined _WIN64
146 #define KDE_fdopen kdewin32_fdopen
147 #define KDE_signal kdewin32_signal
149 #define KDE_fdopen ::fdopen
150 #define KDE_signal ::signal
154 #if defined _WIN32 || defined _WIN64
155 #define KPATH_SEPARATOR ';'
156 #define KDIR_SEPARATOR '\\' /* faster than QDir::separator() */
159 #define O_BINARY 0 /* for open() */
161 #define KPATH_SEPARATOR ':'
162 #define KDIR_SEPARATOR '/' /* faster than QDir::separator() */
165 #endif /* _KDE_FILE_H_ */