diff options
author | Christopher Faylor <me@cgf.cx> | 2004-01-03 18:15:03 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-01-03 18:15:03 +0000 |
commit | e80cbe3e52decfeb93fb121d624c2bf5cd42abf3 (patch) | |
tree | c55243b2c5a9b594f2dde7ffab0ceac747b52a7b | |
parent | d84514bd0fa6780a30d28e3aa05f956d4c58ae30 (diff) | |
download | newlib-e80cbe3e52decfeb93fb121d624c2bf5cd42abf3.zip newlib-e80cbe3e52decfeb93fb121d624c2bf5cd42abf3.tar.gz newlib-e80cbe3e52decfeb93fb121d624c2bf5cd42abf3.tar.bz2 |
* cygheap.h (init_cygheap): Play more vfork shell games and move ctty_on_hold
and open_fhs_on_hold (back) here.
* dcrt0.cc (_dll_crt0): Just set impure_ptr_ptr here and let later
initialization deal with tls.
* dtable.cc (dtable::vfork_child_fixup): Move ctty considerations here.
(dtable:vfork_parent_restore): And here.
* fork.cc (vfork): Reflect change to ctty handling.
* perthread.h (vfork_save::fhctty): Eliminate.
* cygwin.din: Make more exports NOSIGFE that will never be interrupted by a
signal.
* init.cc (dll_entry): Set stackptr to NULL to catch problems earlier.
-rw-r--r-- | winsup/cygwin/ChangeLog | 16 | ||||
-rw-r--r-- | winsup/cygwin/cygheap.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/cygtls.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/cygwin.din | 12 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 13 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 18 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/version.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/init.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/perthread.h | 1 |
10 files changed, 45 insertions, 29 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d330ea2..9f2b44c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,19 @@ +2004-01-02 Christopher Faylor <cgf@redhat.com> + + * cygheap.h (init_cygheap): Play more vfork shell games and move + ctty_on_hold and open_fhs_on_hold (back) here. + * dcrt0.cc (_dll_crt0): Just set impure_ptr_ptr here and let later + initialization deal with tls. + * dtable.cc (dtable::vfork_child_fixup): Move ctty considerations here. + (dtable:vfork_parent_restore): And here. + * fork.cc (vfork): Reflect change to ctty handling. + * perthread.h (vfork_save::fhctty): Eliminate. + + * cygwin.din: Make more exports NOSIGFE that will never be interrupted + by a signal. + + * init.cc (dll_entry): Set stackptr to NULL to catch problems earlier. + 2003-12-31 Christopher Faylor <cgf@redhat.com> * cygwin.din: Make crt0 functions NOSIGFE. diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index af21814..6aef317 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -262,6 +262,7 @@ struct init_cygheap struct sigaction *sigs; fhandler_tty_slave *ctty; /* Current tty */ + fhandler_tty_slave *ctty_on_hold; int open_fhs; }; diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 9253683..f11c65b 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -28,6 +28,8 @@ details. */ # define UNLEN 256 #endif +#define TLS_STACK_SIZE 1024 + #pragma pack(push,4) struct _local_storage { @@ -107,7 +109,7 @@ struct _threadinfo struct _threadinfo *prev, *next; __stack_t *stackptr; int sig; - __stack_t stack[1024]; + __stack_t stack[TLS_STACK_SIZE]; /*gentls_offsets*/ static CRITICAL_SECTION protect_linked_list; diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index f60d2d5..1f3fe08 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -34,7 +34,7 @@ __fpclassifyd NOSIGFE __fpclassifyf NOSIGFE __getreent NOSIGFE __infinity NOSIGFE -__main SIGFE +__main NOSIGFE __signbitd NOSIGFE __signbitf NOSIGFE __signgam NOSIGFE @@ -43,7 +43,7 @@ __swbuf SIGFE _asprintf_r SIGFE asprintf_r = _asprintf_r SIGFE _dll_crt0@0 NOSIGFE -_exit SIGFE +_exit NOSIGFE _f_atan2 NOSIGFE __f_atan2 = _f_atan2 NOSIGFE _f_atan2f NOSIGFE @@ -290,9 +290,9 @@ cygwin_conv_to_posix_path SIGFE cygwin32_conv_to_posix_path = cygwin_conv_to_posix_path SIGFE cygwin_conv_to_win32_path SIGFE cygwin32_conv_to_win32_path = cygwin_conv_to_win32_path SIGFE -cygwin_detach_dll SIGFE -cygwin32_detach_dll = cygwin_detach_dll SIGFE -cygwin_dll_init SIGFE +cygwin_detach_dll NOSIGFE +cygwin32_detach_dll = cygwin_detach_dll NOSIGFE +cygwin_dll_init NOSIGFE endprotoent = cygwin_endprotoent SIGFE endservent = cygwin_endservent SIGFE endusershell SIGFE @@ -434,7 +434,7 @@ execve SIGFE _execve = execve SIGFE execvp SIGFE _execvp = execvp SIGFE -exit = cygwin_exit SIGFE +exit = cygwin_exit NOSIGFE exp NOSIGFE _exp = exp NOSIGFE exp2 NOSIGFE diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 1922cc5..3a3d689 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -916,12 +916,11 @@ _dll_crt0 () void dll_crt0 (per_process *uptr) { - char padding[CYGTLS_PADSIZE]; /* Set the local copy of the pointer into the user space. */ if (uptr && uptr != user_data) { memcpy (user_data, uptr, per_process_overwrite); - *(user_data->impure_ptr_ptr) = initialize_main_tls (padding); + *(user_data->impure_ptr_ptr) = &reent_data; } _dll_crt0 (); } diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index e5bb802..141e173 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -745,8 +745,13 @@ dtable::vfork_parent_restore () fds = fds_on_hold; fds_on_hold = NULL; cfree (deleteme); - ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "restore"); + + cygheap->ctty = cygheap->ctty_on_hold; // revert + if (cygheap->ctty) + cygheap->ctty->close (); // Undo previous bump of this archetype + cygheap->ctty_on_hold = NULL; + return; } @@ -777,6 +782,12 @@ dtable::vfork_child_fixup () cfree (fds_on_hold); fds_on_hold = NULL; + if (cygheap->ctty_on_hold) + { + cygheap->ctty_on_hold->close (); + cygheap->ctty_on_hold = NULL; + } + return; } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 477d85c..5671d1c 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -719,7 +719,7 @@ vfork () vf->ctty = myself->ctty; vf->sid = myself->sid; vf->pgid = myself->pgid; - vf->fhctty = cygheap->ctty; + cygheap->ctty_on_hold = cygheap->ctty; vf->open_fhs = cygheap->open_fhs; int res = cygheap->fdtab.vfork_child_dup () ? 0 : -1; debug_printf ("%d = vfork()", res); @@ -739,20 +739,8 @@ vfork () myself->ctty = vf->ctty; myself->sid = vf->sid; myself->pgid = vf->pgid; - termios_printf ("cygheap->ctty %p, vf->fhctty %p", cygheap->ctty, vf->fhctty); - if (cygheap->ctty != vf->fhctty) - { - vf->fhctty->close (); - if (vf->pid <= 0) - { - if (vf->ctty) - vf->fhctty->close (); - cygheap->ctty = vf->fhctty; - } - } - - if (vf->pid <= 0) - cygheap->open_fhs = vf->open_fhs; + termios_printf ("cygheap->ctty %p, cygheap->ctty_on_hold %p", cygheap->ctty, cygheap->ctty_on_hold); + cygheap->open_fhs = vf->open_fhs; if (vf->pid < 0) { diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 4b083d0..1a91721 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -34,8 +34,8 @@ details. */ that didn't invalidate existing executables. Both numbers were recorded in the executable and in the dll. - In October 1998 (starting with Cygwin 19.6), we started a new - means of Cygwin versioning: */ + In October 1998 (starting with Cygwin 19.6), we started a new method + of Cygwin versioning: */ /* The DLL major and minor numbers correspond to the "version of the Cygwin shared library". This version is used to track important diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 61da81f..8bae79e 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -53,7 +53,7 @@ dll_entry (HANDLE h, DWORD reason, void *static_load) case DLL_PROCESS_ATTACH: dynamically_loaded = (static_load == NULL); // __cygwin_user_data.impure_ptr = &_my_tls.local_clib; - _my_tls.stackptr = _my_tls.stack; + _my_tls.stackptr = NULL; break; case DLL_PROCESS_DETACH: break; diff --git a/winsup/cygwin/perthread.h b/winsup/cygwin/perthread.h index e0efffc..593f779 100644 --- a/winsup/cygwin/perthread.h +++ b/winsup/cygwin/perthread.h @@ -59,7 +59,6 @@ class vfork_save int ctty; pid_t sid; pid_t pgid; - class fhandler_tty_slave *fhctty; int open_fhs; int is_active () { return pid < 0; } void restore_pid (int val) |