~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to mkspecs/solaris-g++/qplatformdefs.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef QPLATFORMDEFS_H
 
2
#define QPLATFORMDEFS_H
 
3
 
 
4
// Get Qt defines/settings
 
5
 
 
6
#include "qglobal.h"
 
7
 
 
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
 
11
#endif
 
12
 
 
13
#include <unistd.h>
 
14
 
 
15
 
 
16
// We are hot - unistd.h should have turned on the specific APIs we requested
 
17
 
 
18
 
 
19
#include <pthread.h>
 
20
#include <dirent.h>
 
21
#include <fcntl.h>
 
22
#include <grp.h>
 
23
#include <pwd.h>
 
24
#include <signal.h>
 
25
#include <dlfcn.h>
 
26
 
 
27
#include <sys/types.h>
 
28
#include <sys/ioctl.h>
 
29
#include <sys/filio.h>
 
30
#include <sys/ipc.h>
 
31
#include <sys/time.h>
 
32
#include <sys/shm.h>
 
33
#include <sys/socket.h>
 
34
#include <sys/stat.h>
 
35
#include <sys/wait.h>
 
36
#include <netinet/in.h>
 
37
 
 
38
 
 
39
 
 
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
 
46
#else
 
47
// always this case in practice
 
48
#define QT_SOCKLEN_T            int
 
49
#endif
 
50
 
 
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); }
 
54
#if defined (connect)
 
55
# undef connect
 
56
#endif
 
57
 
 
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); }
 
61
#if defined(bind)
 
62
# undef bind
 
63
#endif
 
64
 
 
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
 
 
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
 
108
 
 
109
#define QT_SIGNAL_RETTYPE       void
 
110
#define QT_SIGNAL_ARGS          int
 
111
#define QT_SIGNAL_IGNORE        SIG_IGN
 
112
 
 
113
#if !defined(_XOPEN_UNIX)
 
114
// Solaris 2.5.1
 
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);
 
123
#endif
 
124
 
 
125
#if defined(_XOPEN_UNIX)
 
126
// Solaris 2.6 and better
 
127
#define QT_SNPRINTF             ::snprintf
 
128
#define QT_VSNPRINTF            ::vsnprintf
 
129
#endif
 
130
 
 
131
#endif // QPLATFORMDEFS_H