diff --git a/command.c b/command.c index 799b6b3553..2fde7e1a26 100644 --- a/command.c +++ b/command.c @@ -336,7 +336,7 @@ static void network_cmd_poll(rarch_cmd_t *handle) FD_ZERO(&fds); FD_SET(handle->net_fd, &fds); - if (select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0) + if (socket_select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0) return; if (!FD_ISSET(handle->net_fd, &fds)) diff --git a/netplay.c b/netplay.c index 5e041608bb..c882e7c62a 100644 --- a/netplay.c +++ b/netplay.c @@ -348,7 +348,7 @@ static int poll_input(netplay_t *netplay, bool block) FD_SET(netplay->udp_fd, &fds); FD_SET(netplay->fd, &fds); - if (select(max_fd, &fds, NULL, NULL, &tmp_tv) < 0) + if (socket_select(max_fd, &fds, NULL, NULL, &tmp_tv) < 0) return -1; /* Somewhat hacky, @@ -1485,7 +1485,7 @@ static void netplay_pre_frame_spectate(netplay_t *netplay) FD_ZERO(&fds); FD_SET(netplay->fd, &fds); - if (select(netplay->fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0) + if (socket_select(netplay->fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0) return; if (!FD_ISSET(netplay->fd, &fds)) diff --git a/netplay_compat.c b/netplay_compat.c index fe322e305a..2d8a8dd14b 100644 --- a/netplay_compat.c +++ b/netplay_compat.c @@ -110,3 +110,13 @@ int socket_close(int fd) return close(fd); #endif } + +int socket_select(int nfds, fd_set *readfs, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout) +{ +#if defined(__CELLOS_LV2__) + return socketselect(nfds, readfs, writefds, errorfds, timeout); +#else + return select(nfds, readfs, writefds, errorfds, timeout); +#endif +} diff --git a/netplay_compat.h b/netplay_compat.h index 6814311f7b..40bf72d9a8 100644 --- a/netplay_compat.h +++ b/netplay_compat.h @@ -81,9 +81,6 @@ #include #include -#if defined(__CELLOS_LV2__) -#define select(nfds, readfds, writefds, errorfds, timeout) socketselect(nfds, readfds, writefds, errorfds, timeout) -#endif #endif /* Compatibility layer for legacy or incomplete BSD socket implementations. @@ -125,5 +122,8 @@ bool socket_nonblock(int fd); int socket_close(int fd); +int socket_select(int nfds, fd_set *readfs, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout); + #endif