Commit Graph

8143 Commits

Author SHA1 Message Date
Corinna Vinschen cc01c77f7e * autoload.cc (GetNamedPipeClientProcessId): Define.
* fhandler.h (fhandler_tty_slave::fch_open_handles): Declare private.
	(fhandler_tty_slave::fch_close_handles): Ditto.
	(fhandler_tty_slave::cygserver_attach_tty): Drop declaration.
	(fhandler_tty_slave::fstat): Declare public.
	(fhandler_tty_slave::fchmod): Declare public.
	(fhandler_tty_slave::fchown): Declare public.
	(class fhandler_pty_master): Add master_ctl handle.
	(fhandler_pty_master::pty_master_thread): Declare public.
	* fhandler_termios.cc (fhandler_termios::tcinit): If the process
	is started from a non-Cygwin process, make it tty process group
	leader.
	* fhandler_tty.cc: Throughout accommodate additional security related
	arguments in calls to functions creating or opening objects.
	(close_maybe): Move to start of file to reuse it
	in other methods.
	(struct pipe_request): Define.
	(struct pipe_reply): Define.
	(fhandler_tty_slave::open): Throughout, try to open synchronization
	objects with MAXIMUM_ALLOWED permissions.  Drop call to cygserver.
	Try to duplicate pipe handles via master_ctl pipe if duplicating
	directly doesn't work.
	(fhandler_tty_slave::cygserver_attach_tty): Remove.
	(fhandler_tty_slave::init): Close unused incoming pipe handle.
	(fhandler_pty_master::close): Send exit message to master control
	thread and close master_ctl handle.
	(fhandler_pty_master::pty_master_thread): New method, implementing the
	master control thread.
	(pty_master_thread): Static helper to start master control thread.
	(fhandler_pty_master::setup): Simplify creating pipe inheritance.
	Make sure we're the one creating the input_available_event.  Add
	comment to explain why.  Create master_ctl pipe and start master
	control thread.  Close master_ctl handle in case of error.
	* security.cc (alloc_sd): Add code to handle tty objects.  Add comments
	to explain what exactly is required.
	(get_object_sd): New function.
	(get_object_attribute): New function.
	(create_object_sd_from_attribute): New function.
	(set_object_sd): New function.
	(set_object_attribute): New function.
	(set_file_attribute): Change attribute type to mode_t.
	* security.h (set_file_attribute): Change attribute type to mode_t.
	(get_object_sd): Declare.
	(get_object_attribute): Declare.
	(create_object_sd_from_attribute): Declare.
	(set_object_sd): Declare.
	(set_object_attribute): Declare.
	* tty.cc (tty::slave_alive): Implement directly instead of via alive.
	(tty::exists): Open mutex handle with READ_CONTROL access.
	(tty::alive): Remove.
	(tty::open_output_mutex): Convert to inline method.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): Take additional ACCESS_MASK parameter for the
	mutex open access mask.
	(tty::open_inuse): New method.
	(tty::create_inuse): Take PSECURITY_ATTRIBUTES parameter.  Drop fmt
	name parameter.  Always create TTY_SLAVE_ALIVE event.
	(tty::get_event): Take additional PSECURITY_ATTRIBUTES parameter for
	CreateEvent.
	* tty.h (class tty): Change declarations according to aforementioned
	changes.
	(tty::open_output_mutex): Implement as inline method.
	(tty::open_input_mutex): Ditto.
2010-04-19 19:52:43 +00:00
Corinna Vinschen 02a33ea774 * dtable.cc (dtable::init_std_file_from_handle): Set dev to
valid content for ptys.  Remove setting FILE_CREATE_PIPE_INSTANCE
	in access flags since it's not needed.  Set the access mask for
	kernel objects according to what's returned by NtQueryInformationFile,
	info class FileAccessInformation.
2010-04-19 16:25:11 +00:00
Corinna Vinschen bc8a5a9f66 * syscalls.cc (rename): On STATUS_ACCESS_VIOLATION, retry to open
for DELETE until the STATUS_ACCESS_VIOLATION goes away.  Add comment
	to explain why.
2010-04-19 08:09:51 +00:00
Corinna Vinschen b5efa8990f * sec_helper.cc (get_null_sd): Make static. Use PSECURITY_DESCRIPTOR
instead of SECURITY_DESCRIPTOR *.
	(sec_acl): Fix fomratting.
	* security.h (get_null_sd): Drop declaration.
2010-04-17 15:51:09 +00:00
Corinna Vinschen 7cdcd90ca1 * cygerrno.h (seterrno_from_nt_status): Declare.
(__seterrno_from_nt_status): Call seterrno_from_nt_status.
	* errno.cc (seterrno_from_win_error): Set errno without calling
	set_errno to avoid packing strace output with errno messages.
	(seterrno_from_nt_status): New function to print NT status as well as
	resulting Windows error.
2010-04-16 15:42:29 +00:00
Corinna Vinschen 6b0f100a6d * kernel32.cc (CreateEventW): Create event object with EVENT_ALL_ACCESS
access mask.
	(CreateMutexW): Create mutex object with MUTEX_ALL_ACCESS access mask.
	(CreateSemaphoreW): Create semaphore object with SEMAPHORE_ALL_ACCESS
	access mask.
2010-04-15 17:20:59 +00:00
Corinna Vinschen b873ce0686 * sec_helper.cc (set_cygwin_privileges): Enable SE_DEBUG_PRIVILEGE, if
available.  Add comments.
2010-04-15 17:17:59 +00:00
Corinna Vinschen 0ef4bb7c50 * fhandler_socket.cc (get_inet_addr): Only test the file for being a
socket after opening it.  Retry if opening failed with sharing
	violation.  Explain why we do this.
	(fhandler_socket::bind): Create file with no sharing allowed.
2010-04-13 19:56:30 +00:00
Corinna Vinschen 2bba259eb7 * cygheap.cc (cwcsdup): Fix allocation size to accommodate sizeof WCHAR.
(cwcsdup1): Ditto.
2010-04-13 10:01:34 +00:00
Corinna Vinschen 098f9c6e48 * include/cygwin/version.h: Bump DLL minor version number to 5. 2010-04-12 17:01:01 +00:00
Corinna Vinschen 6b1c332f28 * posix.sgml (std-notes): Improve lseek description. 2010-04-12 15:36:48 +00:00
Corinna Vinschen 42e9cefd71 * fhandler_tty.cc (fhandler_tty_slave::open): Add code to duplicate
handles within a single process to simplify openpty case.
	(fhandler_tty_slave::cygserver_attach_tty): Correctly send Windows PID
	to cygserver, rather than the Cygwin PID.
2010-04-12 13:28:06 +00:00
Christopher Faylor 7092cadf76 * cygwin.dsl: Remove comments. 2010-04-11 22:15:59 +00:00
Corinna Vinschen 5e64c96949 * new-features.sgml (ov-new1.7.5): New section. 2010-04-11 19:38:35 +00:00
Corinna Vinschen 0250709234 * fhandler.h (class dev_console): Add backspace_keycode member.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Initialize
	backspace_keycode with CERASE.
	(fhandler_console::read): Return dev_state->backspace_keycode if the
	backspace key is pressed.
	(fhandler_console::char_command): Implement DECBKM escape sequence.
2010-04-11 19:11:17 +00:00
Christopher Faylor e4f6022e52 * cygwin-api.in.sgml: Update to DocBook SGML 4.5 DTD.
* cygwin-ug-net.in.sgml: Ditto.
* cygwin-ug.in.sgml: Ditto.
* faq-sections.xml: Ditto.
* faq.xml: Ditto.
2010-04-11 17:43:28 +00:00
Christopher Faylor 1d6adee8ed * fhandler_console.cc (fhandler_console::read): Default to sending CERASE
character if termios VERASE field is zero.
(fhandler_console::fixup_after_fork_exec): Avoid a spurious debug message.
2010-04-10 18:05:52 +00:00
Christopher Faylor 3481527cc6 update copyright 2010-04-10 05:47:54 +00:00
Christopher Faylor 89a903b879 * mkvers.sh: Use modern date formats to construct the date. 2010-04-10 05:46:45 +00:00
Corinna Vinschen 1691abe75e * nlsfuncs.cc (__set_lc_time_from_win): Actually set
_time_locale->md_order to the D_MD_ORDER value written to the buffer.
2010-04-09 21:20:21 +00:00
Christopher Faylor 412f3e61d4 * path.cc (path_conv::set_normalized_path): Use crealloc_abort to avoid a
memory leak.
* path.h (path_conv::operator =): Just use cstrdup to allocate normalized_path,
avoiding attempt to free a pointer which is allocated in another pc.
2010-04-09 16:51:08 +00:00
Corinna Vinschen f8fbd1ea58 * include/cygwin/version.h: Bump DLL minor version number to 4. 2010-04-07 08:55:38 +00:00
Corinna Vinschen 385b0add19 * thread.cc (valid_sched_parameters): Declare extern here.
(sched_set_thread_priority): Ditto.
2010-04-06 15:27:34 +00:00
Corinna Vinschen 249ccad30c * include/sched.h: Remove, overruled by newlib file.
* include/sys/sched.h: Ditto.
2010-04-06 15:16:24 +00:00
Christopher Faylor 35297ebe0b * fhandler_fifo.cc (fhandler_fifo::open): Accommodate previous return value
change to setup_overlapped.
2010-04-06 15:09:44 +00:00
Christopher Faylor 1908518227 * fhandler.h (fhandler_base::has_ongoing_io): Declare virtual method.
* select.cc (peek_pipe): Reorganize slightly.  Don't attempt to check a handle
if it has ongoing I/O.
(select_pipe_info::select_pipe_info): Delete definition.
(select_pipe_info::~select_pipe_info): Delete definition.
(thread_pipe): Get rid of WFMO call.  Reorganize loop.
(pipe_cleanup): Remove dependence on destructor.
(thread_serial): Reorganize loop.
* select.h (select_pipe_info): Empty this class since it no longer has any
special requirements (for now).
* syscalls.cc (readv): Remove an unneeded debug printf.
2010-04-02 22:36:44 +00:00
Christopher Faylor 5151c80c8a * fhandler.h (fhandler_base::setup_overlapped): Delete virtual declaration.
(fhandler_base::destroy_overlapped): Ditto.
(fhandler_base_overlapped): Remove now-unneeded friend.
(fhandler_base_overlapped::setup_overlapped): Return int, remove parameter.
(fhandler_base_overlapped::get_overlapped): Return reference.
(fhandler_base_overlapped::fhandler_base_overlapped): Be more assertive about
zeroing everything.
(fhandler_base_overlapped::fixup_after_fork): Declare new function.
(fhandler_base_overlapped::fixup_after_exec): Ditto.
(fhandler_base_overlapped::dup): Ditto.
(fhandler_base_overlapped::close): Ditto.
* fhandler_fifo.cc (fhandler_fifo::dup): Call fhandler_base_overlapped::dup
rather than fhandler_base::dup.
* pipe.cc (fhandler_pipe::dup): Ditto.
(fhandler_pipe::init): Accommodate change in setup_overlapped arguments for
"opened_properly" case.
2010-04-02 18:55:02 +00:00
Christopher Faylor 60efdd0c4c * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Properly initialize
overlapped part of this class.
2010-04-02 16:43:27 +00:00
Corinna Vinschen 7c972c6354 * fhandler_tty.cc (fhandler_tty_slave::close): Revert previous change. 2010-04-02 16:16:53 +00:00
Christopher Faylor baa671ea26 fix typo 2010-04-02 16:01:58 +00:00
Christopher Faylor dffe690c84 * select.h (select_pipe_info::add_watch_handle): Delete declaration.
* select.cc (select_pipe_info::add_watch_handle): Delete deinition.
(fhandler_pipe::select_read): Delete call to add_watch_handle.
(fhandler_pipe::select_write): Ditto.
(fhandler_pipe::select_except): Ditto.
2010-04-02 15:50:54 +00:00
Christopher Faylor 1ae0a7c5a6 * dtable.cc (dtable::init_std_file_from_handle): Avoid adding fh to fdtab until
we know that it is good.
* fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Handle error
conditions more consistently.  Avoid handle leakage on error.
2010-04-02 15:41:27 +00:00
Corinna Vinschen ed32dd8946 * fhandler_tty.cc (fhandler_tty_slave::close): Avoid potential crash
if former open call has been unsuccessful.
2010-04-02 14:11:45 +00:00
Corinna Vinschen ce3124dc19 * nlsfuncs.cc: Fix indentation. 2010-04-01 20:30:07 +00:00
Corinna Vinschen 57f7ebe1f2 * nlsfuncs.cc (rebase_locale_buf): New helper function to rebase
function pointers in locale structures.  Explain why this is necessary.
	(__set_lc_time_from_win): Use rebase_locale_buf after realloc.
	(__set_lc_numeric_from_win): Ditto.
	(__set_lc_monetary_from_win): Ditto.
2010-04-01 20:13:22 +00:00
Charles Wilson 7e53fcbc29 * setup-net.sgml: Remove more mentions of rxvt. 2010-04-01 05:23:07 +00:00
Christopher Faylor 3d8a6b6236 * cygwinenv.sgml: Remove/deprecate mention of rxvt.
* effectively.sgml: Ditto.
* faq-using.xml: Ditto.
* setup-net.sgml: Ditto.
2010-03-31 21:06:43 +00:00
Christopher Faylor bc3f0d64c9 * sigproc.cc (wait_sig): Make sure that strace is activated on __SIGSTRACE by
calling new strace::activate function.
* strace.cc (strace::activate): Rename from strace::strace.
* strace.h (strace::activate): Define new function.
(strace::strace): Call activate.
2010-03-31 18:06:02 +00:00
Christopher Faylor e446d6d0f4 * fhandler.h (fhandler_base_overlapped): Temporarily (?) make select_pipe_info
a friend until the fhandler_tty intertangling can be worked out.
* select.cc (select_pipe_info::add_watch_handle): Don't inspect the overlapped
event if we're not waiting for I/O.
(fhandler_tty_common::select_*): Change to standard function.  Don't do kludgy
fhandler_pipe coercion.
2010-03-31 15:00:48 +00:00
Christopher Faylor b791ec4a2c Add missing fhandler.h patch and ChangeLog comment. 2010-03-31 04:39:13 +00:00
Christopher Faylor 2aeef06579 * fhandler.cc (fhandler_base::dup): Call setup_overlapped unconditionally.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::fixup_after_fork): Ditto.
(fhandler_base::fixup_after_exec): Ditto.
(fhandler_base_overlapped::setup_overlapped): Move to this class from
fhandler_base.
(handler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::wait_overlapped): Ditto.  Track when we expect
pending I/O.
(fhandler_base_overlapped::read_overlapped): Move to this class from
fhandler_base.  Return error if ongoing I/O.
(fhandler_base_overlapped::write_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Semi-reinstate previous function.
* fhandler.h (fhandler_base::wait_overlapped): Move to fhandler_base_overlapped
class.
(fhandler_base::write_overlapped): Ditto.
(fhandler_base::get_overlapped): Ditto.
(fhandler_base::get_overlapped_buffer): Ditto.
(fhandler_base_overlapped): New class.
(fhandler_pipe): Inherit from fhandler_base_overlapped.  Remove overlapped
stuff as a result.
(fhandler_fifo): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Initialize fhandler_base_overlapped.
(pipe): Put a descriptive name in the fhandler.
2010-03-31 04:26:11 +00:00
Corinna Vinschen d8b4cbe896 * fhandler_socket.cc (fhandler_socket::wait_for_events): Remove call to
sig_dispatch_pending.
2010-03-30 16:20:15 +00:00
Corinna Vinschen ca8eb333c9 2010-03-30 Thomas Wolff <towo@towo.net>
* fhandler.h (class dev_console): Drop vt100_graphics_mode_active.
	Add flags vt100_graphics_mode_G0, vt100_graphics_mode_G1 and
	iso_2022_G1.
	* fhandler_console.cc: Throughout, tune VT100 graphics mode switching
	to follow ISO 2022 strictly.
2010-03-30 16:17:34 +00:00
Corinna Vinschen 298cf05c21 * syscalls.cc (open): Remove call to sig_dispatch_pending. 2010-03-30 14:36:42 +00:00
Corinna Vinschen 83dddecb34 * net.cc: Remove calls to sig_dispatch_pending throughout.
* libc/rexec.cc: Ditto.
2010-03-30 09:25:46 +00:00
Corinna Vinschen e23275a8ac * mount.cc (fs_info::update): Allow variable FILE_SUPPORTS_SPARSE_FILES
flag in netapp flag test.  Add comment.
2010-03-30 08:55:23 +00:00
Corinna Vinschen b3cbb06c9d * spawn.cc (find_exec): Enable finding paths in backslash notation,
especially for the exec[vl]p functions.

	* path.cc (symlink_info::check): Disable returning directories with
	suffix appended here.
2010-03-29 17:15:51 +00:00
Corinna Vinschen 3f4a0c963a * new-features.sgml (ov-new1.7.3): New section. 2010-03-29 15:10:09 +00:00
Corinna Vinschen ef7fc14537 * include/cygwin/version.h: Bump DLL minor version number to 3. 2010-03-29 15:06:09 +00:00
Corinna Vinschen ce3d89938b * fhandler.cc (fhandler_base::fstat): Keep st_ctime and st_birthtime
fixed to 2006-12-01 00:00 UTC.
2010-03-29 15:02:50 +00:00