![]() |
Qt 6.x
The Qt SDK
|
#include "qplatformdefs.h"
#include <QtCore/private/qglobal_p.h>
#include "qatomic.h"
#include "qbytearray.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
#include <chrono>
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ipc.h>
#include <poll.h>
Go to the source code of this file.
Classes | |
union | qt_semun |
Macros | |
#define | EINTR_LOOP(var, cmd) |
#define | QT_OPEN qt_safe_open |
#define | QT_READ qt_safe_read |
#define | QT_WRITE qt_safe_write |
#define | QT_CLOSE qt_safe_close |
#define | _POSIX_MONOTONIC_CLOCK -1 |
Functions | |
QT_BEGIN_NAMESPACE | Q_DECLARE_TYPEINFO (pollfd, Q_PRIMITIVE_TYPE) |
timespec | durationToTimespec (std::chrono::nanoseconds timeout) noexcept |
template<typename Duration > | |
Duration | timespecToChrono (timespec ts) noexcept |
std::chrono::milliseconds | timespecToChronoMs (timespec ts) noexcept |
constexpr timespec & | normalizedTimespec (timespec &t) |
constexpr bool | operator< (const timespec &t1, const timespec &t2) |
constexpr bool | operator== (const timespec &t1, const timespec &t2) |
constexpr bool | operator!= (const timespec &t1, const timespec &t2) |
constexpr timespec & | operator+= (timespec &t1, const timespec &t2) |
constexpr timespec | operator+ (const timespec &t1, const timespec &t2) |
constexpr timespec | operator- (const timespec &t1, const timespec &t2) |
constexpr timespec | operator* (const timespec &t1, int mul) |
timeval | timespecToTimeval (timespec ts) |
timespec & | operator+= (timespec &t1, std::chrono::milliseconds msecs) |
timespec & | operator+= (timespec &t1, int ms) |
timespec | operator+ (const timespec &t1, std::chrono::milliseconds msecs) |
timespec | operator+ (const timespec &t1, int ms) |
timespec | qAbsTimespec (timespec ts) |
void | qt_ignore_sigpipe () |
static int | qt_safe_open (const char *pathname, int flags, mode_t mode=0777) |
static int | qt_safe_pipe (int pipefd[2], int flags=0) |
static int | qt_safe_dup (int oldfd, int atleast=0, int flags=FD_CLOEXEC) |
static int | qt_safe_dup2 (int oldfd, int newfd, int flags=FD_CLOEXEC) |
static qint64 | qt_safe_read (int fd, void *data, qint64 maxlen) |
static qint64 | qt_safe_write (int fd, const void *data, qint64 len) |
static qint64 | qt_safe_write_nosignal (int fd, const void *data, qint64 len) |
static int | qt_safe_close (int fd) |
timespec | qt_gettime () noexcept |
QByteArray | qt_readlink (const char *path) |
bool | qt_haveLinuxProcfs () |
Q_CORE_EXPORT int | qt_safe_poll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts) |
static int | qt_poll_msecs (struct pollfd *fds, nfds_t nfds, int timeout) |
static struct pollfd | qt_make_pollfd (int fd, short events) |
Variables | |
static constexpr auto | OneSecAsNsecs = std::chrono::nanoseconds(std::chrono::seconds{ 1 }).count() |
#define _POSIX_MONOTONIC_CLOCK -1 |
Definition at line 370 of file qcore_unix_p.h.
#define EINTR_LOOP | ( | var, | |
cmd | |||
) |
Definition at line 63 of file qcore_unix_p.h.
#define QT_CLOSE qt_safe_close |
Definition at line 335 of file qcore_unix_p.h.
#define QT_OPEN qt_safe_open |
Definition at line 229 of file qcore_unix_p.h.
#define QT_READ qt_safe_read |
Definition at line 311 of file qcore_unix_p.h.
#define QT_WRITE qt_safe_write |
Definition at line 320 of file qcore_unix_p.h.
|
inlinenoexcept |
Definition at line 74 of file qcore_unix_p.h.
Referenced by QtLinuxFutex::futexWait(), QtFreeBSDFutex::futexWait(), operator+=(), qt_abstime_for_timeout(), QFileSystemEngine::setFileTime(), QThread::sleep(), QTimerInfoList::timerWait(), and QMutexPrivate::wait().
|
inlineconstexpr |
Definition at line 98 of file qcore_unix_p.h.
References OneSecAsNsecs.
Referenced by operator*(), operator+(), operator+=(), operator-(), and qAbsTimespec().
|
inlineconstexpr |
Definition at line 114 of file qcore_unix_p.h.
References t2.
Referenced by QT6_ONLY().
|
inlineconstexpr |
Definition at line 136 of file qcore_unix_p.h.
References normalizedTimespec().
|
inlineconstexpr |
Definition at line 122 of file qcore_unix_p.h.
References normalizedTimespec(), and t2.
Referenced by QJsonArray::iterator::operator-(), QJsonArray::const_iterator::operator-(), QJsonObject::iterator::operator-(), and QJsonObject::const_iterator::operator-().
|
inline |
Definition at line 170 of file qcore_unix_p.h.
|
inline |
Definition at line 163 of file qcore_unix_p.h.
References t1.
|
inlineconstexpr |
Definition at line 116 of file qcore_unix_p.h.
References normalizedTimespec(), and t2.
|
inline |
Definition at line 157 of file qcore_unix_p.h.
References t1.
|
inline |
Definition at line 151 of file qcore_unix_p.h.
References durationToTimespec(), and t1.
|
inlineconstexpr |
Definition at line 129 of file qcore_unix_p.h.
References normalizedTimespec(), OneSecAsNsecs, and t2.
|
inlineconstexpr |
Definition at line 110 of file qcore_unix_p.h.
References t2.
|
inlineconstexpr |
Definition at line 112 of file qcore_unix_p.h.
References t2.
QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO | ( | pollfd | , |
Q_PRIMITIVE_TYPE | |||
) |
|
inline |
Definition at line 175 of file qcore_unix_p.h.
References normalizedTimespec(), and OneSecAsNsecs.
|
noexcept |
Definition at line 84 of file qcore_unix.cpp.
References do_gettime().
Referenced by qt_safe_poll(), and time_update().
|
inline |
Definition at line 378 of file qcore_unix_p.h.
Referenced by bluetoothdVersion(), createUnnamedFile(), and QLockFilePrivate::processNameByPid().
|
inline |
Definition at line 187 of file qcore_unix_p.h.
References Q_BASIC_ATOMIC_INITIALIZER.
Referenced by qt_safe_sendmsg(), and qt_safe_write_nosignal().
|
inlinestatic |
Definition at line 407 of file qcore_unix_p.h.
Referenced by QNativeSocketEnginePrivate::nativeSelect(), QThreadPipe::prepare(), and QEventDispatcherUNIX::processEvents().
|
inlinestatic |
Definition at line 394 of file qcore_unix_p.h.
References qt_safe_poll().
Referenced by QNativeSocketEnginePrivate::nativeSelect().
QByteArray qt_readlink | ( | const char * | path | ) |
Definition at line 23 of file qcore_unix.cpp.
References PATH_MAX, and Qt::Uninitialized.
Referenced by QFileSystemEngine::getLinkTarget(), QFileSystemEngine::getRawLinkPath(), QLockFilePrivate::processNameByPid(), and qAppFileName().
|
inlinestatic |
Definition at line 328 of file qcore_unix_p.h.
References EINTR_LOOP, QT_CLOSE, and ret.
Referenced by QBsdFbScreen::~QBsdFbScreen(), QEvdevMouseHandler::~QEvdevMouseHandler(), QGstreamerCamera::~QGstreamerCamera(), QQnxNavigatorPps::~QQnxNavigatorPps(), QSysInfo::bootUniqueId(), QEglFSKmsGbmDevice::close(), QEglFSKmsVsp2Device::close(), QLinuxFbDevice::close(), QNetworkInterfaceManager::interfaceIndexFromName(), QNetworkInterfaceManager::interfaceNameFromIndex(), liClose(), QSysInfo::machineUniqueId(), mandatoryHciIoctlsAvailable(), QNativeSocketEnginePrivate::nativeClose(), QEglFSKmsGbmDevice::open(), QEglFSKmsVsp2Device::open(), QLinuxFbDevice::open(), QEglFSMaliIntegration::platformInit(), QLockFilePrivate::processNameByPid(), QEvdevMouseHandler::readMouseData(), QFdContainer::reset(), stderrHasConsoleAttached(), and QLockFilePrivate::tryLock_sys().
|
inlinestatic |
Definition at line 263 of file qcore_unix_p.h.
Referenced by QKqueueFileSystemWatcherEngine::addPaths().
|
inlinestatic |
Definition at line 284 of file qcore_unix_p.h.
References EINTR_LOOP, Q_ASSERT, and ret.
|
inlinestatic |
Definition at line 213 of file qcore_unix_p.h.
References EINTR_LOOP, and QT_OPEN.
Referenced by QKqueueFileSystemWatcherEngine::addPaths(), QSysInfo::bootUniqueId(), QEvdevMouseHandler::create(), QEvdevKeyboardHandler::create(), liOpen(), QSysInfo::machineUniqueId(), QEglFSKmsGbmDevice::open(), QEglFSKmsEglDevice::open(), QEglFSKmsVsp2Device::open(), QLinuxFbDevice::open(), QEglFSDeviceIntegration::platformInit(), QEglFSMaliIntegration::platformInit(), QLockFilePrivate::processNameByPid(), QLockFilePrivate::removeStaleLock(), QQnxButtonEventNotifier::start(), stderrHasConsoleAttached(), and QLockFilePrivate::tryLock_sys().
|
inlinestatic |
Definition at line 234 of file qcore_unix_p.h.
Referenced by QThreadPipe::init(), QtWaylandClient::QWaylandMimeData::retrieveData_sys(), and QtWaylandClient::EventThread::run().
Q_CORE_EXPORT int qt_safe_poll | ( | struct pollfd * | fds, |
nfds_t | nfds, | ||
const struct timespec * | timeout_ts | ||
) |
Behaves as close to POSIX poll(2) as practical but may be implemented using select(2) where necessary. In that case, returns -1 and sets errno to EINVAL if passed any descriptor greater than or equal to FD_SETSIZE.
Definition at line 142 of file qcore_unix.cpp.
References EINTR_LOOP, forever, qt_gettime(), qt_ppoll(), ret, and time_update().
Referenced by QEventDispatcherUNIX::processEvents(), and qt_poll_msecs().
Definition at line 304 of file qcore_unix_p.h.
References EINTR_LOOP, QT_READ, and ret.
Referenced by QSysInfo::bootUniqueId(), LeCmacCalculator::calculateMac(), QOpenGLProgramBinaryCache::load(), QSysInfo::machineUniqueId(), QNativeSocketEnginePrivate::nativeRead(), QLockFilePrivate::processNameByPid(), QBsdKeyboardHandler::readKeyboardData(), and QEvdevKeyboardHandler::readKeycode().
Definition at line 313 of file qcore_unix_p.h.
References EINTR_LOOP, QT_WRITE, and ret.
Referenced by LeCmacCalculator::calculateMac(), qt_safe_write_nosignal(), qt_write_loop(), QThreadPipe::wakeUp(), and QBluetoothSocketPrivateBluez::writeData().
Definition at line 322 of file qcore_unix_p.h.
References qt_ignore_sigpipe(), and qt_safe_write().
Referenced by QNativeSocketEnginePrivate::nativeWrite().
|
inlinenoexcept |
Definition at line 86 of file qcore_unix_p.h.
|
inlinenoexcept |
Definition at line 92 of file qcore_unix_p.h.
|
inline |
Definition at line 143 of file qcore_unix_p.h.
Referenced by qt_poll().
|
staticconstexpr |
Definition at line 72 of file qcore_unix_p.h.
Referenced by normalizedTimespec(), operator-(), and qAbsTimespec().