may not end up in the pool.
(cygthread::new): Avoid race when checking for initialized. Add debugging
code.
* fhandler.cc (fhandler_base::raw_read): Add case for ERROR_INVALID_HANDLE due
to Win95 directories.
(fhandler_base::open): Handle errors due to Win95 directories.
(fhandler_base::close): Add get_nohandle () test.
(fhandler_base::set_close_on_exec): Ditto.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::lock): Change error code to Posix EINVAL.
(fhandler_base::dup): If get_nohandle (), set new value to INVALID_HANDLE_VALUE
instead of NULL.
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name if
get_nohandle (). Remove extraneous element from strpbrk.
(fhandler_disk_file::open): Remove test for Win95 directory.
* fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle ().
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
(fhandler_dev_zero::close): Delete.
* fhandler.h (class fhandler_dev_zero): Ditto.
This work inspires by Thomas Pfaff's pthread_fork patch (1).
* fork.cc (fork_child): Remove MTinterface fixup call, it's
adsorbed by pthread::atforkchild.
Rename __pthread_atforkchild to pthread::atforkchild to give
access to private members.
(fork_parent): Rename __pthread_atforkparent to
pthread::atforkparent to give it access to private members.
Ditto for __pthread_atforkprepare.
* thread.cc: Fix some formatting problems throughout.
(MTinterface::fixup_before_fork): Implement.
(MTinterface::fixup_after_fork): Fix pthread_keys.
(pthread_key::keys): Implement.
(pthread_key::fixup_before_fork): Ditto.
(pthread_key::fixup_after_fork): Ditto.
(pthread_key::pthread_key): Add to pthread_key::keys.
(pthread_key::~pthread_key): Remove from pthread_key::keys.
(pthread_key::saveKeyToBuffer): Implement.
(pthread_key::recreateKeyFromBuffer): Ditto.
(pthread::atforkprepare): Prepare all MT classes for fork.
(pthread::atforkchild): And fix them up afterwards.
* thread.h (pthread_key): Buffer the key value during
fork in fork_buf.
List the keys needing to be fixed up in a linked list with
head pthread_key::keys.
(pthread): Move atfork cygwin internal calls into the class.
(MTInterface): Provide a fixup_before_fork for objecst that
need to save state.
(__pthread_atforkprepare): Remove.
(__pthread_atforkparent): Remove.
(__pthread_atforkchild): Remove.
* init.cc (dll_entry): On thread detach, if the thread hasn't
exit()ed, do so.
* pthread.cc (pthread_getsequence_np): Remove the
__pthread_getsequence_np wrapper. This requires errno.h.
* thread.cc (pthread::self): Instantiate a new pthread object
when called and none exists. return a NULL object if instantiation
fails.
(pthread::precreate): Factor out common code.
(pthread::postcreate): Ditto.
(pthread::create): Ditto.
(pthread::exit): Remove the TLS value when we exit to prevent
double exits.
(MTinterface::Init): Bugfix - don't mark the TLS index as created
if one was not allocated.
Apply Extract Method to move pthread specific initialisation into
pthread.
(pthread::initMainThread): Extracted method from MTinterface::Init.
(pthread::setTlsSelfPointer): Extracted method from various pthread
calls, to make reading those functions easier.
(pthread::setThreadIdtoCurrent): Ditto.
(pthread::cancel_self): Bring into the .cc file, it's only used
within the class.
(pthread::getThreadId): Ditto.
(pthread::thread_init_wrapper): Apply Extract Method to the TLS
setting logic.
(pthread::isGoodObject): Extracted method from various pthread
wrapper calls, for clarity of reading.
(pthread::getsequence_np): Converted from __pthread_getsquence_np.
(__pthread_create): Apply Extract Method to the object validation.
(__pthread_cancel): Ditto.
(__pthread_join): Ditto.
(__pthread_detach): Ditto.
(__pthread_suspend): Ditto.
(__pthread_continue): Ditto.
(__pthread_getschedparam): Ditto.
(__pthread_getsequence_np): Remove.
(__pthread_setschedparam): Apply Extract Method to the object
validation.
(pthreadNull::getNullpthread): New method, return the pthreadNull
object.
(pthreadNull::pthreadNull): Private constructor to prevent accidental
use.
(pthreadNull::~pthreadNull): Prevent compile warnings.
(pthreadNull::create): Override pthread behaviour.
(pthreadNull::exit): Ditto.
(pthreadNull::cancel): Ditto.
(pthreadNull::testcancel): Ditto.
(pthreadNull::setcancelstate): Ditto.
(pthreadNull::setcanceltype): Ditto.
(pthreadNull::push_cleanup_handler): Ditto.
(pthreadNull::pop_cleanup_handler): Ditto.
(pthreadNull::getsequence_np): Ditto.
(pthreadNull::_instance): Ditto.
* thread.h (pthread): Declare pre- and post-create.
Move GetThreadId to private scope and rename to getThreadId.
Move setThreadIdtoCurrent to private scope.
Make create virtual.
Make ~pthread virtual.
Declare initMainThread.
Declare isGoodObject.
Make exit virtual.
Make cancel virtual.
Make testcancel virtual.
Make setcancelstate virtual.
Make setcanceltype virtual.
Make push_cleanup_handler virtual.
Make pop_cleanup_handler virtual.
Declare getsequence_np.
Declare setTlsSelfPointer.
(pthreadNull): New null object class for pthread.
(__pthread_getsequence_np): Remove.
* thread.h (pthread::cleanup_stack): Renamed cleanup_handlers to
cleanup_stack.
* thread.cc (pthread::pthread): Ditto.
(pthread::create): Fixed mutex verification.
(pthread::push_cleanup_handler): Renamed cleanup_handlers to
cleanup_stack.
Mutex calls removed, used InterlockedExchangePointer instead.
(pthread::pop_cleanup_handler): Renamed cleanup_handlers to
cleanup_stack.
(pthread::pop_all_cleanup_handlers): Ditto.
(__pthread_once): Check state first and return if already done.
(__pthread_join): DEADLOCK test reverted to __pthread_equal
call.
(__pthread_detach): Unlock mutex before deletion.
(cygheap_user::env_logsrv): Verify env_domain is valid.
* environ.cc: Include child_info.h and keep spenvs[] sorted.
(environ_init): Check child_proc_info instead of myself->ppid_handle.
* cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop.
* pthread.cc: Change __pthread_self to pthread::self() thruoghout.
(_pthread_cleanup_push): New function.
(_pthread_cleanup_pop): Ditto.
* thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop
patch, this work is derived from that.
Change __pthread_self to pthread::self() thruoghout.
(__pthread_self): Rename to pthread::self.
(pthread::self): New method.
(pthread::pthread): Initialize new member.
(pthread::push_cleanup_handler): New method.
(pthread::pop_cleanup_handler): New method.
(pthread::pop_all_cleanup_handlers): New method.
(__pthread_exit): Pop all cleanup handlers.
* thread.h (pthread::push_cleanup_handler): Declare.
(pthread::pop_cleanup_handler): Ditto.
(pthread::pop_all_cleanup_handlers): Ditto.
(pthread::self): New static method.
(__pthread_exit): Give C++ linkage.
(__pthread_join): Ditto.
(__pthread_detach): Ditto.
(__pthread_self): Remove.
2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
* include/pthread.h (__pthread_cleanup_handler): New structure
(pthread_cleanup_push): Rewritten .
(pthread_cleanup_pop): Ditto.
(_pthread_cleanup_push): New prototype.
(_pthread_cleanup_pop) Ditto.
2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (thread_init_wrapper): Check if thread is already joined.
(__pthread_join): Set joiner first.
(__pthread_detach): Ditto.
* fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument.
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search for
given pid.
(fhandler_proc::readdir): Assume that pid exists if it shows up in the winpid
list.
* fhandler_process.cc (fhandler_process::open): Simplify search for given pid.
Call fill_filebuf with pinfo argument.
(fhandler_process::fill_filebuf): Pass pinfo here and assume that it exists.
* pinfo.h (pinfo::remember): Define differently if sigproc.h is not included.
* dll_init.cc (dll_list::detach): Don't run destructor on exit.
where appropriate, throughout. Remove unneeded exceptions.h, where
appropriate, throughout. Remove unneeded perprocess.h, where appropriate,
throughout.
* thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
thread woken by the same condition variable it's signalling on. Thanks
to Michael Beach for the report and test case.
* thread.cc (pthread_cond::Signal): Use a separate flag for signal detection
and broadcast semantics.
(__pthread_cond_dowait): Ditto.
* thread.h (pthread_cond): New flag for testing when a waiter has woken.
* autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - its a
n NT only call.
* thread.cc (pthread_cond::TimedWait): Use critical sections for NT.
(pthread_cond::fixup_after_fork): Don't detect bad apps.
(pthread_mutex::pthread_mutex): Use critical sections for NT.
(pthread_mutex::~pthread_mutex): Ditto.
(pthread_mutex::Lock): Ditto.
(pthread_mutex::TryLock): Ditto.
(pthread_mutex::UnLock): Ditto.
(pthread_mutex::fixup_after_fork): Ditto. Also do not detect bad apps.
(__pthread_mutex_trylock): Move WIN32 specific test into the class metho
d.
(__pthread_mutex_destroy): Prevent dereferencing passed pointer without
valid address.
* thread.h (pthread_mutex): Use critical sections for NT.
* dcrt0.cc (cygwin_finished_initializing): Copy _mtinterf on fork;
* fork.cc (fork_child): fixup thread-related structures after fork;
* thread.cc (MTinterface::Init): Initialise the new mutex, condition and semaphore lists.
(MTinterface::fixup_after_fork): Iterate through each list and fixup the objects.
(pthread_cond::pthread_cond): Add this to the condition list.
(pthread_cond::~pthread_cond): Remove this from the condition list.
(pthread_cond::fixup_after_fork): Recreate as best we can the pre-fork state.
(pthread_mutex::pthread_mutex): Add this to the mutex list.
(pthread_mutex::~pthread_mutex): Remove this from the mutex list.
(pthread_mutex::fixup_after_fork): Recreate as best we can the pre-fork state.
(semaphore::semaphore): Store the initial value, and add this to the semaphore list.
(semaphore::~semaphore): Remove this from the semaphore list.
(semaphore::Post): Increment the current semaphore value.
(semaphore::TryWait): Decrement the current semaphore value.
(semaphore::Wait): Ditto.
(semaphote::fixup_after_fork): Recreate the pre-fork state as best we can.
* thread.h (pthread_mutex): New members to allow fixup_after_fork.
(pthread_cond): Ditto.
(semaphore): Ditto.
(MTinterface): New list heads for tracking conds and semaphores.
* dcrt0.cc (set_os_type): Set 'iswinnt' appropriately.
* cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating cygheap.
(cygheap_setup_for_child_cleanup): New function. Standard function to call
after calling CreateProcess to cleanup cygheap info passed to child.
(cygheap_fixup_in_child): Copy cygheap from shared memory into allocated space
under Windows 9x or if can't relocate shared space under NT.
* cygheap.h: Declare new function.
* spawn.cc (spawn_guts): Use cygheap_fixup_in_child.
* fork.cc (fork_parent): Ditto.
* winsup.h: Declare iswinnt.
* thread.cc (verifyable_object_isvalid): Don't validate
PTHREAD_MUTEX_INITIALIZER pointer as it will cause an exception
in IsBadWritePtr() when running GDB.
* path.cc (path_conv::check): Add signal protection here since retrieving info
about remote shares can take some time.
* path.h (check_null_empty_str_errno): Convert to a function prototype.
* path.cc (check_null_empty_str): Move to miscfuncs.cc.
* miscfuncs.cc (check_null_empty_str_errno): New function.
(__check_null_invalid_struct): Ditto.
(__check_null_invalid_struct_errno): Ditto.
(check_null_empty_str): Change from VirtualQuery to IsBadWritePtr.
* thread.cc (check_valid_pointer): Ditto.
* resource.cc (getrlimit): Use check_null_invalid_struct macro for checking
validity of pointer.
(setrlimit): Ditto.
* thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well as
WAIT_ABANDONED.
(__pthread_cond_timedwait): Calculate a relative wait from the abstime
parameter.
* thread.cc (__pthread_cond_timedwait): Lock the waiting mutex before
the condition protect mutex to avoid deadlocking. (Found by Greg Smith).
(__pthread_cond_wait): Ditto.
mutexs - user programs are allowed to call pthread_cond_broadcast like that.
(__pthread_cond_timedwait): Initialise themutex properly.
(__pthread_cond_wait): Initialise themutex properly.
* thread.h (pthread_cond): New element cond_access to allow atomic broadcasts.
* thread.cc (pthread_cond::pthread_cond): Initialise cond_access.
(pthread_cond::~pthread_cond): Destroy cond_access.
(pthread_cond::Broadcast): Use cond_access.
(pthread_cond::Signal): Use cond_access.
(pthread_cond_wait): Use cond_access.
(pthread_cond_timedwait): Use cond_access.
* pinfo.h: Correctly set __SIGOFFSET.
* path.cc (hash_path_name): Avoid calling library functions for simple copying
of characters.
* shortcut.c: Use WIN32_LEAN_AND_MEAN.
* smallprint.c: Ditto.
* environ.cc (getwinenv): Minor clarity fix.
* localtime.c: No need to include windows.h
* string.h: New file.
structure of newlib.
* sigproc.h (sig_send): Add exception parameter to sig_send.
* sigproc.cc (sig_send): Ditto. Use it when setting frame info.
* exceptions.cc (handle_exceptions): Use exception flag when calling sig_send.
* thread.h (MTinterface): Add threadcount.
* thread.cc (MTinterface::Init): Set threadcount to 1.
(__pthread_create): Increment threadcount.
(__pthread_exit): Decrement threadcount and call exit() from the last thread.
(fork_parent): Call the __pthread_atforkparent function.
* cygwin.din: Export pthread_atfork.
* thread.h (callback): New class.
(MTinterface): Use it.
* thread.cc (__pthread_atforkprepare): New function.
(__pthread_atforkparent): New function.
(__pthread_atforkchild): New function.
(__pthread_atfork): New function.
* pthread.cc (pthread_atfork): New function.
* cygwin.din: Remove @PTH_ALLOW@ prefixes to pthread functions.
Add new pthread exports.
* pthread.cc: New wrapper functions for the above new exports.
* sched.cc (valid_sched_parameters): New function.
(sched_setparam): Use it.
(sched_set_thread_priority): New function. Used by pthread_sched*.
* thread.cc (pthread_key_destructor::InsertAfter): New function.
(pthread_key_destructor::UnlinkNext): New function.
(pthread_key_destructor::Next): New function.
(pthread_key_destructor_list::Insert): New function.
(pthread_key_destructor_list::Remove): New function.
(pthread_key_destructor_list::Pop): New function.
(pthread_key_destructor::pthread_key_destructor): New function.
(pthread_key_destructor_list::IterateNull): New function.
(MTinterface::Init): Initialise new member.
(pthread::pthread): Initialise new members.
(pthread::create): Copy new attributes. Set the new thread priority.
(pthread_attr::pthread_attr): Initialise new members.
(pthread_key::pthread_key): Setup destructor function.
(pthread_key::~pthread_key): Remove destructor function.
(pthread_mutexattr::pthread_mutexattr): New function.
(pthread_mutexattr::~pthread_mutexattr): New function.
(__pthread_once): New function.
(__pthread_cleanup): New function.
(__pthread_cancel): New function.
(__pthread_setcancelstate): New function.
(__pthread_setcanceltype): New function.
(__pthread_testcancel): New function.
(__pthread_attr_getinheritsched): New function.
(__pthread_attr_getschedparam): New function.
(__pthread_attr_getschedpolicy): New function.
(__pthread_attr_getscope): New function.
(__pthread_attr_setinheritsched): New function.
(__pthread_attr_setschedparam): New function.
(__pthread_attr_setschedpolicy): New function.
(__pthread_attr_setscope): New function.
(__pthread_exit): Call any key destructors on thread exit.
(__pthread_join): Use the embedded attr values.
(__pthread_detach): Use the embedded attr values.
(__pthread_getconcurrency): New function.
(__pthread_getschedparam): New function.
(__pthread_key_create): Pass the destructor on object creation.
(__pthread_key_delete): Correct incorrect prototype.
(__pthread_setconcurrency): New function.
(__pthread_setschedparam): New function.
(__pthread_cond_timedwait): Support static mutex initialisers.
(__pthread_cond_wait): Ditto.
(__pthread_mutex_getprioceiling): New function.
(__pthread_mutex_lock): Support static mutex initialisers.
(__pthread_mutex_trylock): Ditto.
(__pthread_mutex_unlock): Ditto.
(__pthread_mutex_destroy): Ditto.
(__pthread_mutex_setprioceiling): New function.
(__pthread_mutexattr_getprotocol): New function.
(__pthread_mutexattr_getpshared): New function.
(__pthread_mutexattr_gettype): New function.
(__pthread_mutexattr_init): New function.
(__pthread_mutexattr_destroy): New function.
(__pthread_mutexattr_setprotocol): New function.
(__pthread_mutexattr_setprioceiling): New function.
(__pthread_mutexattr_getprioceiling): New function.
(__pthread_mutexattr_setpshared): New function.
(__pthread_mutexattr_settype): New function.
Remove stubs for non MT_SAFE compilation.
* thread.h: Remove duplicate #defines.
Add prototypes for new functions in thread.cc.
(pthread_key_destructor): New class.
(pthread_key_destructor_list): New class.
(pthread_attr): Add new members.
(pthread): Remove members that are duplicated in the pthread_attr class.
(pthread_mutex_attr): Add new members.
(pthread_once): New class.
* include/pthread.h: Add prototypes for new functions exported from cygwin1.dll.
Remove typedefs.
* include/sched.h: Add prototypes for new functions in sched.cc.
* include/cygwin/types.h: Add typedefs from pthread.h
it.
* cygwin.din: Remove obsolete "__empty" export.
* exceptions.cc (call_signal_handler_now): Force inclusion of function even
when -finline-functions is specified.
* sigproc.h: Remove obsolete call_signal_handler declaration.
* fhandler_console.cc (cp_get_internal): New function.
(cp_convert): New function.
(con_to_str): New function.
(str_to_con): New function.
(fhandler_console::read): Replace OemToCharBuff with con_to_str.
(fhandler_console::write_normal): Replace CharToOemBuff with str_to_con.
* pthread.cc (pthread_cond_*): Add wrapper functions that call __pthread_cond*
functions.
* thread.cc (__pthread_cond_*): Implement the pthread_cond* functions.
* thread.h: Add new class entries and prototypes for __pthread_cond* functions.
* include/pthread.h: user land header prototypes for pthread_cond* functions
and related defines.
* thread.cc (MTinterface::Init): Remove the initialization of `reent_data'.
* dcrt0.cc: Add the initalizer to the declaration of `reent_data'.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 35.
* environ.cc (codepage_init): To here.
* exceptoins.cc (SIG_NONMASKABLE): Remove SIGCONT from consideration since it
is supposed to be maskable.
* signal.cc (sigaction): Ditto.
* sigproc.cc (wait_sig): Ditto.
* winsup.h: Eliminate global declaration of codepage_init.
* dcrt0.cc (dll_crt0_1): Call signal_fixup_after_exec where appropriate. Set
myself->uid from parent version. Just use ThreadItem Init method. Close or
store hexec_proc as appropriate.
(_dll_crt0): Store user_data->forkee here so that proper tests can be made
subsequently.
(do_exit): Remove hExeced stuff.
* environ.cc (environ_init): Accept environ count as well as environ pointer.
* environ.h: Reflect above change.
* pinfo.cc (pinfo_init): Ditto. Accept environ count.
(fixup_in_spawned_child): Remove.
* spawn.cc (spawn_guts): Move signal code to dll_crt0_1. Don't suspend execing
process since it is no longer necessary. Store envc.
* exceptions.cc (signal_fixup_after_exec): New function.
(call_handler): Remove hExeced test.
* child_info.h (cygheap_exec_info): Store envc as well as envp.
(child_info_spawn): Store hexec_proc so that it can be closed in child.
* path.cc (normalize_posix_path): Avoid intermediate use of temporary cwd buf.
(normalize_win32_path): Ditto.
(cwdstuff::get_initial): Always set lock.
* sigproc.h: Remove hExeced.
* strace.cc (strace::vsprntf): Modify to accomodate for lack of hExeced.
* thread.cc (MTinterface::Init): Merge Init1 and ClearReent into this method.
(MTinterface::Init1): Eliminate.
(MTinterface::ClearReent): Eliminate.
* thread.h: Reflect above changes.
* include/sys/strace.h (strace): Make microseconds() public. Make various
functions 'regparm', throughout.
* pinfo.h (_pinfo): Inline simple signal manipulation functions. Requires
inclusion of thread.h which was removed from .cc files, where appropriate.
throughout.
* pinfo.cc: Eliminate signal manipulation functions.
(_pinfo::exit): Calculate total rusage for exiting process here.
* cygheap.cc (size2bucket): Eliminate.
(init_buckets): Ditto.
(_cmalloc): Calculate size and bits in a loop rather than going through a
function call.
(_crealloc): Use stored array index to calculate allocated size.
* spawn.cc (spawn_guts): Use _pinfo exit method to exit, calculating cpu usage.
throughout.
* shared.h: Remove.
* cygwin_version.h: New file.
* delqueue.h: New file.
* environ.h: New file.
* host_dependent.h: New file.
* perprocess.h: New file.
* registry.h: New file.
* security.h: New file.
* child_info.h: Add specific exec class.
* cygheap.h: New file. Contains declarations for cygwin heap.
* cygheap.cc: New file. Implements cygwin heap functions.
* dcrt0.cc (quoted): Simplify due to new method for passing arguments between
cygwin programs.
(alloc_stack_hard_way): Attempt to handle overlapped stack.
(dll_crt0_1): Move child_info processing here. Accomodate new method for
passing arguments between cygwin programs. Initialize cygwin heap. Establish
__argc and __argv variables.
(_dll_crt0): Move most of child_info processing to dll_crt0_1.
(cygwin_dll_init): Remove duplication.
* dtable.cc (dtable::extend): Allocate dtable using cygwin heap.
(dtable::build_fhandler): Ditto for fhandler type being constructed.
(dtable::dup_worker): Free new fhandler from cygwin heap on error.
(dtable::select_*): Don't assume that this == fdtab.
(dtable::linearize_fd_array): Delete.
(dtable::delinearize_fd_array): Delete.
(dtable::fixup_after_exec): New file.
(dtable::vfork_child_dup): Use cygwin heap.
(dtable::vfork_parent_restore): Ditto.
* dtable.h: Remove obsolete methods. Add new method.
* environ.cc (posify): Eliminate already_posix parameter and logic.
(envsize): New function.
(_addenv): Use envsize.
(environ_init): Accept an argument pointing to an existing environment list.
If supplied, allocate space for this in the the program's heap.
* fhandler.cc (fhandler_base::operator =): Move here from fhandler.h. Use
cygwin heap to allocate filenames.
(fhandler_base::set_name): Allocate/free names from cygwin heap.
(fhandler_base::linearize): Delete.
(fhandler_base::de_linearize): Delete.
(fhandler_base::operator delete): Free from cygwin heap.
(fhandler_base::~fhandler_base): Ditto.
* fhandler.h: Accomodate elimination of *linearize and other changes above.
* fhandler_console.cc (fhandler_console::fixup_after_exec): Rename from
de_linearize.
* heap.h: New file.
* fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Use cygwin heap for
name. fhandler_tty::fixup_after_exec): Rename from de_linearize.
* fork.cc (fork): Call cygheap_fixup_in_child.
* heap.cc: Use declarations in heap.h.
* malloc.cc: Sprinkle assertions throughout to catch attempts to free/realloc
something from the cygwin heap.
* path.cc: Throughout, eliminate use of per-thread cache for cwd. Use cwd_*
functions rather than cwd_* variables to access cwd_win32 and cwd_posix.
(cwd_win32): New function.
(cwd_posix): New function.
(cwd_hash): New function.
(cwd_fixup_after_exec): New function.
* path.h: Accomodate path.cc changes.
* pinfo.cc (pinfo_init): Accept a pointer to an environment table. Pass this
to environ_init. Eliminate old 'title' tests.
* pinfo.h: Accomodate above change in argument.
* spawn.cc (struct av): New method for building argv list.
(av::unshift): New method.
(spawn_guts): Allocate everything that the child process needs in the cygwin
heap and pass a pointer to this to the child. Build argv list using new
method. Eliminate delinearize stuff.
* thread.h: Eliminate _cwd_win32 and _cwd_posix buffers.
* winsup.h: Eliminate obsolete functions. Add envsize() declaration.
since we are already bounds checked by default.
* thread.cc (ResourceLocks::Lock): Streamline this function since it is called
a lot.
(ReleaseResourceLock): Ditto.
* *.cc: put winsup.h before other headers (for __INSIDE_CYGWIN__);
use cur_environ() instead of just environ
* times.cc: remove import protections
* glob.c: add winsup.h
* localtime.c: ditto
* smallprint.c: ditto
* Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
appropriate.
(LIBCOS): Find additional stub library stuff in their own subdirectory.
* dcrt0.cc: Convert user_data pointer to static __cygwin_user_data area.
(do_global_ctors): Check magic_bisquit for initialization.
(dll_crt0_1): First group of premain functions prior to fd initialization. Run
second group before calling main.
(dll_crt0 ()): New function, called from new initialization code.
(dll_crt0 (per_process *uptr)): Call new dll_crt0 () function on
initialization.
* debug.cc (thread_stub): Initialize bottom of stack with per-thread info.
* environ.cc (parse_thing): Use binmode global to control CYGWIN=binmode
behavior.
* fhandler.cc (fhandler_base::open): Allow explicit setting of __fmode to
O_BINARY or O_TEXT to override disk mount settings.
* libcmain.cc: Move to lib subdirectory.
* libccrt0.cc: Ditto.
* dll_main.cc: Ditto.
* dll_entry.cc: Ditto.
* getopt.c: Ditto.
* thread.cc (thread_init_wrapper): Call ExitThread explicitly rather than
returning, as a preliminary step towards placing per thread info at the bottom
of the stack.
* winsup.h: Move per_process class to include/sys/cygwin.h. Declare new
dll_crt0().
* include/cygwin/version.h: Bump API minor version.
* binmode.c: New file.
* textmode.c: Ditto.
* lib/_cygwin_crt0_common.cc: Ditto.
* lib/crt0.h: Ditto.
* lib/cygwin_attach_dll.c: Ditto.
* lib/cygwin_crt0.c: Ditto.
* lib/dll_entry.cc: Ditto.
* lib/dll_main.cc: Ditto.
* lib/getopt.c: Ditto.
* lib/libcmain.c: Ditto.
* lib/premain0.c: Ditto.
* lib/premain1.c: Ditto.
* lib/premain2.c: Ditto.
* lib/premain3.c: Ditto.
referring to something like c:\.
* dcrt0.cc (dll_crt0_1): Move uinfo initialization prior to sig_send
initialization to give signal thread a chance to finish.
* debug.cc (WFSO): Move to sigproc.cc
(WFMO): Ditto.
* exceptions.cc (interruptible): Allocate slightly more space for directory
just for paranoia's sake.
(call_handler): Eliminate nonmain argument. Determine if main thread has set a
frame pointer and use it if so.
(sig_handle): Eliminate nonmain argument.
* net.cc: Record frame information in appropriate routines throughout.
* select.cc (select): Ditto.
* sigproc.cc: Use sigthread structure to record mainthread id throughout.
(sig_send): Record frame information for signal handler.
(wait_sig): Reflect argument change in sig_handle.
(WFSO): Move here and record frame information for signal handler.
(WFMO): Ditto.
* sigproc.h: Implement new "sigthread" class. Implement "sigframe" class for
manipulating signal frame info.
* thread.cc (__pthread_kill): Use standard _kill() function rather than calling
sig_send directly.
* winsup.h: Eliminate ebp element from signal_dispatch class.