Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9b507f7 authored by Chris Weir's avatar Chris Weir Committed by Android (Google) Code Review
Browse files

Merge "Add support for poll()-ing nlsockets"

parents d4b24972 50c25280
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -153,6 +153,10 @@ std::optional<unsigned> Socket::getPid() {
    return sa.nl_pid;
}

pollfd Socket::preparePoll(short events) {
    return {mFd.get(), events, 0};
}

Socket::receive_iterator::receive_iterator(Socket& socket, bool end)
    : mSocket(socket), mIsEnd(end) {
    if (!end) receive();
+9 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <libnl++/MessageFactory.h>

#include <linux/netlink.h>
#include <poll.h>

#include <optional>
#include <set>
@@ -173,6 +174,14 @@ class Socket {
     */
    std::optional<unsigned> getPid();

    /**
     * Creates a pollfd object for the socket.
     *
     * \param events Value for pollfd.events.
     * \return A populated pollfd object.
     */
    pollfd preparePoll(short events = 0);

    /**
     * Live iterator continuously receiving messages from Netlink socket.
     *