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