Commit Graph

6044 Commits

Author SHA1 Message Date
Christopher Faylor d89e61f354 * update-copyright (update_maybe): Accommodate perl-style copyright comments. 2013-01-21 04:30:27 +00:00
Christopher Faylor eb0876b22f * update-copyright: Silently skip nonexistent files. Display filename on
update.  Don't update non-Red Hat copyrights.
2013-01-21 03:55:55 +00:00
Christopher Faylor 0413f0bd40 * update-copyright: Update standard copyright information based on cvs log and
current sandbox status.
2013-01-20 23:56:26 +00:00
Christopher Faylor 4713b1b294 * malloc_wrapper.cc: Change 'use_internal_malloc' to 'use_internal' throughout.
(export_malloc_called): Delete.
(internal_malloc_determined): New variable.
(malloc_init): Control calculation of internal/external malloc based on
'internal_malloc_determined'.  Use import_address() to determine if malloc in
user_data is ours or not.
* miscfuncs.cc (thread_wrapper): Make static.
(__import_address): Define new function.
* miscfuncs.h (import_address): New define.
(__import_address): Declare new function.
2013-01-20 22:59:58 +00:00
Christopher Faylor 1471537a8f * sigproc.cc (sig_dispatch_pending): Add correct regparm attributes to match
declaration.
(pid_exists): Ditto.
(proc_subproc): Ditto.
(sig_clear): Ditto.
(sig_send): Ditto.
(checkstate): Ditto.
2013-01-20 06:34:59 +00:00
Corinna Vinschen a32a9a87a1 * syscalls.cc (rename): Remove ill-conceived NFS workaround from
2013-01-10 for self-inflicted NFS server problem.
2013-01-19 14:54:18 +00:00
Christopher Faylor d5c977948b * exceptions.cc (ctrl_c_handler): Remove special-case handler for
"cygwin_finished_initializing".
* sigproc.cc (exit_thread): Undefine ExitThread earlier to avoid recursion on
error return.
2013-01-19 05:57:06 +00:00
Corinna Vinschen 5d858e49eb * errno.cc (errmap): Map ERROR_LOCK_VIOLATION to EBUSY. 2013-01-18 16:09:51 +00:00
Corinna Vinschen b31aa3904c * mmap.cc (handler_disk_file::msync): Add call to FlushFileBuffers
to implement MS_SYNC.
2013-01-18 09:35:05 +00:00
Christopher Faylor c5eb7a4971 * mmap.cc (handler_disk_file::msync): Retry up to 99 times if FlushViewOFile
fails with ERROR_LOCK_VIOLATION.
2013-01-18 00:28:21 +00:00
Christopher Faylor 211dd84b83 * sigproc.cc (no_signals_available): Finally remove this macro entirely.
(exit_thread): Ensure process lock is released on error exit.
(sig_send): Simplify "its_me" test.  Remove no_signals_available tests.
2013-01-16 23:04:28 +00:00
Christopher Faylor b01065f174 * pthread.cc (pthread_exit): Add kludge to accommodate noreturn attribute. 2013-01-16 19:20:59 +00:00
Christopher Faylor 18905f5551 fix typo 2013-01-14 22:24:36 +00:00
Christopher Faylor b8540dae6c * include/pthread.h (pthread_exit): Mark as "noreturn". 2013-01-14 21:17:37 +00:00
Christopher Faylor b712b4408a * exceptions.cc (signal_exit): Move captive process termintation...
(_cygtls::interrupt_setup): ...into here.
(sigpacket::process): Simplify setting of handler when have_execed.
(_cygtls::interrupt_setup): Don't call proc_subproc when we've execed.
* globals.cc (exit_states): Delete unneeded ES_EXEC_EXIT.
* pinfo.cc (pinfo::exit): Change debugging output.  Call proc_terminate rather
than the now-obsolete sigproc_terminate.  Don't set exit_state to ES_EXEC_EXIT.
Set exit_state to ES_FINAL later.
* sigproc.cc (sigproc_terminate): Delete function.
(wait_sig): Don't call proc_subproc if have_execed.
* sigproc.h (sigproc_terminate): Delete declaration.
* sync.h (lock_process::lock_process): Don't set exit_state to
ES_PROCESS_LOCKED.
(lock_process::operator LONG): Define.
2013-01-14 06:03:59 +00:00
Christopher Faylor 2f47bbd555 * DevNotes: Add entry cgf-000021.
* select.cc (select): Unconditionally return when a signal is detected.
(select_stuff::wait): Ditto.
2013-01-11 15:36:40 +00:00
Corinna Vinschen 7142197465 * syscalls.cc (rename): Drop handling paths > 32757 chars, emit EINVAL
instead, thus simplifying code allocating and filling pfri.  Drop size
	and use constant expression in NtSetInformationFile call.  Add comments.
	Drop redundant test for fs_serial_number and change comment accordingly.
2013-01-11 12:34:41 +00:00
Corinna Vinschen 09707415eb * fhandler.h (class dev_console): Flag for expanded control sequence.
* fhandler_console.cc (char_command): Supporting cursor style modes.
2013-01-11 11:04:50 +00:00
Corinna Vinschen 34ce80888a * path.h (path_conv::fs_type): New method.
* syscalls.cc (rename): Check for cross-device situation before
	touching anything.  Explain why.  Workaround NFS bug in call to
	NtSetInformationFile(FileRenameInformation).
2013-01-10 15:08:22 +00:00
Corinna Vinschen 2b814a1937 * cygerrno.h: Fix copyright.
* exceptions.cc: Drop comment explaining removed variable.
2013-01-09 16:25:15 +00:00
Corinna Vinschen 85d8e389cd * dcrt0.cc (main_thread_sinit): New inline function. Fix and explain
a stdio initialization issue.
	(dll_crt0_1): Call main_thread_sinit rather than __sinit.
2013-01-09 14:23:44 +00:00
Christopher Faylor 98f16610ca * thread.cc (pthread_rwlock::lookup_reader): Remove parameter: always assume
that we're looking for the current thread.
(pthread_rwlock::tryrdlock): Eliminate self variable.  Accommodate change in
lookup_reader().
(pthread_rwlock::unlock): Ditto.
(pthread_rwlock::rdlock): Ditto.  Move add_reader call after writer tests to
more closely mimic old behavior.
(pthread_rwlock::wrlock): Accommodate change in lookup_reader().
* thread.h ((pthread_rwlock::lookup_reader): Eliminate argument.
2013-01-07 19:34:44 +00:00
Christopher Faylor 8f3f61eb96 * thread.cc (pthread_rwlock::add_reader): Perform new operation here and return
pointer to allocated RWLOCK_READER structure.
(pthread_rwlock::rdlock): Reorganize to reflect new add_reader functionality.
(pthread_rwlock::tryrdlock): Ditto.  Remove unneeded call to lookup_reader().
* thread.h (pthread_rwlock::RWLOCK_READER::RWLOCK_READER): New constructor.
(pthread_rwlock::add_reader): Reflect new functionality.
2013-01-07 16:01:10 +00:00
Christopher Faylor 0fd830efdf * globals.cc (exit_states): Renumber so that ES_EXIT_STARTING is first, as
intended.
* sigproc.cc (wait_sig): Only stop accepting signals after exit_state >
ES_EXIT_STARTING.
2013-01-04 02:21:03 +00:00
Christopher Faylor fba91299d7 * sigproc.cc (exit_thread): Set thread signal mask so that no signals are sent
to an exiting thread.
2013-01-03 05:05:10 +00:00
Christopher Faylor d8e0d0a1b9 * sigproc.cc (no_signals_available): Remove exit_state test since signals are
available in a limited fashion when exiting.
(sig_dispatch_pending): Ditto.
(sig_send): Ditto.
(exit_thread): Rearrange to avoid an unnecessary DuplicateProcess when exiting.
(wait_sig): Allow special signals when exiting.
2013-01-03 03:33:18 +00:00
Christopher Faylor 36e97781ee * DevNotes: Add entry cgf-000020, relating to previous checkin. 2013-01-02 18:46:55 +00:00
Christopher Faylor ca77b848e7 * cygtls.h (_cygtls::signal_exit): Delete from class.
* exception.h (cygwin_exception): New class.
(cygwin_exception::dumpstack): Declare new function.
(cygwin_exception::context): Ditto.
(cygwin_exception::dump_exception): Ditto.
* exceptions.cc (cygwin_exception::dump_exception): Move into cygwin_exception
class.  Accommodate new variable names.
(cygwin_exception::dumpstack): Ditto stackdump -> dumpstack.
(exception::handle): Move andreas processing earlier.  Defer signal processing
decisions to the signal thread where they belong.  Pass exception information
to sig_send via new siginfo_t si_cyg field.
(ctrl_c_handler): Wait for SIGHUP signal to be processed since it could cause a
process exit and we don't want races with thread exit lock.
(signal_exit): Move back here from sigproc.cc.  Modify arguments and remove
from sigpacket class.  Decide when to dump core based on signal type.
(sigpacket::process): Handle exiting signals in context of threads rather than
in the signal thread.  Signal debugger on non-Windows signals.  Remove
setup_signal_exit call.
* sigproc.cc (no_signals_available): Remove argument.
(signal_exit_code): Delete.
(close_my_readsig): Ditto.
(_cygtls::signal_exit): Move to exceptions.cc.
(sigproc_terminate): Don't attempt to terminate signal thread.
(setup_signal_exit): Delete.
(exit_thread): Use new si_cyg entry in siginfo_t.
(sig_send): Just use empty initializer for si.  Accommodate change in
no_signals_available argument.
(wait_sig): Remove attempt to "go asynchronous" on process exit.  Delete
__SIGEXIT handling.  Don't ever exit.
* sigproc.h: Remove __SIGEXIT from signal enum.  Renumber.
* include/cygwin/signal.h (siginfo_t): Add si_cyg entry.
2013-01-02 18:34:06 +00:00
Christopher Faylor d6aec4e025 * sigproc.cc (wait_sig): Remove spurious extern. 2012-12-31 19:07:03 +00:00
Christopher Faylor f6187d46b1 * dtable.cc (dtable::dup3): Fix bounds checking for valid newfd.
* syscalls.cc (dup2): Ditto.
* winsup.h (events_terminate): Delete obsolete function declaration.
2012-12-31 18:31:49 +00:00
Christopher Faylor 871d0724fa * DevNotes: Add entry cgf-000019.
* dcrt0.cc (do_exit): Just set exit_state to ES_EVENTS_TERMINATE and nuke call
to events_terminate which just set a superfluous flag.
* sigproc.cc (signal_exit_code): New variable.
(setup_signal_exit): Define new function.
(_cygtls::signal_exit): Remove accommodations for closing the signal pipe
handle.
(exit_thread): Just sleep if we're exiting.
(wait_sig): If signal_exit_code is set, just handle bookkeeping signals and
exit ReadFile loop if there is nothing more to process.  Call signal_exit at
end if signal_exit_code is non-zero.
* sigproc.h (setup_signal_exit): Declare new function.
* exceptions.cc (sigpacket::process): Use setup_signal_exit to control exiting
due to a signal.
(exception::handle): Ditto.  Query exit_state rather than defunct exit_already
to determine if we are exiting.
* globals.cc (ES_SIGNAL_EXIT): New enum.
* sync.h (lock_process::release): New function for explicitly unlocking muto.
(lock_process::~lock_process): Use release method.
2012-12-28 18:06:17 +00:00
Christopher Faylor 81f1868336 * fork.cc (child_info::prefork): Fix error message formatting. 2012-12-27 17:25:17 +00:00
Christopher Faylor dbadcc4372 Fix tid comment. 2012-12-22 23:37:33 +00:00
Christopher Faylor 4a84997ae4 * select.h (select_stuff): Remove variable names from parameter declarations.
(select_info): Ditto.
(select_record::dump_select_record): Declare new debugging-only function.
(select_info): Zero all fields.
(select_pipe_info): Ditto.
(select_socket_info): Ditto.
(select_serial_info): Ditto.
(select_mailslot_info): Ditto.
* select.cc (select_record::dump_select_record): Define new debugging-only
function.
(select_stuff::test_and_set): Call dump_select_record when debugging.
* thread.cc (pthread_mutex::unlock): Revert setting of tid to NULL since, in
this context, it is a number, not a pointer.
(pthread_spinlock::unlock): Ditto.
2012-12-22 19:35:41 +00:00
Christopher Faylor d3a03427bc * sigproc.cc (exit_thread): undef ExitThread or suffer recursion. Attempt to
lock process prior to calling sig_send.
2012-12-22 03:14:37 +00:00
Christopher Faylor c3a4634985 Revert the reversion and go with implementation described in cgf-000017, with
some modifications.
* init.cc (dll_entry): Revert previous change.
* miscfuncs.cc: Include sigproc.h for exit_thread declaration.
* winsup.h (ExitThread): Define as 'exit_thread' to ensure no accidental use.
* sigproc.cc (exit_thread): New function.
(wait_sig): Handle __SIGTHREADEXIT case.  Don't just block rather than
returning from this function.
* sigproc.h (__SIGTHREADEXIT): New enum.
(exit_thread): Declare.
* sync.cc (muto::release): Accept a tls command-line argument.
* sync.h (muto::release): Accept a tls command-line parameter.  Default to
&_my_tls.
* cygerrno.h (__set_errno): Define as extern so that no function code is ever
emitted.
* cygserver_ipc.h (cygserver_ipc.h): Ditto.
* miscfuncs.h (transform_chars): Ditto.
* path.h (has_attribute): Ditto.
* security.h (privilege_luid): Ditto.
* winsup.h (flush_file_buffers): Ditto.
2012-12-21 21:30:56 +00:00
Christopher Faylor 65068ebd7f * DevNotes: Add entry cgf-000018.
* init.cc (dll_entry): Grab process lock before exiting to ensure that thread
doesn't exit before parent if parent is exiting.
* _cygtls.cc (_cygtls::call2): Revert previous 2012-12-21 change.
* miscfuncs.cc (thread_wrapper): Ditto.
* thread.cc (pthread::exit): Ditto.
* sigproc.cc (exit_thread): Ditto.
(wait_sig): Ditto.
* sync.cc (muto::release): Ditto.
* sync.h (muto::release): Ditto.
* sigproc.h (__SIGTHREADEXIT): Delete enum.
(exit_thread): Delete declaration.
2012-12-21 19:32:43 +00:00
Christopher Faylor 614aff88a0 * DevNotes: Add entry cgf-000017.
* _cygtls.cc (_cygtls::call2): Use new exit_thread function in place of
ExitThread.
* miscfuncs.cc (thread_wrapper): Ditto.
* thread.cc (pthread::exit): Ditto.
(pthread_mutex::unlock): Set tid to NULL rather than 0.
(pthread_spinlock::unlock): Ditto.
* pinfo.cc (commune_process): Actually call lock_process constructor.
* sigproc.cc (exit_thread): New function.
(wait_sig): Handle __SIGTHREADEXIT case.  Don't just block rather than
returning from this function.
* sigproc.h (__SIGTHREADEXIT): New enum.
(exit_thread): Declare.
* sync.cc (muto::release): Accept a tls command-line argument.
* sync.h (muto::release): Accept a tls command-line parameter.  Default to
&_my_tls.
2012-12-21 18:52:00 +00:00
Corinna Vinschen 45edfcd2ab * dcrt0.cc (build_argv): Allow quoted filenames in @ expression. 2012-12-20 13:39:34 +00:00
Christopher Faylor 6dadfa5644 * select.h (select_stuff::select_stuff): Make default constructor always zero
everything while constructor with int arg just zeroes next.
* select.cc (select_stuff::test_and_set): Revert to using default constructor.
2012-12-19 21:15:54 +00:00
Christopher Faylor 63d9f29311 * select.cc (select_stuff::wait): Add windows error number to error message. 2012-12-19 18:44:40 +00:00
Christopher Faylor 4effb32b81 * select.cc (select_stuff::test_and_set): Remove workaround and use proper
constructor.
2012-12-18 17:32:45 +00:00
Christopher Faylor 9574be60a7 * select.cc (select_stuff::test_and_set): Work around problem of new() not
returning zeroed memory.
2012-12-18 16:41:38 +00:00
Corinna Vinschen 05297cca5f * fhandler.cc (fhandler_base::write): Don't attempt to sparsify
an already sparse file.  Drop check for FILE_SUPPORTS_SPARSE_FILES
	flag.  Explicitely set FILE_ATTRIBUTE_SPARSE_FILE attribute in
	cached attributes.
	(fhandler_base::lseek): Only set did_lseek if sparseness is supported.
	* fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Don't attempt
	to sparsify an already sparse file.  Explicitely set
	FILE_ATTRIBUTE_SPARSE_FILE attribute in cached attributes.
	* mount.cc (oopt): Add "sparse" flag.
	(fillout_mntent): Ditto.
	* path.h (enum path_types): Add PATH_SPARSE.
	(path_conv::support_sparse): New method.
	(path_conv::fs_flags): Constify.
	(path_conv::fs_name_len): Ditto.
	include/sys/mount.h: Replace unused MOUNT_MIXED flag with MOUNT_SPARSE.
2012-12-14 10:45:29 +00:00
Christopher Faylor 8cabc308a2 * sigproc.h (sig_send): Accept tid as argument #3. Default to NULL.
* sigproc.cc (sig_send): Ditto.  Pass tid to other sig_send.
(sigpending): Send current thread as arg #3.
2012-12-10 22:13:26 +00:00
Christopher Faylor ff8ba3cabe * exceptions.cc (sigpacket::process): Reorganize to avoid use of tls before
initialization.
* fhandler_fifo.cc (fhandler_fifo::arm): Avoid improper printing of integer as
a string in debug output.
2012-12-07 20:59:44 +00:00
Christopher Faylor 0d1a50b81a * sigproc.h (sigpacket): Remove parameter names from declarations.
(sigpacket::sigtls): Rename from 'tls'.
* exceptions.cc (sigpacket::process): Define local tls variable and assign that
to sigtls if appropriate.  Clarify debugging output.
* sigproc.cc (sig_send): Accommodate tls -> sigtls rename.
(pending_signals::add): Ditto.
(wait_sig): Ditto.
2012-12-07 17:37:33 +00:00
Christopher Faylor 9873ac53d7 * cygtls.h (_cygtls::get_signal_arrived): Add parameter to make lock/unlock
conditional.
* exceptions.cc (_cygtls::interrupt_setup): Don't get a lock when setting
signal_arrived since we already have one.
* gendef: Add some comments to make it easier to find functions.
2012-12-07 17:23:22 +00:00
Yaakov Selkowitz 0ba7e5d36b * include/cygwin/wait.h (WAIT_ANY): Define.
(WAIT_MYPGRP): Define.
2012-12-06 08:32:58 +00:00
Corinna Vinschen 497826e97a * child_info.h (class child_info_spawn): Drop unused member lock.
(CURR_CHILD_INFO_MAGIC): Update.
	* sigproc.cc (child_info_spawn::child_info_spawn): Drop setting lock.
2012-12-05 10:37:17 +00:00