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

Commit 3f28530a authored by Jiwen 'Steve' Cai's avatar Jiwen 'Steve' Cai
Browse files

Expose TakeXXXFd from UDS's ChannelEventReceiver

This enables efficient UDS channel export by avoiding duplicating
those FDs.

Bug: 37517761
Test: libpdx_uds_tests
Change-Id: Iaaabf586ac8f918a3ad820dba5576212dc80b753
parent 7e13a6f1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -54,6 +54,14 @@ class ChannelEventReceiver {
  BorrowedHandle pollhup_event_fd() const { return pollhup_event_fd_.Borrow(); }
  BorrowedHandle data_fd() const { return data_fd_.Borrow(); }

  // Moves file descriptors out of ChannelEventReceiver. Note these operations
  // immediately invalidates the receiver.
  std::tuple<LocalHandle, LocalHandle, LocalHandle> TakeFds() {
    epoll_fd_.Close();
    return {std::move(data_fd_), std::move(pollin_event_fd_),
            std::move(pollhup_event_fd_)};
  }

  Status<int> GetPendingEvents() const;
  Status<int> PollPendingEvents(int timeout_ms) const;