summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscottc <scottc>2002-08-07 10:44:59 +0000
committerscottc <scottc>2002-08-07 10:44:59 +0000
commit2a18bfd72f114f4cdff77661866b2439b3685d33 (patch)
treeba941f3014cbe4060a9322bb050a5db97cbffdaf
parent19203fb54c030d04124df3cb2cd82904c68758f3 (diff)
downloadgdb-2a18bfd72f114f4cdff77661866b2439b3685d33.tar.gz
Merged changes from HEAD
-rw-r--r--winsup/cygwin/ChangeLog16
-rw-r--r--winsup/cygwin/cygheap.cc33
-rw-r--r--winsup/cygwin/fhandler_socket.cc5
-rw-r--r--winsup/cygwin/shared.cc2
4 files changed, 33 insertions, 23 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 20f4c1262b0..3a4487f2328 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,19 @@
+2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com>
+
+ * fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call.
+
+2002-08-06 Christopher Faylor <cgf@redhat.com>
+
+ * cygheap.cc (_csbrk): Avoid !cygheap considerations.
+ (cygheap_init): Deal with unintialized cygheap issues here.
+ (cheap_init): Move cygheap_max setting here.
+
+2002-08-06 Christopher Faylor <cgf@redhat.com>
+ Conrad Scott <conrad.scott@dsl.pipex.com
+
+ * cygheap.cc (_csbrk): Allocate some slop initially. Don't erroneously
+ add sbrk amount to returned value in initial case.
+
2002-08-06 Christopher Faylor <cgf@redhat.com>
* spawn.cc (spawn_guts): Don't set mount_h here.
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index edd77fcf325..7ea7a39c39e 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -61,6 +61,7 @@ init_cheap ()
api_fatal ("AllocationBase %p, BaseAddress %p, RegionSize %p, State %p\n",
m.AllocationBase, m.BaseAddress, m.RegionSize, m.State);
}
+ cygheap_max = cygheap;
}
static void dup_now (void *, child_info *, unsigned) __attribute__ ((regparm(3)));
@@ -171,25 +172,13 @@ cygheap_fixup_in_child (bool execed)
static void *__stdcall
_csbrk (int sbs)
{
- void *prebrk;
-
- if (!cygheap)
- {
- init_cheap ();
- cygheap_max = cygheap;
- (void) _csbrk ((int) pagetrunc (4095 + sbs + sizeof (*cygheap)));
- prebrk = (char *) (cygheap + 1) + sbs;
- }
- else
- {
- prebrk = cygheap_max;
- void *prebrka = pagetrunc (prebrk);
- (char *) cygheap_max += sbs;
- if (!sbs || (prebrk != prebrka && prebrka == pagetrunc (cygheap_max)))
- /* nothing to do */;
- else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
- api_fatal ("couldn't commit memory for cygwin heap, %E");
- }
+ void *prebrk = cygheap_max;
+ void *prebrka = pagetrunc (prebrk);
+ (char *) cygheap_max += sbs;
+ if (!sbs || (prebrk != prebrka && prebrka == pagetrunc (cygheap_max)))
+ /* nothing to do */;
+ else if (!VirtualAlloc (prebrk, (DWORD) sbs, MEM_COMMIT, PAGE_READWRITE))
+ api_fatal ("couldn't commit memory for cygwin heap, %E");
return prebrk;
}
@@ -198,7 +187,11 @@ extern "C" void __stdcall
cygheap_init ()
{
new_muto (cygheap_protect);
- _csbrk (0);
+ if (!cygheap)
+ {
+ init_cheap ();
+ (void) _csbrk (sizeof (*cygheap));
+ }
if (!cygheap->fdtab)
cygheap->fdtab.init ();
}
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 6e76a6523a2..01a9f738e8a 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -523,8 +523,9 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
/* Unset events for listening socket and
switch back to blocking mode */
- WSAEventSelect (get_socket (), ev[0], 0 );
- ioctlsocket (get_socket (), FIONBIO, 0);
+ WSAEventSelect (get_socket (), ev[0], 0);
+ unsigned long nonblocking = 0;
+ ioctlsocket (get_socket (), FIONBIO, &nonblocking);
switch (wait_result)
{
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
index dd8e67c6342..7585d63647d 100644
--- a/winsup/cygwin/shared.cc
+++ b/winsup/cygwin/shared.cc
@@ -29,7 +29,7 @@ details. */
shared_info NO_COPY *cygwin_shared = NULL;
mount_info NO_COPY *mount_table = NULL;
-HANDLE cygwin_mount_h;
+HANDLE NO_COPY cygwin_mount_h;
char * __stdcall
shared_name (const char *str, int num)