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