IPC: move the *_unix.cpp contents to the main files
It's just the setUnixErrorString() functions. Change-Id: I12a088d1ae424825abd3fffd171d2880ebaf49c7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
eaa7528baa
commit
762017f03c
@ -1139,10 +1139,8 @@ qt_internal_extend_target(Core CONDITION UNIX
|
||||
SOURCES
|
||||
ipc/qsharedmemory_posix.cpp
|
||||
ipc/qsharedmemory_systemv.cpp
|
||||
ipc/qsharedmemory_unix.cpp
|
||||
ipc/qsystemsemaphore_posix.cpp
|
||||
ipc/qsystemsemaphore_systemv.cpp
|
||||
ipc/qsystemsemaphore_unix.cpp
|
||||
)
|
||||
|
||||
qt_internal_extend_target(Core CONDITION VXWORKS
|
||||
|
@ -647,6 +647,37 @@ QString QSharedMemory::errorString() const
|
||||
return d->errorString;
|
||||
}
|
||||
|
||||
void QSharedMemoryPrivate::setUnixErrorString(QLatin1StringView function)
|
||||
{
|
||||
// EINVAL is handled in functions so they can give better error strings
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
errorString = QSharedMemory::tr("%1: permission denied").arg(function);
|
||||
error = QSharedMemory::PermissionDenied;
|
||||
break;
|
||||
case EEXIST:
|
||||
errorString = QSharedMemory::tr("%1: already exists").arg(function);
|
||||
error = QSharedMemory::AlreadyExists;
|
||||
break;
|
||||
case ENOENT:
|
||||
errorString = QSharedMemory::tr("%1: doesn't exist").arg(function);
|
||||
error = QSharedMemory::NotFound;
|
||||
break;
|
||||
case EMFILE:
|
||||
case ENOMEM:
|
||||
case ENOSPC:
|
||||
errorString = QSharedMemory::tr("%1: out of resources").arg(function);
|
||||
error = QSharedMemory::OutOfResources;
|
||||
break;
|
||||
default:
|
||||
errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errno);
|
||||
error = QSharedMemory::UnknownError;
|
||||
#if defined QSHAREDMEMORY_DEBUG
|
||||
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(sharedmemory)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -1,45 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#include "qsharedmemory.h"
|
||||
|
||||
#if QT_CONFIG(sharedmemory)
|
||||
# include "qsharedmemory_p.h"
|
||||
# include <errno.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
void QSharedMemoryPrivate::setUnixErrorString(QLatin1StringView function)
|
||||
{
|
||||
// EINVAL is handled in functions so they can give better error strings
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
errorString = QSharedMemory::tr("%1: permission denied").arg(function);
|
||||
error = QSharedMemory::PermissionDenied;
|
||||
break;
|
||||
case EEXIST:
|
||||
errorString = QSharedMemory::tr("%1: already exists").arg(function);
|
||||
error = QSharedMemory::AlreadyExists;
|
||||
break;
|
||||
case ENOENT:
|
||||
errorString = QSharedMemory::tr("%1: doesn't exist").arg(function);
|
||||
error = QSharedMemory::NotFound;
|
||||
break;
|
||||
case EMFILE:
|
||||
case ENOMEM:
|
||||
case ENOSPC:
|
||||
errorString = QSharedMemory::tr("%1: out of resources").arg(function);
|
||||
error = QSharedMemory::OutOfResources;
|
||||
break;
|
||||
default:
|
||||
errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errno);
|
||||
error = QSharedMemory::UnknownError;
|
||||
#if defined QSHAREDMEMORY_DEBUG
|
||||
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_CONFIG(sharedmemory)
|
@ -323,6 +323,41 @@ QString QSystemSemaphore::errorString() const
|
||||
return d->errorString;
|
||||
}
|
||||
|
||||
void QSystemSemaphorePrivate::setUnixErrorString(QLatin1StringView function)
|
||||
{
|
||||
// EINVAL is handled in functions so they can give better error strings
|
||||
switch (errno) {
|
||||
case EPERM:
|
||||
case EACCES:
|
||||
errorString = QSystemSemaphore::tr("%1: permission denied").arg(function);
|
||||
error = QSystemSemaphore::PermissionDenied;
|
||||
break;
|
||||
case EEXIST:
|
||||
errorString = QSystemSemaphore::tr("%1: already exists").arg(function);
|
||||
error = QSystemSemaphore::AlreadyExists;
|
||||
break;
|
||||
case ENOENT:
|
||||
errorString = QSystemSemaphore::tr("%1: does not exist").arg(function);
|
||||
error = QSystemSemaphore::NotFound;
|
||||
break;
|
||||
case ERANGE:
|
||||
case ENOSPC:
|
||||
errorString = QSystemSemaphore::tr("%1: out of resources").arg(function);
|
||||
error = QSystemSemaphore::OutOfResources;
|
||||
break;
|
||||
case ENAMETOOLONG:
|
||||
errorString = QSystemSemaphore::tr("%1: key too long").arg(function);
|
||||
error = QSystemSemaphore::KeyError;
|
||||
break;
|
||||
default:
|
||||
errorString = QSystemSemaphore::tr("%1: unknown error %2").arg(function).arg(errno);
|
||||
error = QSystemSemaphore::UnknownError;
|
||||
#if defined QSYSTEMSEMAPHORE_DEBUG
|
||||
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(systemsemaphore)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -1,61 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#include "qsystemsemaphore.h"
|
||||
#include "qsystemsemaphore_p.h"
|
||||
|
||||
#include <qdebug.h>
|
||||
#include <qcoreapplication.h>
|
||||
|
||||
#if QT_CONFIG(systemsemaphore)
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef QT_POSIX_IPC
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "private/qcore_unix_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
void QSystemSemaphorePrivate::setUnixErrorString(QLatin1StringView function)
|
||||
{
|
||||
// EINVAL is handled in functions so they can give better error strings
|
||||
switch (errno) {
|
||||
case EPERM:
|
||||
case EACCES:
|
||||
errorString = QSystemSemaphore::tr("%1: permission denied").arg(function);
|
||||
error = QSystemSemaphore::PermissionDenied;
|
||||
break;
|
||||
case EEXIST:
|
||||
errorString = QSystemSemaphore::tr("%1: already exists").arg(function);
|
||||
error = QSystemSemaphore::AlreadyExists;
|
||||
break;
|
||||
case ENOENT:
|
||||
errorString = QSystemSemaphore::tr("%1: does not exist").arg(function);
|
||||
error = QSystemSemaphore::NotFound;
|
||||
break;
|
||||
case ERANGE:
|
||||
case ENOSPC:
|
||||
errorString = QSystemSemaphore::tr("%1: out of resources").arg(function);
|
||||
error = QSystemSemaphore::OutOfResources;
|
||||
break;
|
||||
case ENAMETOOLONG:
|
||||
errorString = QSystemSemaphore::tr("%1: key too long").arg(function);
|
||||
error = QSystemSemaphore::KeyError;
|
||||
break;
|
||||
default:
|
||||
errorString = QSystemSemaphore::tr("%1: unknown error %2").arg(function).arg(errno);
|
||||
error = QSystemSemaphore::UnknownError;
|
||||
#if defined QSYSTEMSEMAPHORE_DEBUG
|
||||
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_CONFIG(systemsemaphore)
|
Loading…
Reference in New Issue
Block a user