summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dll_init.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen2016-06-231-3/+0
| | | | | | | | | | | | | | Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause. Everything else stays under GPLv3+. New Linking Exception exempts resulting executables from LGPLv3 section 4. Add CONTRIBUTORS file to keep track of licensing. Remove 'Copyright Red Hat Inc' comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Fix copyright datesCorinna Vinschen2015-07-291-1/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Reduce stack pressure throughout CygwinCorinna Vinschen2015-07-191-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dcrt0.cc (initial_env): Reduce size of local path buffers to PATH_MAX. Allocate debugger_command from process heap. (init_windows_system_directory): Very early initialize new global variable global_progname. * dll_init.cc (dll_list::alloc): Make path buffer static. Explain why. (dll_list::populate_deps): Use tmp_pathbuf for local path buffer. * exceptions.cc (debugger_command): Convert to PWCHAR. (error_start_init): Allocate debugger_command and fill with wide char strings. Only allocate if NULL. (try_to_debug): Just check if debugger_command is a NULL pointer to return. Drop conversion from char to WCHAR and drop local variable dbg_cmd. * globals.cc (global_progname): New global variable to store Windows application path. * pinfo.cc (pinfo_basic::pinfo_basic): Just copy progname over from global_progname. (pinfo::status_exit): Let path_conv create the POSIX path to avoid local buffer. * pseudo_reloc.cc (__report_error): Utilize global_progname, drop local buffer. * smallprint.cc (__small_vsprintf): Just utilize global_progname for %P format specifier. (__small_vswprintf): Ditto. * strace.cc (PROTECT): Change to reflect x being a pointer. Reformat. (CHECK): Ditto. Reformat. (strace::activate): Utilize global_progname, drop local buffer. Fix formatting. (strace::vsprntf): Reduce size of local progname buffer to NAME_MAX. Copy and, if necessary, convert only the last path component to progname. (strace_buf_guard): New muto. (buf): New static pointer. (strace::vprntf): Use buf under strace_buf_guard lock only. Allocate buffer space for buf on Windows heap. * wow64.cc (wow64_respawn_process): Utilize global_progname, drop local path buffer. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* * dlfcn.cc (dlopen): Disable old 32 bit code on 64 bit.Corinna Vinschen2014-10-101-1/+1
| | | | | * dcrt0.cc (check_sanity_and_sync): Ditto. * dll_init.cc (dll_dllcrt0_1): Fix typo in comment.
* * common.din (__cxa_finalize): Export.Yaakov Selkowitz2014-08-071-2/+2
| | | | | | | * dcrt0.cc (cygwin_atexit): Use d->handle with __cxa_atexit. * dll_init.cc (dll_list::detach): Use d->handle with __cxa_finalize. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Use 274 for __cxa_finalize as well.
* * dll_init.cc (dll_list::alloc): Fix buffer overrun (CID 59940).Corinna Vinschen2014-06-231-1/+1
|
* * dll_init.cc (dll_list::topsort): Fix early-return condition toCorinna Vinschen2013-05-271-1/+1
| | | | | | | accommodate process with all runtime loaded DLLs already dlclosed at fork time. * gendef (_sigfe_maybe): Fix code handling early return if we don't have a tls, broken on 2013-05-21.
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-32/+38
|
* Throughout, update copyrights to reflect dates which correspond to main-branchChristopher Faylor2013-01-211-2/+2
| | | | checkins. Regularize copyright format.
* whitespace cleanupChristopher Faylor2012-08-161-2/+2
|
* * dll_init.cc (dll_list::alloc): Take long UNC paths into account.Corinna Vinschen2012-07-021-1/+8
|
* * dll_init.cc (dll_list::operator[]): Extend comment a bit more toCorinna Vinschen2012-03-051-1/+16
| | | | explain previous patch.
* * dll_init.cc (dll_list::alloc): Compare linked DLLs by basename only.Corinna Vinschen2012-03-041-4/+30
| | | | | | | | | | Explain why. Add code to check if a DLL with the same basename but different path is the same DLL. Bail out if not. (in_load_after_fork): New static NO_COPY bool to allow to differ between linked and loaded DLL at fork. (dll_list::load_after_fork): Set in_load_after_fork accordingly. (dll_dllcrt0_1): Don't treat DLL as linked if in_load_after_fork is set. Drop test for in_forkee.
* * dll_init.cc: Revert pathname changes from 2012-02-08.Corinna Vinschen2012-03-041-13/+48
| | | | | | | (dll_list::operator[]): Add long comment to explain the misery. (dll_list::alloc): Skip long pathname prefix potentially returned by GetModuleFileNameW. * dll_init.h (dll_list::find_by_modname): Add back declaration.
* * dll_init.h (struct dll): Re-add modname.Corinna Vinschen2012-02-091-28/+26
| | | | | | | | * dll_init.cc: Throughout, use modname where it was used before. (dll_list::operator[]): Use modname. Move comment from dll_list::alloc here and remove hint about GetModuleBaseNameW. (dll_list::alloc): Store full path in name, pointer to basename in modname. Search dll using modname.
* * dll_init.cc: Throughout, drop usage of modname in favor of name.Corinna Vinschen2012-02-081-48/+29
| | | | | | | (dll_list::find_by_modname): Remove. (dll_list::alloc): Only store module basename in name. Add comment to explain why. Simplify address check. Fix formatting in comment. * dll_init.h (struct dll): Drop modname and find_by_modname.
* * dll_init.cc (dll_list::alloc): Add DLL name to fabort output. FixCorinna Vinschen2012-02-081-8/+8
| | | | fabort string in case of bss start.
* * dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we'reChristopher Faylor2011-12-081-10/+4
| | | | | | | | | | dynamically loaded since fork() doesn't work in that scenario anyway. (dll_dllcrt0_1): Don't accommodate dynamically loaded dlls. * exceptions.cc (ctrl_c_handler): Don't lock the process; there's too much risk of deadlock. * sigproc.cc (_cygtls::remove_wq): Don't try to remove anything from the waitq if there is obviously nothing there. * strace.cc (strace::activate): Allow stracing dynamically loaded cygwin1.dll.
* * sync.cc: Fix comment.Christopher Faylor2011-11-291-1/+1
| | | | | * dll_init.cc (dll_list::reserve_space): Use %p rather than %lx to show reserved space.
* * dll_init.cc: Use fabort in favor of api_fatal and fork_info->abort whereChristopher Faylor2011-08-031-42/+42
| | | | | | | | | | | | appropriate throughout. (fabort): Define. (dll_list::topsort): Don't print sorting information. Fix formatting. (dll_list::topsort_visit): Fix formatting. (dll_list::load_after_fork_impl): Perform comment fixups. * sigproc.cc (child_info_fork::abort): (for now?) Always print cause of fork failure. * include/sys/strace.h (strace_vprintf): Remove _STRACE_NOTALL when printing. We really do want to see this.
* * dll_init.cc (dll_list::load_after_fork_impl): Add a hint to an error message.Christopher Faylor2011-08-011-1/+1
|
* whitespace eliminationChristopher Faylor2011-06-061-1/+1
|
* * dll_init.cc (dll_list::append): Eliminate increment of unused tot variable.Christopher Faylor2011-05-301-1/+0
| | | | | | | * dll_init.h (dll_list::tot): Delete. (dll_list::populate_all_deps): Delete undefined function. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Move EPIPE handling under error condition.
* * dll_init.cc (reserve_upto): Remove.Christopher Faylor2011-05-301-112/+121
| | | | | | | | | | | | | | | (release_upto): Ditto. (dll_list::reserve_space): New function to reserve space needed by DLL_LOAD dlls early in the fork process. (dll_list::load_after_fork): Rewrite to use recursion to track reservations it makes while trying to make dlls land where they belong. (dll_list::load_after_fork_impl): New function used by load_after_fork. (dll_list::alloc): Initialize image base field. * dll_init.h (dll_list::prefered_base): New field. (dll_list::reserve_space): Declare new function. (dll_list::load_after_fork): Declare new function. * fork.cc (frok::child): call dll_list::reserve_space early, so we can retry if it fails.
* * dll_init.cc (dll_list::find_by_modname): New function to search the dll listChristopher Faylor2011-05-301-26/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | for a module name only (no path). (dll_list::alloc): Initialize newly-added members of struct dll. (dll_list::append): New function to factor out the append operation (used by dll_list::topsort). (dll_list::populate_deps): New function to identify dll dependencies. (dll_list::topsort): New function to sort the dll list topologically by dependencies. (dll_list::topsort_visit): New helper function for the above. * dll_init.h (dll::ndeps): New class member. (dll::deps): Ditto. (dll::modname): Ditto. (dll_list::find_by_modname): New function related to topsort. (dll_list::populate_all_deps): Ditto. (dll_list::populate_deps): Ditto. (dll_list::topsort): Ditto. (dll_list::topsort_visit): Ditto. (dll_list::append): Ditto. (pefile): New struct allowing simple introspection of dll images. * fork.cc (fork): Topologically sort the dll list before forking * child_info.h (CURR_CHILD_INFO_MAGIC): Refresh. (child_info::refresh_cygheap): New function. * spawn.cc (spawn_guts): Call refresh_cygheap before creating a new process to ensure that cygheap_max is up-to-date. * fork.cc (frok::parent): Ditto.
* * dll_init.cc (dll_list::alloc): Initialize dll::image_size.Christopher Faylor2011-05-281-6/+20
| | | | | | | | (reserve_at): Don't reserve space needed by the target dll if the latter overlaps the free region to be blocked. (dll_list::load_after_fork): Use new version of reserve_at. * dll_init.h (dll::image_size): New member. (pefile): New struct.
* Revert previous checkins as they introduced a bug when running zsh.Christopher Faylor2011-05-281-151/+13
|
* * dll_init.cc (reserve_upto): Remove.Christopher Faylor2011-05-281-6/+20
| | | | | | | | | | | | (release_upto): Ditto. (dll_list::reserve_space): New function to reserve space needed by DLL_LOAD dlls early in the fork process. (dll_list::load_after_fork): Rewrite to use recursion for tracking reservations made while trying to make dlls land where they belong. (dll_list::load_after_fork_impl): Ditto. (dll_list::alloc): Initialize image base field. * dll_init.h (struct dll_list): declare new functions. (dll::image_size): New member.
* * dll_init.cc (dll_list::find_by_modname): New function to search the dll listChristopher Faylor2011-05-281-7/+131
| | | | | | | | | | | | | | | | | | | | | | for a module name only (no path). (dll_list::alloc): Initialize newly-added members of struct dll. (dll_list::append): New function to factor out the append operation (used by dll_list::topsort). (dll_list::populate_deps): New function to identify dll dependencies. (dll_list::topsort): New function to sort the dll list topologically by dependencies. (dll_list::topsort_visit): New helper function for the above. * dll_init.h (dll::ndeps): New class member. (dll::deps): Ditto. (dll::modname): Ditto. (dll_list::find_by_modname): New function related to topsort. (dll_list::populate_all_deps): Ditto. (dll_list::populate_deps): Ditto. (dll_list::topsort): Ditto. (dll_list::topsort_visit): Ditto. (dll_list::append): Ditto. (pefile): New struct allowing simple introspection of dll images. * fork.cc (fork): Topologically sort the dll list before forking.
* * dll_init.c (dll_list::load_after_fork): Don't clear in_forkee here.Christopher Faylor2011-05-281-1/+0
| | | | | | | | | * fork.cc (frok::errmsg): Rename from 'error'. (frok::error): New function. Handle conditional printing of error messages. (frok::parent): Record hchild handle for use by error function. Use throughout. Use error function rather than setting error pointer directly. (fork): Clear is_forkee here. Accommodate rename of 'error' to 'errmsg'. * sigproc.cc (child_info::proc_retry): Detect EXITCODE_FORK_FAILED.
* * autoload.cc: Call _api_fatal in asm.Christopher Faylor2011-05-281-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * child_info.h: Redefine CURR_CHILD_INFO_MAGIC. (child_info_fork::abort): Rename from handle_failure. Change arguments. * cygtls.h (_local_storage::ttybuf): New field. * dcrt0.cc (vapi_fatal): Split api_fatal. Add "in forked process" to message when appropriate. (api_fatal): Use vapi_fatal. * devices.h: Make multiple inclusion safe. (fh_devices): Add FH_CONS* stuff. Reorder slightly. (device): Eliminate anonymous union. Add more ways to access minor/major. (device::setunit): Accommodate no-longer-anonymous union. (device::is_fs): Ditto. (device::is_fs_special): Ditto. (device::major): New function. (device::minor): Ditto. (device::is_device): New function. (device::not_device): Ditto. (device::operator int): New operator. (device::operator fh_devices): Ditto. (device::operator bool): Ditto. (device::operator DWORD): Ditto. (device::operator =): Ditto. (isproc_dev): New function. (isprocsys_dev): Ditto. (iscons_dev): Ditto. (istty_slave_dev): Ditto. * devices.in: Add new "/dev/cons*" strings. Accommodate no-longer-anonymous union throughout. (BRACK): Use more precise method for initialization. * devices.cc: Regenerate. * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty. (dtable::find_archetype): Use new DWORD operator in device to test archetypes. (dtable::init_std_file_from_handle): Use different method to initialize 'dev'. Adapt to different ctty handling and accommodate /dev/cons*. (fh_alloc): Accommodate no-longer-anonymous union. Adapt to new /dev/cons*. (build_fh_pc): Make debugging output more useful. * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty. * external.cc (fillout_pinfo): Accommodate new cons* stuff. * fhandler.cc (fhandler_base::read): Eliminate is_slow() test. * fhandler.h (fhandler_base::*): Adapt to changes in device.h. (fhandler_*::is_slow): Delete. ( fhandler_proc::get_proc_fhandler): Return fh_devices type. * fhandler_console.cc (open_shared_console): New function. (console_unit): New class. (console_unit::console_unit): New constructor. (enum_windows): New function. Declare as friend to console_unit. (fhandler_console::set_unit): New function. (fhandler_console::get_tty_stuff): Call set_unit to set the unit number and determine if initialization is needed. Eliminate flags parameter. (tty_list::get_cttyp): Rename (sorta) from get_tty. Return pointer to correct tty_min. (fhandler_console::open): Adapt to elimination of argument to get_tty_stuff. (fhandler_console::output_tcsetattr): Properly detect error condition. (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff() setting tc automatically. * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using fh_devices enum. (fhandler_proc::get_proc_fhandler): Return fh_devices. Adapt to devices.h changes. * fhandler_process.cc: Adapt to devices.h changes. Use FH_BAD rather than 0 throughout where using fh_devices enum. * fhandler_procnet.cc: Ditto. * fhandler_procsys.cc: Ditto. * fhandler_procsysvipc.cc: Ditto. * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto. * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname() rather than assuming that we can construct a tty. * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just return get_minor() of dev. (fhandler_pty_master::process_slave_output): Add slightly more debugging info. (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to unit. (fhandler_pty_master::open): Ditto. (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to represent a complete device. (fhandler_tty_master::init_console): Add debugging for failure path. (fhandler_pty_master::setup): Use get_unit() to retrieve unit number rather than relying on raw ntty. (fhandler_pty_master::setup): Ditto. * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices. * fork.cc: Remove obsolete vfork stuff. (frok::child): Don't assume that a ctty == 0 is valid. * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct changes. (mount_info::conv_to_win32_path): Ditto. * path.cc (path_conv::check): Retrive major/minor numbers via a method rather than accessing them directly from device. Rely on dev operators to set/retrieve device information as required by device struct change. * path.h (isproc_dev): Move to devices.h. (isprocsys_dev): Ditto. (isvirtual_dev): Ditto. (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}): Use device methods to access/manipulate devices. * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid. Use iscons_dev to determine if a device is a console. (_pinfo::_ctty): Use device::parse to generate tty/cons name. (_pinfo::set_ctty): Don't assume that ctty == 0 is valid. Remove redundant info from debugging. * shared.cc (offsets): Remove console offset. * shared_info.h (shared_locations): Ditto. * syscalls.cc (umask): Use device methods to manipulate device information. (ctermid): Use device::parse to generate term device name. * tlsoffsets.h: Regenerate. * tty.cc (ttyslot): Return minor number of ctty since ctty now represents a full device. (tty::create_master): Set ctty to a complete device. (tty_list::attach): Rework to detect new /dev/cons* stuff. (tty_list::terminate): Adapt to changes to ctty. (tty_list::init): Adapt to change to setntty - pass in device major number. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Define new function. * tty.h (tty_min::ntty): Redefine as fh_devices. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Declare new function. (tty::getntty): Declare as const. (tty_list::operator []): Assure that only minor part of argument is used. * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early issuing an explicit error message if necessary. * heap.cc (heap_init): Adapt to changes from fork->handle_failure to fork->abort. * pinfo.h (EXITCODE_FORK_FAILED): New enum. (from Ryan Johnson) * sigproc.cc (child_info_fork::abort): Rename from handle_failure. Change arguments to allow passing in a printf-like message. * winsup.h (api_fatal): Delete macro definition. (api_fatal): Redefine from __api_fatal. (vapi_fatal): Declare new function. * include/sys/strace.h (strace_vprintf): Define new macro. * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
* * dll_list::detach (dll_list::detach): Avoid doing anything with detach duringChristopher Faylor2011-05-041-1/+4
| | | | a failing fork.
* * dll_init.cc (dll_global_dtors): Avoid calling destructors during failingChristopher Faylor2011-05-041-0/+5
| | | | fork().
* Eliminate trailing whitespace in some files.Christopher Faylor2011-05-021-0/+1
| | | | | | * dll_init.cc (dll_list::alloc): Reset 'p' in forked process. * select.cc (select_stuff::wait): Move cleanup() closer to WFMO to minimize unavoidable (?) race.
* * cygheap.cc (init_cygheap::close_ctty): Avoid closing console-cttys since theyChristopher Faylor2011-04-211-18/+28
| | | | | | | | | | | don't use archetypes and this will just result in double frees. * dll_init.cc (dll_list::protect): Define. (dll_list::alloc): Guard list access. (dll_list::detach): Ditto. * dll_init.h (dll_list::protect): Declare new muto. (dll_list::guard): Define/declare function to guard list access. * fhandler_termios.cc (fhandler_termios::sigflush): Avoid SEGV in pathological condition of get_ttyp() == NULL.
* * dll_init.cc (reserve_at, release_at): New functions.Christopher Faylor2011-04-061-11/+61
| | | | | | (load_after_fork): If the DLL was loaded higher than the required address, assume that it loaded at it's base address and also reserve memory there to force it to be relocated.
* * dll_init.cc (dll::init): Accommodate ill-behaved dlls who don't fill outChristopher Faylor2011-03-271-1/+4
| | | | p.envptr.
* * Throughout fix copyright dates.Corinna Vinschen2011-02-151-1/+1
|
* * dll_init.cc: Fix typo in comment.Christopher Faylor2011-02-081-1/+1
|
* * Makefile.in (DLL_OFILES): Add pseudo-reloc.o.Christopher Faylor2010-05-071-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dcrt0.cc (child_info_fork::handle_fork): Call _pei386_runtime_relocator here. (dll_crt0_1): Ditto for non-fork case. * dll_init.cc (dll::init): Complain more in comment. Clean up slightly. (dll_dllcrt0_1): Call _pei386_runtime_relocator when we know we have a filled-in per_process structure. * globals.cc (__cygwin_user_data): Accommodate new fields for _pei386_runtime_relocator. * pseudo-reloc.cc: New file adapted from old lib/pseudo-reloc.c. Include winsup.h directly. Collapse #ifdef __CYGWIN__ into one block. Perform minor whitespace code reformatting. (__report_error): Use small_printf to output error. (_pei386_runtime_relocator): Conditionalize for cygwin to take per_process pointer parameter. * winsup.h (_pei386_runtime_relocator): Declare. * include/cygwin/version.h (CYGWIN_VERSION_PER_PROCESS_API_VERSION_COMBINED): New macro. (CYGWIN_VERSION_USER_API_VERSION_COMBINED): Use above macro. (CYGWIN_VERSION_USE_PSEUDO_RELOC_IN_DLL): New macro. (CYGWIN_VERSION_API_MINOR): Bump to 227. * include/sys/cygwin.h: Remove obsolete comment. (per_process::unused2): Shorten. (per_process::pseudo_reloc_start): New field. (per_process::pseudo_reloc_end): Ditto. (per_process::image_base): Ditto. * lib/_cygwin_crt0_common.cc: Declare pseudo runtime externs needed for per_process structure. (_cygwin_crt0_common): Fill in pseudo_reloc runtime constants. * lib/pseudo-reloc-dummy.c: New file. Dummy function to satisify ld. * lib/pseudo-reloc.c: Delete.
* * dll_init.cc (dll_list::alloc): Add debugging assertion.Christopher Faylor2010-05-031-22/+25
|
* * globals.cc (exit_status): Add new ES_EXIT_STARTING enum.Christopher Faylor2010-03-281-2/+4
| | | | | | | * dcrt0.cc (cygwin_exit): Set exit_state to ES_EXIT_STARTING prior to calling real exit. * dll_init.cc (dll_list::detach): Remove dll from linked list and call destructors even if exiting. Don't call __cxa_finalize in exiting case.
* Update some copyrights.Christopher Faylor2010-02-281-12/+4
| | | | | | | | | | | | | | | | | | | | | | * cygtls.cc (_cygtls::call): Invoke new exception protection here. (_cygtls::init_thread): Remove conditionalized exception handler setup. (exception_list): Delete declaration. (_cygtls::init_exception_handler): Delete obsolete function. * cygtls.h: Remove (now) unneeded include. (_cygtls): Make this a real C++ class. (_cygtls::handle_exceptions): Remove. (_cygtls::init_exception_handler): Remove. (_cygtls::call2): Make private. (myfault::faulted): Remove unneeded parentheses. * dcrt0.cc (dll_crt0_1): Remove exception handler setup. * dlfcn.cc (dlopen): Ditto. (dlclose): Ditto. * dll_init.cc (dll_dllcrt0_1): Ditto. (dll_list::detach): Use new exception handler protection. * exceptions.cc (dump_exception): Rename to prevent confusion with new class. (exception::handle): Rename from _cygtls::handle_exceptions. Accommodate new exception class. Accommodate rename to dump_exception. * tlsoffsets.h: Regenerate.
* * cygtls.h (_cygtls::init_exception_handler): Eliminate argument.Christopher Faylor2010-02-261-1/+3
| | | | | | | | | | | | | | | | | | | | (_cygtls::andreas): Convert to a pointer. (san): Convert to a real class with methods. Use a linked list to keep track of previous handlers on the "stack". (myfault): Rewrite to use new san class rather than calling directly into _cygtls. * cygtls.cc (_cygtls::init_exception_handler): Just assume that we're always using the standard exception handler. (_cygtls::init_thread): Reflect loss of argument to init_exception_handler. * dcrt0.cc (dll_crt0_1): Ditto. * dfcn.cc (dlopen): Ditto. (dlclose): Reset the exception handler after FreeLibrary. * dll_init.cc (dll_list::detach): Make sure that the exception handler is initialized before calling destructors. * exceptions.cc (_cygtls::handle_exceptions): Accommodate new andreas pointer. * thread.cc (verifyable_object_isvalid): Pass objectptr to faulted for explicit NULL pointer checking. * tlsoffsets.h: Regenerate.
* * dll_init.cc (per_module::run_dtors): Use consistent method for runningChristopher Faylor2010-02-051-2/+2
| | | | destructors.
* * dcrt0.cc (atexit_lock): Delete.Christopher Faylor2010-02-021-50/+30
| | | | | | | | | | | | | | | (cygwin_exit): Remove atexit lock. (cygwin_atexit): Ditto. Rename parameter to match newlib. Call __cxa_atexit when invoked by a registered DLL. * dll_init.cc (remove_dll_atexit): Delete. (dll_list::find): New function. (dll_list::detach): Use dll_list::find to find dll associated with return address. Use __cxa_finalize to run atexit functions associated with the dll. (cygwin_detach_dll): Don't assume that HANDLE == void *. * dll_init.h (dll_list::find): Declare. (__cxa_atexit): Ditto. (__cxa_finalize): Ditto. * init.cc (dll_entry): Clarify comment.
* * dll_init.cc (remove_dll_atexit): New function.Christopher Faylor2010-01-291-0/+28
| | | | | (dll_list::detach): Run any atexit handlers registered in the DLL prior to unloading.
* * libc/strfmon.c (__setup_vars): Fix compiler warning about assigning constChristopher Faylor2010-01-291-1/+1
| | | | | | strings. Compare a pointer to NULL rather than '\0'. * dll_init.cc (dll_dllcrt0_1): Minor comment fix. * pipe.cc (fhandler_pipe::create_selectable): Remove Win9x accommodation.
* * dll_init.h (has_dtors): New flag.Christopher Faylor2009-08-211-2/+4
| | | | | | | (run_dtors): New wrapper function which avoids calling dtors more than once. * dll_init.cc (dll_global_dtors): Use dll.run_dtors wrapper. (dll_list::detach): Ditto. (dll_list::alloc): Set has_dtors flag.
* * cxx.cc (default_cygwin_cxx_malloc): Enhance commenting.Corinna Vinschen2009-08-131-0/+20
| | | | | | | | | * dll_init.cc (dll_dllcrt0_1): Likewise. * dlfcn.cc (dlopen): Prevent dlopen()'d DLL from installing any cxx malloc overrides. * include/cygwin/cygwin_dll.h (__dynamically_loaded): New variable. * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Check it and only install cxx malloc overrides when statically loaded. Extend comments.