~ubuntu-branches/ubuntu/edgy/curl/edgy

« back to all changes in this revision

Viewing changes to lib/select.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-06-29 15:04:24 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060629150424-pn00qumt9sml8p4m
Tags: 7.15.4-1ubuntu1
Synchronize to Debian. Only change left: Removal of stunnel and
libdb4.2-dev build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: select.c,v 1.14 2005/11/13 09:24:06 bagder Exp $
 
21
 * $Id: select.c,v 1.17 2006-05-05 10:24:27 bagder Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
50
50
#include "connect.h"
51
51
#include "select.h"
52
52
 
53
 
#ifdef WIN32
54
 
#define VERIFY_SOCK(x)  /* Win-sockets are not in range [0..FD_SETSIZE> */
 
53
#if defined(WIN32) || defined(TPF)
 
54
#define VERIFY_SOCK(x)  /* sockets are not in range [0..FD_SETSIZE] */
55
55
#else
56
56
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
57
57
#define VERIFY_SOCK(x) do { \
131
131
  timeout.tv_usec = (timeout_ms % 1000) * 1000;
132
132
 
133
133
  FD_ZERO(&fds_err);
134
 
  maxfd = -1;
 
134
  maxfd = (curl_socket_t)-1;
135
135
 
136
136
  FD_ZERO(&fds_read);
137
137
  if (readfd != CURL_SOCKET_BAD) {
152
152
 
153
153
  do {
154
154
    r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, &timeout);
155
 
  } while((r == -1) && (Curl_ourerrno() == EINTR));
 
155
  } while((r == -1) && (Curl_sockerrno() == EINTR));
156
156
 
157
157
  if (r < 0)
158
158
    return -1;
206
206
  FD_ZERO(&fds_read);
207
207
  FD_ZERO(&fds_write);
208
208
  FD_ZERO(&fds_err);
209
 
  maxfd = -1;
 
209
  maxfd = (curl_socket_t)-1;
210
210
 
211
211
  for (i = 0; i < nfds; i++) {
212
212
    if (ufds[i].fd == CURL_SOCKET_BAD)
237
237
 
238
238
  do {
239
239
    r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout);
240
 
  } while((r == -1) && (Curl_ourerrno() == EINTR));
 
240
  } while((r == -1) && (Curl_sockerrno() == EINTR));
241
241
 
242
242
  if (r < 0)
243
243
    return -1;
261
261
#endif
262
262
  return r;
263
263
}
 
264
 
 
265
#ifdef TPF
 
266
/*
 
267
 * This is a replacement for select() on the TPF platform.
 
268
 * It is used whenever libcurl calls select().
 
269
 * The call below to tpf_process_signals() is required because
 
270
 * TPF's select calls are not signal interruptible.
 
271
 *
 
272
 * Return values are the same as select's.
 
273
 */
 
274
int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
 
275
                       fd_set* excepts, struct timeval* tv)
 
276
{
 
277
   int rc;
 
278
 
 
279
   rc = tpf_select_bsd(maxfds, reads, writes, excepts, tv);
 
280
   tpf_process_signals();
 
281
   return(rc);
 
282
}
 
283
#endif /* TPF */