Commit Graph

5840 Commits

Author SHA1 Message Date
Corinna Vinschen 32c02f191b * thread.cc (__cygwin_lock_lock): Replace null thread check with test
for cygwin_finished_initializing to handle process startup.
	(__cygwin_lock_trylock): Ditto.
	(__cygwin_lock_unlock): Ditto.
2012-05-24 14:17:51 +00:00
Corinna Vinschen 9cbf10a06e * thread.cc (__cygwin_lock_lock): Take null thread at process startup
into account.
	(__cygwin_lock_trylock): Ditto.
	(__cygwin_lock_unlock): Ditto.
2012-05-23 19:49:39 +00:00
Corinna Vinschen 2b165a453e * thread.cc (pthread::cancel): Re-allow asynchronous cancellation from
Cygwin code since it looks like the problem is Windows only.
2012-05-23 17:39:39 +00:00
Corinna Vinschen bff08077a6 * thread.cc: Add a temporary workaround to help Cygwin along while
newlib doesn't install cleanup handlers.  Explain the problem.
	(class __cygwin_lock_handler): New class.
	(__cygwin_lock_cleanup): New function.
	(__cygwin_lock_lock): Push __cygwin_lock_cleanup thread cleanup
	handler.
	(__cygwin_lock_trylock): Ditto.
	(__cygwin_lock_unlock): Pop thread cleanup handler.
	(pthread::pop_cleanup_handler): Temporarily allow cleanup function to
	destroy cleanup handler so we can pop in another function than we
	pushed in.
2012-05-23 16:26:34 +00:00
Corinna Vinschen 86b35406f2 * thread.cc (pthread::cancel): Only allow asynchronous cancellation
if the thread is not executing Cygwin or Windows code.  Explain why.
2012-05-23 13:30:26 +00:00
Corinna Vinschen 750329ae90 * thread.cc (pthread::precreate): Make sure mutex is recursive.
Explain why.
2012-05-23 13:24:57 +00:00
Corinna Vinschen dacf4be3fa * thread.cc (pthread::pop_cleanup_handler): Move setting the cancelstate
to PTHREAD_CANCEL_DISABLE from here...
	(pthread::pop_all_cleanup_handlers): ...to here, otherwise any explicit
	call to pthread_cleanup_pop disables cancellation for this thread.
2012-05-23 13:18:34 +00:00
Corinna Vinschen 2ca9ed527e * fhandler.h (refcnt): Add i interlocked. Explain why.
* winbase.h (ilockadd): New function.
	(InterlockedAdd): Define as ilockadd.
2012-05-23 13:13:56 +00:00
Corinna Vinschen 73447abbb6 * devices.in: Fix native name of /dev/kmem.
* devices.cc: Regenerate.
	* dtable.cc (fh_alloc): Don't forget FH_KMEM.
	* fhandler_mem.cc (fhandler_dev_mem::open): Set errno to EACCES rather
	than ENOENT on systems not granting access to physical memory from
	user space.
2012-05-22 17:37:40 +00:00
Corinna Vinschen 6014310903 * thread.cc (pthread::cancel): Set thread's cancel_event in
PTHREAD_CANCEL_ASYNCHRONOUS case, too.  Explain why.
2012-05-22 10:28:05 +00:00
Corinna Vinschen 08d7e0c909 * strace.cc (strace::activate): Move printing heap size from here...
* heap.cc (heap_init_info): ...to here.  Explain why.  Print heap
	size in hex and decimal.
2012-05-21 19:45:12 +00:00
Corinna Vinschen 6cb222edce * net.cc (cygwin_recvfrom): Don't shortcircuit if len == 0. Add comment
to explain why.
	(cygwin_recv): Ditto.
	(cygwin_recvmsg): Ditto.
2012-05-21 14:56:02 +00:00
Corinna Vinschen ece05938f2 * fhandler_disk_file.cc (path_conv::isgood_inode): Rearrange, take
Samba versions >= 3.5.4 into account, add comments.
2012-05-21 12:00:09 +00:00
Christopher Faylor fe66a97ae4 * DevNotes: Add entry cgf-000009.
* smallprint.cc (__small_vsprintf): Always treat '%c' and '%C' as characters.
Don't decode them if they are > 127.
(__small_vswprintf): Ditto.
2012-05-17 02:18:41 +00:00
Christopher Faylor bd8afa5eb1 * DevNotes: Add entry cgf-000008.
* fhandler_tty.cc (bytes_available): Simplify by returning the number of bytes
available in the message unless that is zero.
2012-05-16 01:56:41 +00:00
Christopher Faylor 8f55341ea1 * child_info.h (CURR_CHILD_INFO_MAGIC): Update. 2012-05-14 23:29:03 +00:00
Christopher Faylor 3de7be4c1d * DevNotes: Add entry cgf-000007.
* child_info.h (child_info_spawn::parent_winpid): Declare new field.
(child_info_spawn::get_parent_handle): Declare new function.
* dcrt0.cc (child_info_spawn::get_parent_handle): Define new function.
(child_info_spawn::handle_spawn): Recreate parent handle if possible when
dynamically loaded.  Don't mess with parent handle if it's NULL.
* spawn.cc (child_info_spawn::worker): Set parent_winpid appropriately.
2012-05-14 22:42:56 +00:00
Christopher Faylor 1f99484812 * DevNotes: Add entry cgf-000006.
* thread.cc (pthread::pop_cleanup_handler): Set cancel state to disabled to
avoid recursively waiting for cancel.
2012-05-12 20:26:43 +00:00
Christopher Faylor 348b56b5a3 * DevNotes: Add entry cgf-000005.
* fhandler.h (PIPE_ADD_PID): Redefine to something we actually DON'T use.
* pipe.cc (fhandler_pipe::create): Avoid clearing all open_mode bits when
checking for PIPE_ADD_PID.  Properly keep track of len so that passed in name
is not overwritten.
2012-05-12 19:17:17 +00:00
Corinna Vinschen 3ebb4f04b5 * cygwin.din (memrchr): Export.
* posix.sgml (std-gnu): Add memrchr.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2012-05-10 08:35:22 +00:00
Corinna Vinschen 3ef81a86fb * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 16. 2012-05-10 06:51:40 +00:00
Christopher Faylor dfd5d5bea6 * DevNotes: Add entry cgf-000004.
* pinfo.cc (pinfo::init): Reuse shared memory if the state is marked with
PID_REAPED.
* spawn.cc (child_info_spawn::worker): Don't duplicate myself_pinfo into
non-cygwin child.
* fork.cc (frok::parent): Improve error output.
2012-05-08 15:06:43 +00:00
Christopher Faylor 06bd0ef2ab * DevNotes: Add entry cgf-000003.
* cygheap.h (init_cygheap::pid_handle): Delete.
* dcrt0.cc (child_info_spawn::handle_spawn): Keep parent open if we have
execed.
* pinfo.cc (pinfo::thisproc): Remove pid_handle manipulations.
(pinfo::init): Don't consider a reaped process to be available.
* spawn.cc (child_info_spawn::worker): Remove pid_handle manipulations.  Make
wr_proc_pipe and parent noninheritable when starting a program which doesn't
use the Cygwin DLL.  Conditionally reset wr_proc_pipe to inheritable if
CreateProcess fails.  Inject wr_proc_pipe handle into non-Cygwin process.
Consider a non-cygwin process to be 'synced'.
2012-05-07 15:05:56 +00:00
Christopher Faylor fb9d631817 * DevNotes: Add entry cgf-000002.
* fhandler_tty.cc (bytes_available): Revert to previous Oct-2011 behavior where
a dummy buffer is used to determine how many bytes will be read.
(fhandler_pty_master::ioctl): Correct coercion in assignment.
2012-05-04 03:00:43 +00:00
Corinna Vinschen 00a76ece10 * net.cc (get_adapters_addresses): Only create thread on affected
systems.  Change comment acordingly.
	* wincap.h (wincaps::has_gaa_largeaddress_bug): New element.
	* wincap.cc: Implement above element throughout.
	(wincap_8): New globale wincaps to support Windows 8.
	(wincapc::init): Take Windows 8 into account.  Set new
	has_gaa_largeaddress_bug member to false on 32 bit systems.
2012-05-03 08:34:44 +00:00
Christopher Faylor 287a26f349 Reflect ChangeNotes -> DevNotes 2012-05-02 20:39:31 +00:00
Christopher Faylor b79c0094f8 * ChangeNotes: New file. Add entry cgf-000001.
* sigproc.cc (proc_terminate): Don't set parent pid of child to 1 if we've
execed since the execed process is still considered the parent.
* child_info.h: Bump copyright.
2012-05-02 16:39:39 +00:00
Corinna Vinschen 6f5a3401aa * fenv.cc (fesetround): Fix test for valid input parameter.
(fesetprec): Ditto.
2012-05-02 07:42:08 +00:00
Christopher Faylor 28c8ae66d5 * fhandler.h (PIPE_ADD_PID): Define new flag.
* pipe.cc (fhandler_pipe::create): Don't indiscriminately add process id to
every pipe since some pipe names (fifo, tty) don't need it.
* sigproc.cc (sigproc_init): Pass PIPE_ADD_PID to fhandler_pipe::create to
ensure that pid is always part of sigwait pipe name.
2012-04-30 15:38:45 +00:00
Christopher Faylor ea17849f8b * environ.cc (struct parse_thing): Add temporary (?) "pipe_byte" option.
* globals.cc (pipe_byte): Declare.
* pipe.cc (fhandler_pipe::create): Use current process id in pipe name rather
than pid for simple name collision avoidance.  Do this only once to avoid extra
overhead when a busy pipe is found.  Honor pipe_byte to create non-message
pipes if set.
* sigproc.cc (sigproc_init): Use a specific name for the signal pipe.
2012-04-28 19:49:58 +00:00
Corinna Vinschen 2d487f2dd6 * path.cc (find_fast_cwd_pointer): Fix for W8 CP 32 bit. 2012-04-27 12:07:15 +00:00
Corinna Vinschen 8ee7527dc2 * fhandler.h (class dev_console): Add member ext_mouse_mode5.
* fhandler_console.cc (fhandler_console::read): Implement extended
	mouse mode 1005 (xterm, mintty).
	Fix actual mouse reporting for large coordinates.
2012-04-25 07:25:00 +00:00
Corinna Vinschen f1ce77295d * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 15. 2012-04-24 16:05:20 +00:00
Corinna Vinschen d581bbfa8e * fhandler_console.cc (ALT_PRESSED): Define earlier, never undefine.
(CTRL_PRESSED): Ditto.
	(fhandler_console::read): Simplify expressions testing for pressed ALT
	or CTRL modifier keys.
	(get_nonascii_key): Ditto.
2012-04-24 14:39:22 +00:00
Corinna Vinschen c9df1b2729 * fhandler.h (class dev_console): Add members ext_mouse_mode6 and
ext_mouse_mode15.
	* fhandler_console.cc (fhandler_console::read): Implement extended
	mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).  Recognize,
	but don't implement extended mouse mode 1005 (xterm, mintty).
	Support mouse coordinates greater than 222 (each axis).  Fix formatting.
	(fhandler_console::char_command): Initialize enhanced mouse reporting
	modes.
2012-04-24 14:29:37 +00:00
Christopher Faylor 8b4bd08220 * dtable.cc (fh_alloc): Only disallow opening of nonexistent on-disk device.
* path.cc (path_conv::check): Remove PATH_KEPT_HANDLE setting.
* path.h (path_types): Remove PATH_KEPT_HANDLE.
(path_conv::kept_handle): Delete now-unneeded function.
2012-04-21 19:52:11 +00:00
Christopher Faylor 080f275bae * dtable.cc (fh_alloc): Keep fh which was flagged as error if it is for an
on-disk device and we were stating it.
* path.cc (path_conv::check): Set PATH_KEPT_HANDLE.
* path.h (path_types): Add PATH_KEPT_HANDLE.
(path_conv::kept_handle): Implement.
2012-04-19 17:21:32 +00:00
Christopher Faylor 55dcba98db * fhandler.h (fhandler_base::nohandle): Revert to standard implementation.
* dtable.cc (dtable::fixup_after_exec): Specifically reject releasing
nohandle() type fhandlers rather than relying on contents of io_handle.
(dtable::fixup_after_fork): Ditto.
* fhandler_termios.cc: Add includes necessary for definitions of have_execed
and have_execed_cygwin.
(fhandler_termios::sigflush): Don't flush console input when we've started a
non-Cygwin process.
2012-04-18 05:57:38 +00:00
Christopher Faylor c1d26a99cd reformat 2012-04-15 17:56:50 +00:00
Christopher Faylor aba77cbe8f wincap.h: Rename assitant to assistant throughout. wincap.cc: Ditto.
* devices.in (exists_console): Use fhandler_console::exists () rather than raw
test.
* devices.cc: Regenerate.
* fhandler.h (fhandler_console::exists): Define new function.
* fhandler_console.cc (fhandler_console::need_invisible): Use
fhandler_console::exists () rather than raw test.
* spawn.cc: Rename assitant to assistant throughout.
(child_info_spawn::worker): Simplify test for when to start a non-Cygwin
process in its own process group.  Just do it whenever we start a non-Cygwin
process.
2012-04-15 17:51:22 +00:00
Christopher Faylor 0a3819e655 clarify latest entry 2012-04-13 05:05:42 +00:00
Christopher Faylor 3bfa9d984b * devices.in (exists_console): Allow /dev/con{sole,in,out} to be referenced
they exist.
* devices.cc: Regenerate.
* fhandler_console.cc (fhandler_console::set_unit): Ditto.
2012-04-13 02:30:51 +00:00
Corinna Vinschen e62d782aec * syscalls.cc (fhandler_base::stat_fixup): Fix inode numbers of
non-device files in virtual fileysystems.
2012-04-11 08:49:52 +00:00
Christopher Faylor e5b7e4d1c7 * dtable.cc (cygwin_attach_handle_to_fd): Defend against NULL return from
build_fh_*.
(dtable::init_std_file_from_handle): Ditto.
* mmap.cc (mmap_record::alloc_fh): Ditto.
* path.cc (path_conv::check): Ditto.
2012-04-07 17:32:44 +00:00
Christopher Faylor 00ceaad134 * fhandler.h (fhandler_base::nohandle): Implement "by hand" rather than through
macro.  Set io_handle to INVALID_HANDLE_VALUE when setting flag to true.
2012-04-06 19:40:58 +00:00
Christopher Faylor 25fdb1ded1 * path.c (path_conv::check): Avoid directly referencing fields of the dev
structure when it can be easily avoided.
2012-04-06 04:40:49 +00:00
Christopher Faylor 7217f94752 Fix a couple of typos. 2012-04-06 04:36:22 +00:00
Corinna Vinschen d422f9e30f * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 14. 2012-04-05 15:26:27 +00:00
Corinna Vinschen b475fe5497 * passwd.cc (pwdgrp::read_passwd): Fix pretty_ls entry tyo contain
the required number of colons.
2012-04-05 10:16:09 +00:00
Christopher Faylor 7b03b0d8ce * fhandler.h (fhandler_pty_common::bytes_available): Declare new function.
(fhandler_pty_master::flush_to_slave): Ditto.
* fhandler_tty.cc (bytes_available): Define new function.
(fhandler_pty_common::bytes_available): Ditto.
(handler_pty_master::flush_to_slave): Ditto.
(fhandler_pty_master::process_slave_output): Call flush_to_slave () here.  Use
bytes_available () rather than PeekNamedPipe.  Cleanup sloppy logic.
(fhandler_pty_slave::read): Use bytes_available () rather than PeekNamedPipe.
(fhandler_pty_slave::ioctl): Ditto.
(fhandler_pty_master::ioctl): Ditto.
(fhandler_pty_master::cleanup): Remove ancient #if 0.
* select.cc (peek_pipe): Call flush_to_slave whenever we're checking for a pty
master.
2012-04-05 02:54:51 +00:00