Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandpipewritehelper.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 UnionTech Software Technology Co., Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <QtCore/private/qcore_unix_p.h>
6
8
11 const char *data,
12 qsizetype len,
13 qsizetype chunkSize,
14 std::chrono::nanoseconds timeout)
15{
16 if (len == 0)
18
19 struct pollfd pfd;
20 pfd.fd = fd;
21 pfd.events = POLLOUT;
22
23 QDeadlineTimer deadline(timeout);
24 qsizetype offset = 0;
25 while (offset < len) {
26 int ready = qt_safe_poll(&pfd, 1, deadline);
27 if (ready < 0) {
29 } else if (ready == 0 || deadline.hasExpired()) {
31 } else {
32 const qsizetype toWrite = qMin(chunkSize, len - offset);
33 ssize_t n = qt_safe_write_nosignal(fd, data + offset, toWrite);
34 if (n > 0) {
35 offset += n;
36 continue;
37 } else if (n < 0) {
38 if (errno == EAGAIN || errno == EWOULDBLOCK)
39 continue;
40 if (errno == EPIPE)
43 }
44 }
45 }
46
48}
49
50QT_END_NAMESPACE
Combined button and popup list for selecting options.
SafeWriteResult safeWriteWithTimeout(int fd, const char *data, qsizetype len, qsizetype chunkSize, std::chrono::nanoseconds timeout)