diff options
author | Christopher Faylor <me@cgf.cx> | 2000-10-07 03:25:38 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-10-07 03:25:38 +0000 |
commit | 7aadaf0f7eefe50e4f7d4aa71b71b1f85e37ea6e (patch) | |
tree | 2126164785991b7b164faec20382c0006c77ee33 /winsup | |
parent | 829425c9fdfa7aa595e247897bb33d2f69272048 (diff) | |
download | cygnal-7aadaf0f7eefe50e4f7d4aa71b71b1f85e37ea6e.tar.gz cygnal-7aadaf0f7eefe50e4f7d4aa71b71b1f85e37ea6e.tar.bz2 cygnal-7aadaf0f7eefe50e4f7d4aa71b71b1f85e37ea6e.zip |
* syscalls.cc (_read): Behave properly when passed previous version of
O_NDELAY. Fix up debugging output.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6cb4c75a4..ef5486235 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 6 23:21:29 2000 Christopher Faylor <cgf@cygnus.com> + + * syscalls.cc (_read): Behave properly when passed previous version of + O_NDELAY. Fix up debugging output. + Thu Oct 5 20:34:48 2000 Christopher Faylor <cgf@cygnus.com> * net.cc (set_socket_inheritance): Rename from duplicate_socket. Use diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index ffb1e7a03..893dab9e2 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -38,6 +38,11 @@ details. */ #include "perprocess.h" #include "security.h" +/* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it + properly defines both to be the same. Unfortunately, we have to + behave properly the old version, too, to accomodate older executables. */ +#define OLD_O_NDELAY 4 + extern BOOL allow_ntsec; /* Close all files and process any queued deletions. @@ -202,10 +207,10 @@ _read (int fd, void *ptr, size_t len) set_sig_errno (0); fhandler_base *fh = fdtab[fd]; - DWORD wait = fh->get_flags () & (O_NONBLOCK | O_NDELAY) ? 0 : INFINITE; + DWORD wait = (fh->get_flags () & (O_NONBLOCK | OLD_O_NDELAY)) ? 0 : INFINITE; /* Could block, so let user know we at least got here. */ - syscall_printf ("read (%d, %p, %d)", fd, ptr, len); + syscall_printf ("read (%d, %p, %d) %sblocking", fd, ptr, len, wait ? "" : "non"); int res; if (wait && (!fh->is_slow () || fh->get_r_no_interrupt ())) @@ -232,7 +237,7 @@ _read (int fd, void *ptr, size_t len) out: - syscall_printf ("%d = read (%d<%s>, %p, %d), errno %d", -1, fd, fh->get_name (), + syscall_printf ("%d = read (%d<%s>, %p, %d), errno %d", res, fd, fh->get_name (), ptr, len, get_errno ()); MALLOC_CHECK; return res; |