Skip to content

Commit 5034cd7

Browse files
committed
Remove poll() based implementation of mariadb_dr_socket_ready()
One select() based implementation which works on both POSIX and WIN32 systems for just one file descriptor is enough.
1 parent ee0a7d6 commit 5034cd7

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

socket.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
#include <windows.h>
77
#include <winsock.h>
88
#endif
9-
109
#include <mysql.h>
11-
12-
#ifndef _WIN32
13-
#include <poll.h>
10+
#include <stddef.h>
1411
#include <errno.h>
15-
#endif
1612

1713
/*
1814
* Warning: Native socket code must be outside of dbdimp.c and dbdimp.h because
@@ -22,12 +18,9 @@
2218

2319
int mariadb_dr_socket_ready(my_socket fd)
2420
{
25-
int retval;
26-
27-
#ifdef _WIN32
28-
/* Windows does not have poll(), so use select() instead */
2921
struct timeval timeout;
3022
fd_set fds;
23+
int retval;
3124

3225
FD_ZERO(&fds);
3326
FD_SET(fd, &fds);
@@ -36,15 +29,6 @@ int mariadb_dr_socket_ready(my_socket fd)
3629
timeout.tv_usec = 0;
3730

3831
retval = select(fd+1, &fds, NULL, NULL, &timeout);
39-
#else
40-
struct pollfd fds;
41-
42-
fds.fd = fd;
43-
fds.events = POLLIN;
44-
45-
retval = poll(&fds, 1, 0);
46-
#endif
47-
4832
if (retval < 0) {
4933
#ifdef _WIN32
5034
/* Windows does not update errno */

0 commit comments

Comments
 (0)