diff options
-rw-r--r-- | tools/qvfb/qvfbmmap.cpp | 2 | ||||
-rw-r--r-- | tools/qvfb/qvfbshmem.cpp | 25 | ||||
-rw-r--r-- | tools/qvfb/qvfbview.cpp | 5 |
3 files changed, 6 insertions, 26 deletions
diff --git a/tools/qvfb/qvfbmmap.cpp b/tools/qvfb/qvfbmmap.cpp index 7e80e37..01c1d9c 100644 --- a/tools/qvfb/qvfbmmap.cpp +++ b/tools/qvfb/qvfbmmap.cpp @@ -48,9 +48,7 @@ #include <unistd.h> #include <sys/ipc.h> #include <sys/types.h> -#include <sys/shm.h> #include <sys/stat.h> -#include <sys/sem.h> #include <sys/mman.h> #include <fcntl.h> #include <errno.h> diff --git a/tools/qvfb/qvfbshmem.cpp b/tools/qvfb/qvfbshmem.cpp index b05b69c..c17a680 100644 --- a/tools/qvfb/qvfbshmem.cpp +++ b/tools/qvfb/qvfbshmem.cpp @@ -39,10 +39,9 @@ ** ****************************************************************************/ -#include "qlock_p.h" - #include "qvfbshmem.h" -#include "qvfbhdr.h" +#include <qvfbhdr.h> +#include <private/qlock_p.h> #include <QFile> #include <QTimer> @@ -53,8 +52,6 @@ #include <sys/types.h> #include <sys/shm.h> #include <sys/stat.h> -#include <sys/sem.h> -#include <sys/mman.h> #include <fcntl.h> #include <errno.h> #include <math.h> @@ -143,20 +140,10 @@ QShMemViewProtocol::QShMemViewProtocol(int displayid, const QSize &s, qws_dataDir(displayid); - QString oldPipe = "/tmp/qtembedded-" + username + "/" + QString("QtEmbedded-%1").arg(displayid); - int oldPipeSemkey = ftok(oldPipe.toLatin1().constData(), 'd'); - if (oldPipeSemkey != -1) { - int oldPipeLockId = semget(oldPipeSemkey, 0, 0); - if (oldPipeLockId >= 0){ - sembuf sops; - sops.sem_num = 0; - sops.sem_op = 1; - sops.sem_flg = SEM_UNDO; - int rv; - do { - rv = semop(lockId,&sops,1); - } while (rv == -1 && errno == EINTR); - + { + QString oldPipe = "/tmp/qtembedded-" + username + "/" + QString("QtEmbedded-%1").arg(displayid); + QLock oldPipeLock(oldPipe, 'd', false); + if (oldPipeLock.isValid()) { perror("QShMemViewProtocol::QShMemViewProtocol"); qFatal("Cannot create lock file as an old version of QVFb has " "opened %s. Close other QVFb and try again", diff --git a/tools/qvfb/qvfbview.cpp b/tools/qvfb/qvfbview.cpp index 3f13ecc..91c5380 100644 --- a/tools/qvfb/qvfbview.cpp +++ b/tools/qvfb/qvfbview.cpp @@ -61,12 +61,7 @@ #include <stdlib.h> #include <unistd.h> -#include <sys/ipc.h> #include <sys/types.h> -#include <sys/shm.h> -#include <sys/stat.h> -#include <sys/sem.h> -#include <fcntl.h> #include <errno.h> #include <math.h> |