31 #include <sys/socket.h> 32 #include <sys/epoll.h> 35 #include <netinet/in.h> 38 #include <utils_sync.h> 40 enum filehandle_type {
70 CSTF_TXCLOSED_ACK = 4,
106 struct sockaddr_in addr;
110 volatile uint32_t sp_lock;
132 volatile uint32_t sp_lock;
158 struct pollfd *pollfds_cache;
159 size_t pollfds_cache_size;
161 struct pollfd *selectfds_cache;
162 size_t selectfds_cache_size;
165 int flextcp_fd_init(
void);
166 int flextcp_fd_salloc(
struct socket **ps);
167 int flextcp_fd_ealloc(
struct epoll **pe,
int fd);
168 int flextcp_fd_slookup(
int fd,
struct socket **ps);
169 int flextcp_fd_elookup(
int fd,
struct epoll **pe);
170 void flextcp_fd_srelease(
int fd,
struct socket *s);
171 void flextcp_fd_erelease(
int fd,
struct epoll *ep);
172 void flextcp_fd_close(
int fd);
181 void flextcp_epoll_sockinit(
struct socket *s);
182 void flextcp_epoll_sockclose(
struct socket *s);
183 void flextcp_epoll_set(
struct socket *s, uint32_t evts);
184 void flextcp_epoll_clear(
struct socket *s, uint32_t evts);
185 void flextcp_epoll_destroy(
struct epoll *ep);
187 int tas_sock_close(
struct socket *sock);
188 int tas_sock_move(
struct socket *s);
190 int tas_libc_epoll_create1(
int flags);
191 int tas_libc_epoll_ctl(
int epfd,
int op,
int fd,
192 struct epoll_event *event);
193 int tas_libc_epoll_wait(
int epfd,
struct epoll_event *events,
195 int tas_libc_poll(
struct pollfd *fds, nfds_t nfds,
int timeout);
196 int tas_libc_close(
int fd);
197 int tas_libc_dup(
int oldfd);
198 int tas_libc_dup2(
int oldfd,
int newfd);
199 int tas_libc_dup3(
int oldfd,
int newfd,
int flags);
201 static inline void socket_lock(
struct socket *s)
203 util_spin_lock(&s->sp_lock);
206 static inline void socket_unlock(
struct socket *s)
208 util_spin_unlock(&s->sp_lock);
211 static inline void epoll_lock(
struct epoll *ep)
213 util_spin_lock(&ep->sp_lock);
216 static inline void epoll_unlock(
struct epoll *ep)
218 util_spin_unlock(&ep->sp_lock);
221 static inline uint64_t get_msecs(
void)
226 ret = clock_gettime(CLOCK_MONOTONIC, &ts);
228 perror(
"flextcp get_msecs: clock_gettime failed\n");
232 return ts.tv_sec * 1000ULL + (ts.tv_nsec / 1000000ULL);
struct epoll_socket * inactive
Public low-level application interface for TAS.
struct epoll_socket * active_first
struct epoll_socket * eps