+2006-03-22 Eric Blake <ebb9@byu.net>
+
+ * fhandler.cc (fcntl): Print flags in hex.
+
+2006-03-22 Christopher Faylor <cgf@timesys.com>
+
+ * dcrt0.cc (dll_crt0_0): Semi-revert 2006-03-14 change which moved
+ pinfo_init and uinfo_init here.
+ (dll_crt0_1): Ditto.
+ (__dll_crt0): Ditto. Don't call update_envptrs here.
+ (dll_crt0_1): Ditto. Move wait_for_sigthread call here from dll_crt0_0.
+ * environ.cc (environ_init): Call it here instead.
+ * sigproc.cc (my_readsig): New static variable.
+ (wait_for_sigthread): Set up read pipe here since we are assured that
+ we have the proper privileges when this is called.
+ (talktome): Eliminate second argument since it is available as a global
+ now.
+ (wait_sig): Reflect use of my_readsig.
+
2006-03-22 Corinna Vinschen <corinna@vinschen.de>
* thread.cc (pthread_cond::init): Disable validity test of object
2006-03-19 Christopher Faylor <cgf@timesys.com>
- * dcrt0.cc (dll_crt0_0): Oops. We need to bother with setting this in
- the fork/exec case.
+ * dcrt0.cc (dll_crt0_0): Oops. We need to bother with setting
+ init_console_handler in the fork/exec case.
2006-03-19 Christopher Faylor <cgf@timesys.com>
2006-02-03 Corinna Vinschen <corinna@vinschen.de>
- * path.cc (suffix_scan::lnk_match): Return true beginning with
+ * path.cc (suffix_scan::lnk_match): Return true beginning with
SCAN_APPENDLNK.
(suffix_scan::next): Rearrange code to make .lnk append order slightly
more deterministic.
user_data->resourcelocks->Init ();
user_data->threadinterface->Init ();
- if (!in_forkee)
- {
- pinfo_init (envp, envc);
- uinfo_init (); /* initialize user info */
- }
-
_cygtls::init ();
/* Initialize events */
fork_init ();
}
#endif
+ pinfo_init (envp, envc);
/* Can be set only after environment has been initialized. */
if (wincap.has_security ())
/* Allocate cygheap->fdtab */
dtable_init ();
+ uinfo_init (); /* initialize user info */
+
+ wait_for_sigthread ();
+ extern DWORD threadfunc_ix;
+ if (!threadfunc_ix)
+ system_printf ("internal error: couldn't determine location of thread function on stack. Expect signal problems.");
+
+
/* Connect to tty. */
tty_init ();
extern "C" void __stdcall
_dll_crt0 ()
{
- extern DWORD threadfunc_ix;
- wait_for_sigthread ();
- if (!threadfunc_ix)
- 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];
cygthread *hwait_sig;
Static HANDLE wait_sig_inited; // Control synchronization of
// message queue startup
-static bool sigheld; // True if holding signals
+static NO_COPY bool sigheld; // True if holding signals
Static int nprocs; // Number of deceased children
Static char cprocs[(NPROCS + 1) * sizeof (pinfo)];// All my children info
_cygtls NO_COPY *_sig_tls;
+Static HANDLE my_sendsig;
+Static HANDLE my_readsig;
+
/* Function declarations */
static int __stdcall checkstate (waitq *) __attribute__ ((regparm (1)));
static __inline__ bool get_proc_lock (DWORD, DWORD);
static bool __stdcall remove_proc (int);
static bool __stdcall stopped_or_terminated (waitq *, _pinfo *);
static DWORD WINAPI wait_sig (VOID *arg);
-static HANDLE NO_COPY my_sendsig;
/* wait_sig bookkeeping */
void __stdcall
wait_for_sigthread ()
{
+ PSECURITY_ATTRIBUTES sa_buf = (PSECURITY_ATTRIBUTES) alloca (1024);
+ if (!CreatePipe (&my_readsig, &my_sendsig, sec_user_nih (sa_buf), 0))
+ api_fatal ("couldn't create signal pipe, %E");
+ ProtectHandle (my_readsig);
+ myself->sendsig = my_sendsig;
sigproc_printf ("wait_sig_inited %p", wait_sig_inited);
HANDLE hsig_inited = wait_sig_inited;
WaitForSingleObject (hsig_inited, INFINITE);
wait_sig_inited = NULL;
ForceCloseHandle1 (hsig_inited, wait_sig_inited);
+ SetEvent (sigCONT);
}
/* Get the sync_proc_subproc muto to control access to
}
static void
-talktome (siginfo_t *si, HANDLE readsig)
+talktome (siginfo_t *si)
{
unsigned size = sizeof (*si);
sigproc_printf ("pid %d wants some information", si->si_pid);
{
size_t n;
DWORD nb;
- if (!ReadFile (readsig, &n, sizeof (n), &nb, NULL) || nb != sizeof (n))
+ if (!ReadFile (my_readsig, &n, sizeof (n), &nb, NULL) || nb != sizeof (n))
return;
siginfo_t *newsi = (siginfo_t *) alloca (size += n + 1);
*newsi = *si;
newsi->_si_commune._si_str = (char *) (newsi + 1);
- if (!ReadFile (readsig, newsi->_si_commune._si_str, n, &nb, NULL) || nb != n)
+ if (!ReadFile (my_readsig, newsi->_si_commune._si_str, n, &nb, NULL) || nb != n)
return;
newsi->_si_commune._si_str[n] = '\0';
si = newsi;
static DWORD WINAPI
wait_sig (VOID *)
{
- HANDLE readsig;
- PSECURITY_ATTRIBUTES sa_buf = (PSECURITY_ATTRIBUTES) alloca (1024);
-
/* Initialization */
SetThreadPriority (GetCurrentThread (), WAIT_SIG_PRIORITY);
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);
- 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
SetEvent (wait_sig_inited);
_sig_tls->init_threadlist_exceptions ();
- debug_printf ("entering ReadFile loop, readsig %p, myself->sendsig %p",
- readsig, myself->sendsig);
+ debug_printf ("entering ReadFile loop, my_readsig %p, myself->sendsig %p",
+ my_readsig, myself->sendsig);
sigpacket pack;
- if (in_forkee)
- pack.si.si_signo = __SIGHOLD;
+ pack.si.si_signo = __SIGHOLD;
for (;;)
{
if (pack.si.si_signo == __SIGHOLD)
WaitForSingleObject (sigCONT, INFINITE);
DWORD nb;
pack.tls = NULL;
- if (!ReadFile (readsig, &pack, sizeof (pack), &nb, NULL))
+ if (!ReadFile (my_readsig, &pack, sizeof (pack), &nb, NULL))
break;
if (nb != sizeof (pack))
switch (pack.si.si_signo)
{
case __SIGCOMMUNE:
- talktome (&pack.si, readsig);
+ talktome (&pack.si);
break;
case __SIGSTRACE:
strace.hello ();
break;
}
- ForceCloseHandle (readsig);
+ ForceCloseHandle (my_readsig);
sigproc_printf ("signal thread exiting");
ExitThread (0);
}