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
AgeCommit message (Collapse)Author
2002-10-172002-10-17 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare. * thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement. (pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid unneeded SEGV's during debugging.
2002-09-302002-09-30 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc (pthread_mutex::initMutex): Use the wrapper init call. (pthread_mutex::nativeMutex::init): Implement. (pthread_mutex::nativeMutex::lock): Ditto. (pthread_mutex::nativeMutex::unlock): Ditto. (pthread_mutex::init): Use the wrapper lock and unlockcalls. * thread.h (pthread_mutex): Move mutexInitializationLock into a nativeMutex wrapper class.
2002-09-30* environ.cc (environ_init): Avoid a compiler warning.Christopher Faylor
* path.cc (path_conv::check): Ditto. * path.h (path_conv::operator int): Ditto. * regex/engine.c: Ditto throughout. * regex/regcomp.c: Ditto throughout. * regex/regexec.c: Ditto throughout.
2002-09-302002-09-30 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* pthread.cc (pthread_mutex_init): Use new pthread_mutex::init. * thread.cc: Change __pthread_mutex_init to pthread_mutex::init throughout. (MTinterface::Init): Initialise pthread_mutex support. (pthread_mutex::mutexInitializationLock): Instantiate. (pthread_mutex::initMutex): New method. (__pthread_cond_dowait): Don't dereference untrusted pointers. Use the new pthread_mutex::init method. (__pthread_condattr_init): Don't dereference untrusted pointers. (__pthread_mutex_init): Rename to pthread_mutex::init. Lock and release mutexInitializationLock to prevent races on mutex initialisation. * thread.h (pthread_mutex::initMutex): New method, initialise pthread_mutex supporting state on process initialisation. (pthread_mutex::init): Initialise a single mutex. (pthread_mutex::mutexInitializationLock): A win32 mutex for syncronising pthread mutex initialisation. (__pthread_mutex_init): Remove this.
2002-09-29* cygthread.h (cygthread::terminate): Declare new function.Christopher Faylor
(cygthread::initialized): Change to 'int'. * cygthread.cc (cygthread::stub): Exit thread if initialized < 0. (cygthread::new): Ditto. (cygthread::runner): Ditto. Set initialized using xor to preserve sign. (cygthread::terminate): New function. * dcrt0.cc (do_exit): Call cygthread::terminate.
2002-09-272002-09-27 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc (pthread_key::run_destructor): Run_destructor is not const as it needs to set the key value. * thread.h (pthread_key::run_destructor): Ditto. 2002-09-27 Robert Collins <rbtcollins@hotmail.com> * thread.cc (pthread_key::run_destructor): Follow opengroup algorithm. I.e. only run the destructor NON-NULL key values, and reset the key to NULL before running the destructor. Reported by Thomas Pfaff.
2002-09-212002-09-21 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* pthread.cc: Use class::call for converted pthread and semaphore calls. * thread.cc: Convert various __pthread_call and __sem_call to pthread::call and sem::call throughout. * pthread.h (__pthread_cancel): Convert to pthread::cancel. (__pthread_join): Convert to pthread::join. (__pthread_detach): Convert to pthread::detach. (__pthread_create): Convert to pthread::create. (__pthread_once): Convert to pthread::once. (__pthread_atfork): Convert to pthread::atfork. (__pthread_suspend): Convert to pthread::suspend. (__pthread_continue): Convert to pthread::resume. (__sem_init): Convert to semaphore::init. (__sem_destroy): Convert to semaphore::destroy. (__sem_wait): Convert to semaphore::wait. (__sem_trywait): Convert to semaphore::trywait. (__sem_post): Convert to semaphore::post.
2002-09-212002-09-21 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc: Finish the removal of the separate pthread_key destructor list. Remove all pthread_key_destructor and pthread_key_destructor_list references throughout. (pthread::exit): Call the new pthread_key interface to activate destructors. (pthread_key::keys): Change into a list. (pthread_key::saveAKey): New method, used via forEach. (pthread_key::restoreAKey): Ditto. (pthread_key::destroyAKey): Ditto. (pthread_key::fixup_before_fork): Use the List::forEach functionality. (pthread_key::fixup_after_fork): Ditto. (pthread_key::runAllDestructors): New method implementation. (pthread_key::pthread_key): Use List::Insert rather than custom list code. (pthread_key::~pthread_key): Use List::Remove for the same reason. * thread.h: Remove all pthread_key_destructor and pthread_key_destructor_list references throughout. (List): Move the interface above pthread_key in the header. Use atomic operations during insert and delete. (List::forEach): A generic interface for doing something on each node. (pthread_key::runAllDestructors): New method, run all destructors. (pthread_key::fork_buf): Make private. (pthread_key::run_destructor): Ditto. (pthread_key::saveAKey): New method for clearer source. (pthread_key::restoreAKey): Ditto. (pthread_key::destroyAKey): Ditto. (MTinterface::destructors): Remove.
2002-09-212002-09-21 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc: Partial refactoring of pthread_key destructor handling. Loosely based on Thomas Pfaff's work. (pthread_key_destructor_list::Insert): Remove. (pthread_key_destructor_list::Pop): Remove. (pthread_key_destructor_list::IterateNull): Call the key's run_destructor method. (pthread_key::pthread_key): Initialize new member. (pthread_key::get): Mark as const for correctness. (pthread_key::run_destructor): Implement. * thread.h (pthread_key::get): Mark as const for correctness. (pthread_key::run_destructor): Declare. (List): New template class that implements a generic list. (pthread_key_destructor_list): Inherit from List, and remove now duplicate functions.
2002-09-212002-09-21 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc: Change verifyable_object_isvalid calls with PTHREAD_CONDATTR_MAGIC, PTHREAD_MUTEXATTR_MAGIC, PTHREAD_COND_MAGIC, SEM_MAGIC to objecttype::isGoodObject() calls throughout. (pthread_condattr::isGoodObject): Implement. (pthread_mutex::isGoodInitializer): Implement. (pthread_mutex::isGoodInitializerOrObject): Minor bugfix in the check for verifyable_object_isvalid result. (pthread_mutexattr::isGoodObject): Implement. (pthread_cond::isGoodObject): Ditto. (pthread_cond::isGoodInitializer): Ditto. (pthread_cond::isGoodInitializerOrObject): Ditto. (semaphore::isGoodObject): Ditto. * thread.h (pthread_mutex::isGoodInitializer): Declare. (pthread_condattr::isGoodObject): Ditto. (pthread_cond::isGoodObject): Const correctness. (pthread_cond::isGoodInitializer): Declare. (pthread_cond::isGoodInitializerOrObject): Ditto. (semaphore::isGoodObject): Const correctness.
2002-09-212002-09-21 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc: Change verifyable_object_isvalid calls with PTHREAD_MUTEX_MAGIC and PTHREAD_KEY_MAGIC and PTHREAD_ATTR_MAGIC to ::isGoodObject() calls throughout. (MTinterface::Init): Remove dead code. (pthread_attr::isGoodObject): Implement. (pthread_key::isGoodObject): Implement. (pthread_mutex::isGoodObject): Implement. (pthread_mutex::isGoodInitializerOrObject): Implement. (pthread::isGoodObject): Update signature. * thread.h (pthread_key::isGoodObject): Declare. (pthread_attr::isGoodObject): Ditto. (pthread_mutex::isGoodObject): Ditto. (pthread_mutex::isGoodInitializerOrObject): Ditto. (pthread::isGoodObject): Change to a const parameter for const correctness. (pthread_mutexattr::isGoodObject): Declare. (pthread_condattr::isGoodObject): Ditto. (pthread_cond::isGoodObject): Ditto. (semaphore::isGoodObject): Ditto.
2002-09-172002-09-17 Robert Collins <rbtcollins@hotmail.com>Robert Collins
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.
2002-09-16* init.cc: Cleanup slightly and remove obsolete code.Christopher Faylor
2002-09-162002-09-11 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2002-07-042002-06-25 Thomas Pfaff <tpfaff@gmx.net>Robert Collins
* include/pthread.h (PTHREAD_CANCELED): Defined a reasonable value. * pthread.cc (pthread_exit): Call method instead of function. (pthread_setcancelstate): Ditto. (pthread_setcanceltype): Ditto. (pthread_testcancel): Ditto. * thread.h (pthread::cancel_event): New member. (__pthread_cancel_self): New prototype. (pthread::exit): New Method. (pthread::cancel): Ditto. (pthread::testcancel): Ditto. (pthread::cancel_self): Ditto. (pthread::static_cancel_self): Ditto. (pthread::setcancelstate): Ditto. (pthread::setcanceltype): Ditto. (__pthread_cancel): Give c++ linkage. (__pthread_exit): Remove. (__pthread_setcancelstate): Ditto. (__pthread_setcanceltype): Ditto. (__pthread_testcancel): Ditto. * thread.cc (pthread::pthread): Inititialize cancel_event. (pthread::~pthread): Close cancel_event if needed. (pthread::create): Create cancel_event. (pthread::exit): New method. Replacement for __pthread_exit. (pthread::cancel): New method. (pthread::testcancel): Ditto. (pthread::static_cancel_self); New static method. (pthread::setcancelstate): New method. Replacement for __pthread_setcancelstate. (pthread::setcanceltype): New method. Replacement for __pthread_setcanceltype. (pthread::pop_cleanup_handler): Added lock for async cancel safe cancellation. (pthread::thread_init_wrapper): Change __pthread_exit to thread->exit(). (__pthread_cancel): Call method thread->cancel(). (__pthread_exit): Remove. (__pthread_setcancelstate): Ditto. (__pthread_setcanceltype): Ditto. (__pthread_testcancel): Ditto.
2002-06-232002-06-12 Thomas Pfaff <tpfaff@gmx.net>Robert Collins
* 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.
2002-06-13* winver.rc: Add more words to copyright.Christopher Faylor
2002-06-11* spawn.cc (spawn_guts): More hToken removal cleanup.Christopher Faylor
2002-06-10/tmp/cvs610a0a90.1Robert Collins
2002-06-102002-06-10 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2002-06-05/tmp/cvs610a0efc.1Robert Collins
2002-02-10 * child_info.h, cygheap.h, fhandler_clipboard.cc, fhandler_dsp.cc,Corinna Vinschen
fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc, fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc, pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc, security.h, thread.h, uinfo.cc, include/cygwin/acl.h: Fix copyright.
2002-02-10 * (child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,Corinna Vinschen
fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc, fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc, fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc, pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc, security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h): Change usage of uid_t to __uid16_t, gid_t to __gid16_t and off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and INVALID_SEEK instead casting -1 to the appropriate type. * winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK. * include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t types. Don't declare acl functions when compiling Cygwin. * include/cygwin/grp.h: Declare getgrgid() and getgrnam() with correct types for internal usage.
2001-12-262001-12-26 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2001-11-05Eliminate excess whitespace.Christopher Faylor
2001-09-29Sat Sep 29 18:26:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* pthread.cc (pthread_cond_timedwait): Deleted - exported from thread.cc. (pthread_cond_wait): Deleted - exported from thread.cc. * thread.cc (pthread_cond::BroadCast): Update to use the new syntax for verifyable_object_isvalid (). (pthread_cond::Signal): Ditto. Also attempt to fix the lost signal race with pthread_cond::TimedWait(). (check_valid_pointer): Change definiton to void const *. (verifyable_object_isvalid): Add new parameter to allow identification of static initializers, and return a enum rather than magic numbers. (__pthread_create): Ditto. (__pthread_cleanup): Ditto. (__pthread_attr_init): Ditto. (__pthread_attr_getinheritsched): Ditto. (__pthread_attr_getschedparam): Ditto. (__pthread_attr_getschedpolicy): Ditto. (__pthread_attr_getscope): Ditto. (__pthread_attr_setdetachstate): Ditto. (__pthread_attr_getdetachstate): Ditto. (__pthread_attr_setinheritsched): Ditto. (__pthread_attr_setschedparam): Ditto. (__pthread_attr_setschedpolicy): Ditto. (__pthread_attr_setscope): Ditto. (__pthread_attr_setstacksize): Ditto. (__pthread_attr_getstacksize): Ditto. (__pthread_attr_destroy): Ditto. (__pthread_join): Ditto. (__pthread_detach): Ditto. (__pthread_suspend): Ditto. (__pthread_continue): Ditto. (__pthread_getschedparam): Ditto. (__pthread_getsequence_np): Ditto. (__pthread_key_create): Ditto. (__pthread_key_delete): Ditto. (__pthread_setschedparam): Ditto. (__pthread_setspecific): Ditto. (__pthread_getspecific): Ditto. (__pthread_cond_destroy): Ditto. (__pthread_cond_init): Ditto. (__pthread_cond_broadcast): Ditto. (__pthread_cond_signal): Ditto. (__pthread_condattr_init): Ditto. (__pthread_condattr_getpshared): Ditto. (__pthread_condattr_setpshared): Ditto. (__pthread_condattr_destroy): Ditto. (__pthread_kill): Ditto. (__pthread_mutex_init): Ditto. (__pthread_mutex_getprioceiling): Ditto. (__pthread_mutex_lock): Ditto. (__pthread_mutex_trylock): Ditto. (__pthread_mutex_unlock): Ditto. (__pthread_mutex_destroy): Ditto. (__pthread_mutex_setprioceiling): Ditto. (__pthread_mutexattr_getprotocol): Ditto. (__pthread_mutexattr_getpshared): Ditto. (__pthread_mutexattr_gettype): Ditto. (__pthread_mutexattr_init): Ditto. (__pthread_mutexattr_destroy): Ditto. (__pthread_mutexattr_setprotocol): Ditto. (__pthread_mutexattr_setprioceiling): Ditto. (__pthread_mutexattr_getprioceiling): Ditto. (__pthread_mutexattr_setpshared): Ditto. (__pthread_mutexattr_settype): Ditto. (__sem_init): Ditto. (__sem_destroy): Ditto. (__sem_wait): Ditto. (__sem_trywait): Ditto. (__sem_post): Ditto. (__pthread_cond_dowait): New function, contains core logic from __pthread_cond_wait and __pthread_cond_timedwait. Decrement (*cond)->waiting before reentering the cond access mutex to allow detection of lost signals. (__pthread_cond_timedwait): Rename to pthread_cond_timedwait, and call __pthread_cond_dowait after calculating the wait length. (__pthread_cond_wait): Rename to pthread_cond_wait, and call __pthread_cond_dowait. * thread.h: New enum for use with verifyable_object_isvalid. Remove the extern exporting of __pthread_cond_timedwait and __pthread_cond_wait.
2001-09-25Tue Sep 25 21:25:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.cc (pthread_cond::BroadCast): Use address with verifyable_object_isvalid(). (pthread_cond::Signal): Ditto. (__pthread_create): Ditto. (__pthread_cleanup): Ditto. (__pthread_attr_init): Ditto. (__pthread_attr_getinheritsched): Ditto. (__pthread_attr_getschedparam): Ditto. (__pthread_attr_getschedpolicy): Ditto. (__pthread_attr_getscope): Ditto. (__pthread_attr_setdetachstate): Ditto. (__pthread_attr_getdetachstate): Ditto. (__pthread_attr_setinheritsched): Ditto. (__pthread_attr_setschedparam): Ditto. (__pthread_attr_setschedpolicy): Ditto. (__pthread_attr_setscope): Ditto. (__pthread_attr_setstacksize): Ditto. (__pthread_attr_getstacksize): Ditto. (__pthread_attr_destroy): Ditto. (__pthread_join): Ditto. (__pthread_detach): Ditto. (__pthread_suspend): Ditto. (__pthread_continue): Ditto. (__pthread_getschedparam): Ditto. (__pthread_getsequence_np): Ditto. (__pthread_key_create): Ditto. (__pthread_key_delete): Ditto. (__pthread_setschedparam): Ditto. (__pthread_setspecific): Ditto. (__pthread_getspecific): Ditto. (__pthread_cond_destroy): Ditto. (__pthread_cond_init): Ditto. (__pthread_cond_broadcast): Ditto. (__pthread_cond_signal): Ditto. (__pthread_cond_timedwait): Ditto. (__pthread_cond_wait): Ditto. (__pthread_condattr_init): Ditto. (__pthread_condattr_getpshared): Ditto. (__pthread_condattr_setpshared): Ditto. (__pthread_condattr_destroy): Ditto. (__pthread_kill): Ditto. (__pthread_mutex_init): Ditto. (__pthread_mutex_getprioceiling): Ditto. (__pthread_mutex_lock): Ditto. (__pthread_mutex_trylock): Ditto. (__pthread_mutex_unlock): Ditto. (__pthread_mutex_destroy): Ditto. (__pthread_mutex_setprioceiling): Ditto. (__pthread_mutexattr_getprotocol): Ditto. (__pthread_mutexattr_getpshared): Ditto. (__pthread_mutexattr_gettype): Ditto. (__pthread_mutexattr_init): Ditto. (__pthread_mutexattr_destroy): Ditto. (__pthread_mutexattr_setprotocol): Ditto. (__pthread_mutexattr_setprioceiling): Ditto. (__pthread_mutexattr_getprioceiling): Ditto. (__pthread_mutexattr_setpshared): Ditto. (__pthread_mutexattr_settype): Ditto. (__sem_init): Ditto. (__sem_destroy): Ditto. (__sem_wait): Ditto. (__sem_trywait): Ditto. (__sem_post): Ditto. (verifyable_object_isvalid): Recieve a pointer to a pointer for verification. (__pthread_mutexattr_getprotocol): Fix typo in magic number. (__pthread_mutexattr_getpshared): Ditto. (__pthread_mutexattr_gettype): Ditto. * thread.h (verifyable_object_isvalid): Change prototype to recieve a pointer to a pointer for verification. * include/pthread.h: Fix typo for __cleanup_routine_type typedef. (Contrib from Net).
2001-09-12Wed Sep 12 13:03:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2001-09-12Update copyrights.Christopher Faylor
2001-09-11Tue Sep 11 18:15:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2001-09-10Mon Sep 10 08:28:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* thread.h (MT_Interface): Remove pshared mutex array. Add a threadsafe list for mutex tracking (for fixupafter fork). * thread.cc (MTInterface::Init): Remove pshared mutex array. (pthread_mutex::pthread_mutex): Remove pshared mutex functionality. Fail with EINVAL on attempts to use pshared functionality. (__pthread_mutex_getpshared): Remove. (__pthread_cond_timedwait): Remove pshared mutex functionality. (__pthread_cond_wait): Ditto. (__pthread_mutex_init): Ditto. (__pthread_mutex_getprioceiling): Ditto. (__pthread_mutex_lock): Ditto. (__pthread_mutex_trylock): Ditto. (__pthread_mutex_unlock): Ditto. (__pthread_mutex_destroy): Ditto. (__pthread_mutex_setprioceiling): Ditto. (__pthread_mutexattr_setpshared): Ditto.
2001-08-23 * net.cc (cygwin_inet_ntoa): Rearrange previous patch to useCorinna Vinschen
thread local buffer space when compiled thread safe. (cygwin_getprotobyname): Ditto. (cygwin_getprotobynumber): Ditto. (cygwin_getservbyname): Ditto. (cygwin_getservbyport): Ditto. (cygwin_gethostbyname): Ditto. (cygwin_gethostbyaddr): Ditto. Move near to cygwin_gethostbyname. * thread.h (struct _winsup_t): Add pointers for above used buffer space. * passwd.cc (getpwduid): Remove initializing passwd. (setpwent): Ditto. (endpwent): Ditto. (setpassent): Ditto.
2001-06-26* mmap.cc: Clean up *ResourceLock calls throughout.Christopher Faylor
* 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.
2001-05-07Sun May 6 17:05:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2001-04-30 * grp.cc: Eliminate MAX_DOMAIN_NAME define.Corinna Vinschen
(read_etc_group): Substitute MAX_DOMAIN_NAME by INTERNET_MAX_HOST_NAME_LENGTH. * passwd.cc (parse_pwd): Don't force pw_name to be lower case. * sec_helper.cc: Substitute MAX_USER_NAME by UNLEN, MAX_COMPUTERNAME_LENGTH by INTERNET_MAX_HOST_NAME_LENGTH throughout. (lookup_name): Slight cleanup. * security.cc (alloc_sd): Substitute MAX_USER_NAME by UNLEN. * security.h: Define DEFAULT_UID as DOMAIN_USER_RID_ADMIN and DEFAULT_GID as DOMAIN_ALIAS_RID_ADMINS. * shared.cc (memory_init): Substitute MAX_USER_NAME by UNLEN. * thread.h: Ditto. * uinfo.cc (internal_getlogin): Substitute MAX_USER_NAME by UNLEN. Substitute MAX_COMPUTERNAME_LENGTH and MAX_HOST_NAME by INTERNET_MAX_HOST_NAME_LENGTH. * winsup.h: Include lmcons.h. Eliminate MAX_USER_NAME and MAX_HOST_NAME. Move DEFAULT_UID and DEFAULT_GID to security.h.
2001-04-21Sun Apr 22 20:22:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* passwd.cc (getpwuid): Check for thread cancellation. (getpwuid_r): Ditto. (getpwname): Ditto. (getpwnam_r): Ditto. * thread.h (pthread_mutex): New constructors for pshared operation. (MTinterface): Associative array for pshared mutex's. * thread.cc (MTinterface::Init): Initailize pshared mutex array. (pthread_cond::BroadCast): Implementation notes. (pthread_cond::TimedWait): Remove use of SignalObjectAndWait on non-NT systems. (pthread_mutex::pthread_mutex(unsigned short)): New function. (pthread_mutex::pthread_mutex (pthread_mutex_t *, pthread_mutexattr *)):New function. (pthread_mutex::pthread_mutex(pthread_mutexattr *)): Fail on pshared mutex's. (__pthread_mutex_getpshared): New function. (__pthread_join): Check for thread cancellation. (__pthread_cond_timedwait): Support pshared mutex's. (__pthread_cond_wait): Ditto. (__pthread_condattr_setpshared): Error on PROCESS_SHARED requests. (__pthread_mutex_init): Support pshared mutex's. (__pthread_mutex_getprioceiling): Ditto. (__pthread_mutex_lock): Ditto. (__pthread_mutex_trylock): Ditto. (__pthread_mutex_unlock): Ditto. (__pthread_mutex_destroy): Ditto. (__pthread_mutex_setprioceiling): Ditto. (__pthread_mutexattr_setpshared): Support PTHREAD_PROCESS_PSHARED requests.
2001-04-14Sat Apr 14 17:04:00 2001 Robert Collins <rbtcollins@hotmail.com>Robert Collins
* 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.
2001-04-13* fork.cc (fork_child): Call the __pthread_atforkchild function.Christopher Faylor
(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.
2001-04-12 * configure.in: Remove PTH_ALLOW.Robert Collins
* 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
2001-04-02* shared_info.h (mount_info): Remove mnt_ elements.Christopher Faylor
* thread.h (struct _winsup_t): Add mnt_ elements. * path.cc (fillout_mntent): Use mnt_ elements from reent_winsup ().
2001-04-01* thread.h (struct _winsup_t): Remove obsolete elements. Add available_drivesChristopher Faylor
element. * path.cc (mount_info::getmntent): Report "/cygdrive" drives when mounted drives are exhausted. (fillout_mntent): New function. (mount_item::getmntent): Use fillout_mntent. (cygdrives_mntent): New function. Returns next available "/cygdrive". (setmntent): Initialize available "/cygdrives". * syscalls.cc: Remove some if 0'ed code. * times.cc (timezone): Use more descriptive variable name.
2001-03-21* sched.cc: New file. Implement sched*.Christopher Faylor
* include/sched.h: New file. User land includes for sched*. * Makefile.in: Add sched.o * cygwin.din: Add exports for sched*.
2001-03-20* exceptions.cc (interruptible): Update debugging output.Christopher Faylor
(setup_handler): Ensure that wait_sig loop wakes up when we punt on sending a signal. * poll.cc (poll): Add signal guard here.
2001-03-18* external.cc (fillout_pinfo): Match windows pid, as well as cygwin pid whenChristopher Faylor
passed in pid. Don't prematurely break when searching for a pid. * thread.h (_winsup_t): Eliminate unneeded field.
2001-03-17* cygwin.din: Export the new functions.Christopher Faylor
* 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.
2000-10-17* Makefile.in: Remove some obsolete stuff.Christopher Faylor
* 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.
2000-10-15* exceptions.cc (set_console_handler): Don't allocateChristopher Faylor
console_handler_thread_waiter. It is obsolete. (ctrl_c_handler): Don't use console_handler_thread_waiter. * path.cc (hash_path_name): Fix handling of relative names. Make case insensitive. * path.h (suffix_info): Use initializers. * pinfo.h (_pinfo): Avoid initializers for null case. * resource.cc (fill_rusage): Zero rest of rusage structure. * security.cc (set_process_privileges): Don't reopen parent process. Just use hMainProc. * signal.cc (signal): Track when a signal handler has been used. (sigaction): Ditto. * sigproc.cc (pchildren): Use default initializer. (zombies): Ditto. (sigproc_terminate): Avoid closing handles that will be closed on exit anyway. (wait_sig): Send signal to "parent" on EXECing, not FORKing. (wait_subproc): Send SIGCHLD here rather than in proc_wait to avoid potential muto conflicts. * sigproc.h (sigthread): Don't initialize to zero. It's the default. * spawn.cc (spawn_guts): Fill in resources from exec parent prior to termination. * sync.h (muto): Don't initialize to zero. * syscalls.cc (close_all_files): Use one lock around entire loop and call fhandler close/release stuff directly. (_read): Don't use ready_for_read if there are not signal handlers active. * dcrt0.cc (dll_crt0_1): Fix display of "title". (do_exit): Use pinfo exit method to exit. (__api_fatal): Ditto. * exceptions.cc (signal_exit): Ditto. * fork.cc (fork_child): Remove debugging stuff. Use pinfo_fixup_after fork in place of exec_fixup_after_fork. * pinfo.cc (pinfo_fixup_after_fork): New method. (pinfo_fixup_in_spawned_child): Ditto. (_pinfo::exit): New method. (_pinfo::init): Remove recursion. Detect pathological case where pinfo structure already exists for new pid. * pinfo.h (_pinfo): Reorganize slightly. Add new method and new function declarations. * sigproc.cc (proc_exists): Previous simplification was a little to simple. Try harder to detect if a process exists. (proc_terminate): Use PID_EXITED setting to determine if process is still around. (WFSO): Remove debugging statement. (WFMO): Ditto. * spawn.cc (exec_fixup_after_fork): Eliminate. (spawn_guts): Always set old_title to NULL. Is it really needed? Move hexec_proc to pinfo.cc. Call pinfo_fixup_in_spawned_child to eliminate handle link after a spawn. * include/sys/cygwin.h: Remove PID_NOT_IN_USE. Add PID_EXITED.
2000-09-25* spawn.cc (av::dup_maybe): Make function void rather than void *.Christopher Faylor
* environ.cc (environ_init): Remember to reparse CYGWIN if envp is supplied. * heap.cc (_sbrk): Remember frame for signal handling. * syscalls.cc (read_handler): Eliminate. (_read): Move read_handler code here. Reorganize for one path through 'ready_for_read'.
2000-09-03* Makefile.in: Add cygheap.o.Christopher Faylor
* 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.
2000-08-22* winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h filesChristopher Faylor
only in sources which require them. * Makefile.in: Generate dependencies with -MD option.