summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscottc <scottc>2002-07-31 16:49:36 +0000
committerscottc <scottc>2002-07-31 16:49:36 +0000
commit22b8c8f5cb1b8abb5ed7dc614d34c9a0931e1c29 (patch)
treea4194c5095a90db7293218eb417dca75455fabfd
parent78eb7244a9d749e9d87c8212d2278bf2657ac825 (diff)
downloadgdb-22b8c8f5cb1b8abb5ed7dc614d34c9a0931e1c29.tar.gz
Merged changes from HEAD
-rw-r--r--winsup/cygwin/ChangeLog20
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc28
-rw-r--r--winsup/cygwin/net.cc1
-rw-r--r--winsup/cygwin/syscalls.cc9
4 files changed, 39 insertions, 19 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 5d59564e2b4..40384f53fcd 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,23 @@
+2002-07-31 Conrad Scott <conrad.scott@dsl.pipex.com>
+
+ * fhandler.h (fhandler_base::get_r_no_interrupt): Make non-virtual.
+ * net.cc (fdsock): Call set_r_no_interrupt.
+
+2002-07-30 Christopher Faylor <cgf@redhat.com>
+
+ * syscalls.cc (_read): Clarify debugging output.
+
+2002-07-30 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler.h (fhandler_base::get_r_no_interrupt): Make virtual.
+
+2002-07-30 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate .
+ and .. processing here.
+ (fhandler_cygdrive::readdir): Assume . and .. are already in pdrive.
+ (fhandler_cygdrive::seekdir): Ditto.
+
2002-07-29 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Move debug_fixup_after_fork_exec.
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 738416fbf9d..84698efe92a 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -730,9 +730,13 @@ void
fhandler_cygdrive::set_drives ()
{
const int len = 1 + 26 * DRVSZ;
- char *p = (char *) crealloc ((void *) win32_path_name, len);
+ char *p = (char *) crealloc ((void *) win32_path_name,
+ sizeof (".") + sizeof ("..") + len);
win32_path_name = pdrive = p;
+ strcpy (p, ".");
+ strcpy (p + sizeof ("."), "..");
+ p += sizeof (".") + sizeof ("..");
ndrives = GetLogicalDriveStrings (len, p) / DRVSZ;
}
@@ -770,28 +774,21 @@ fhandler_cygdrive::readdir (DIR *dir)
set_errno (ENMFILE);
return NULL;
}
- if (dir->__d_position == 0)
+ else if (dir->__d_position > 1
+ && GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
{
- *dir->__d_dirent->d_name = '.';
- dir->__d_dirent->d_name[1] = '\0';
- }
- else if (dir->__d_position == 1)
- {
- dir->__d_dirent->d_name[0] = dir->__d_dirent->d_name[1] = '.';
- dir->__d_dirent->d_name[2] = '\0';
- }
- else if (GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
- {
- pdrive += DRVSZ;
+ pdrive = strchr (pdrive, '\0') + 1;
return readdir (dir);
}
+ else if (*pdrive == '.')
+ strcpy (dir->__d_dirent->d_name, pdrive);
else
{
*dir->__d_dirent->d_name = cyg_tolower (*pdrive);
dir->__d_dirent->d_name[1] = '\0';
}
dir->__d_position++;
- pdrive += DRVSZ;
+ pdrive = strchr (pdrive, '\0') + 1;
syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir,
dir->__d_dirent->d_name);
return dir->__d_dirent;
@@ -809,7 +806,8 @@ fhandler_cygdrive::seekdir (DIR *dir, __off64_t loc)
if (!iscygdrive_root ())
return fhandler_disk_file::seekdir (dir, loc);
- for (pdrive = win32_path_name, dir->__d_position = -1; *pdrive; pdrive += DRVSZ)
+ for (pdrive = win32_path_name, dir->__d_position = -1; *pdrive;
+ pdrive = strchr (pdrive, '\0') + 1)
if (++dir->__d_position >= loc)
break;
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 870bf7865e2..f6a403fc357 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -511,6 +511,7 @@ fdsock (int& fd, const char *name, SOCKET soc)
fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name);
fh->set_io_handle ((HANDLE) soc);
fh->set_flags (O_RDWR | O_BINARY);
+ fh->set_r_no_interrupt (winsock2_active);
debug_printf ("fd %d, name '%s', soc %p", fd, name, soc);
return fh;
}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 2dc5f177623..4b2fc3d0738 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -305,10 +305,11 @@ _read (int fd, void *ptr, size_t len)
DWORD wait = cfd->is_nonblocking () ? 0 : INFINITE;
/* Could block, so let user know we at least got here. */
- syscall_printf ("read (%d, %p, %d) %sblocking, sigcatchers %d", fd, ptr, len, wait ? "" : "non", sigcatchers);
+ syscall_printf ("read (%d, %p, %d) %sblocking, sigcatchers %d",
+ fd, ptr, len, wait ? "" : "non", sigcatchers);
if (wait && (!cfd->is_slow () || cfd->get_r_no_interrupt ()))
- debug_printf ("non-interruptible read\n");
+ debug_printf ("no need to call ready_for_read\n");
else if (!cfd->ready_for_read (fd, wait))
{
res = -1;
@@ -318,7 +319,7 @@ _read (int fd, void *ptr, size_t len)
/* FIXME: This is not thread safe. We need some method to
ensure that an fd, closed in another thread, aborts I/O
operations. */
- if (!cfd.isopen())
+ if (!cfd.isopen ())
return -1;
/* Check to see if this is a background read from a "tty",
@@ -331,7 +332,7 @@ _read (int fd, void *ptr, size_t len)
if (res > bg_eof)
{
myself->process_state |= PID_TTYIN;
- if (!cfd.isopen())
+ if (!cfd.isopen ())
return -1;
res = cfd->read (ptr, len);
myself->process_state &= ~PID_TTYIN;