00001 /**************************************************************************** 00002 ** $Id: qsharedmemory_p.h,v 1.2 2003/07/10 02:40:11 llornkcor Exp $ 00003 ** 00004 ** Includes system files for shared memory 00005 ** 00006 ** Created : 020124 00007 ** 00008 ** Copyright (C) 2002 Trolltech AS. All rights reserved. 00009 ** 00010 ** This file is part of the kernel module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed and/or modified under the terms of the 00013 ** GNU General Public License version 2 as published by the Free Software 00014 ** Foundation and appearing in the file LICENSE.GPL included in the 00015 ** packaging of this file. 00016 ** 00017 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00018 ** licenses for Qt/Embedded may use this file in accordance with the 00019 ** Qt Embedded Commercial License Agreement provided with the Software. 00020 ** 00021 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00022 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00023 ** 00024 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00025 ** information about Qt Commercial License Agreements. 00026 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00027 ** 00028 ** Contact info@trolltech.com if any conditions of this licensing are 00029 ** not clear to you. 00030 ** 00031 **********************************************************************/ 00032 00033 #ifndef QSHAREDMEMORY_P_H 00034 #define QSHAREDMEMORY_P_H 00035 00036 // 00037 // W A R N I N G 00038 // ------------- 00039 // 00040 // This file is not part of the Qt API. It exists for the convenience 00041 // of qapplication_qws.cpp and qgfxvnc_qws.cpp. This header file may 00042 // change from version to version without notice, or even be removed. 00043 // 00044 // We mean it. 00045 // 00046 // 00047 00048 #include <qstring.h> 00049 00050 #if !defined (QT_QWS_NO_SHM) 00051 00052 #include <sys/types.h> 00053 #include <sys/ipc.h> 00054 00055 class QSharedMemory { 00056 public: 00057 QSharedMemory(){}; 00058 QSharedMemory(int, QString, char c = 'Q'); 00059 ~QSharedMemory(){}; 00060 00061 bool create(); 00062 void destroy(); 00063 00064 bool attach(); 00065 void detach(); 00066 00067 void setPermissions(mode_t mode); 00068 int size(); 00069 void * base() { return shmBase; }; 00070 00071 private: 00072 void *shmBase; 00073 int shmSize; 00074 QString shmFile; 00075 char character; 00076 #if defined(QT_POSIX_QSHM) 00077 int shmFD; 00078 #else 00079 int shmId; 00080 key_t key; 00081 int idInitted; 00082 #endif 00083 }; 00084 00085 #endif 00086 00087 #endif
1.4.2