struct sockaddr_un my_addr;
int s;
int ret;
- struct timeval before,after,to;
+ struct timeval before,after;
int sock_err;
socklen_t err_len;
ret = connect(s, (struct sockaddr *) &my_addr, sizeof(my_addr));
if (ret == -1) {
if (errno == EINPROGRESS) {
- fd_set fds;
+ struct pollfd pollfds[1];
- FD_ZERO(&fds);
- FD_SET(s, &fds);
- memcpy(&to, timeout, sizeof(to));
+ pollfds[0].fd = s;
+ pollfds[0].events = POLLOUT;
+
gettimeofday(&before,NULL);
- switch (select(s+1, NULL, &fds, NULL, &to)) {
+ switch (poll(pollfds, 1, timeout->tv_sec*1000+timeout->tv_usec/1000)) {
case -1: close(s);
return errno;
case 0: close(s);
int count;
size_t remain = buf_len;
char *cbuf = buf;
- fd_set fds;
- struct timeval timeout,before,after;
+ struct pollfd pollfds[1];
+ struct timeval before,after;
int ret;
if (to) {
- memcpy(&timeout,to,sizeof(timeout));
gettimeofday(&before,NULL);
}
while (remain > 0) {
- FD_ZERO(&fds);
- FD_SET(sock,&fds);
- switch (select(sock+1, &fds, NULL, NULL, to ? &timeout : NULL)) {
+ pollfds[0].fd = sock;
+ pollfds[0].events = POLLIN;
+ switch (poll(pollfds, 1, to ? (to->tv_sec*1000+to->tv_usec/1000) : INFTIM)) {
case 0:
ret = EDG_WLPR_ERROR_TIMEOUT;
goto end;
const char *cbuf = buf;
int count;
size_t remain = buf_len;
- fd_set fds;
- struct timeval timeout,before,after;
+ struct pollfd pollfds[1];
+ struct timeval before,after;
int ret;
if (to) {
- memcpy(&timeout,to,sizeof(timeout));
gettimeofday(&before,NULL);
}
while (remain > 0) {
- FD_ZERO(&fds);
- FD_SET(sock,&fds);
- switch (select(sock+1, NULL, &fds, NULL, to ? &timeout : NULL)) {
+ pollfds[0].fd = sock;
+ pollfds[0].events = POLLOUT;
+ switch (poll(pollfds, 1, to ? (to->tv_sec*1000+to->tv_usec/1000) : INFTIM)) {
case 0: ret = EDG_WLPR_ERROR_TIMEOUT;
goto end;
case -1: ret = EDG_WLPR_ERROR_ERRNO;