1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the qmake spec of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef Q_POSIX_QPLATFORMDEFS_H |
41 | #define Q_POSIX_QPLATFORMDEFS_H |
42 | |
43 | #include <signal.h> |
44 | |
45 | #include <sys/types.h> |
46 | #ifndef QT_NO_SOCKET_H |
47 | # include <sys/socket.h> |
48 | #endif |
49 | #include <sys/stat.h> |
50 | |
51 | #if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT) |
52 | |
53 | #define QT_STATBUF struct stat64 |
54 | #define QT_FPOS_T fpos64_t |
55 | #define QT_OFF_T off64_t |
56 | |
57 | #define QT_STAT ::stat64 |
58 | #define QT_LSTAT ::lstat64 |
59 | #define QT_TRUNCATE ::truncate64 |
60 | |
61 | // File I/O |
62 | #define QT_OPEN ::open64 |
63 | #define QT_LSEEK ::lseek64 |
64 | #define QT_FSTAT ::fstat64 |
65 | #define QT_FTRUNCATE ::ftruncate64 |
66 | |
67 | // Standard C89 |
68 | #define QT_FOPEN ::fopen64 |
69 | #define QT_FSEEK ::fseeko64 |
70 | #define QT_FTELL ::ftello64 |
71 | #define QT_FGETPOS ::fgetpos64 |
72 | #define QT_FSETPOS ::fsetpos64 |
73 | |
74 | #define QT_MMAP ::mmap64 |
75 | |
76 | #else // !defined(QT_USE_XOPEN_LFS_EXTENSIONS) || !defined(QT_LARGEFILE_SUPPORT) |
77 | |
78 | #include "../c89/qplatformdefs.h" |
79 | |
80 | #define QT_STATBUF struct stat |
81 | |
82 | #define QT_STAT ::stat |
83 | #define QT_LSTAT ::lstat |
84 | #define QT_TRUNCATE ::truncate |
85 | |
86 | // File I/O |
87 | #define QT_OPEN ::open |
88 | #define QT_LSEEK ::lseek |
89 | #define QT_FSTAT ::fstat |
90 | #define QT_FTRUNCATE ::ftruncate |
91 | |
92 | // Posix extensions to C89 |
93 | #if !defined(QT_USE_XOPEN_LFS_EXTENSIONS) && !defined(QT_NO_USE_FSEEKO) |
94 | #undef QT_OFF_T |
95 | #undef QT_FSEEK |
96 | #undef QT_FTELL |
97 | |
98 | #define QT_OFF_T off_t |
99 | |
100 | #define QT_FSEEK ::fseeko |
101 | #define QT_FTELL ::ftello |
102 | #endif |
103 | |
104 | #define QT_MMAP ::mmap |
105 | |
106 | #endif // !defined (QT_USE_XOPEN_LFS_EXTENSIONS) || !defined(QT_LARGEFILE_SUPPORT) |
107 | |
108 | #define QT_STAT_MASK S_IFMT |
109 | #define QT_STAT_REG S_IFREG |
110 | #define QT_STAT_DIR S_IFDIR |
111 | #define QT_STAT_LNK S_IFLNK |
112 | |
113 | #define QT_ACCESS ::access |
114 | #define QT_GETCWD ::getcwd |
115 | #define QT_CHDIR ::chdir |
116 | #define QT_MKDIR ::mkdir |
117 | #define QT_RMDIR ::rmdir |
118 | |
119 | // File I/O |
120 | #define QT_CLOSE ::close |
121 | #define QT_READ ::read |
122 | #define QT_WRITE ::write |
123 | |
124 | #define QT_OPEN_LARGEFILE O_LARGEFILE |
125 | #define QT_OPEN_RDONLY O_RDONLY |
126 | #define QT_OPEN_WRONLY O_WRONLY |
127 | #define QT_OPEN_RDWR O_RDWR |
128 | #define QT_OPEN_CREAT O_CREAT |
129 | #define QT_OPEN_TRUNC O_TRUNC |
130 | #define QT_OPEN_APPEND O_APPEND |
131 | #define QT_OPEN_EXCL O_EXCL |
132 | |
133 | // Posix extensions to C89 |
134 | #define QT_FILENO fileno |
135 | |
136 | // Directory iteration |
137 | #define QT_DIR DIR |
138 | |
139 | #define QT_OPENDIR ::opendir |
140 | #define QT_CLOSEDIR ::closedir |
141 | |
142 | #if defined(QT_LARGEFILE_SUPPORT) \ |
143 | && defined(QT_USE_XOPEN_LFS_EXTENSIONS) \ |
144 | && !defined(QT_NO_READDIR64) |
145 | #define QT_DIRENT struct dirent64 |
146 | #define QT_READDIR ::readdir64 |
147 | #define QT_READDIR_R ::readdir64_r |
148 | #else |
149 | #define QT_DIRENT struct dirent |
150 | #define QT_READDIR ::readdir |
151 | #define QT_READDIR_R ::readdir_r |
152 | #endif |
153 | |
154 | #define QT_SOCKLEN_T socklen_t |
155 | |
156 | #define QT_SOCKET_CONNECT ::connect |
157 | #define QT_SOCKET_BIND ::bind |
158 | |
159 | #define QT_SIGNAL_RETTYPE void |
160 | #define QT_SIGNAL_ARGS int |
161 | #define QT_SIGNAL_IGNORE SIG_IGN |
162 | |
163 | #endif // include guard |
164 | |