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