UnixSockUtils.hpp 561 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <c10d/Utils.hpp>
  3. namespace c10d {
  4. namespace tcputil {
  5. #define CONNECT_SOCKET_OFFSET 2
  6. inline int poll(struct pollfd *fds, unsigned long nfds, int timeout) {
  7. return ::poll(fds, nfds, timeout);
  8. }
  9. inline void addPollfd(std::vector<struct pollfd> &fds, int socket,
  10. short events) {
  11. fds.push_back({.fd = socket, .events = events});
  12. }
  13. inline struct ::pollfd getPollfd(int socket, short events) {
  14. struct ::pollfd res = {.fd = socket, .events = events};
  15. return res;
  16. }
  17. } // namespace tcputil
  18. } // namespace c10d