projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Have just one debug test, and don't use timers during gdb operations.
[m6w6/libmemcached]
/
poll
/
poll.c
diff --git
a/poll/poll.c
b/poll/poll.c
index 7f47b758b1c654707c1eff74f6993b3e2fc9730c..28156d1f7bd1163116618eed9cf17584a7182ade 100644
(file)
--- a/
poll/poll.c
+++ b/
poll/poll.c
@@
-8,10
+8,18
@@
* Summary: Implementation of poll by using select
*
*/
* Summary: Implementation of poll by using select
*
*/
-#include "config.h"
+#include "mem_config.h"
+
+#if defined(WIN32) || defined(__MINGW32__)
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#endif
+
#include <sys/time.h>
#include <strings.h>
#include <sys/time.h>
#include <strings.h>
+#include "poll/poll.h"
+
int poll(struct pollfd fds[], nfds_t nfds, int tmo)
{
fd_set readfds, writefds, errorfds;
int poll(struct pollfd fds[], nfds_t nfds, int tmo)
{
fd_set readfds, writefds, errorfds;
@@
-19,16
+27,16
@@
int poll(struct pollfd fds[], nfds_t nfds, int tmo)
FD_ZERO(&writefds);
FD_ZERO(&errorfds);
FD_ZERO(&writefds);
FD_ZERO(&errorfds);
- int maxfd
= 0;
+ int maxfd= 0;
- for (
int x
= 0; x < nfds; ++x)
+ for (
nfds_t x
= 0; x < nfds; ++x)
{
if (fds[x].events & (POLLIN | POLLOUT))
{
#ifndef WIN32
if (fds[x].fd > maxfd)
{
{
if (fds[x].events & (POLLIN | POLLOUT))
{
#ifndef WIN32
if (fds[x].fd > maxfd)
{
- maxfd
= fds[x].fd;
+ maxfd= fds[x].fd;
}
#endif
if (fds[x].events & POLLIN)
}
#endif
if (fds[x].events & POLLIN)
@@
-42,23
+50,23
@@
int poll(struct pollfd fds[], nfds_t nfds, int tmo)
}
}
}
}
- struct timeval timeout
= { .tv_sec = tmo / 1000,
-
.tv_usec= (tmo % 1000) * 1000 };
- struct timeval *tp
= &timeout;
+ struct timeval timeout= { .tv_sec = tmo / 1000,
+ .tv_usec= (tmo % 1000) * 1000 };
+ struct timeval *tp= &timeout;
if (tmo == -1)
{
if (tmo == -1)
{
- tp
= NULL;
+ tp= NULL;
}
}
- int ret
= select(maxfd + 1, &readfds, &writefds, &errorfds, tp);
+ int ret= select(maxfd + 1, &readfds, &writefds, &errorfds, tp);
if (ret <= 0)
{
return ret;
}
/* Iterate through all of them because I need to clear the revent map */
if (ret <= 0)
{
return ret;
}
/* Iterate through all of them because I need to clear the revent map */
- for (
int x
= 0; x < nfds; ++x)
+ for (
nfds_t x
= 0; x < nfds; ++x)
{
{
- fds[x].revents
= 0;
+ fds[x].revents= 0;
if (FD_ISSET(fds[x].fd, &readfds))
{
fds[x].revents |= POLLIN;
if (FD_ISSET(fds[x].fd, &readfds))
{
fds[x].revents |= POLLIN;