mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
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.
This commit is contained in:
parent
066e8c8424
commit
169c465a83
@ -1,3 +1,18 @@
|
||||
2005-01-12 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
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.
|
||||
|
||||
2005-01-12 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* syscalls.cc (system): Use "/bin/sh" as per linux and (sorta) SUSv3.
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "child_info.h"
|
||||
#include "heap.h"
|
||||
|
@ -14,6 +14,7 @@ details. */
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
@ -21,7 +22,6 @@ details. */
|
||||
#include "thread.h"
|
||||
#include "dlfcn.h"
|
||||
#include "dll_init.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygtls.h"
|
||||
|
||||
static void __stdcall
|
||||
|
@ -584,7 +584,7 @@ dtable::select_read (int fd, select_record *s)
|
||||
s = fh->select_read (s);
|
||||
s->fd = fd;
|
||||
s->fh = fh;
|
||||
s->saw_error = 0;
|
||||
s->thread_errno = 0;
|
||||
debug_printf ("%s fd %d", fh->get_name (), fd);
|
||||
return s;
|
||||
}
|
||||
@ -601,7 +601,7 @@ dtable::select_write (int fd, select_record *s)
|
||||
s = fh->select_write (s);
|
||||
s->fd = fd;
|
||||
s->fh = fh;
|
||||
s->saw_error = 0;
|
||||
s->thread_errno = 0;
|
||||
debug_printf ("%s fd %d", fh->get_name (), fd);
|
||||
return s;
|
||||
}
|
||||
@ -618,7 +618,7 @@ dtable::select_except (int fd, select_record *s)
|
||||
s = fh->select_except (s);
|
||||
s->fd = fd;
|
||||
s->fh = fh;
|
||||
s->saw_error = 0;
|
||||
s->thread_errno = 0;
|
||||
debug_printf ("%s fd %d", fh->get_name (), fd);
|
||||
return s;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ details. */
|
||||
#include "perprocess.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "cygerrno.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "registry.h"
|
||||
|
@ -13,13 +13,13 @@ details. */
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <process.h>
|
||||
#include "cygerrno.h"
|
||||
#include "perprocess.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "pinfo.h"
|
||||
#include "environ.h"
|
||||
#include "cygerrno.h"
|
||||
#undef _execve
|
||||
|
||||
/* This is called _execve and not execve because the real execve is defined
|
||||
|
@ -11,11 +11,11 @@ details. */
|
||||
#include "winsup.h"
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "thread.h"
|
||||
|
||||
|
@ -1216,7 +1216,7 @@ struct select_record
|
||||
int fd;
|
||||
HANDLE h;
|
||||
fhandler_base *fh;
|
||||
bool saw_error;
|
||||
int thread_errno;
|
||||
bool windows_handle;
|
||||
bool read_ready, write_ready, except_ready;
|
||||
bool read_selected, write_selected, except_selected;
|
||||
@ -1227,9 +1227,11 @@ struct select_record
|
||||
fd_set *exceptfds);
|
||||
void (*cleanup) (select_record *me, class select_stuff *stuff);
|
||||
struct select_record *next;
|
||||
void set_select_errno () {__seterrno (); thread_errno = errno;}
|
||||
int saw_error () {return thread_errno;}
|
||||
|
||||
select_record (fhandler_base *in_fh = NULL) : fd (0), h (NULL),
|
||||
fh (in_fh), saw_error (false), windows_handle (false),
|
||||
fh (in_fh), thread_errno (0), windows_handle (false),
|
||||
read_ready (false), write_ready (false), except_ready (false),
|
||||
read_selected (false), write_selected (false),
|
||||
except_selected (false), except_on_write (false),
|
||||
|
@ -16,10 +16,10 @@ details. */
|
||||
#include <asm/socket.h>
|
||||
#include <cygwin/hdreg.h>
|
||||
#include <cygwin/fs.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/**********************************************************************/
|
||||
/* fhandler_dev_floppy */
|
||||
|
@ -13,6 +13,7 @@ details. */
|
||||
#include "winsup.h"
|
||||
#include <errno.h>
|
||||
#include "security.h"
|
||||
#include "cygerrno.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
|
||||
|
@ -13,11 +13,11 @@ details. */
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygheap.h"
|
||||
|
@ -16,12 +16,12 @@ details. */
|
||||
#include <wininet.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "cygerrno.h"
|
||||
#include "pinfo.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "pwdgrp.h"
|
||||
#include "cygtls.h"
|
||||
|
@ -14,11 +14,11 @@ details. */
|
||||
#include "winsup.h"
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "heap.h"
|
||||
#include "sync.h"
|
||||
|
@ -13,11 +13,11 @@ details. */
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/mman.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "pinfo.h"
|
||||
#include "sys/cygwin.h"
|
||||
|
@ -14,11 +14,11 @@ details. */
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygwin_version.h"
|
||||
|
@ -18,11 +18,11 @@
|
||||
#include <stdlib.h>
|
||||
#define USE_SYS_TYPES_FD_SET
|
||||
#include <winsock2.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "sigproc.h"
|
||||
|
||||
|
@ -13,10 +13,10 @@ details. */
|
||||
#include "registry.h"
|
||||
#include "security.h"
|
||||
#include <cygwin/version.h>
|
||||
#include "cygerrno.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
static const char cygnus_class[] = "cygnus";
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ details. */
|
||||
#include <stdlib.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include "cygerrno.h"
|
||||
#include "pinfo.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "heap.h"
|
||||
#include "shared_info_magic.h"
|
||||
|
@ -14,6 +14,7 @@ details. */
|
||||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include <ctype.h>
|
||||
#include "cygerrno.h"
|
||||
#include "pinfo.h"
|
||||
#include "perprocess.h"
|
||||
#include "cygwin_version.h"
|
||||
@ -23,7 +24,6 @@ details. */
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
|
||||
#define PROTECT(x) x[sizeof (x)-1] = 0
|
||||
|
@ -13,11 +13,11 @@ details. */
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <ntdef.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "ntdll.h"
|
||||
|
||||
|
@ -14,11 +14,11 @@ details. */
|
||||
#include <syslog.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "thread.h"
|
||||
#include "cygtls.h"
|
||||
|
@ -18,12 +18,12 @@ details. */
|
||||
#include <stdlib.h>
|
||||
#include <lm.h>
|
||||
#include <sys/cygwin.h>
|
||||
#include "cygerrno.h"
|
||||
#include "pinfo.h"
|
||||
#include "security.h"
|
||||
#include "path.h"
|
||||
#include "fhandler.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "registry.h"
|
||||
#include "child_info.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user