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
2012-08-17* DevNotes: Add entry cgf-000016.Christopher Faylor
* cygtls.h (_cygtls::push): Inline. (_cygtls::interrupt_now): Change signal number argument to siginfo_t argument. (_cygtls::interrupt_setup): Ditto. (_cygtls::set_siginfo): Delete declaration. (_cygtls::reset_signal_arrived): Don't reset signal_arrived signal. Just reset flag. * exceptions.cc (_cygtls::interrupt_now): Reflect argument changes. Pass si to interrupt_setup. (_cygtls::interrupt_setup): Reflect argument changes. Fill out tls infodata here using passed-in si. Use si.si_signo instead of sig. (sigpacket::setup_handler): Move this function into sigpacket class. Use si field from the class as appropriate. (sigpacket::process): Don't call tls->set_siginfo here since setup_handler could fail. Eliminate now-unneeded sig argument. * sigproc.h (sigpacket::setup_handler): Move setup_handler to this class.
2012-08-17* exceptions.cc (sig_handle_tty_stop): Clear tls sig field.Christopher Faylor
(sigpacket::process): When continuing, set tls->sig before arming signal_arrived.
2012-08-16* cygheap.cc (init_cygheap::find_tls): Don't consider unitialized threads.Christopher Faylor
* cygtls.cc (_cygtls::operator HANDLE): Return NULL when tid is not set. * exceptions.cc (setup_handler): Don't try to suspend a thread if it has no handle.
2012-08-15Rename cancelable_wait -> cygwait throughout.Christopher Faylor
* DevNotes: Add entry cgf-000015. * cygwait.h (cygwait): Don't allow an optional PLARGE_INTERGER argument.
2012-08-15* cygtls.h (_cygtls::create_signal_arrived): New function.Christopher Faylor
(_cygtls::set_signal_arrived): Lock creation of signal_arrived. * cygwait.cc (cancelable_wait): Ignore signal_arrived event if _my_tls 'sig' element does not exist. * exceptions.cc (_cygtls::interrupt_setup): Create signal_arrived if recipient thread has not created it.
2012-08-15* exceptions.cc (sigdelayed): Move declaration to sigproc.h.Christopher Faylor
* sigproc.h (sigdelayed): Make symbol globally available. * gendef (sigdelayed): Specifically zero incyg and stacklock. * signal.cc (sigwaitinfo): Lock _my_tls and try harder to clean up signal information.
2012-08-09* DevNotes: Add entry cgf-000014.Christopher Faylor
* cygheap.cc (tls_sentry): Move here, rename from 'sentry' in cygtls.cc (tls_sentry::lock): Ditto. (nthreads): Move from cygtls.cc (THREADLIST_CHUNK): Ditto. (cygheap_init): Call init_tls_list(). (init_cygheap::init_tls_list): Define new function. (init_cygheap::add_tls): Ditto. (init_cygheap::remove_tls): Ditto. (init_cygheap::find_tls): Ditto. Semi-resurrect from _cygtls::find_tls. * cygheap.h (init_cygheap::init_tls_list): Declare new function. (init_cygheap::add_tls): Ditto. (init_cygheap::remove_tls): Ditto. (init_cygheap::find_tls): Ditto. * cygtls.cc (sentry): Delete. (sentry::lock): Ditto. (nthreads): Ditto. (THREADLIST_CHUNK): Ditto. (_cygtls::init): Delete definition. (_cygtls::init_thread): Call cygheap->add_tls() to add thread to global list. (_cygtls::remove): cygheap->remove_tls() to remove thread from global list. * cygtls.h (_cygtls::init): Delete declaration. * dcrt0.cc (dll_crt0_0): Delete call to _cygtls::init(). * exceptions.cc (sigpacket::process): When no thread is specified, try to find one via cygheap->find_tls.
2012-08-03* exceptions.cc (sigdelayed): Simplify declaration.Christopher Faylor
(_cygtls::call_signal_handler): Fix test for when to pop signal stack. Only do it exactly when what is on the stack is a no-op.
2012-07-30* cygwait.cc (cancelable_wait): Add some debugging-only output.Christopher Faylor
* exceptions.cc (sig_handle_tty_stop): Make sure that incyg is cleared when exiting if we have no parent process. Only wait for signal_arrived. (sigpacket::process): Make continue_now a bool. Delay sending signal_arrived until the end. Make code more defensive to avoid calling signal handler when stopped. Only set signal_arrived when stopped. * sigproc.cc (sig_hold): Rename from sigCONT. Make static. (sig_send): Accommodate sigCONT -> sig_hold rename. (wait_sig): Ditto. * sigproc.h (sigCONT): Delete declaration. * fhandler_console.cc (fhandler_console::write): Use new '%0c' facility to print characters. Change to paranoid to avoid excessive strace output. * fhandler_tty.cc (fhandler_pty_master::accept_input): Make frequent strace printf "paranoid" to help cut down on strace output size. * signal.cc (sigsuspend): Add standard syscall strace output. (sigpause): Ditto. (pause): Ditto. * cygtls.h (_cygtls::reset_signal_arrived): New function.
2012-07-30* cygtls.cc (_cygtls::reset_signal_arrived): New function.Christopher Faylor
(set_signal_arrived::~set_signal_arrived): Use reset_signal_arrived to reset state. * exceptions.cc (sig_handle_tty_stop): Use WAIT_SIGNALED rather than assume we know the return from cancelable_wait. (_cygtls::interrupt_setup): Modify to allow calling when executing in non-cygwin code via sigdelayed. Always reset signal_arrived. * gendef: Throughout use start_offset rather than the completely wrong sizeof__cygtls. (_sigdelayed): Rewrite to avoid duplication when calling the signal handler. (sigreturn): Delete. * gentls_offsets: Define start_offset rather than sizeof__cygtls. * tlsoffsets.h: Regenerate.
2012-07-22* DevNotes: Add entry cgf-000013.Christopher Faylor
* cygserver_ipc.h (ipc_set_proc_info): Use _cygtls::ipc_set_proc_info to set per-thread signal arrived value. * cygthread.cc (cygthread::detach): Use per-thread signal_arrived via set_thread_waiting. * fork.cc (_cygtls::fixup_after_fork): Clear signal_arrived. (_cygtls::remove): Close any signal_arrived handle when thread exists. (_cygtls::find_tls): Remove unneeded function. * cygtls.h: Update copyright. (class _cygtls): Reorganize to help avoid rebuilding newlib when structure changes. (_cygtls::event): Delete. (_cygtls::threadkill): Ditto. (_cygtls::signal_waiting): Declare new bool. (_cygtls::find_tls): Delete declaration. (_cygtls::set_threadkill): Ditto. (_cygtls::reset_threadkill): Ditto. (_cygtls::set_signal_arrived): Declare new function. (class set_thread_waiting): Declare new class. * cygwait.cc (cw_nowait_storage): Define. (cygwait): Set per-thread signal_arrived via set_thread_waiting. Don't special-case _main_tls. * cygwait.h (cw_nowait): Define. (cw_infinite): Ditto. (cygwait): Redefine pathological wait-only case. * dcrt0.cc (dll_crt0_0): Remove call to now-defunct events_init(). (dll_crt0_1): Remove call to now-defunct create_signal_arrived(). * exceptions.cc: Reflect set_signal_mask() argument reordering throughout. Remove signal mask synchronization throughout. (events_init): Delete definition. (mask_sync): Delete now-unneeded mask synchronization. (set_signal_mask): Reverse order of arguments to "standard" to, from layout. Rename "newmask" argument to "setmask". Remove debugging. (sig_handle_tty_stop): Use cancelable_wait rather than WFMO. (_cygtls::interrupt_setup): Don't treat "threadkill" events specially. Conditionally set signal_arrived depending on whether the thread has created it or not. (sigpacket::process): Reorganize to reflect thread-specific sending of signals which is more in line with the way it was actually supposed to work. * fhandler_socket.cc (get_inet_addr): Use cancelable_wait rather than IsEventSignalled to avoid potential race. (fhandler_socket::wait_for_events): Set signal_arrived event using set_thread_waiting(). (fhandler_socket::close): Use cygwait for the case of just waiting 10 ms for a signal. * fhandler_tape.cc (fhandler_dev_tape::_lock): Use cancelable_wait rather than WFMO. Redo switch/case tests accordingly. * fhandler_termios.cc (fhandler_termios::bg_check): Use cygwait for case of just waiting 0 ms for a potential signal. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use cancelable_wait rather than WFSO. * fhandler_windows.cc (fhandler_windows::read): Set per-thread signal_arrived via set_thread_waiting(). * flock.cc (lf_setlock): Ditto. * select.cc (pselect): Ditto. Set per-thread signal_arrived using set_thread_waiting(). * gendef: Don't special case handling of _cygtls::sig for threads. * gentls_offsets: Use #pragma once in tlsoffsets.h. * ntdll.h: Use #pragma once. * poll.cc: Reflect set_signal_mask() argument reordering. * posix_ipc.cc (ipc_mutex_lock): Use cancelable_wait rather than WFMO. (ipc_cond_timedwait): Set perl-thread signal arrived using set_thread_waiting(). * security.h: Use #pragma once. * signal.cc (abort): Reflect set_signal_mask() argument reordering. (clock_nanosleep): Ditto. Change call to cancelable_wait to properly specify handling of cancel and interrupt. (sigwaitinfo): Remove handling of per-thread event in favor of per-thread signal_arrived. Use cancelable_wait rather than WFSO. * sigproc.cc (signal_arrived): Delete definition. (create_signal_arrived): Ditto. * sigproc.h (signal_arrived): Delete declaration. (set_signal_mask): Avoid defining as a "C" function. Don't conditionally declare. (create_signal_arrived): Delete declaration. * syscalls.cc (rename): Use cygwait() rather than WFSO. * thread.h (fast_mutex::lock): Use cw_infinite rather than LARGE_NULL. * wait.cc (wait4): Ditto. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_wait): Ditto. (pthread_kill): Remove set_threadkill() accommodation. * tlsoffsets.h: Regenerate.
2012-07-04* exceptions.cc (setup_handler): Remove unneeded assignment found by Clang.Christopher Faylor
2012-07-03* exceptions.cc (exception::handle): Use error_code in klog, as intended.Christopher Faylor
Found by Clang.
2012-07-02* Makefile.in: Add some more optimization flags for cygwait, malloc and ↵Christopher Faylor
path. Explain why -fomit-frame-pointer doesn't work right for passwd.o and path.o. Add -static to link command line for cygwin0.dll. * fhandler_disk_file.cc (fhandler_disk_file::facl): Reorganize slightly to silence compiler warning when compiling with -fstack-check. * net.cc (inet_ntop6): Initialize structure members to silence compiler warning when compiling with -fstack-check. * pseudo-reloc.cc (_pei386_runtime_relocator): Make this a C function. Detect NULL u. * winsup.h (_pei386_runtime_relocator): Declare this as extern "C". * lib/_cygwin_crt0_common.cc (_pei386_runtime_relocator): Call with NULL argument. * signal.cc (sigaction_worker): Eliminate last argument. Let callers report their own strace info. Regparmize. (sigaction): Reflect sigaction_worker changes. (siginterrupt): Ditto. * exceptions.cc: Update copyright.
2012-06-28 * exceptions.cc (RtlUnwind): Align declaration with MSDN.Corinna Vinschen
* ntdll.h: Define CreateDisposition Flags. Add comments. * winlean.h: Define FILE_SHARE_VALID_FLAGS if using Mingw64 headers.
2012-06-27 * exceptions.cc (exception::handle): Cast exception code to NTSTATUSCorinna Vinschen
for comparison. * ntdll.h: Drop defining NT status codes in favor of including ntstatus.h.
2012-06-19* cygwait.h (LARGE_NULL): Define.Christopher Faylor
(cancelable_wait): Define variant which accepts DWORD time argument. (cygwait): Use cancelable_wait with DWORD argument. (cygwait): Use cancelable_wait with DWORD argument and cw_sig_eintr for timeout-only case. * exceptions.cc (handle_sigsuspend): Use LARGE_NULL as second argument to distinguish between cancelable_wait variants. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_timedwait): Ditto. * thread.h (fast_mutex::lock): Ditto. * wait.cc (wait4): Ditto.
2012-06-19Revert errneous checkin.Christopher Faylor
Check in actual change associated with ChangeLog.
2012-06-19* cygwait.cc (cancelable_wait): Mimic old cygwait behavior more closely wrtChristopher Faylor
handling of call_signal_handler. * cygwait.h (WAIT_CANCELED): Move here and redefine. (WAIT_SIGNALED): Ditto. * thread.h (WAIT_CANCELED): Delete. (WAIT_SIGNALED): Ditto.
2012-06-18Add '#include "cygwait.h"' throughout, where appropriate.Christopher Faylor
* DevNotes: Add entry cgf-000012. * Makefile.in (DLL_OFILES): Add cygwait.o. * sigproc.h: Remove cygwait definitions. * cygwait.h: New file. Define/declare Cygwin waitfor functions. * cygwait.cc: Ditto. * exceptions.cc: Include cygwait.h. (handle_sigsuspend): Accommodate change in cancelable_wait arguments. (sigpacket::process): Display thread tls in debugging output. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use symbolic names for signal and cancel return. * fhandler_console.cc (fhandler_console::read): Ditto. (fhandler_dev_dsp::Audio_out::waitforspace): Ditto. fhandler_dev_dsp::Audio_in::waitfordata): Ditto. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * select.cc (cygwin_select): Ditto. * wait.cc (wait4): Ditto. * thread.cc (cancelable_wait): Move definition to cygwait.h. (pthread_cond::wait): Accommodate change in cancelable_wait arguments. (pthread_mutex::lock): Ditto. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (pthread::thread_init_wrapper): Display tls in debugging output. (semaphore::_timedwait): Ditto. * thread.h (cw_sig_wait): Move to cygwait.h. (cw_cancel_action): Delete. (cancelable_wait): Move declaration to cygwait.h.
2012-06-03* exceptions.cc (setup_handler): Make debugging output a little more verbose.Christopher Faylor
2012-03-29* exceptions.cc (ctrl_c_handler): Don't generate a SIGINT if we've execed aChristopher Faylor
non-cygwin process. Let the Windows process deal with it itself.
2012-02-13* exception.h (stackdump): Declare.Christopher Faylor
* exceptions.cc (stackdump): Rework to perform all operations needed for a stackdump and to avoid recursion. (exception::handle): Use simplified stackdump interface. * sigproc.cc (signal::exit): Ditto. Delete now, uneeded declaration.
2012-02-09* exceptions.cc (setup_handler): Reduce system_printf to sigproc_printf sinceChristopher Faylor
it is for a transient situation which will undoubtedly be handled.
2011-12-17* exceptions.cc (set_signal_mask): Remove useless debugging output.Christopher Faylor
* fhandler.cc (fhandler_base::write): Ditto. (fhandler_base_overlapped::close): Cancel any ongoing I/O before closing. * syscalls.cc (write): Default to always reporting all writes in strace output via syscall_printf. * wait.cc (wait4): Fix debugging output. Use standard syscall leaver output.
2011-12-17Implement fhandler reference counting.Christopher Faylor
* cygheap.h (cygheap_fdmanip::release): Make virtual. (cygheap_fdnew::~cygheap_fdnew): New destructor increments reference count when fd has been allocated. (cygheap_fdget::fh): New (old?) field. (cygheap_fdget::cygheap_fdget): Increment reference count when we've found an active fd. Set fh appropriately. (cygheap_fdget::~cygheap_fdget): Decrement reference count when appropriate. Delete fh if reference count goes to zero. (cygheap_fdget::release): New function. Do more bookkeping on release. * dtable.cc (dtable::release): Change from void to boolean return. Only delete the fhandler when its reference count is <= 0 (this should be a fairly unusual case). Return true if fhandler has been deleted. (cygwin_attach_handle_to_fd): Increment reference count when fh is assigned. (dtable::init_std_file_from_handle): Ditto. * dtable.h (dtable::release): Change return to boolean. * fhandler.cc (fhandler_base::fhandler_base): Set new isclosed flag to false. Set _refcnt to zero. (fhandler_base::close): Simplify paranoid debugging output. Set new isclosed() flag. (fhandler_base_overlapped::wait_overlapped): Use isclosed() flag to avoid querying the exception handle. * fhandler.h (fhandler_base::_refcnt): New field. (fhandler_base::refcnt): New function. (fhandler_base::isclosed): Implement. (fhandler_base::fhandler_base): Set isclosed to false. * syscalls.cc: Remove space after function before parentheses for several strace printfs. (dup): Add standard strace "leaver" code. (dup2): Ditto. (dup3): Ditto. (remove): Ditto. (getpid): Ditto. (getppid): Ditto. (lseek64): Fix strace debugging to correctly use %R. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Avoid sending signals to other processes if we're debugging since it can cause a deadlock with the calling debugger. * exceptions.cc (_cygtls::call_signal_handler): Add debugging-only strace output.
2011-12-16* exceptions.cc (_cygtls::call_signal_handler): Fix debugging to not go toChristopher Faylor
console. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Add temporary kludge to work around problem of make closing a handler while it is being read. * gendef (sigdelayed): Don't call a function if sig has been cleared. * sigproc.h (cygwait): Simplify slightly.
2011-12-14* dcrt0.cc (init_windows_system_directory): Record system_wow64_directoryChristopher Faylor
information. * exceptions.cc (_cygtls::inside_kernel): Modernize comment. Consider executing a DLL from the Wow64 directory as being "in the kernel". (_cygtls::call_signal_handler): For now, only deal with main_tls signals if main_tls is known to be executing in the cygwin DLL. To more closely emulate linux, consider the operation to be restartable if not executing in the main thread. * globals.cc (windows_system_directory): Remove NO_COPY. (windows_system_directory_length): Ditto. (system_wow64_directory): New variable. (system_wow64_directory_length): Ditto. * select.cc (cygwin_select): Don't issue a EINTR on non-main threads since that seems to be what Linux does. Add missing break to signal case/switch. (select_stuff::wait): Don't issue a EINTR on non-main threads since that seems to be what Linux does. Remove now-unneeded accommodation for WAIT_IO_COMPLETION. Add a comment. * sigproc.h (cygwait): Ditto. Don't return if signal_received noticed and it's not the main thread. * signal.cc (sigprocmask): Add standard syscall debug stuff. * thread.cc (pthread_sigmask): Ditto.
2011-12-13* cygthread.h (cygthread::name): Very minor formatting tweak.Christopher Faylor
* exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging output. * sigproc.h (cygwait): Call signal handler when signal is detected and loop as appropriate. * fhandler.h (fhandler_base_overlapped::wait_return): Remove overlapped_signal. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove restartable signal accommodations in light of cygwait improvements. (fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop behavior. (fhandler_base_overlapped::raw_write): Ditto. * fhandler_console.cc (fhandler_console::read): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. (fhandler_serial::raw_write): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * ioctl.cc (ioctl): Add standard syscall introducer and leaver debug output.
2011-12-10* exceptions.cc (ctrl_c_handler): YA in a series or reversions. Put backChristopher Faylor
_my_tls.remove along with a comment. (sigpacket::process): Remove code which now causes a gdb deadlock. * sigproc.cc (_cygtls::signal_exit): Signal debugger with signal number earlier.
2011-12-08* dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we'reChristopher Faylor
dynamically loaded since fork() doesn't work in that scenario anyway. (dll_dllcrt0_1): Don't accommodate dynamically loaded dlls. * exceptions.cc (ctrl_c_handler): Don't lock the process; there's too much risk of deadlock. * sigproc.cc (_cygtls::remove_wq): Don't try to remove anything from the waitq if there is obviously nothing there. * strace.cc (strace::activate): Allow stracing dynamically loaded cygwin1.dll.
2011-12-07* exceptions.cc (ctrl_c_handler): Remove _my_tls.remove since it can causeChristopher Faylor
deadlocks during exec and will eventually be handled anyway.
2011-12-04* exceptions.cc (exception::handle): Drop abbreviation for "exception" since IChristopher Faylor
never remember what it stands for. (sig_handle_tty_stop): Remove obsolete call to sig_handle_tty_stop. (_cygtls::call_signal_handler): Rework to grab signal information from _main_tls if none is set for _my_tls. Try harder to keep thread locked. (reset_signal_arrived): Delete. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use new cygWFMO call to wait for an event + standard cygwin stuff. Modify debug output to acccomodate new function. * fhandler_console.cc (fhandler_console::read): Replace WaitForMultipleObjects with cygWFMO. * fhandler_socket.cc (get_inet_addr): Add comment. * gendef (_sigdelayed): Remove call to reset_signal_arrived. * sigproc.cc (_cygtls::signal_exit): Don't close my_readsig here unless we're in the signal thread. (create_signal_arrived): Create signal_arrived as auto-reset so that only one thread is woken when a signal arrives. * sigproc.h (cygWFMO): New function. (reset_signal_arrived): Delete declaration.
2011-11-26* exceptions.cc (stackdump): Make global.Christopher Faylor
(signal_exit): Move to sigproc.cc. * sigproc.cc (signal_exit): Move here. Declare stackdump extern. Set my_sendsig to indicate that signals are no longer available. (my_readsig): Make Static again. (sig_send): Interpret ERROR_BROKEN_PIPE as ESRCH. Remove special-case EACCESS errno setting, just setting errno generally, even for "its_me" case.
2011-11-26* exceptions.cc (sigpacket::process): Move signal_exit processing into...Christopher Faylor
(_cygtls::signal_exit): ...here. Close my_readsig and comment on why. * pinfo.cc (pinfo::exit): Move sigproc_terminate earlier. Set exiting flag in lock_process. * sigproc.cc (my_readsig): Make global. * sync.cc (muto::exiting_thread): Delete. (muto::acquire): Delete #if 0'ed code. * sync.h (muto::exiting_thread): Delete. (set_exiting_thread): Ditto. (lock_process::lock_process): Don't worry about setting the exiting thread since it had no meaning.
2011-11-14Throughout use "have_execed" macro rather than "hExeced" global handle.Christopher Faylor
Throughout rename _PROC_* to _CH_*. * child_info.h: Include "pinfo.h". (child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with similarly named constants. (_PROC_*): Delete unneeded aliases. (PROC_*): Ditto. (CURR_CHILD_INFO_MAGIC): Ditto. (cchildren): Define using "pinfo_minimal". (child_info::set_saw_ctrl_c): Move to (child_info_spawn::set_saw_ctrl_c): Here. (child_info_spawn::lock): New field. (child_info_spawn::hExeced): Ditto. (child_info_spawn::ev): Ditto. (child_info_spawn::~child_info_spawn): Move to sigproc.cc. (child_info_spawn::child_info_spawn): Ditto. (child_info_spawn::cleanup): Declare new function. (child_info_spawn::set_saw_ctrl_c): Move to this class. Set flag only when execed and return true when we have set the flag. (child_info_spawn::child_info_spawn::signal_myself_exited): New function. (child_info_spawn::wait_for_myself): Ditto. (child_info_spawn::has_execed_cygwin): Ditto. (child_info_spawn::has_execed): Ditto. Replaces "hExeced" test. (child_info_spawn::operator HANDLE&): New operator. (child_info_spawn::worker): Define old "spawn_guts" as class member. (ch_spawn): Declare. (have_execed): Define. (have_execed_cygwin): Ditto. * cygheap.h: Update comment. * dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums. (child_info_spawn::handle_spawn): Ditto. (dll_crt0_0): Ditto. (multiple_cygwin_problem): Ditto. * exceptions.cc (chExeced): Delete obsolete declaration. (ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global. * globals.cc (hExeced): Delete. * pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for consistency in handle naming when -DDEBUGGING. (pinfo::init): Accommodate case where myself.h is known but h0 is passed in. (pinfo::pinfo): New constructor for setting up a pinfo passed in by previous exec'or. (pinfo::proc_waiter): Don't handle subprocess if we're in the process of exiting due to an exec of a cygwin process. Don't close rd_proc_pipe here. Close it when we actually are finished with the process. Use new ch_spawn.signal_myself_exited function to let exec stub know that subprocess has exited. (pinfo::wait): Clarify debugging output. (pinfo::release): Use "close_h" to close all handles to avoid races. (winpids::add): Assume that elements of the array do not need to be zeroed and are properly initialized or suffer problems on pinfo::release. Don't close hProcess since release does that now. * pinfo.h: Update comment. (pinfo_minimal): Move some elements from pinfo here so that child_info_spawn can use them. (pinfo): Inherit from pinfo_minimal. (pinfo::pinfo): Modify to accommodate new pinfo_minimal. (pinfo::allow_remove): New function. * sigproc.cc (proc_subproc): Use boolean values for true/false. Implement PROC_EXEC_CLEANUP. (proc_terminate): Set ppid = 1 since the procs list will only be iterated when the process has not execed. Don't do any cleanup here since it is now handled in pinfo::release. (sigproc_init): Initialize sync_proc_subproc earlier. (child_info::child_info): Assume that all important fields are properly initialized and avoid memset(). (child_info_spawn::child_info_spawn): Specifically test for execing and then set up appropriate fields in the struct. (child_info_spawn::cleanup): Define new function. (child_info_spawn::record_children): Specifically test for being execed here. Fill in pinfo_minimal part of children array. (child_info_spawn::reattach_children): Use constructor to duplicate information for previous exec'or. Add more debugging output. (remove_proc): Force deletion of thread when exiting due to exec. Rely on pinfo::cleanup in release. * sigproc.h (PROC_EXEC_CLEANUP): New enum. (PROC_DETACHED_CHILD): Delete. * spawn.cc (chExeced): Delete. (child_info_spawn::worker): Rename from spawn_guts. Use elements of child_info_spawn throughout rather than ch.whatever. Use ::cygheap to refer to global rather than element of child_info. Use wait_for_myself() rather than waitpid(). Call child_info_spawn::cleanup on function return. (spawnve): Reflect movement of spawn_guts functionality into child_info_spawn::worker. * syscalls.cc (popen): Ditto. * winsup.h (spawn_guts): Delete declaration.
2011-10-28* exceptions.cc (sigpacket::process): Avoid a potential deadlock when exitingChristopher Faylor
due to a signal.
2011-08-03* cygtls.h (struct _local_storage): Add cw_timer member.Yaakov Selkowitz
* cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer. (_cygtls::fixup_after_fork): Ditto. * tlsoffsets.h: Regenerate. * ntdll.h (enum _TIMER_INFORMATION_CLASS): Define. (struct _TIMER_BASIC_INFORMATION): Define. (NtQueryTimer): Declare function. * thread.h (cancelable_wait): Change timeout argument to PLARGE_INTEGER and provide NULL default. (fast_mutex::lock): Adjust accordingly. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER and default to NULL. * thread.cc (cancelable_wait): Change timeout argument to PLARGE_INTEGER. Initialize _cygtls.locals.cw_timer if needed. Use NT waitable timers for handling timeout. Return remaining time to timeout argument if timeout was relative. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER. Adjust to change in cancelable_wait. (pthread_mutex::lock): Adjust to change in cancelable_wait. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER. Adjust to changes in cancelable_wait and pthread_cond::wait. (pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait. (pthread_cond_wait): Ditto. (semaphore::_timedwait): Adjust to change in cancelable_wait. (semaphore::_wait): Ditto. * exceptions.cc (handle_sigsuspend): Ditto. * signal.cc (nanosleep): Ditto. * wait.cc (wait4): Ditto. Fix copyright dates. * times.cc (FACTOR, NSPERSEC): Move from here... * hires.h (FACTOR, NSPERSEC): ...to here.
2011-07-13* setup_handler (setup_handler): Change break to goto out, missed in 2011-07-06Christopher Faylor
changes.
2011-07-06* exceptions.cc (_cygtls::interrupt_now): Back out previous change since itChristopher Faylor
could theoretically cause a non-CTRL-C-able program if a program has suffered memory corruption. (setup_handler): Ditto.
2011-07-06* exceptions.cc (_cygtls::interrupt_now): Don't check for spinning here.Christopher Faylor
(setup_handler): Check for spinning here, assuming that it is transitory and should not affect the retry loop.
2011-07-06* exceptions.cc (CALL_HANDLER_RETRY_INNER): Rename to reflect differentChristopher Faylor
functionality. (CALL_HANDLER_RETRY_OUTER): New define. (setup_handler): Add outer loop to signal handler to try harder to deliver the signal. * miscfuncs.cc (yield): Drop priority and use SleepEx() to force thread rescheduling rather than relying on SwitchToThread().
2011-06-06whitespace eliminationChristopher Faylor
2011-06-01* exceptions.cc (ctrl_c_handler): Simplify test for no parent tty.Christopher Faylor
* fhandler_console.cc (fhandler_console::get_tty_stuff): Return NULL if ctty is not tty/console. Improve test for slave tty/pty device.
2011-05-28* autoload.cc: Call _api_fatal in asm.Christopher Faylor
* child_info.h: Redefine CURR_CHILD_INFO_MAGIC. (child_info_fork::abort): Rename from handle_failure. Change arguments. * cygtls.h (_local_storage::ttybuf): New field. * dcrt0.cc (vapi_fatal): Split api_fatal. Add "in forked process" to message when appropriate. (api_fatal): Use vapi_fatal. * devices.h: Make multiple inclusion safe. (fh_devices): Add FH_CONS* stuff. Reorder slightly. (device): Eliminate anonymous union. Add more ways to access minor/major. (device::setunit): Accommodate no-longer-anonymous union. (device::is_fs): Ditto. (device::is_fs_special): Ditto. (device::major): New function. (device::minor): Ditto. (device::is_device): New function. (device::not_device): Ditto. (device::operator int): New operator. (device::operator fh_devices): Ditto. (device::operator bool): Ditto. (device::operator DWORD): Ditto. (device::operator =): Ditto. (isproc_dev): New function. (isprocsys_dev): Ditto. (iscons_dev): Ditto. (istty_slave_dev): Ditto. * devices.in: Add new "/dev/cons*" strings. Accommodate no-longer-anonymous union throughout. (BRACK): Use more precise method for initialization. * devices.cc: Regenerate. * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty. (dtable::find_archetype): Use new DWORD operator in device to test archetypes. (dtable::init_std_file_from_handle): Use different method to initialize 'dev'. Adapt to different ctty handling and accommodate /dev/cons*. (fh_alloc): Accommodate no-longer-anonymous union. Adapt to new /dev/cons*. (build_fh_pc): Make debugging output more useful. * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty. * external.cc (fillout_pinfo): Accommodate new cons* stuff. * fhandler.cc (fhandler_base::read): Eliminate is_slow() test. * fhandler.h (fhandler_base::*): Adapt to changes in device.h. (fhandler_*::is_slow): Delete. ( fhandler_proc::get_proc_fhandler): Return fh_devices type. * fhandler_console.cc (open_shared_console): New function. (console_unit): New class. (console_unit::console_unit): New constructor. (enum_windows): New function. Declare as friend to console_unit. (fhandler_console::set_unit): New function. (fhandler_console::get_tty_stuff): Call set_unit to set the unit number and determine if initialization is needed. Eliminate flags parameter. (tty_list::get_cttyp): Rename (sorta) from get_tty. Return pointer to correct tty_min. (fhandler_console::open): Adapt to elimination of argument to get_tty_stuff. (fhandler_console::output_tcsetattr): Properly detect error condition. (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff() setting tc automatically. * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using fh_devices enum. (fhandler_proc::get_proc_fhandler): Return fh_devices. Adapt to devices.h changes. * fhandler_process.cc: Adapt to devices.h changes. Use FH_BAD rather than 0 throughout where using fh_devices enum. * fhandler_procnet.cc: Ditto. * fhandler_procsys.cc: Ditto. * fhandler_procsysvipc.cc: Ditto. * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto. * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname() rather than assuming that we can construct a tty. * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just return get_minor() of dev. (fhandler_pty_master::process_slave_output): Add slightly more debugging info. (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to unit. (fhandler_pty_master::open): Ditto. (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to represent a complete device. (fhandler_tty_master::init_console): Add debugging for failure path. (fhandler_pty_master::setup): Use get_unit() to retrieve unit number rather than relying on raw ntty. (fhandler_pty_master::setup): Ditto. * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices. * fork.cc: Remove obsolete vfork stuff. (frok::child): Don't assume that a ctty == 0 is valid. * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct changes. (mount_info::conv_to_win32_path): Ditto. * path.cc (path_conv::check): Retrive major/minor numbers via a method rather than accessing them directly from device. Rely on dev operators to set/retrieve device information as required by device struct change. * path.h (isproc_dev): Move to devices.h. (isprocsys_dev): Ditto. (isvirtual_dev): Ditto. (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}): Use device methods to access/manipulate devices. * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid. Use iscons_dev to determine if a device is a console. (_pinfo::_ctty): Use device::parse to generate tty/cons name. (_pinfo::set_ctty): Don't assume that ctty == 0 is valid. Remove redundant info from debugging. * shared.cc (offsets): Remove console offset. * shared_info.h (shared_locations): Ditto. * syscalls.cc (umask): Use device methods to manipulate device information. (ctermid): Use device::parse to generate term device name. * tlsoffsets.h: Regenerate. * tty.cc (ttyslot): Return minor number of ctty since ctty now represents a full device. (tty::create_master): Set ctty to a complete device. (tty_list::attach): Rework to detect new /dev/cons* stuff. (tty_list::terminate): Adapt to changes to ctty. (tty_list::init): Adapt to change to setntty - pass in device major number. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Define new function. * tty.h (tty_min::ntty): Redefine as fh_devices. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Declare new function. (tty::getntty): Declare as const. (tty_list::operator []): Assure that only minor part of argument is used. * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early issuing an explicit error message if necessary. * heap.cc (heap_init): Adapt to changes from fork->handle_failure to fork->abort. * pinfo.h (EXITCODE_FORK_FAILED): New enum. (from Ryan Johnson) * sigproc.cc (child_info_fork::abort): Rename from handle_failure. Change arguments to allow passing in a printf-like message. * winsup.h (api_fatal): Delete macro definition. (api_fatal): Redefine from __api_fatal. (vapi_fatal): Declare new function. * include/sys/strace.h (strace_vprintf): Define new macro. * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2011-04-17* cygheap.h (init_cygheap::ctty): Use base class so that console can join inChristopher Faylor
the fun. * dtable.cc (dtable::stdio_init): Remove special-case call to set_console_ctty (). * exceptions.cc (sigpacket::process): Conditionally flush terminal input on certain signals. * fhandler.h (fhandler_console::get_tty_stuff): Make non-static. (fhandler_termios::get_ttyp): Move here. (fhandler_termios::sigflush): Declare. (fhandler_tty_common::get_ttyp): Delete. * fhandler_console.cc (fhandler_console::get_tty_stuff): Pass this as "arch" argument. (set_console_ctty): Delete. (tty_list::get_tty): Just return pointer to shared console region, delaying get_tty_stuff until open(). (fhandler_console::init): Treat NULL handle as signifying that console should be opened with O_NOCTTY flag. Rename handle argument to the more common 'h'. * fhandler_termios.cc (fhandler_termios::sigflush): Define. * fhandler_tty.cc (handler_tty_master::init_console): Pass NULL as first argument to fhandler_console::init. * pinfo.cc (_pinfo::set_ctty): Change third parameter to fhandler_termios *. Add extra debugging. * pinfo.h (_pinfo::set_ctty): Change third parameter to fhandler_termios *. * sigproc.cc (handle_sigsuspend): Don't special-case non-main threads.
2010-10-24* exceptions.cc (try_to_debug): Improve comment.Christopher Faylor
* fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Add a comment.
2010-08-28 * autoload.cc (LoadDLLprime): Change dllname storage to string16.Corinna Vinschen
(struct dll_info): Convert name to WCHAR. (std_dll_init): Load DLLs with full path to windows system directory. Add hint to Microsoft security advisory. * dcrt0.cc (init_windows_system_directory): New function. (dll_crt0_0): Call init_windows_system_directory first. * exceptions.cc (windows_system_directory): Move to globals.cc. (windows_system_directory_length): Ditto. (events_init): Drop code fetching windows_system_directory. * globals.cc (windows_system_directory): New global variable. (windows_system_directory_length): Ditto. * net.cc (load_ipv6_funcs): Use windows_system_directory rather than GetSystemDirectoryW. * netdb.cc (open_system_file): Ditto. Simplify debug output.
2010-08-18 * exceptions.cc (open_stackdumpfile): Don't try to open file if weCorinna Vinschen
have no filesystem based CWD. Add comment. * path.cc (cwdstuff::set): Set CWD handle to NULL if CWD is a virtual path. Simplify matching comment.
2010-08-01* exceptions.cc (_cygtls::interrupt_now): Revert to checking for "spinning"Christopher Faylor
when choosing to defer signal. (_cygtls::call_signal_handler): Grab func when we have the lock. * gendef: Update copyright. (__sigbe): Simplify slightly. (_sigdelayed): Grab a lock before manipulating stuff. (_cygtls::pop): Properly return popped value. (stabilize_sig_stack): Set incyg when we have the lock. * sigproc.cc: Update copyright.