* cygheap.h (init_cygheap): Move heap pointers here.
* include/sys/cygwin.h (perprocess): Remove heap pointers. * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff. (_dll_crt0): Don't initialize heap pointers. (cygwin_dll_init): Ditto. (release_upto): Use heap pointers from cygheap. * heap.h: Ditto. * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch. (fork_child): Remove obsolete sigproc_fixup_after_fork. * shared.cc (memory_init): Reorganize so that cygheap initialization is called prior to regular heap since regular heap uses cygheap now. * sigproc.cc (proc_subproc): Eliminate zombies allocation. (sigproc_init): Move zombies alloation here. Don't free up array on fork, just reuse it. (sigproc_fixup_after_fork): Eliminate. * sigproc.h: Ditto. * include/cygwin/version.h: Reflect change to perprocess structure.
This commit is contained in:
parent
b2d319cb3e
commit
1ff9f4b937
|
@ -1,3 +1,23 @@
|
||||||
|
Fri Sep 7 17:11:11 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* cygheap.h (init_cygheap): Move heap pointers here.
|
||||||
|
* include/sys/cygwin.h (perprocess): Remove heap pointers.
|
||||||
|
* dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff.
|
||||||
|
(_dll_crt0): Don't initialize heap pointers.
|
||||||
|
(cygwin_dll_init): Ditto.
|
||||||
|
(release_upto): Use heap pointers from cygheap.
|
||||||
|
* heap.h: Ditto.
|
||||||
|
* fork.cc (fork_parent): Ditto. Don't set heap pointers in ch.
|
||||||
|
(fork_child): Remove obsolete sigproc_fixup_after_fork.
|
||||||
|
* shared.cc (memory_init): Reorganize so that cygheap initialization is
|
||||||
|
called prior to regular heap since regular heap uses cygheap now.
|
||||||
|
* sigproc.cc (proc_subproc): Eliminate zombies allocation.
|
||||||
|
(sigproc_init): Move zombies alloation here. Don't free up array on
|
||||||
|
fork, just reuse it.
|
||||||
|
(sigproc_fixup_after_fork): Eliminate.
|
||||||
|
* sigproc.h: Ditto.
|
||||||
|
* include/cygwin/version.h: Reflect change to perprocess structure.
|
||||||
|
|
||||||
Fri Sep 7 10:53:34 2001 Jason Tishler <jason@tishler.net>
|
Fri Sep 7 10:53:34 2001 Jason Tishler <jason@tishler.net>
|
||||||
|
|
||||||
* poll.cc (poll): Change implementation to only call select() when no
|
* poll.cc (poll): Change implementation to only call select() when no
|
||||||
|
|
|
@ -153,6 +153,9 @@ struct init_cygheap
|
||||||
{
|
{
|
||||||
_cmalloc_entry *chain;
|
_cmalloc_entry *chain;
|
||||||
char *buckets[32];
|
char *buckets[32];
|
||||||
|
void *heapbase;
|
||||||
|
void *heapptr;
|
||||||
|
void *heaptop;
|
||||||
cygheap_root root;
|
cygheap_root root;
|
||||||
cygheap_user user;
|
cygheap_user user;
|
||||||
mode_t umask;
|
mode_t umask;
|
||||||
|
|
|
@ -101,9 +101,9 @@ extern "C"
|
||||||
/* calloc */ export_calloc,
|
/* calloc */ export_calloc,
|
||||||
/* premain */ {NULL, NULL, NULL, NULL},
|
/* premain */ {NULL, NULL, NULL, NULL},
|
||||||
/* run_ctors_p */ 0,
|
/* run_ctors_p */ 0,
|
||||||
/* unused */ { 0, 0, 0},
|
/* unused */ {0, 0, 0, 0, 0, 0, 0},
|
||||||
/* heapbase */ NULL, /* heapptr */ NULL, /* heaptop */ NULL,
|
/* forkee */ 0,
|
||||||
/* unused1 */ 0, /* forkee */ 0, /* hmodule */ NULL,
|
/* hmodule */ NULL,
|
||||||
/* api_major */ CYGWIN_VERSION_API_MAJOR,
|
/* api_major */ CYGWIN_VERSION_API_MAJOR,
|
||||||
/* api_minor */ CYGWIN_VERSION_API_MINOR,
|
/* api_minor */ CYGWIN_VERSION_API_MINOR,
|
||||||
/* unused2 */ {0, 0, 0, 0, 0},
|
/* unused2 */ {0, 0, 0, 0, 0},
|
||||||
|
@ -683,9 +683,6 @@ dll_crt0_1 ()
|
||||||
cygheap_fixup_in_child (child_proc_info, 0);
|
cygheap_fixup_in_child (child_proc_info, 0);
|
||||||
alloc_stack (fork_info);
|
alloc_stack (fork_info);
|
||||||
set_myself (mypid);
|
set_myself (mypid);
|
||||||
user_data->heaptop = child_proc_info->heaptop;
|
|
||||||
user_data->heapbase = child_proc_info->heapbase;
|
|
||||||
user_data->heapptr = child_proc_info->heapptr;
|
|
||||||
ProtectHandle (child_proc_info->forker_finished);
|
ProtectHandle (child_proc_info->forker_finished);
|
||||||
break;
|
break;
|
||||||
case PROC_SPAWN:
|
case PROC_SPAWN:
|
||||||
|
@ -896,7 +893,6 @@ _dll_crt0 ()
|
||||||
|
|
||||||
main_environ = user_data->envptr;
|
main_environ = user_data->envptr;
|
||||||
*main_environ = NULL;
|
*main_environ = NULL;
|
||||||
user_data->heapbase = user_data->heapptr = user_data->heaptop = NULL;
|
|
||||||
|
|
||||||
set_console_handler ();
|
set_console_handler ();
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
||||||
|
@ -954,7 +950,6 @@ cygwin_dll_init ()
|
||||||
{
|
{
|
||||||
static char **envp;
|
static char **envp;
|
||||||
static int _fmode;
|
static int _fmode;
|
||||||
user_data->heapbase = user_data->heapptr = user_data->heaptop = NULL;
|
|
||||||
|
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
||||||
GetCurrentProcess (), &hMainProc, 0, FALSE,
|
GetCurrentProcess (), &hMainProc, 0, FALSE,
|
||||||
|
|
|
@ -13,6 +13,10 @@ details. */
|
||||||
#include "perprocess.h"
|
#include "perprocess.h"
|
||||||
#include "dll_init.h"
|
#include "dll_init.h"
|
||||||
#include "environ.h"
|
#include "environ.h"
|
||||||
|
#include "security.h"
|
||||||
|
#include "fhandler.h"
|
||||||
|
#include "dtable.h"
|
||||||
|
#include "cygheap.h"
|
||||||
|
|
||||||
extern void __stdcall check_sanity_and_sync (per_process *);
|
extern void __stdcall check_sanity_and_sync (per_process *);
|
||||||
|
|
||||||
|
@ -253,7 +257,7 @@ release_upto (const char *name, DWORD here)
|
||||||
{
|
{
|
||||||
size = mb.RegionSize;
|
size = mb.RegionSize;
|
||||||
if (!(mb.State == MEM_RESERVE && mb.AllocationProtect == PAGE_NOACCESS &&
|
if (!(mb.State == MEM_RESERVE && mb.AllocationProtect == PAGE_NOACCESS &&
|
||||||
((void *) start < user_data->heapbase || (void *) start > user_data->heaptop)))
|
((void *) start < cygheap->heapbase || (void *) start > cygheap->heaptop)))
|
||||||
continue;
|
continue;
|
||||||
if (!VirtualFree ((void *) start, 0, MEM_RELEASE))
|
if (!VirtualFree ((void *) start, 0, MEM_RELEASE))
|
||||||
api_fatal ("couldn't release memory %p(%d) for '%s' alignment, %E\n",
|
api_fatal ("couldn't release memory %p(%d) for '%s' alignment, %E\n",
|
||||||
|
|
|
@ -28,6 +28,25 @@
|
||||||
* malloc_usable_size(P) is equivalent to realloc(P, malloc_usable_size(P))
|
* malloc_usable_size(P) is equivalent to realloc(P, malloc_usable_size(P))
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.4 2001/09/07 21:32:04 cgf
|
||||||
|
* * cygheap.h (init_cygheap): Move heap pointers here.
|
||||||
|
* * include/sys/cygwin.h (perprocess): Remove heap pointers.
|
||||||
|
* * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff.
|
||||||
|
* (_dll_crt0): Don't initialize heap pointers.
|
||||||
|
* (cygwin_dll_init): Ditto.
|
||||||
|
* (release_upto): Use heap pointers from cygheap.
|
||||||
|
* * heap.h: Ditto.
|
||||||
|
* * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch.
|
||||||
|
* (fork_child): Remove obsolete sigproc_fixup_after_fork.
|
||||||
|
* * shared.cc (memory_init): Reorganize so that cygheap initialization is called
|
||||||
|
* prior to regular heap since regular heap uses cygheap now.
|
||||||
|
* * sigproc.cc (proc_subproc): Eliminate zombies allocation.
|
||||||
|
* (sigproc_init): Move zombies alloation here. Don't free up array on fork, just
|
||||||
|
* reuse it.
|
||||||
|
* (sigproc_fixup_after_fork): Eliminate.
|
||||||
|
* * sigproc.h: Ditto.
|
||||||
|
* * include/cygwin/version.h: Reflect change to perprocess structure.
|
||||||
|
*
|
||||||
* Revision 1.3 2001/06/26 14:47:48 cgf
|
* Revision 1.3 2001/06/26 14:47:48 cgf
|
||||||
* * mmap.cc: Clean up *ResourceLock calls throughout.
|
* * mmap.cc: Clean up *ResourceLock calls throughout.
|
||||||
* * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well as
|
* * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well as
|
||||||
|
|
|
@ -279,7 +279,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
|
||||||
debug_fixup_after_fork ();
|
debug_fixup_after_fork ();
|
||||||
pinfo_fixup_after_fork ();
|
pinfo_fixup_after_fork ();
|
||||||
cygheap->fdtab.fixup_after_fork (hParent);
|
cygheap->fdtab.fixup_after_fork (hParent);
|
||||||
sigproc_fixup_after_fork ();
|
|
||||||
signal_fixup_after_fork ();
|
signal_fixup_after_fork ();
|
||||||
|
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
|
@ -430,9 +429,6 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
|
||||||
init_child_info (PROC_FORK1, &ch, 1, subproc_ready);
|
init_child_info (PROC_FORK1, &ch, 1, subproc_ready);
|
||||||
|
|
||||||
ch.forker_finished = forker_finished;
|
ch.forker_finished = forker_finished;
|
||||||
ch.heaptop = user_data->heaptop;
|
|
||||||
ch.heapbase = user_data->heapbase;
|
|
||||||
ch.heapptr = user_data->heapptr;
|
|
||||||
|
|
||||||
stack_base (ch);
|
stack_base (ch);
|
||||||
|
|
||||||
|
@ -556,7 +552,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll,
|
||||||
rc = fork_copy (pi, "user/cygwin data",
|
rc = fork_copy (pi, "user/cygwin data",
|
||||||
user_data->data_start, user_data->data_end,
|
user_data->data_start, user_data->data_end,
|
||||||
user_data->bss_start, user_data->bss_end,
|
user_data->bss_start, user_data->bss_end,
|
||||||
ch.heapbase, ch.heapptr,
|
cygheap->heapbase, cygheap->heapptr,
|
||||||
stack_here, ch.stackbottom,
|
stack_here, ch.stackbottom,
|
||||||
dll_data_start, dll_data_end,
|
dll_data_start, dll_data_end,
|
||||||
dll_bss_start, dll_bss_end, NULL);
|
dll_bss_start, dll_bss_end, NULL);
|
||||||
|
|
|
@ -16,6 +16,10 @@ details. */
|
||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "shared_info.h"
|
#include "shared_info.h"
|
||||||
|
#include "security.h"
|
||||||
|
#include "fhandler.h"
|
||||||
|
#include "dtable.h"
|
||||||
|
#include "cygheap.h"
|
||||||
|
|
||||||
#define assert(x)
|
#define assert(x)
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ void malloc_init ();
|
||||||
|
|
||||||
#define inheap(s) (brk && ((char *) (s) >= (char *) brkbase) && ((char *) (s) <= (char *) brktop))
|
#define inheap(s) (brk && ((char *) (s) >= (char *) brkbase) && ((char *) (s) <= (char *) brktop))
|
||||||
|
|
||||||
#define brksize ((char *) user_data->heaptop - (char *) user_data->heapbase)
|
#define brksize ((char *) cygheap->heaptop - (char *) cygheap->heapbase)
|
||||||
#define brk (user_data->heapptr)
|
#define brk (cygheap->heapptr)
|
||||||
#define brkbase (user_data->heapbase)
|
#define brkbase (cygheap->heapbase)
|
||||||
#define brktop (user_data->heaptop)
|
#define brktop (cygheap->heaptop)
|
||||||
#define brkchunk (cygwin_shared->heap_chunk_size ())
|
#define brkchunk (cygwin_shared->heap_chunk_size ())
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ details. */
|
||||||
42: sys_errlist, sys_nerr
|
42: sys_errlist, sys_nerr
|
||||||
43: sigsetjmp, siglongjmp fixed
|
43: sigsetjmp, siglongjmp fixed
|
||||||
44: Export dirfd
|
44: Export dirfd
|
||||||
|
45: perprocess change
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CYGWIN_VERSION_API_MAJOR 0
|
#define CYGWIN_VERSION_API_MAJOR 0
|
||||||
|
|
|
@ -163,14 +163,7 @@ struct per_process
|
||||||
/* non-zero of ctors have been run. Inherited from parent. */
|
/* non-zero of ctors have been run. Inherited from parent. */
|
||||||
int run_ctors_p;
|
int run_ctors_p;
|
||||||
|
|
||||||
DWORD unused[3];
|
DWORD unused[7];
|
||||||
|
|
||||||
/* Heap management. Inherited from parent. */
|
|
||||||
void *heapbase; /* bottom of the heap */
|
|
||||||
void *heapptr; /* current index into heap */
|
|
||||||
void *heaptop; /* current top of heap */
|
|
||||||
|
|
||||||
DWORD unused1;
|
|
||||||
|
|
||||||
/* Non-zero means the task was forked. The value is the pid.
|
/* Non-zero means the task was forked. The value is the pid.
|
||||||
Inherited from parent. */
|
Inherited from parent. */
|
||||||
|
|
|
@ -151,7 +151,6 @@ memory_init ()
|
||||||
cygwin_shared_address);
|
cygwin_shared_address);
|
||||||
|
|
||||||
cygwin_shared->initialize ();
|
cygwin_shared->initialize ();
|
||||||
heap_init ();
|
|
||||||
|
|
||||||
/* Allocate memory for the per-user mount table */
|
/* Allocate memory for the per-user mount table */
|
||||||
char user_name[UNLEN + 1];
|
char user_name[UNLEN + 1];
|
||||||
|
@ -159,12 +158,6 @@ memory_init ()
|
||||||
|
|
||||||
if (!GetUserName (user_name, &user_name_len))
|
if (!GetUserName (user_name, &user_name_len))
|
||||||
strcpy (user_name, "unknown");
|
strcpy (user_name, "unknown");
|
||||||
mount_table = (mount_info *) open_shared (user_name, cygwin_mount_h,
|
|
||||||
sizeof (mount_info), 0);
|
|
||||||
debug_printf ("opening mount table for '%s' at %p", cygheap->user.name (),
|
|
||||||
mount_table_address);
|
|
||||||
ProtectHandle (cygwin_mount_h);
|
|
||||||
debug_printf ("mount table version %x at %p", mount_table->version, mount_table);
|
|
||||||
|
|
||||||
/* Initialize the Cygwin heap, if necessary */
|
/* Initialize the Cygwin heap, if necessary */
|
||||||
if (!cygheap)
|
if (!cygheap)
|
||||||
|
@ -172,9 +165,18 @@ memory_init ()
|
||||||
cygheap_init ();
|
cygheap_init ();
|
||||||
cygheap->user.set_name (user_name);
|
cygheap->user.set_name (user_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
cygheap->shared_h = shared_h;
|
cygheap->shared_h = shared_h;
|
||||||
ProtectHandle (cygheap->shared_h);
|
ProtectHandle (cygheap->shared_h);
|
||||||
|
|
||||||
|
heap_init ();
|
||||||
|
mount_table = (mount_info *) open_shared (user_name, cygwin_mount_h,
|
||||||
|
sizeof (mount_info), 0);
|
||||||
|
debug_printf ("opening mount table for '%s' at %p", cygheap->user.name (),
|
||||||
|
mount_table_address);
|
||||||
|
ProtectHandle (cygwin_mount_h);
|
||||||
|
debug_printf ("mount table version %x at %p", mount_table->version, mount_table);
|
||||||
|
|
||||||
/* Initialize the Cygwin per-user mount table, if necessary */
|
/* Initialize the Cygwin per-user mount table, if necessary */
|
||||||
if (!mount_table->version)
|
if (!mount_table->version)
|
||||||
{
|
{
|
||||||
|
|
|
@ -303,8 +303,6 @@ proc_subproc (DWORD what, DWORD val)
|
||||||
|
|
||||||
int thiszombie;
|
int thiszombie;
|
||||||
thiszombie = nzombies;
|
thiszombie = nzombies;
|
||||||
if (!zombies)
|
|
||||||
zombies = (pinfo *) malloc (sizeof (pinfo) * ZOMBIEMAX);
|
|
||||||
zombies[nzombies] = pchildren[val]; // Add to zombie array
|
zombies[nzombies] = pchildren[val]; // Add to zombie array
|
||||||
zombies[nzombies++]->process_state = PID_ZOMBIE;// Walking dead
|
zombies[nzombies++]->process_state = PID_ZOMBIE;// Walking dead
|
||||||
|
|
||||||
|
@ -545,6 +543,11 @@ sig_dispatch_pending (int justwake)
|
||||||
void __stdcall
|
void __stdcall
|
||||||
sigproc_init ()
|
sigproc_init ()
|
||||||
{
|
{
|
||||||
|
if (!zombies)
|
||||||
|
zombies = (pinfo *) malloc (sizeof (pinfo) * ZOMBIEMAX);
|
||||||
|
else
|
||||||
|
nzombies = 0;
|
||||||
|
|
||||||
wait_sig_inited = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
|
wait_sig_inited = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
|
||||||
ProtectHandle (wait_sig_inited);
|
ProtectHandle (wait_sig_inited);
|
||||||
|
|
||||||
|
@ -1304,17 +1307,6 @@ wait_subproc (VOID *)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall
|
|
||||||
sigproc_fixup_after_fork ()
|
|
||||||
{
|
|
||||||
if (zombies)
|
|
||||||
{
|
|
||||||
free (zombies);
|
|
||||||
nzombies = 0;
|
|
||||||
zombies = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
/* Provide a stack frame when calling WaitFor* functions */
|
/* Provide a stack frame when calling WaitFor* functions */
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,6 @@ int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_addre
|
||||||
bool exception = 0) __attribute__ ((regparm(3)));
|
bool exception = 0) __attribute__ ((regparm(3)));
|
||||||
void __stdcall signal_fixup_after_fork ();
|
void __stdcall signal_fixup_after_fork ();
|
||||||
void __stdcall signal_fixup_after_exec (bool);
|
void __stdcall signal_fixup_after_exec (bool);
|
||||||
void __stdcall sigproc_fixup_after_fork ();
|
|
||||||
|
|
||||||
extern char myself_nowait_dummy[];
|
extern char myself_nowait_dummy[];
|
||||||
extern char myself_nowait_nonmain_dummy[];
|
extern char myself_nowait_nonmain_dummy[];
|
||||||
|
|
Loading…
Reference in New Issue