00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (qt-info@nokia.com) 00006 ** 00007 ** This file is part of the QtCore module of the Qt Toolkit. 00008 ** 00009 ** $QT_BEGIN_LICENSE:LGPL$ 00010 ** Commercial Usage 00011 ** Licensees holding valid Qt Commercial licenses may use this file in 00012 ** accordance with the Qt Commercial License Agreement provided with the 00013 ** Software or, alternatively, in accordance with the terms contained in 00014 ** a written agreement between you and Nokia. 00015 ** 00016 ** GNU Lesser General Public License Usage 00017 ** Alternatively, this file may be used under the terms of the GNU Lesser 00018 ** General Public License version 2.1 as published by the Free Software 00019 ** Foundation and appearing in the file LICENSE.LGPL included in the 00020 ** packaging of this file. Please review the following information to 00021 ** ensure the GNU Lesser General Public License version 2.1 requirements 00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00023 ** 00024 ** In addition, as a special exception, Nokia gives you certain additional 00025 ** rights. These rights are described in the Nokia Qt LGPL Exception 00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module. 00027 ** 00028 ** GNU General Public License Usage 00029 ** Alternatively, this file may be used under the terms of the GNU 00030 ** General Public License version 3.0 as published by the Free Software 00031 ** Foundation and appearing in the file LICENSE.GPL included in the 00032 ** packaging of this file. Please review the following information to 00033 ** ensure the GNU General Public License version 3.0 requirements will be 00034 ** met: http://www.gnu.org/copyleft/gpl.html. 00035 ** 00036 ** If you have questions regarding the use of this file, please contact 00037 ** Nokia at qt-info@nokia.com. 00038 ** $QT_END_LICENSE$ 00039 ** 00040 ****************************************************************************/ 00041 00042 #ifndef QFUNCTIONS_VXWORKS_H 00043 #define QFUNCTIONS_VXWORKS_H 00044 #ifdef Q_OS_VXWORKS 00045 00046 #include <unistd.h> 00047 #include <pthread.h> 00048 #include <dirent.h> 00049 #include <signal.h> 00050 #include <string.h> 00051 #include <strings.h> 00052 #include <errno.h> 00053 #include <sys/types.h> 00054 #include <sys/ioctl.h> 00055 #include <sys/times.h> 00056 #include <sys/socket.h> 00057 #include <sys/stat.h> 00058 #include <sys/wait.h> 00059 #include <netinet/in.h> 00060 #ifndef QT_NO_IPV6IFNAME 00061 #include <net/if.h> 00062 #endif 00063 00064 QT_BEGIN_HEADER 00065 QT_BEGIN_NAMESPACE 00066 00067 #ifdef QT_BUILD_CORE_LIB 00068 QT_MODULE(Core) 00069 #endif 00070 00071 QT_END_NAMESPACE 00072 QT_END_HEADER 00073 00074 00075 #ifndef RTLD_LOCAL 00076 #define RTLD_LOCAL 0 00077 #endif 00078 00079 #ifndef NSIG 00080 #define NSIG _NSIGS 00081 #endif 00082 00083 #ifdef __cplusplus 00084 extern "C" { 00085 #endif 00086 00087 // isascii is missing (sometimes!!) 00088 #ifndef isascii 00089 inline int isascii(int c) { return (c & 0x7f); } 00090 #endif 00091 00092 // no lfind() - used by the TIF image format 00093 void *lfind(const void* key, const void* base, size_t* elements, size_t size, 00094 int (*compare)(const void*, const void*)); 00095 00096 // no rand_r(), but rand() 00097 // NOTE: this implementation is wrong for multi threaded applications, 00098 // but there is no way to get it right on VxWorks (in kernel mode) 00099 int rand_r(unsigned int * /*seedp*/); 00100 00101 // no usleep() support 00102 int usleep(unsigned int); 00103 00104 // gettimeofday() is declared, but is missing from the library. 00105 // It IS however defined in the Curtis-Wright X11 libraries, so 00106 // we have to make the symbol 'weak' 00107 int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak)); 00108 00109 // neither getpagesize() or sysconf(_SC_PAGESIZE) are available 00110 int getpagesize(); 00111 00112 // symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) 00113 int symlink(const char *, const char *); 00114 ssize_t readlink(const char *, char *, size_t); 00115 00116 // there's no truncate(), but ftruncate() support... 00117 int truncate(const char *path, off_t length); 00118 00119 // VxWorks doesn't know about passwd & friends. 00120 // in order to avoid patching the unix fs path everywhere 00121 // we introduce some dummy functions that simulate a single 00122 // 'root' user on the system. 00123 00124 uid_t getuid(); 00125 gid_t getgid(); 00126 uid_t geteuid(); 00127 00128 struct passwd { 00129 char *pw_name; /* user name */ 00130 char *pw_passwd; /* user password */ 00131 uid_t pw_uid; /* user ID */ 00132 gid_t pw_gid; /* group ID */ 00133 char *pw_gecos; /* real name */ 00134 char *pw_dir; /* home directory */ 00135 char *pw_shell; /* shell program */ 00136 }; 00137 00138 struct group { 00139 char *gr_name; /* group name */ 00140 char *gr_passwd; /* group password */ 00141 gid_t gr_gid; /* group ID */ 00142 char **gr_mem; /* group members */ 00143 }; 00144 00145 struct passwd *getpwuid(uid_t uid); 00146 struct group *getgrgid(gid_t gid); 00147 00148 #ifdef __cplusplus 00149 } // extern "C" 00150 #endif 00151 00152 #endif // Q_OS_VXWORKS 00153 #endif // QFUNCTIONS_VXWORKS_H