6#include <QtCore/private/qglobal_p.h>
7#include <QtCore/qbasicatomic.h>
13# include <sys/syscall.h>
19#include <mach/mach_time.h>
27 Q_CONSTINIT
static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER(0);
28 if (!atom.loadRelaxed()) {
32 struct sigaction noaction = {};
33 noaction.sa_handler = SIG_IGN;
34 ::sigaction(SIGPIPE, &noaction,
nullptr);
43# define PATH_MAX 1024
*1024
48 ssize_t len = ::readlink(path, buf.data(), buf.size());
49 while (len == buf.size()) {
57 buf.resize(buf.size() * 2);
58 len = ::readlink(path, buf.data(), buf.size());
68#if defined(Q_PROCESSOR_X86_32) && defined(__GLIBC__
)
69# if !__GLIBC_PREREQ(2
, 22
)
75int qt_open64(
const char *pathname,
int flags, mode_t mode)
77 return syscall(SYS_open, pathname, flags | O_LARGEFILE, mode);
82#ifndef QT_BOOTSTRAPPED
84#if QT_CONFIG(poll_pollts)
91 using namespace std::chrono;
94 auto ms = ceil<milliseconds>(timespecToChrono<nanoseconds>(*ts));
95 return int(ms.count());
99int qt_poll(
struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout_ts);
101static inline int qt_ppoll(
struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout_ts)
103#if QT_CONFIG(poll_ppoll) || QT_CONFIG(poll_pollts)
104 return ::ppoll(fds, nfds, timeout_ts,
nullptr);
105#elif QT_CONFIG(poll_poll)
106 return ::poll(fds, nfds, timespecToMillisecs(timeout_ts));
107#elif QT_CONFIG(poll_select)
108 return qt_poll(fds, nfds, timeout_ts);
116
117
118
119
120
121
122int qt_safe_poll(
struct pollfd *fds, nfds_t nfds, QDeadlineTimer deadline)
124 if (deadline.isForever()) {
131 using namespace std::chrono;
132 nanoseconds remaining = deadline.remainingTimeAsDuration();
135 timespec ts = durationToTimespec(remaining);
137 if (ret != -1 || errno != EINTR)
139 remaining = deadline.remainingTimeAsDuration();
140 }
while (remaining > 0ns);
Combined button and popup list for selecting options.
int qt_safe_poll(struct pollfd *fds, nfds_t nfds, QDeadlineTimer deadline)
int qt_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts)
static int timespecToMillisecs(const struct timespec *ts)
QT_BEGIN_NAMESPACE void qt_ignore_sigpipe() noexcept
static int qt_ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts)
QByteArray qt_readlink(const char *path)
#define QT_EINTR_LOOP(var, cmd)