Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-03-14 22:07:36 +0300
committerChristopher Faylor <me@cgf.cx>2006-03-14 22:07:36 +0300
commite5aa298da5598c651d500fd097ed8ff417458641 (patch)
tree49f4eb15dc154a99dc9106c70e67123f04b35432
parent3b731dc0e18a975b6627b0a821b68ceb41ec86ab (diff)
* dcrt0.cc (main_environ): Initialize to &__cygwin_environment.
(dll_crt0_1): Move resourcelocks, thread interface, pinfo_init, and uinfo_init... (dll_crt0_0): ...to here. (_dll_crt0): Call update_envptrs here after setting main_environ. * environ.cc (environ_init): Eliminate initted variable. Don't call update_envptrs here. * sigproc.cc (wait_sig): Use my_sendsig when calling CreatePipe to avoid a dereference.
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/dcrt0.cc20
-rw-r--r--winsup/cygwin/dll_init.cc1
-rw-r--r--winsup/cygwin/environ.cc17
-rw-r--r--winsup/cygwin/sigproc.cc8
5 files changed, 33 insertions, 25 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ac979fcdb..3d4a90fc4 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,15 @@
+2006-03-14 Christopher Faylor <cgf@timesys.com>
+
+ * dcrt0.cc (main_environ): Initialize to &__cygwin_environment.
+ (dll_crt0_1): Move resourcelocks, thread interface, pinfo_init, and
+ uinfo_init...
+ (dll_crt0_0): ...to here.
+ (_dll_crt0): Call update_envptrs here after setting main_environ.
+ * environ.cc (environ_init): Eliminate initted variable. Don't call
+ update_envptrs here.
+ * sigproc.cc (wait_sig): Use my_sendsig when calling CreatePipe to
+ avoid a dereference.
+
2006-03-13 Christopher Faylor <cgf@timesys.com>
* child_info.h (child_info_fork::handle_failure): Declare new function.
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 892a46581..46fdf926c 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -36,6 +36,7 @@ details. */
#include "dll_init.h"
#include "sync.h"
#include "heap.h"
+#include "environ.h"
#define MAX_AT_FILE_LEVEL 10
@@ -92,7 +93,7 @@ extern "C"
/* This is an exported copy of environ which can be used by DLLs
which use cygwin.dll. */
char **__cygwin_environ;
- char ***main_environ;
+ char ***main_environ = &__cygwin_environ;
/* __progname used in getopt error message */
char *__progname;
struct per_process __cygwin_user_data =
@@ -753,6 +754,14 @@ dll_crt0_0 ()
}
}
+ user_data->resourcelocks->Init ();
+ user_data->threadinterface->Init ();
+
+ if (!in_forkee)
+ {
+ pinfo_init (envp, envc);
+ uinfo_init (); /* initialize user info */
+ }
_cygtls::init ();
/* Initialize events */
@@ -784,8 +793,6 @@ dll_crt0_1 (char *)
small_printf ("cmalloc returns %p\n", cmalloc (HEAP_STR, n));
#endif
- user_data->resourcelocks->Init ();
- user_data->threadinterface->Init ();
ProtectHandle (hMainProc);
ProtectHandle (hMainThread);
@@ -834,9 +841,6 @@ dll_crt0_1 (char *)
}
#endif
- /* Initialize our process table entry. */
- pinfo_init (envp, envc);
-
/* Can be set only after environment has been initialized. */
if (wincap.has_security ())
set_cygwin_privileges (hProcImpToken);
@@ -847,9 +851,6 @@ dll_crt0_1 (char *)
/* Allocate cygheap->fdtab */
dtable_init ();
- /* Initialize user info. */
- uinfo_init ();
-
/* Connect to tty. */
tty_init ();
@@ -967,6 +968,7 @@ _dll_crt0 ()
system_printf ("internal error: couldn't determine location of thread function on stack. Expect signal problems.");
main_environ = user_data->envptr;
+ update_envptrs ();
char padding[CYGTLS_PADSIZE];
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 7c7fc6407..b1aceec18 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -424,7 +424,6 @@ dlfork (int val)
void __stdcall
update_envptrs ()
{
- extern char ***main_environ;
for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ())
*(d->p.envptr) = __cygwin_environ;
*main_environ = __cygwin_environ;
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 23d0993a7..28bfe3959 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -729,16 +729,12 @@ environ_init (char **envp, int envc)
if (efault.faulted ())
api_fatal ("internal error reading the windows environment - too many environment variables?");
- static int initted;
- if (!initted)
- {
- for (int i = 0; conv_envvars[i].name != NULL; i++)
- {
- conv_start_chars[(int) cyg_tolower (conv_envvars[i].name[0])] = 1;
- conv_start_chars[(int) cyg_toupper (conv_envvars[i].name[0])] = 1;
- }
- initted = 1;
- }
+ if (!conv_start_chars[0])
+ for (int i = 0; conv_envvars[i].name != NULL; i++)
+ {
+ conv_start_chars[(int) cyg_tolower (conv_envvars[i].name[0])] = 1;
+ conv_start_chars[(int) cyg_toupper (conv_envvars[i].name[0])] = 1;
+ }
got_something_from_registry = regopt ("default");
if (myself->progname[0])
@@ -814,7 +810,6 @@ environ_init (char **envp, int envc)
out:
__cygwin_environ = envp;
- update_envptrs ();
if (envp_passed_in)
{
p = getenv ("CYGWIN");
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 8f49320fa..0b22495c9 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -523,7 +523,7 @@ sig_send (_pinfo *p, int sig)
else
{
#ifdef DEBUGGING
- system_printf ("internal signal sent while signals are on hold");
+ system_printf ("signal %d sent to %p while signals are on hold", p, sig);
#endif
return -1;
}
@@ -1073,11 +1073,11 @@ wait_sig (VOID *)
/* Initialization */
SetThreadPriority (GetCurrentThread (), WAIT_SIG_PRIORITY);
- if (!CreatePipe (&readsig, &myself->sendsig, sec_user_nih (sa_buf), 0))
+ sigCONT = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
+ if (!CreatePipe (&readsig, &my_sendsig, sec_user_nih (sa_buf), 0))
api_fatal ("couldn't create signal pipe, %E");
ProtectHandle (readsig);
- sigCONT = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
- my_sendsig = myself->sendsig;
+ myself->sendsig = my_sendsig;
/* Setting dwProcessId flags that this process is now capable of receiving
signals. Prior to this, dwProcessId was set to the windows pid of