aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/debug
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-06-18 21:38:33 +0200
committerVaxry <[email protected]>2024-06-18 21:53:01 +0200
commitb98e0876d3b54b7625bacf14e3546dd2d0e600d0 (patch)
tree49c1747b29023dd0118d7607ba10ef7e4a51b804 /src/debug
parent236150b3c5227bbfbe46d2610c739a386afdca1f (diff)
downloadHyprland-b98e0876d3b54b7625bacf14e3546dd2d0e600d0.tar.gz
Hyprland-b98e0876d3b54b7625bacf14e3546dd2d0e600d0.zip
hyprctl: avoid using select()
move to poll() ref #6584
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/HyprCtl.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 70b886f2..e212ed1c 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -11,6 +11,7 @@
#include <sys/utsname.h>
#include <sys/un.h>
#include <unistd.h>
+#include <sys/poll.h>
#include <sstream>
#include <string>
@@ -1784,13 +1785,17 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
std::array<char, 1024> readBuffer;
- fd_set fdset;
- FD_ZERO(&fdset);
- FD_SET(ACCEPTEDCONNECTION, &fdset);
- timeval timeout = {.tv_sec = 0, .tv_usec = 5000};
- auto success = select(ACCEPTEDCONNECTION + 1, &fdset, nullptr, nullptr, &timeout);
+ //
+ pollfd pollfds[1] = {
+ {
+ .fd = ACCEPTEDCONNECTION,
+ .events = POLLIN,
+ },
+ };
+
+ int ret = poll(pollfds, 1, 5000);
- if (success <= 0) {
+ if (ret <= 0) {
close(ACCEPTEDCONNECTION);
return 0;
}