diff options
author | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:33 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:33 +0000 |
commit | 1fd5e000ace55b323124c7e556a7a864b972a5c4 (patch) | |
tree | dc4fcf1e5e22a040716ef92c496b8d94959b2baa /winsup/cygwin/init.cc | |
parent | 369d8a8fd5e887eca547bf34bccfdf755c9e5397 (diff) | |
download | cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.tar.gz cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.tar.bz2 cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.zip |
import winsup-2000-02-17 snapshot
Diffstat (limited to 'winsup/cygwin/init.cc')
-rw-r--r-- | winsup/cygwin/init.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc new file mode 100644 index 000000000..a159def55 --- /dev/null +++ b/winsup/cygwin/init.cc @@ -0,0 +1,58 @@ +/* init.cc for WIN32. + + Copyright 1996, 1997, 1998, 1999 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#include <stdlib.h> +#include <ctype.h> +#include "winsup.h" + +extern "C" +{ + int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); +}; + +extern "C" void *export_malloc (unsigned int); +extern "C" void *export_realloc (void *,unsigned int); +extern "C" void *export_calloc (unsigned int,unsigned int); +extern "C" void export_free (void *); + +extern void do_global_ctors (void (**in_pfunc)(), int force); + +int NO_COPY dynamically_loaded; + +int +WINAPI dll_entry (HANDLE hdll, DWORD reason, void *static_load) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + dynamically_loaded = (static_load == NULL); + break; + case DLL_THREAD_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_DETACH: +#if 0 // FIXME: REINSTATE SOON + waitq *w; + if ((w = waitq_storage.get ()) != NULL) + { + if (w->thread_ev != NULL) + { + system_printf ("closing %p", w->thread_ev); + (void) CloseHandle (w->thread_ev); + } + memset (w, 0, sizeof(*w)); // FIXME: memory leak + } + // FIXME: Need to add other per_thread stuff here +#endif + break; + } + return 1; +} |