Commit Graph

6106 Commits

Author SHA1 Message Date
Christopher Faylor ad48b1b79c change wording 2013-05-08 00:10:35 +00:00
Christopher Faylor eeec3bebbc * fhandler_tty.cc (fhandler_pty_common::__acquire_output_mutex): Never wait an
INFINITE amount of time.  Instead default to 1/10 second.
(fhandler_pty_slave::open): Just default to INFINITE wait rather than
(now) waiting longer than previously.
2013-05-08 00:10:08 +00:00
Christopher Faylor ebba7327e1 * spawn.cc (ILLEGAL_SIG_FUNC_PTR): New define.
(system_call_handle): Rename from system_call_cleanup.
(is_system_call): New convenience method.
(system_call_handle::system_call_handle): Use ILLEGAL_SIG_FUNC_PTR rather than
cast.  Call sig_send here rather than in caller.  Initialize oldint.
(system_call_handle::arm): New function pulled from constructor.
(~system_call_handle::system_call_handle): Use is_system_call().
(child_info_spawn::worker): Use system_call_handle to set up for system call
early.  Use arm call prior to waiting for child to properly set up signal
handling.  Move comment closer to code it is commenting on.
2013-05-03 19:39:01 +00:00
Christopher Faylor 0cfce9acc9 * resource.cc (setrlimit): Use consistent commenting style. Return EINVAL when
rlim_cur > rlim_max.
2013-05-01 21:19:51 +00:00
Yaakov Selkowitz 1f36328e7f Throughout, (mainly in fhandler*) fix remaining gcc 4.7 mismatch
warnings between regparm definitions and declarations.
* smallprint.cc (__small_vswprintf): Conditionalize declaration and
setting of l_opt for only x86_64.
* spawn.cc (child_info_spawn::worker): Remove unused 'pid' variable.
* thread.cc (verifyable_object_isvalid): Temporarily define as
non-inline with gcc 4.7+, regardless of target.
2013-05-01 01:20:37 +00:00
Christopher Faylor 92f63de367 * gendef: Fix sigfe.s typo. 2013-05-01 01:15:07 +00:00
Christopher Faylor 3cb9da1461 * spawn.cc (system_call_cleanup): Rename from pthread_cleanup. Extend
functionality.
(system_call_cleanup::system_call_cleanup): Set up signals like system()
requires.  Unblock previously-blocked signal handling.
(system_call_cleanup::~system_call_cleanup): Restore signal handling after
system().
(child_info_spawn::worker): Put signals on hold and use system_call_cleanup
class to set and restore signals rather than doing it prior to to running the
program.  Remove the ill-conceived pthread_cleanup stuff.
2013-04-30 23:51:08 +00:00
Christopher Faylor cc5bdf003f * exceptions.cc (cygwin_exception::dumpstack): Guard against wild pointer
dereference.
(CYG_EXC_CONTINUE_EXECUTION): Define based on standard Windows definition.
(CYG_EXC_CONTINUE_SEARCH): Ditto.
(exception::handle): Move andreas detection earlier.  Make comment clearer.
(signal_exit): Set core-dumped flag.
2013-04-30 23:47:01 +00:00
Christopher Faylor 9379e877da Sigh. Another missing checkin. 2013-04-30 23:44:06 +00:00
Christopher Faylor bfebe413bd * i686.din: New file.
* x86_64.din: New file.
* common.din: New file.
* cygwin.din: Delete.
* cygwin64.din: Delete.
* gendef: Rework to take options rather than using positional parameters.
Accept multiple files as input.
2013-04-30 23:43:08 +00:00
Christopher Faylor f821269534 * autoload.cc (CreateSymbolicLinkW): Rename from CreateSymbolicLink. 2013-04-30 00:52:46 +00:00
Corinna Vinschen 151f737ab0 * fcntl.cc (fcntl): Define as export alias for fcntl64 on x86_64. 2013-04-26 18:20:17 +00:00
Corinna Vinschen 79b4d1beb0 Fix date in latest ChangeLog entry 2013-04-24 16:06:55 +00:00
Corinna Vinschen 9ecd475cd8 * autoload.cc (CreateSymbolicLink): Define.
* environ.cc (set_winsymlinks): Set allow_winsymlinks.
	(parse_thing): Change "winsymlinks" to set by function.
	* globals.cc (enum winsym_t): Define.
	(allow_winsymlinks): Define as winsym_t.
	(ro_u_afs): New R/O Unicode string.
	* mount.cc (fs_info::update): Fix comment.  Handle AFS.
	(fs_names): Add "afs".
	* mount.h (enum fs_info_type): Add afs.
	(class fs_info): Implement afs.
	* path.cc (symlink): Drop third parameter in call to symlink_worker.
	(symlink_nfs): New function.
	(symlink_native): New function.
	(symlink_worker): Drop third argument.  Handle native symlink type by
	calling symlink_native.  Move code to handle NFS to symlink_nfs.  Fix
	formatting.  Slightly restructure code.
	* path.h (class path_conv): Add fs_is_afs method.
	(symlink_worker): Declare here.
	* security.h: Define privilege constants as unsigned int instead of as
	unsigned long.
	* syscalls.cc (mknod_worker): Set third parameter in symlink_worker
	call to WSYM_lnk.
	* winsup.h (symlink_worker): Drop declaration here.
2013-04-24 10:16:13 +00:00
Corinna Vinschen 629b2a7e19 * cygwin64.din (_setjmp): Export.
(_longjmp): Export.
2013-04-23 10:03:39 +00:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Corinna Vinschen 40702aef2c * include/sys/queue.h: Delete in favor of more complete newlib file. 2013-04-22 10:35:02 +00:00
Corinna Vinschen a1467f6434 Adapt to changes in newlib's sys/cdefs.h:
* include/sys/sysinfo.h (struct sysinfo): Rename __unused member to __f.
	* libc/fts.c (__FBSDID): Drop definition.
	* regex/regexec.c (__unused): Drop definition.
2013-04-22 10:33:09 +00:00
Corinna Vinschen fc1ff1150c * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 19. 2013-04-22 10:13:30 +00:00
Corinna Vinschen 48f81ac677 * glob.cc: Include winsup.h before anything else. 2013-04-16 10:20:25 +00:00
Corinna Vinschen 492ee4ee4b * path.cc (symlink_info::check): Drop PC_KEEP_HANDLE flag for
unrecognized reparse points as well.  Reorganize code and comments
	handling reparse points for better readability.
2013-04-12 08:30:47 +00:00
Corinna Vinschen 8f81761b69 * hires.h (hires_ns::nsecs): Declare with bool parameter.
* times.cc (hires_ns::nsecs): Take bool parameter.  If set to true,
	don't use prime value (== return system wide absolute value).
2013-04-11 19:49:58 +00:00
Christopher Faylor b49dae4a44 fix YA typo 2013-04-09 01:23:41 +00:00
Christopher Faylor 9d2155089e * cygtls.h (_cygtls::reset_signal_arrived): Actually reset the signal_arrived
event.
(_cygtls::handle_SIGCONT): Declare ew function.
* cygwait.cc (is_cw_sig_handle): Delete.
(is_cw_sig_cont): New convenience define.
(cygwait): Clear signal if is_cw_sig_cont and we got a SIGCONT.
* cygwait.h (cw_wait_mask): Add cw_sig_cont.
* exceptions.cc (sig_handle_tty_stop): Tighten "incyg" region.  Use cw_sig_cont
param for cygwait.  Don't zero signal here outside of lock.
(sigpacket::setup_handler): Don't check for in_forkee since we will now never
get here in that state.
(_cygtls::handle_SIGCONT): Define new function.
(sigpacket::process): Call handle_SIGCONT early to deal with SIGCONT.  Nuke
continue_now handling.  Allow SIGKILL to kill a suspended process.  Delete a
couple of now-unneeded labels.
(_cygtls::call_signal_handler): Reorganize setting of incyg within lock.
* sigproc.cc (pending_signals): Simplify.
(pending_signals::clear): New method.
(_cygtls::remove_wq): Reorganize to always close wq.thread_ev if it exists to
avoid handle leaks.
(sig_clear): Simplify by just calling sigq.clear().
(sig_dispatch_pending): Always call sigq.pending even in signal thread to force
another loop in wait_sig.
(sig_send): Remove a "goto out" just before out: label.
(pending_signals::add): Simplify.
(pending_signals::del): Delete.
(pending_signals::next): Delete.
(wait_sig): Define variable q to be the start of the signal queue.  Just
iterate through sigq queue, deleting processed or zeroed signals.  Only set
clearwait when the current signal is SIGCHLD.
* sigproc.h: Add a comment about an unused enum.
2013-04-09 01:01:19 +00:00
Christopher Faylor 037ad80a52 fix typo 2013-04-08 17:55:57 +00:00
Corinna Vinschen 2617a91597 * fhandler_socket.cc (get_inet_addr): Handle abstract AF_LOCAL socket.
(fhandler_socket::recv_internal): Create abstract socket name for
	AF_LOCAL datagram sockets.  Explain why we do that.
2013-04-08 17:34:34 +00:00
Christopher Faylor f653639a22 * cygheap.cc (init_cygheap::find_tls): Add a comment.
* dcrt0.cc (parent_sigmask): Delete.
(dll_crt0_1): Use spawn_info->moreinfo->sigmask rather than saved parent signal
mask.
* thread.cc (pthread::thread_init_wrapper): Add comment stressing the
importance of maintaining ordering of statements.
2013-04-07 23:53:00 +00:00
Corinna Vinschen 9158bb1128 * mmap.cc (is_mmapped_region): Call LIST_UNLOCK on premature return. 2013-04-05 20:25:39 +00:00
Corinna Vinschen 7810aa7cdb * fhandler_proc.cc (format_proc_loadavg): Raise too small buffer size
to avoid overwriting unrelated cygheap memory.
2013-04-03 19:54:58 +00:00
Corinna Vinschen d1bef83800 * path.cc (class suffix_scan): Add member namelen.
(suffix_scan::name_len): New method.
	(suffix_scan::has): Store namelen since we have it already anyway.
	Add a bit of explanation and a FIXME to comment.
	(suffix_scan::next): Never attach extra .lnk suffix if resulting
	filename length exceeds NAME_LEN.
	(symlink_info::check): Bail out immediately with ENAMETOOLONG if
	filename length exceeds NAME_LEN.
2013-04-03 11:20:36 +00:00
Christopher Faylor 8f8eeb70ba * child_info.h (cygheap_exec_info::sigmask): Declare new field.
* cygheap.cc (init_cygheap::find_tls): Rename threadlist_ix -> ix.  Only take
one pass through thread list, looking for eligible threads to signal.  Set a
new param indicating that function has found a sigwait* mask.
* cygheap.h (init_cygheap::find_tls): Reflect new parameter.
* dcrt0.cc (parent_sigmask): New variable.
(child_info_spawn::handle_spawn): Save parent's signal mask here.
(dll_crt0_1): Restore parent's signal mask to tls sigmask as appropriate.  Call
sig_dispatch_pending to flush signal queue when we can finally do something
with signals.
* exceptions.cc (sigpacket::process): Avoid attempting to handle signals if we
haven't finished initializing.  Rely on the fact that find_tls will do mask
checking and don't do it again.  Delete ill-named 'dummy' variable.
* sigproc.cc (cygheap_exec_info::alloc): Save calling thread's signal mask in
new sigmask field.
(wait_sig): Try to debug when WFSO fails and DEBUGGING is defined.
* thread.cc (pthread::set_tls_self_pointer): Make this a true automatic method
rather than inexplicably relying on a thread parameter.
(pthread::thread_init_wrapper): Accommodate set_tls_self_pointer change to
non-static.  Initialize sigmask before setting tid or suffer signal races.
* ehread.h (pthread::set_tls_self_pointer): Make non-static, delete parameter.
2013-03-31 12:35:44 +00:00
Corinna Vinschen 4aa4632ad2 * cygthread.cc (cygthread::terminate_thread): Only try to free
thread stack on systems not freeing it by themselves.
	* wincap.h (wincaps::terminate_thread_frees_stack): New element.
	* wincap.cc: Implement above element throughout.
2013-03-29 17:00:36 +00:00
Christopher Faylor bb93b7ab95 * pinfo.h (pinfo::status_exit): Rename from former static function in pinfo.cc.
(pinfo::operator == (char *)): Remove unused operator.
* pinfo.cc (pinfo::status_exit): Move this function info pinfo class.  Use
progname from the pinfo rather than myself.  Be defensive when inspecting
procinfo.
2013-03-29 16:19:11 +00:00
Christopher Faylor 6fcb223858 * sigproc.cc (wait_sig): Avoid uninitialized use of nb when retrying.
Consolidate two error messages into one.
2013-03-29 13:18:25 +00:00
Christopher Faylor 5e31c80e4e * sigproc.cc (pending_signals::retry): Declare new element.
(pending_signals::pending): Force an additional loop through wait_sig by
setting retry whenever this function is called.
(sig_send): Reorganize to wait for SIGHOLD at bottom.  Always add signal to
pending queue and work on whole queue rather than just the one signal.  Loop
when sigq.retry is set.  Fix long-broken check for SIGCHLD after queued
signals.
2013-03-29 01:22:14 +00:00
Christopher Faylor 1a863e04b3 * exceptions.cc (exception::handle): Generalize comment. 2013-03-28 16:14:53 +00:00
Christopher Faylor 56bc657ce4 * cygtls.h (_cygtls::signal_debugger): Change argument type.
(_cygtls::copy_context): Delete declaration.
* exceptions.cc (exception::handle): Don't call copy_context() here.  Move
signal_handler call earlier and always call it.
(_cygtls::copy_context): Delete definition.
(_cygtls::signal_debugger): Move copy_context logic here.  Suspend thread
receiving signal before gathering context information.
2013-03-09 21:55:18 +00:00
Christopher Faylor 6a375e0325 * spawn.cc (child_info_spawn::worker): Save and restore my_wr_proc_pipe around
non-execing operations to avoid handle leak seen in
http://cygwin.com/ml/cygwin/2013-03/msg00152.html .
2013-03-09 00:11:31 +00:00
Corinna Vinschen 8981489bec * include/sys/un.h (UNIX_PATH_MAX): Rename from UNIX_PATH_LEN to
follow Linux.
	* fhandler_socket.cc: Change UNIX_PATH_LEN to UNIX_PATH_MAX throughout.
	(fhandler_socket::recv_internal): Don't return prematurely in case of
	successful return.  For AF_LOCAL sockets, overwrite returned AF_INET
	name with AF_LOCAL name.
2013-03-07 15:39:35 +00:00
Corinna Vinschen b5545a7b7e * fhandler_socket.cc (fhandler_socket::bind): Fix check for AF_LOCAL
filename length to allow non-NUL terminated strings within namelen
	bytes.  Copy over sun_path to local array sun_path to have a
	NUL-terminated string for subsequent function calls.  Move path_conv
	check before OS bind call to not bind the socket before being sure
	the file doesn't exist.  Add and fix comments.
2013-03-07 11:04:28 +00:00
Corinna Vinschen bd142b93ae * mount.cc (fs_names): Add trailing NULL element to avoid potential
SEGV in format_proc_filesystems.
2013-03-06 14:10:23 +00:00
Christopher Faylor f77f82bba5 fix latest changelog description 2013-03-01 15:55:39 +00:00
Christopher Faylor aad4a3c932 * exceptions.cc (exception::handle): Eliminate buggy recursed value and just
check if we're exiting.
2013-03-01 15:48:14 +00:00
Corinna Vinschen 1ef8ce71a8 * include/pthread.h (pthread_atfork): Add missing declaration. 2013-02-26 10:32:36 +00:00
Yaakov Selkowitz 7b3739f2ae * include/error.h (error_message_count): Declare as dllimport.
(error_one_per_line): Ditto.
(error_print_progname): Ditto.
2013-02-21 03:15:47 +00:00
Corinna Vinschen 064e3a9115 * child_info.h (CURR_CHILD_INFO_MAGIC): Update.
(class child_info_fork): Drop extraneous semicolon.
2013-02-08 20:15:05 +00:00
Corinna Vinschen cf4acdbc1f * fhandler_socket.cc (fhandler_socket::bind): Fix error code for
empty filename.
2013-02-04 12:21:56 +00:00
Corinna Vinschen 188fc1cf6e * fhandler_socket.cc (fhandler_socket::bind): Fix length check of
AF_LOCAL filename so it never accesses memory beyond namelen.  Also
	make sure filename is NUL-terminated.
2013-02-04 12:04:20 +00:00
Christopher Faylor 118e51be1d * DevNotes: Add entry cgf-000022.
* cygtls.h (_cygtls::func): Define as a sa_sigaction style function.
* exceptions.cc (sig_handle_tty_stop): Ditto.
(_cygtls::interrupt_setup): Fix coercion to accommodate 'func' change.
(ctrl_c_handler): Use tty kill_pgrp to send a signal.
(sigpacket::process): Don't process sigflush here.
(_cygtls::call_signal_handler): Reorganize to avoid a race.  Always call
sa_sigaction style function.
* fhandler_termios.cc (is_flush_sig): Define new function.
(tty_min::kill_pgrp): Handle tty flush when signal detected.
(fhandler_termios::bg_check): Be slightly more paranoid about checking for
valid tty.
(fhandler_termios::sigflush): Don't flush unless tty owner.
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Use tty kill_pgrp to send
signal.
(fhandler_pty_master::ioctl): Ditto.
* signal.cc (killsys): Delete definition.
* sigproc.h (killsys): Delete declaration.
* include/cygwin/signal.h (siginfo_t): Simplify union/struct nesting slightly.
Implement mechanism to allow cygwin data passing.
2013-01-31 05:26:47 +00:00
Christopher Faylor a69e27906f * miscfuncs.cc (__import_address): Check if malloc field points directly at
'malloc'.
2013-01-23 14:24:34 +00:00