blob: b402aab29bd3f47654d0ea37814279b871d9d687 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
This file is part of the KDE libraries
Copyright (C) 2001 Waldo Bastian <bastian@kde.org>
Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KDE_FILE_H_
#define _KDE_FILE_H_
/**
* \file kde_file.h
* \brief This file provides portable defines for file support.
*
* Use the KDE_xxx defines instead of the normal C
* functions and structures.
* \since 3.3
*/
#include <unistd.h>
#ifdef _WIN32
#include <kde_file_win.h>
#endif
#if (defined _LFS64_LARGEFILE) && (defined _LARGEFILE64_SOURCE)
/*
* This section provides portable defines for large file support.
* To use this you must compile your code with _LARGEFILE64_SOURCE
* defined and use the KDE_xxx defines instead of the normal
* C functions and structures.
*
* Please note that not every platform supports 64 bit file structures,
* in that case the normal 32 bit functions will be used.
*
* @see http://www.suse.de/~aj/linux_lfs.html
* @see http://ftp.sas.com/standards/large.file/xopen/x_open.05Mar96.html
*
* KDE makes use of the "Transitional Extensions" since we can not ensure
* that all modules and libraries used by KDE will be compiled with
* 64-bit support.
* (A.3.2.3 Mixed API and Compile Environments within a Single Process)
*/
#define KDE_stat ::stat64
#define KDE_lstat ::lstat64
#define KDE_fstat ::fstat64
#define KDE_open ::open64
#define KDE_lseek ::lseek64
#define KDE_fseek ::fseek64
#define KDE_ftell ::ftell64
#define KDE_fgetpos ::fgetpos64
#define KDE_fsetpos ::fsetpos64
#define KDE_readdir ::readdir64
#define KDE_sendfile ::sendfile64
#define KDE_struct_stat struct stat64
#define KDE_struct_dirent struct dirent64
#define KDE_rename ::rename
#define KDE_mkdir ::mkdir
/* TODO: define for win32 */
#else /* !_LFS64_LARGEFILE */
/*
* This section defines portable defines for standard file support.
*/
#ifdef _WIN32
#define KDE_stat kdewin32_stat
#define KDE_lstat kdewin32_lstat
#define KDE_open kdewin32_open
#define KDE_rename kdewin32_rename
#define KDE_mkdir kdewin32_mkdir
#else /* unix */
#define KDE_stat ::stat
#define KDE_lstat ::lstat
#define KDE_open ::open
#define KDE_rename ::rename
#define KDE_mkdir ::mkdir
#endif
#define KDE_fstat ::fstat
#define KDE_lseek ::lseek
#define KDE_fseek ::fseek
#define KDE_ftell ::ftell
#define KDE_fgetpos ::fgetpos
#define KDE_fsetpos ::fsetpos
#define KDE_readdir ::readdir
#define KDE_sendfile ::sendfile
#define KDE_struct_stat struct stat
#define KDE_struct_dirent struct dirent
#endif
#ifdef _LFS64_STDIO
#define KDE_fopen ::fopen64
#define KDE_freopen ::freopen64
/* TODO: define for win32 */
#else
#ifdef _WIN32
#define KDE_fopen kdewin32_fopen
#define KDE_freopen kdewin32_freopen
#else /* unix */
#define KDE_fopen ::fopen
#endif
#endif
/* functions without 64-bit version but wrapped for compatibility reasons */
#ifdef _WIN32
#define KDE_fdopen kdewin32_fdopen
#else /* unix */
#define KDE_fdopen ::fdopen
#endif
#endif /* _KDE_FILE_H_ */
|