1
#ifndef QPLATFORMDEFS_H
2
#define QPLATFORMDEFS_H
4
// Get Qt defines/settings
8
// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
9
#ifndef _POSIX_PTHREAD_SEMANTICS
10
#define _POSIX_PTHREAD_SEMANTICS
16
// We are hot - unistd.h should have turned on the specific APIs we requested
27
#include <sys/types.h>
28
#include <sys/ioctl.h>
29
#include <sys/filio.h>
33
#include <sys/socket.h>
36
#include <netinet/in.h>
40
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE-0 >= 500) && (_XOPEN_VERSION-0 >= 500)
41
// Solaris 7 and better with specific feature test macros
42
#define QT_SOCKLEN_T socklen_t
43
#elif defined(_XOPEN_SOURCE_EXTENDED) && defined(_XOPEN_UNIX)
44
// Solaris 2.6 and better with specific feature test macros
45
#define QT_SOCKLEN_T size_t
47
// always this case in practice
48
#define QT_SOCKLEN_T int
51
// Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED
52
static inline int qt_socket_connect(int s, struct sockaddr *addr, QT_SOCKLEN_T addrlen)
53
{ return ::connect(s, addr, addrlen); }
58
// Solaris redefines bind -> __xnet_bind with _XOPEN_SOURCE_EXTENDED
59
static inline int qt_socket_bind(int s, struct sockaddr *addr, QT_SOCKLEN_T addrlen)
60
{ return ::bind(s, addr, addrlen); }
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
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
87
#define QT_STAT_REG S_IFREG
88
#define QT_STAT_DIR S_IFDIR
89
#define QT_STAT_MASK S_IFMT
90
#define QT_STAT_LNK S_IFLNK
91
#define QT_SOCKET_CONNECT qt_socket_connect
92
#define QT_SOCKET_BIND qt_socket_bind
93
#define QT_FILENO fileno
94
#define QT_CLOSE ::close
95
#define QT_READ ::read
96
#define QT_WRITE ::write
97
#define QT_ACCESS ::access
98
#define QT_GETCWD ::getcwd
99
#define QT_CHDIR ::chdir
100
#define QT_MKDIR ::mkdir
101
#define QT_RMDIR ::rmdir
102
#define QT_OPEN_RDONLY O_RDONLY
103
#define QT_OPEN_WRONLY O_WRONLY
104
#define QT_OPEN_RDWR O_RDWR
105
#define QT_OPEN_CREAT O_CREAT
106
#define QT_OPEN_TRUNC O_TRUNC
107
#define QT_OPEN_APPEND O_APPEND
109
#define QT_SIGNAL_RETTYPE void
110
#define QT_SIGNAL_ARGS int
111
#define QT_SIGNAL_IGNORE SIG_IGN
113
#if !defined(_XOPEN_UNIX)
115
// Function usleep() is defined in C library but not declared in header files
116
// on Solaris 2.5.1. Not really a surprise, usleep() is specified by XPG4v2
117
// and XPG4v2 is only supported by Solaris 2.6 and better.
118
// Function gethostname() is also defined in C library but not declared in
119
// header files on Solaris 2.5.1.
120
typedef unsigned int useconds_t;
121
extern "C" int usleep(useconds_t);
122
extern "C" int gethostname(char *, int);
125
#if defined(_XOPEN_UNIX)
126
// Solaris 2.6 and better
127
#define QT_SNPRINTF ::snprintf
128
#define QT_VSNPRINTF ::vsnprintf
131
#endif // QPLATFORMDEFS_H