heap.
* sigproc.cc (NZOMBIES): Rename from ZOMBIEMAX for clarity.
(zombies): Revert to original behavior. Allocating zombie array resulted in
performance hit.
* winsup.h: Declare malloc lock routines.
+Sat Sep 8 23:32:18 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * fork.cc (fork_parent): Stop malloc activity while fork is in control
+ of the heap.
+ * sigproc.cc (NZOMBIES): Rename from ZOMBIEMAX for clarity.
+ (zombies): Revert to original behavior. Allocating zombie array
+ resulted in performance hit.
+ * winsup.h: Declare malloc lock routines.
+
Fri Sep 7 21:35:35 2001 Christopher Faylor <cgf@cygnus.com>
* cygwin.din: Add gamm*_r function exports.
char sa_buf[1024];
syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)",
myself->progname, myself->progname, c_flags, &si, &pi);
+ __malloc_lock (_reent_clib ());
cygheap_setup_for_child (&ch);
rc = CreateProcess (myself->progname, /* image to run */
myself->progname, /* what we send in arg0 */
dll_data_start, dll_data_end,
dll_bss_start, dll_bss_end, NULL);
+ __malloc_unlock (_reent_clib ());
MALLOC_CHECK;
if (!rc)
goto cleanup;
/* These routines are used by the application if it
doesn't provide its own malloc. */
-extern "C"
-void
+extern "C" void
export_free (void *p)
{
malloc_printf ("(%p), called by %x", p, ((int *)&p)[-1]);
user_data->free (p);
}
-extern "C"
-void *
+extern "C" void *
export_malloc (int size)
{
void *res;
return res;
}
-extern "C"
-void *
+extern "C" void *
export_realloc (void *p, int size)
{
void *res;
return res;
}
-extern "C"
-void *
+extern "C" void *
export_calloc (size_t nmemb, size_t size)
{
void *res;
}
}
-extern "C"
-void
+extern "C" void
__malloc_lock (struct _reent *)
{
mprotect->acquire ();
}
-extern "C"
-void
+extern "C" void
__malloc_unlock (struct _reent *)
{
mprotect->release ();
#define no_signals_available() (!hwait_sig || !sig_loop_wait)
-#define ZOMBIEMAX 4096
+#define NZOMBIES 4096
/*
* Global variables
/* Used by WaitForMultipleObjects. These are handles to child processes.
*/
-Static HANDLE events[PSIZE + 1] = {0}; // All my children's handles++
+Static HANDLE events[PSIZE + 1] = {0}; // All my children's handles++
#define hchildren (events + 1) // Where the children handles begin
Static pinfo pchildren[PSIZE]; // All my children info
Static int nchildren = 0; // Number of active children
-static pinfo *zombies; // All my deceased children info
-static int nzombies; // Number of deceased children
+Static pinfo zombies[NZOMBIES]; // All my deceased children info
+Static int nzombies = 0; // Number of deceased children
Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
Static waitq waitq_main; // Storage for main thread
filled up our table or if we're ignoring SIGCHLD, then we immediately
remove the process and move on. Otherwise, this process becomes a zombie
which must be reaped by a wait() call. */
- if (nzombies >= ZOMBIEMAX
+ if (nzombies >= NZOMBIES
|| myself->getsig (SIGCHLD).sa_handler == (void *) SIG_IGN)
{
sigproc_printf ("automatically removing zombie %d", thiszombie);
void __stdcall
sigproc_init ()
{
- if (!zombies)
- zombies = (pinfo *) malloc (sizeof (pinfo) * ZOMBIEMAX);
- else
- nzombies = 0;
-
wait_sig_inited = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
ProtectHandle (wait_sig_inited);
extern "C" int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/;
extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/;
+extern "C" void __malloc_lock (struct _reent *);
+extern "C" void __malloc_unlock (struct _reent *);
+
/**************************** Exports ******************************/
extern "C" {