1 --- qt-copy/tools/tools.pro.orig 2005-05-13 16:39:18.000000000 +0200
2 +++ qt-copy/tools/tools.pro 2005-05-13 20:02:31.761482520 +0200
10 contains(QT_EDITION, Console) {
11 SUBDIRS += designer/src/uitools # Linguist depends on this
13 diff -Nur qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock.cpp qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock.cpp
14 --- qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock.cpp 1970-01-01 01:00:00.000000000 +0100
15 +++ qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock.cpp 2006-07-02 11:35:54.386518000 +0200
17 +/****************************************************************************
19 +** Copyright (C) 1992-2006 Trolltech AS. All rights reserved.
21 +** This file is part of the QtGui module of the Qt Toolkit.
23 +** This file may be used under the terms of the GNU General Public
24 +** License version 2.0 as published by the Free Software Foundation
25 +** and appearing in the file LICENSE.GPL included in the packaging of
26 +** this file. Please review the following information to ensure GNU
27 +** General Public Licensing requirements will be met:
28 +** http://www.trolltech.com/products/qt/opensource.html
30 +** If you are unsure which license is appropriate for your use, please
31 +** review the following information:
32 +** http://www.trolltech.com/products/qt/licensing.html or contact the
33 +** sales department at sales@trolltech.com.
35 +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
36 +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
38 +****************************************************************************/
42 +#ifndef QT_NO_QWS_MULTIPROCESS
45 +#include <sys/types.h>
46 +#if defined(Q_OS_DARWIN)
47 +#define Q_NO_SEMAPHORE
48 +#include <sys/stat.h>
49 +#include <sys/file.h>
52 +#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) \
53 + || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_BSDI)
54 +/* union semun is defined by including <sys/sem.h> */
56 +/* according to X/OPEN we have to define it ourselves */
58 + int val; /* value for SETVAL */
59 + struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
60 + unsigned short *array; /* array for GETALL, SETALL */
69 +#define MAX_LOCKS 200 // maximum simultaneous read locks
74 +#ifdef Q_NO_SEMAPHORE
85 + \class QLock qlock_p.h
86 + \brief The QLock class is a wrapper for a System V shared semaphore.
93 + It is used by \l {Qtopia Core} for synchronizing access to the graphics
94 + card and shared memory region between processes.
105 + \fn QLock::QLock(const QString &filename, char id, bool create)
107 + Creates a lock. \a filename is the file path of the Unix-domain
108 + socket the \l {Qtopia Core} client is using. \a id is the name of the
109 + particular lock to be created on that socket. If \a create is true
110 + the lock is to be created (as the \l {Qtopia Core} server does); if \a
111 + create is false the lock should exist already (as the \l {Qtopia Core}
115 +QLock::QLock(const QString &filename, char id, bool create)
117 +#ifdef QT_NO_QWS_MULTIPROCESS
118 + Q_UNUSED(filename);
122 + data = new QLockData;
124 +#ifdef Q_NO_SEMAPHORE
125 + data->file = QString(filename+id).toLocal8Bit().constData();
126 + for(int x = 0; x < 2; x++) {
127 + data->id = open(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
128 + if(data->id != -1 || !create) {
134 + key_t semkey = ftok(filename.toLocal8Bit().constData(), id);
135 + data->id = semget(semkey,0,0);
136 + data->owned = create;
138 + semun arg; arg.val = 0;
139 + if (data->id != -1)
140 + semctl(data->id,0,IPC_RMID,arg);
141 + data->id = semget(semkey,1,IPC_CREAT|0600);
142 + arg.val = MAX_LOCKS;
143 + semctl(data->id,0,SETVAL,arg);
146 + if (data->id == -1) {
147 + qWarning("Cannot %s semaphore %s '%c'", (create ? "create" : "get"),
148 + qPrintable(filename), id);
149 + qDebug() << "Error" << errno << strerror(errno);
155 + \fn QLock::~QLock()
162 +#ifndef QT_NO_QWS_MULTIPROCESS
165 +#ifdef Q_NO_SEMAPHORE
169 + unlink(data->file);
173 + semun arg; arg.val = 0;
174 + semctl(data->id, 0, IPC_RMID, arg);
182 + \fn bool QLock::isValid() const
184 + Returns true if the lock constructor was successful; returns false if
185 + the lock could not be created or was not available to connect to.
188 +bool QLock::isValid() const
190 +#ifndef QT_NO_QWS_MULTIPROCESS
191 + return (data->id != -1);
198 + Locks the semaphore with a lock of type \a t. Locks can either be
199 + \c Read or \c Write. If a lock is \c Read, attempts by other
200 + processes to obtain \c Read locks will succeed, and \c Write
201 + attempts will block until the lock is unlocked. If locked as \c
202 + Write, all attempts to lock by other processes will block until
203 + the lock is unlocked. Locks are stacked: i.e. a given QLock can be
204 + locked multiple times by the same process without blocking, and
205 + will only be unlocked after a corresponding number of unlock()
209 +void QLock::lock(Type t)
211 +#ifdef QT_NO_QWS_MULTIPROCESS
214 + if (!data->count) {
215 +#ifdef Q_NO_SEMAPHORE
219 + for(int rv=1; rv;) {
220 + rv = flock(data->id, op);
221 + if (rv == -1 && errno != EINTR)
222 + qDebug("Semop lock failure %s",strerror(errno));
227 + sops.sem_flg = SEM_UNDO;
230 + sops.sem_op = -MAX_LOCKS;
239 + rv = semop(data->id,&sops,1);
240 + if (rv == -1 && errno != EINTR)
241 + qDebug("Semop lock failure %s",strerror(errno));
242 + } while (rv == -1 && errno == EINTR);
250 + \fn void QLock::unlock()
252 + Unlocks the semaphore. If other processes were blocking waiting to
253 + lock() the semaphore, one of them will wake up and succeed in
257 +void QLock::unlock()
259 +#ifndef QT_NO_QWS_MULTIPROCESS
263 +#ifdef Q_NO_SEMAPHORE
264 + for(int rv=1; rv;) {
265 + rv = flock(data->id, LOCK_UN);
266 + if (rv == -1 && errno != EINTR)
267 + qDebug("Semop lock failure %s",strerror(errno));
273 + sops.sem_flg = SEM_UNDO;
275 + sops.sem_op = MAX_LOCKS;
279 + rv = semop(data->id,&sops,1);
280 + if (rv == -1 && errno != EINTR)
281 + qDebug("Semop unlock failure %s",strerror(errno));
282 + } while (rv == -1 && errno == EINTR);
286 + qDebug("Unlock without corresponding lock");
292 + \fn bool QLock::locked() const
294 + Returns true if the lock is currently held by the current process;
295 + otherwise returns false.
298 +bool QLock::locked() const
300 +#ifndef QT_NO_QWS_MULTIPROCESS
301 + return (data->count > 0);
306 diff -Nur qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock_p.h qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock_p.h
307 --- qt-x11-opensource-src-4.1.4/src/gui/embedded.orig/qlock_p.h 1970-01-01 01:00:00.000000000 +0100
308 +++ qt-x11-opensource-src-4.1.4/src/gui/embedded/qlock_p.h 2006-07-02 11:36:23.952365750 +0200
310 +/****************************************************************************
312 +** Copyright (C) 1992-2006 Trolltech AS. All rights reserved.
314 +** This file is part of the QtGui module of the Qt Toolkit.
316 +** This file may be used under the terms of the GNU General Public
317 +** License version 2.0 as published by the Free Software Foundation
318 +** and appearing in the file LICENSE.GPL included in the packaging of
319 +** this file. Please review the following information to ensure GNU
320 +** General Public Licensing requirements will be met:
321 +** http://www.trolltech.com/products/qt/opensource.html
323 +** If you are unsure which license is appropriate for your use, please
324 +** review the following information:
325 +** http://www.trolltech.com/products/qt/licensing.html or contact the
326 +** sales department at sales@trolltech.com.
328 +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
329 +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
331 +****************************************************************************/
340 +// This file is not part of the Qt API. This header file may
341 +// change from version to version without notice, or even be
347 +#include "QtCore/qstring.h"
351 +class Q_GUI_EXPORT QLock
354 + QLock(const QString &filename, char id, bool create = false);
357 + enum Type { Read, Write };
359 + bool isValid() const;
360 + void lock(Type type);
362 + bool locked() const;
370 +// Nice class for ensuring the lock is released.
371 +// Just create one on the stack and the lock is automatically released
372 +// when QLockHandle is destructed.
373 +class Q_GUI_EXPORT QLockHandle
376 + QLockHandle(QLock *l, QLock::Type type) : qlock(l) { qlock->lock(type); }
377 + ~QLockHandle() { if (locked()) qlock->unlock(); }
379 + void lock(QLock::Type type) { qlock->lock(type); }
380 + void unlock() { qlock->unlock(); }
381 + bool locked() const { return qlock->locked(); }