From 2a18bfd72f114f4cdff77661866b2439b3685d33 Mon Sep 17 00:00:00 2001 From: scottc Date: Wed, 7 Aug 2002 10:44:59 +0000 Subject: Merged changes from HEAD --- winsup/cygwin/ChangeLog | 16 ++++++++++++++++ winsup/cygwin/cygheap.cc | 33 +++++++++++++-------------------- winsup/cygwin/fhandler_socket.cc | 5 +++-- winsup/cygwin/shared.cc | 2 +- 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 + + * fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call. + +2002-08-06 Christopher Faylor + + * 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 + Conrad Scott * 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) -- cgit v1.2.1