diff options
author | Christopher Faylor <me@cgf.cx> | 2003-12-26 04:40:52 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-12-26 04:40:52 +0000 |
commit | 76832a5b32dd03a995e5c9c58b84da2ac5c6b26c (patch) | |
tree | b42cabaa294528ec05fe1c0ebc6b1cbf5f4b478c /winsup/cygwin/dcrt0.cc | |
parent | 1f32b7b382a5a7600874b5d582220984afd460b6 (diff) | |
download | cygnal-76832a5b32dd03a995e5c9c58b84da2ac5c6b26c.tar.gz cygnal-76832a5b32dd03a995e5c9c58b84da2ac5c6b26c.tar.bz2 cygnal-76832a5b32dd03a995e5c9c58b84da2ac5c6b26c.zip |
* dcrt0.cc (reent_data): Reluctantly resurrect.
(__cygwin_user_data::impure_ptr): Ditto.
(_dll_crt0): Reluctantly initialize _impure_ptr here.
(initialize_main_tls): Eliminate local_clib initialization since it now happens
in init_thread.
* init.cc (dll_entry): Reluctantly remove code which set _impure_ptr to the
main thread's local_clib.
* perthread.h (reent_data): Remove obsolete declaration.
* sigproc.cc (proc_subproc): Add more debugging output.
(get_proc_lock): Ditto.
*dcrt0.cc (dll_crt0_1): Allocate argv[0] via malloc since main thread could
exit.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 63148061b..1922cc5fb 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -90,6 +90,7 @@ extern "C" char ***main_environ; /* __progname used in getopt error message */ char *__progname; + static struct _reent reent_data; struct per_process __cygwin_user_data = {/* initial_sp */ 0, /* magic_biscuit */ 0, /* dll_major */ CYGWIN_VERSION_DLL_MAJOR, @@ -110,7 +111,7 @@ extern "C" /* api_minor */ CYGWIN_VERSION_API_MINOR, /* unused2 */ {0, 0, 0, 0, 0}, /* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf, - /* impure_ptr */ NULL, + /* impure_ptr */ &reent_data, }; bool ignore_case_with_glob; int __declspec (dllexport) _check_for_executable = true; @@ -700,9 +701,9 @@ dll_crt0_1 (char *) win32 style. */ if ((strchr (__argv[0], ':')) || (strchr (__argv[0], '\\'))) { - char *new_argv0 = (char *) alloca (CYG_MAX_PATH); + char *new_argv0 = (char *) malloc (CYG_MAX_PATH); cygwin_conv_to_posix_path (__argv[0], new_argv0); - __argv[0] = new_argv0; + __argv[0] = (char *) realloc (new_argv0, strlen (new_argv0) + 1); } } @@ -826,9 +827,6 @@ initialize_main_tls (char *padding) _threadinfo::init (); _main_tls = &_my_tls; _main_tls->init_thread (padding); - _main_tls->local_clib._stdin = &_main_tls->local_clib.__sf[0]; - _main_tls->local_clib._stdout = &_main_tls->local_clib.__sf[1]; - _main_tls->local_clib._stderr = &_main_tls->local_clib.__sf[2]; } return &_main_tls->local_clib; } @@ -906,7 +904,12 @@ _dll_crt0 () } } - user_data->impure_ptr = _impure_ptr = initialize_main_tls (zeros); + _impure_ptr = &reent_data; + _impure_ptr->_stdin = &_impure_ptr->__sf[0]; + _impure_ptr->_stdout = &_impure_ptr->__sf[1]; + _impure_ptr->_stderr = &_impure_ptr->__sf[2]; + _impure_ptr->_current_locale = "C"; + initialize_main_tls (zeros); dll_crt0_1 (zeros); } |