diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 815917e26..478ca65d5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2003-09-08 Christopher Faylor + + * dcrt0.cc (dlL_crt0_1): Set __argc_safe after __argc is absolutely + know to be set. + * exceptions.cc (sig_handle_tty_stop): Don't reset sigCONT event since + it is reset automatically. + * fork.cc (fork): Remove obsolete usage of PID_SPLIT_HEAP. + * include/sys/cygwin.h: Ditto. + * sigproc.cc (sig_send): Use sigframe init method to set frame since it + checks for previous ownership of the frame. + * sigproc.h (sigframe::init): Accept an "is_exception" argument. + 2003-09-08 Christopher Faylor * dir.cc (readdir): Reinstate setting of old ino field for legacy diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 635759bb8..d8141dd06 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -607,7 +607,7 @@ dll_crt0_1 () DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) h = NULL; set_myself (mypid, h); - __argc = __argc_safe = spawn_info->moreinfo->argc; + __argc = spawn_info->moreinfo->argc; __argv = spawn_info->moreinfo->argv; envp = spawn_info->moreinfo->envp; envc = spawn_info->moreinfo->envc; @@ -724,6 +724,7 @@ dll_crt0_1 () } } + __argc_safe = __argc; if (user_data->premain[0]) for (unsigned int i = 0; i < PREMAIN_LEN / 2; i++) user_data->premain[i] (__argc, __argv, user_data); diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index feffcd3d2..3a599f989 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -618,7 +618,6 @@ sig_handle_tty_stop (int sig) myself->pid, sig, myself->ppid_handle); if (WaitForSingleObject (sigCONT, INFINITE) != WAIT_OBJECT_0) api_fatal ("WaitSingleObject failed, %E"); - (void) ResetEvent (sigCONT); return; } } @@ -1048,23 +1047,23 @@ sig_handle (int sig) goto dosig; - stop: +stop: /* Eat multiple attempts to STOP */ if (ISSTATE (myself, PID_STOPPED)) goto done; handler = (void *) sig_handle_tty_stop; thissig = myself->getsig (SIGSTOP); - dosig: +dosig: /* Dispatch to the appropriate function. */ sigproc_printf ("signal %d, about to call %p", sig, handler); rc = setup_handler (sig, handler, thissig); - done: +done: sigproc_printf ("returning %d", rc); return rc; - exit_sig: +exit_sig: if (sig == SIGQUIT || sig == SIGABRT) { CONTEXT c; diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 27f85db1b..8ec84d667 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -510,7 +510,7 @@ err: buflen = (size_t) -1; return; - sig_exit: +sig_exit: set_sig_errno (EINTR); buflen = (size_t) -1; return; diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 021b83250..f948209d3 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -633,15 +633,6 @@ fork () grouped.hParent = grouped.first_dll = NULL; grouped.load_dlls = 0; - if (ISSTATE(myself, PID_SPLIT_HEAP)) - { - system_printf ("The heap has been split, CYGWIN can't fork this process."); - system_printf ("Increase the heap_chunk_size in the registry and try again."); - set_errno (ENOMEM); - syscall_printf ("-1 = fork (), split heap"); - return -1; - } - void *esp; __asm__ volatile ("movl %%esp,%0": "=r" (esp)); diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index e117175e0..9dd46db16 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -89,8 +89,7 @@ enum PID_ORPHANED = 0x0020, /* Member of an orphaned process group. */ PID_ACTIVE = 0x0040, /* Pid accepts signals. */ PID_CYGPARENT = 0x0080, /* Set if parent was a cygwin app. */ - PID_SPLIT_HEAP = 0x0100, /* Set if the heap has been split, */ - /* which means we can't fork again. */ + PID_UNUSED = 0x0100, /* ... */ PID_MYSELF = 0x0200, /* Flag that pid is me. */ PID_NOCLDSTOP = 0x0400, /* Set if no SIGCHLD signal on stop. */ PID_INITIALIZING = 0x0800, /* Set until ready to receive signals. */ diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index ce7c38898..795c7f3ef 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -717,7 +717,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception) { thiscatch = sigcatch_main; thiscomplete = sigcomplete_main; - thisframe.set (mainthread, ebp, exception); + thisframe.init (mainthread, ebp, exception); todo = getlocal_sigtodo (sig); issem = true; } diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index 360ae8bcb..35ad89019 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -75,10 +75,10 @@ public: if (!oframe) t.get_winapi_lock (); } - inline void init (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0)) + inline void init (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0), bool is_exception = 0) { - if (!t.frame && t.id == GetCurrentThreadId ()) - set (t, ebp); + if (is_exception || (!t.frame && t.id == GetCurrentThreadId ())) + set (t, ebp, is_exception); else st = NULL; }