| 1 |
/**************************************************************************** |
| 2 |
** |
| 3 |
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). |
| 4 |
** All rights reserved. |
| 5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
| 6 |
** |
| 7 |
** This file is part of the QtCore module of the Qt Toolkit. |
| 8 |
** |
| 9 |
** $QT_BEGIN_LICENSE:LGPL$ |
| 10 |
** GNU Lesser General Public License Usage |
| 11 |
** This file may be used under the terms of the GNU Lesser General Public |
| 12 |
** License version 2.1 as published by the Free Software Foundation and |
| 13 |
** appearing in the file LICENSE.LGPL included in the packaging of this |
| 14 |
** file. Please review the following information to ensure the GNU Lesser |
| 15 |
** General Public License version 2.1 requirements will be met: |
| 16 |
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 17 |
** |
| 18 |
** In addition, as a special exception, Nokia gives you certain additional |
| 19 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
| 20 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 21 |
** |
| 22 |
** GNU General Public License Usage |
| 23 |
** Alternatively, this file may be used under the terms of the GNU General |
| 24 |
** Public License version 3.0 as published by the Free Software Foundation |
| 25 |
** and appearing in the file LICENSE.GPL included in the packaging of this |
| 26 |
** file. Please review the following information to ensure the GNU General |
| 27 |
** Public License version 3.0 requirements will be met: |
| 28 |
** http://www.gnu.org/copyleft/gpl.html. |
| 29 |
** |
| 30 |
** Other Usage |
| 31 |
** Alternatively, this file may be used in accordance with the terms and |
| 32 |
** conditions contained in a signed written agreement between you and Nokia. |
| 33 |
** |
| 34 |
** |
| 35 |
** |
| 36 |
** |
| 37 |
** |
| 38 |
** $QT_END_LICENSE$ |
| 39 |
** |
| 40 |
****************************************************************************/ |
| 41 |
|
| 42 |
#ifndef QFUNCTIONS_VXWORKS_H |
| 43 |
#define QFUNCTIONS_VXWORKS_H |
| 44 |
#ifdef Q_OS_VXWORKS |
| 45 |
|
| 46 |
#include <unistd.h> |
| 47 |
#include <pthread.h> |
| 48 |
#include <dirent.h> |
| 49 |
#include <signal.h> |
| 50 |
#include <string.h> |
| 51 |
#include <strings.h> |
| 52 |
#include <errno.h> |
| 53 |
#include <sys/types.h> |
| 54 |
#include <sys/ioctl.h> |
| 55 |
#include <sys/times.h> |
| 56 |
#include <sys/socket.h> |
| 57 |
#include <sys/stat.h> |
| 58 |
#include <sys/wait.h> |
| 59 |
#include <netinet/in.h> |
| 60 |
#ifndef QT_NO_IPV6IFNAME |
| 61 |
#include <net/if.h> |
| 62 |
#endif |
| 63 |
|
| 64 |
QT_BEGIN_HEADER |
| 65 |
QT_BEGIN_NAMESPACE |
| 66 |
|
| 67 |
#ifdef QT_BUILD_CORE_LIB |
| 68 |
QT_MODULE(Core) |
| 69 |
#endif |
| 70 |
|
| 71 |
QT_END_NAMESPACE |
| 72 |
QT_END_HEADER |
| 73 |
|
| 74 |
|
| 75 |
#ifndef RTLD_LOCAL |
| 76 |
#define RTLD_LOCAL 0 |
| 77 |
#endif |
| 78 |
|
| 79 |
#ifndef NSIG |
| 80 |
#define NSIG _NSIGS |
| 81 |
#endif |
| 82 |
|
| 83 |
#ifdef __cplusplus |
| 84 |
extern "C" { |
| 85 |
#endif |
| 86 |
|
| 87 |
// isascii is missing (sometimes!!) |
| 88 |
#ifndef isascii |
| 89 |
inline int isascii(int c) { return (c & 0x7f); } |
| 90 |
#endif |
| 91 |
|
| 92 |
// no lfind() - used by the TIF image format |
| 93 |
void *lfind(const void* key, const void* base, size_t* elements, size_t size, |
| 94 |
int (*compare)(const void*, const void*)); |
| 95 |
|
| 96 |
// no rand_r(), but rand() |
| 97 |
// NOTE: this implementation is wrong for multi threaded applications, |
| 98 |
// but there is no way to get it right on VxWorks (in kernel mode) |
| 99 |
int rand_r(unsigned int * /*seedp*/); |
| 100 |
|
| 101 |
// no usleep() support |
| 102 |
int usleep(unsigned int); |
| 103 |
|
| 104 |
// gettimeofday() is declared, but is missing from the library. |
| 105 |
// It IS however defined in the Curtis-Wright X11 libraries, so |
| 106 |
// we have to make the symbol 'weak' |
| 107 |
int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak)); |
| 108 |
|
| 109 |
// neither getpagesize() or sysconf(_SC_PAGESIZE) are available |
| 110 |
int getpagesize(); |
| 111 |
|
| 112 |
// symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) |
| 113 |
int symlink(const char *, const char *); |
| 114 |
ssize_t readlink(const char *, char *, size_t); |
| 115 |
|
| 116 |
// there's no truncate(), but ftruncate() support... |
| 117 |
int truncate(const char *path, off_t length); |
| 118 |
|
| 119 |
// VxWorks doesn't know about passwd & friends. |
| 120 |
// in order to avoid patching the unix fs path everywhere |
| 121 |
// we introduce some dummy functions that simulate a single |
| 122 |
// 'root' user on the system. |
| 123 |
|
| 124 |
uid_t getuid(); |
| 125 |
gid_t getgid(); |
| 126 |
uid_t geteuid(); |
| 127 |
|
| 128 |
struct passwd { |
| 129 |
char *pw_name; /* user name */ |
| 130 |
char *pw_passwd; /* user password */ |
| 131 |
uid_t pw_uid; /* user ID */ |
| 132 |
gid_t pw_gid; /* group ID */ |
| 133 |
char *pw_gecos; /* real name */ |
| 134 |
char *pw_dir; /* home directory */ |
| 135 |
char *pw_shell; /* shell program */ |
| 136 |
}; |
| 137 |
|
| 138 |
struct group { |
| 139 |
char *gr_name; /* group name */ |
| 140 |
char *gr_passwd; /* group password */ |
| 141 |
gid_t gr_gid; /* group ID */ |
| 142 |
char **gr_mem; /* group members */ |
| 143 |
}; |
| 144 |
|
| 145 |
struct passwd *getpwuid(uid_t uid); |
| 146 |
struct group *getgrgid(gid_t gid); |
| 147 |
|
| 148 |
#ifdef __cplusplus |
| 149 |
} // extern "C" |
| 150 |
#endif |
| 151 |
|
| 152 |
#endif // Q_OS_VXWORKS |
| 153 |
#endif // QFUNCTIONS_VXWORKS_H |