qplatformdefs.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2015 The Qt Company Ltd.
  4. ** Contact: http://www.qt.io/licensing/
  5. **
  6. ** This file is part of the qmake spec of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:LGPL21$
  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 http://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at http://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 2.1 or version 3 as published by the Free
  20. ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
  21. ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
  22. ** following information to ensure the GNU Lesser General Public License
  23. ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
  24. ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  25. **
  26. ** As a special exception, The Qt Company gives you certain additional
  27. ** rights. These rights are described in The Qt Company LGPL Exception
  28. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  29. **
  30. ** $QT_END_LICENSE$
  31. **
  32. ****************************************************************************/
  33. #ifndef QPLATFORMDEFS_H
  34. #define QPLATFORMDEFS_H
  35. #define QT_QPA_DEFAULT_PLATFORM_NAME "android"
  36. // Get Qt defines/settings
  37. #include "qglobal.h"
  38. // Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
  39. // 1) need to reset default environment if _BSD_SOURCE is defined
  40. // 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
  41. // 3) it seems older glibc need this to include the X/Open stuff
  42. #include <unistd.h>
  43. // We are hot - unistd.h should have turned on the specific APIs we requested
  44. #include <features.h>
  45. #include <pthread.h>
  46. #include <dirent.h>
  47. #include <fcntl.h>
  48. #include <grp.h>
  49. #include <pwd.h>
  50. #include <signal.h>
  51. #include <dlfcn.h>
  52. #include <sys/types.h>
  53. #include <sys/ioctl.h>
  54. #include <sys/ipc.h>
  55. #include <sys/time.h>
  56. #include <sys/socket.h>
  57. #include <sys/stat.h>
  58. #include <sys/wait.h>
  59. #ifndef QT_NO_IPV6IFNAME
  60. #include <net/if.h>
  61. #endif
  62. #ifndef _GNU_SOURCE
  63. # define _GNU_SOURCE
  64. #endif
  65. #ifdef QT_LARGEFILE_SUPPORT
  66. #define QT_STATBUF struct stat64
  67. #define QT_STATBUF4TSTAT struct stat64
  68. #define QT_STAT ::stat64
  69. #define QT_FSTAT ::fstat64
  70. #define QT_LSTAT ::lstat64
  71. #define QT_OPEN ::open64
  72. #define QT_TRUNCATE ::truncate64
  73. #define QT_FTRUNCATE ::ftruncate64
  74. #define QT_LSEEK ::lseek64
  75. #else
  76. #define QT_STATBUF struct stat
  77. #define QT_STATBUF4TSTAT struct stat
  78. #define QT_STAT ::stat
  79. #define QT_FSTAT ::fstat
  80. #define QT_LSTAT ::lstat
  81. #define QT_OPEN ::open
  82. #define QT_TRUNCATE ::truncate
  83. #define QT_FTRUNCATE ::ftruncate
  84. #define QT_LSEEK ::lseek
  85. #endif
  86. #ifdef QT_LARGEFILE_SUPPORT
  87. #define QT_FOPEN ::fopen64
  88. #define QT_FSEEK ::fseeko64
  89. #define QT_FTELL ::ftello64
  90. #define QT_FGETPOS ::fgetpos64
  91. #define QT_FSETPOS ::fsetpos64
  92. #define QT_MMAP ::mmap64
  93. #define QT_FPOS_T fpos64_t
  94. #define QT_OFF_T off64_t
  95. #else
  96. #define QT_FOPEN ::fopen
  97. #define QT_FSEEK ::fseek
  98. #define QT_FTELL ::ftell
  99. #define QT_FGETPOS ::fgetpos
  100. #define QT_FSETPOS ::fsetpos
  101. #define QT_MMAP ::mmap
  102. #define QT_FPOS_T fpos_t
  103. #define QT_OFF_T long
  104. #endif
  105. #define QT_STAT_REG S_IFREG
  106. #define QT_STAT_DIR S_IFDIR
  107. #define QT_STAT_MASK S_IFMT
  108. #define QT_STAT_LNK S_IFLNK
  109. #define QT_SOCKET_CONNECT ::connect
  110. #define QT_SOCKET_BIND ::bind
  111. #define QT_FILENO fileno
  112. #define QT_CLOSE ::close
  113. #define QT_READ ::read
  114. #define QT_WRITE ::write
  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. #define QT_OPEN_LARGEFILE O_LARGEFILE
  121. #define QT_OPEN_RDONLY O_RDONLY
  122. #define QT_OPEN_WRONLY O_WRONLY
  123. #define QT_OPEN_RDWR O_RDWR
  124. #define QT_OPEN_CREAT O_CREAT
  125. #define QT_OPEN_TRUNC O_TRUNC
  126. #define QT_OPEN_APPEND O_APPEND
  127. // Directory iteration
  128. #define QT_DIR DIR
  129. #define QT_OPENDIR ::opendir
  130. #define QT_CLOSEDIR ::closedir
  131. #if defined(QT_LARGEFILE_SUPPORT) \
  132. && defined(QT_USE_XOPEN_LFS_EXTENSIONS) \
  133. && !defined(QT_NO_READDIR64)
  134. #define QT_DIRENT struct dirent64
  135. #define QT_READDIR ::readdir64
  136. #define QT_READDIR_R ::readdir64_r
  137. #else
  138. #define QT_DIRENT struct dirent
  139. #define QT_READDIR ::readdir
  140. #define QT_READDIR_R ::readdir_r
  141. #endif
  142. #define QT_SOCKET_CONNECT ::connect
  143. #define QT_SOCKET_BIND ::bind
  144. #define QT_SIGNAL_RETTYPE void
  145. #define QT_SIGNAL_ARGS int
  146. #define QT_SIGNAL_IGNORE SIG_IGN
  147. #define QT_SOCKLEN_T socklen_t
  148. #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
  149. #define QT_SNPRINTF ::snprintf
  150. #define QT_VSNPRINTF ::vsnprintf
  151. #endif
  152. #endif // QPLATFORMDEFS_H