Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-01-13 01:40:46 +0300
committerChristopher Faylor <me@cgf.cx>2005-01-13 01:40:46 +0300
commit169c465a83ef690c2f84ef563c5b56062ee2cb13 (patch)
tree0dde0f7b39a8dbad2b4577d1125ae0f4d189c888 /winsup/cygwin/select.cc
parent066e8c84249c6d4e81b22312b9d2a9f985dac35b (diff)
Reorganize header file inclusion throughout so that cygerrno.h comes first.
* fhandler.h (select_record::thread_errno): Save any encountered errno here. (select_record::set_select_errno): New function. (select_record::saw_error): New function. (select_record::select_record): Initialize thread_errno to zero. * select.cc (set_handle_or_return_if_not_open): Set thread_errno on failure. (select_stuff::wait): Record errno for later resurrection in calling thread. (peek_serial): Ditto.
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r--winsup/cygwin/select.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index c943b2a1c..105b7233f 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -28,8 +28,8 @@ details. */
#include <limits.h>
#define USE_SYS_TYPES_FD_SET
#include <winsock.h>
-#include "select.h"
#include "cygerrno.h"
+#include "select.h"
#include "security.h"
#include "path.h"
#include "fhandler.h"
@@ -85,8 +85,7 @@ typedef long fd_mask;
h = (s)->fh->get_handle (); \
if (cygheap->fdtab.not_open ((s)->fd)) \
{ \
- (s)->saw_error = true; \
- set_sig_errno (EBADF); \
+ (s)->thread_errno = EBADF; \
return -1; \
} \
@@ -238,7 +237,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
}
if (!s->startup (s, this))
{
- __seterrno ();
+ s->set_select_errno ();
return -1;
}
if (s->h == NULL)
@@ -269,7 +268,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
return -1;
case WAIT_FAILED:
select_printf ("WaitForMultipleObjects failed");
- __seterrno ();
+ s->set_select_errno ();
return -1;
case WAIT_TIMEOUT:
select_printf ("timed out");
@@ -285,8 +284,11 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
If it returns false, then this wakeup was a false alarm and we should go
back to waiting. */
while ((s = s->next))
- if (s->saw_error)
- return -1; /* Somebody detected an error */
+ if (s->saw_error ())
+ {
+ set_errno (s->saw_error ());
+ return -1; /* Somebody detected an error */
+ }
else if ((((wait_ret >= m && s->windows_handle) || s->h == w4[wait_ret])) &&
s->verify (s, readfds, writefds, exceptfds))
gotone = true;
@@ -1005,8 +1007,7 @@ err:
return ready;
}
- __seterrno ();
- s->saw_error = true;
+ s->set_select_errno ();
select_printf ("error %E");
return -1;
}