Commit Graph

4733 Commits

Author SHA1 Message Date
Corinna Vinschen beeae48288 * fhandler_console.cc (read): Detect and handle mouse wheel scrolling
events (for completion of mouse reporting mode 1000) and mouse
	movement events (for additional mouse reporting modes 1002 and 1003).
	Use mouse_aware() as a guard and only condition for mouse
	reporting in order to enforce consistence of read() and select().
	Add focus reports (for additional focus reporting mode 1004).
	(mouse_aware): Enable detection of additional mouse events for select().
	Tune function to precisely match actual reporting criteria.
	Move adjustment of mouse position (by window scroll offset)
	here to avoid duplicate code.
	(char_command): Initialization of enhanced mouse reporting modes.
	Initialization of focus reporting mode.
	* fhandler.h (use_mouse): Change flag (bool->int) to indicate
	additional mouse modes. Add flag to indicate focus reporting.
	(mouse_aware): Move enhanced function into fhandler_console.cc.
	* select.cc (peek_console): Use modified mouse_aware() for more
	general detection of mouse events. Also check for focus reports.
2009-12-16 14:56:10 +00:00
Corinna Vinschen d1600b38c0 * registry.cc (cygnus_class): Remove.
(reg_key::build_reg): Don't set class when creating key.
2009-12-16 13:09:46 +00:00
Corinna Vinschen 2f5d8f7bd0 * net.cc (cygwin_setsockopt): Only skip calling setsockopt(SO_REUSEADDR)
on stream sockets under systems supporting enhanced socket security.
2009-12-15 17:08:20 +00:00
Corinna Vinschen f04f6d49fa * fhandler_console.cc (char_command): Fix code to select dim mode
to 2 rather than 9.  Add entries for mode 22 (normal, not bold)
	28 (visible, not invisible), 25 (not blinking).
2009-12-15 12:46:40 +00:00
Corinna Vinschen 5d5594597e * libc/getopt.c (getopt_internal): Set optreset according to optind
setting earlier.  Reevaluate POSIXLY_CORRECT if optreset is set to !0.
	Handle a leading '-' in options independently of posixly_correct.
2009-12-14 10:47:25 +00:00
Christopher Faylor d0f9de23a1 * fhandler_fifo.cc (fhandler_fifo::open): Avoid resetting errno after it has
been explicitly set.
* include/cygwin/version.h: Bump DLL minor version number to 2.
2009-12-09 16:52:43 +00:00
Corinna Vinschen 6d67afbe9c * include/cygwin/version.h: Bump DLL minor version number to 1. 2009-12-06 12:24:34 +00:00
Corinna Vinschen 2bc3381e5c * fhandler_socket.cc (send_internal): Don't split datagram messages
into pieces.

	* syslog.cc (vsyslog): Set default facility to LOG_USER if it hasn't
	been set yet.
2009-12-02 15:23:03 +00:00
Corinna Vinschen b4a3a3e367 * fhandler_registry.cc (fhandler_registry::open): Mark /proc/registry
directory and siblings as nohandle fhandler.
2009-12-01 16:31:04 +00:00
Christopher Faylor c84fd8fe23 * speclib: Use last dll found since that's the real name of the cygwin DLL. 2009-11-30 15:40:23 +00:00
Corinna Vinschen 667d9ad130 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix typos in
comments.  Always open file synchronized when reading header bytes,
	otherwise suffer stack corruption.
2009-11-27 14:27:22 +00:00
Corinna Vinschen 7bdbf062cd * dtable.cc (dtable::stdio_init): Use GetCurrentProcess() rather than
hMainProc as process handle when duplicating the stdout handle.
	Explain why.  Add Win32 error code to debug output.
2009-11-26 10:58:06 +00:00
Corinna Vinschen 27bbefdefd * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Add
socket handle value to debug output.
	(fhandler_socket::fixup_after_fork): Ditto.  Make new socket handle
	OVERLAPPED, just as if it has been created with socket().
	* net.cc (fdsock): Close duplicated socket and explain why.  Disable
	the entire WSADuplicateSocket test for now and explain why.
2009-11-23 14:50:14 +00:00
Corinna Vinschen 013e402bfc * fhandler_socket.cc (fhandler_socket::set_close_on_exec): Only call
fhandler_base::set_close_on_exec for inheritable sockets.
2009-11-23 12:21:39 +00:00
Corinna Vinschen d9e9c7b5a7 * globals.cc (ro_u_dll): New R/O unicode string.
* syscalls.cc (nt_path_has_executable_suffix): Add ro_u_dll to
	blessed_executable_suffixes array.  Explain why.
2009-11-21 12:44:13 +00:00
Corinna Vinschen 9fa63f7a5e * flock.cc (fhandler_disk_file::lock): Disable a shortcut from the
original BSD code, but keep it in and documented why we can't use it.
2009-11-18 20:05:46 +00:00
Corinna Vinschen b1d699c434 * ntea.cc (read_ea): Always add length of "user." prefix, not only
on Samba.  Change comment.
2009-11-18 15:57:08 +00:00
Corinna Vinschen 7b426e9f4a * ntea.cc (read_ea): Try to open file first to have more sensible
error codes.  Always refuse non "user." EAs for Linux compatibility
	and return EOPNOTSUPP.  Fix handling of empty (== non-existant) EAs.
	Always prepend "user." prefix to EA names.
	(write_ea): Try to open file first to have more sensible error codes.
	Always refuse non "user." EAs for Linux compatibility and return
	EOPNOTSUPP.  Delay skipping "user." prefix until after potential call
	to read_ea.
2009-11-18 11:57:41 +00:00
Corinna Vinschen b14f53a8ec Reintegrate socket duplication via WSADuplicateSocket/WSASocket.
* autoload.cc (WSADuplicateSocketW): Define.
	(WSASocketW): Define.
	* dtable.cc (dtable::release): Call dec_need_fixup_before if necessary.
	(dtable::fixup_before_fork): New function.
	(dtable::fixup_before_exec): New function.
	* dtable.h (class dtable): Add member cnt_need_fixup_before.  Add
	declarations for above new functions.
	(dtable::dec_need_fixup_before): New inline method.
	(dtable::inc_need_fixup_before): New inline method.
	(dtable::need_fixup_before): New inline method.
	* fhandler.h (fhandler_base::fixup_before_fork_exec): New virtual
	method.
	(fhandler_base::need_fixup_before): New virtual method.
	(class fhandler_socket): Add member prot_info_ptr.
	(fhandler_socket::init_fixup_before): Declare.
	(fhandler_socket::need_fixup_before): New inline method.
	(fhandler_socket::fixup_before_fork_exec): Declare.
	(fhandler_socket::fixup_after_exec): Declare.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	prot_info_ptr to NULL.
	(fhandler_socket::~fhandler_socket): Free prot_info_ptr conditionally.
	(fhandler_socket::init_fixup_before): New method.
	(fhandler_socket::fixup_before_fork_exec): Ditto.
	(fhandler_socket::fixup_after_fork): Use WSASocketW to duplicate
	socket if necessary.
	(fhandler_socket::fixup_after_exec): New method.
	(fhandler_socket::dup): Use fixup_before_fork_exec/fixup_after_fork
	to duplicate socket if necessary.
	* fork.cc (frok::parent): Start child suspended if some fhandler
	needs fixup before fork.  If so, call dtable::fixup_before_fork after
	CreateProcess and resume child.
	* net.cc (fdsock): Try to find out if socket needs fixup before and
	initialize socket accordingly.  Add HUGE comment to explain what happens
	and why.
	* spawn.cc (spawn_guts): Start child suspended if some fhandler needs
	fixup before exec.  If so, call dtable::fixup_before_exec after
	CreateProcess.
2009-11-17 10:43:01 +00:00
Eric Blake d01a44977f Fix setenv and unsetenv corner cases.
* environ.cc (setenv): Detect invalid argument.
(unsetenv): Distinguish EFAULT from EINVAL.
2009-11-16 20:05:49 +00:00
Corinna Vinschen ab36239578 * net.cc (fdsock): Fill _rmem and _wmem with valid values returned
from getsockopt if setsockopt with desired values failed.
2009-11-13 12:35:53 +00:00
Corinna Vinschen 339682e6de * sysconf.cc (get_nprocs): New function.
(get_nprocs_conf): Ditto.
	(get_avphys_pages): Ditto.
	(get_phys_pages): Ditto.
	* cygwin.din: Export them.
	* include/sys/sysinfo.h: New header, decalre above new functions.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* posix.sgml: Mention them as GNU extensions.
2009-11-12 14:40:48 +00:00
Corinna Vinschen c08f09ab78 * fhandler.h (class fhandler_mailslot): Declare new private method
get_object_attr.
	* fhandler_mailslot.cc (fhandler_mailslot::get_object_attr): Implement.
	(fhandler_mailslot::open): Replace calls to path_conv::get_object_attr
	with calls to fhandler_mailslot::get_object_attr.
2009-11-11 18:16:57 +00:00
Corinna Vinschen 03c48ee2e0 * fhandler_console.cc (fhandler_console::read): Revert change from
2009-11-09.
2009-11-10 20:02:20 +00:00
Corinna Vinschen 3aec0f00b1 * fhandler_disk_file.cc (is_volume_mountpoint): Align check with
symlink_info::check_reparse_point().
	* path.cc (symlink_info::check_reparse_point): Rearrange slightly.
	Add code path for unrecognized repare point types.  Add comment.
2009-11-10 08:54:24 +00:00
Corinna Vinschen 16a72f7e4b * path.cc (symlink_info::check_reparse_point): Always check
SubstituteName for volume string to recognize volume mount points.
	Reuse subst when calling sys_wcstombs.
	* syscalls.cc (rename): Set errno to EBUSY when trying to rename
	volume mount points.  Explain why.
2009-11-09 19:46:36 +00:00
Corinna Vinschen ed66791aba * fhandler_console.cc (fhandler_console::read): Restrict generating
META key sequences to singlebyte input chars.
2009-11-09 15:38:36 +00:00
Corinna Vinschen aa9681ec35 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Drop all "other"
permissions from st_mode, if the reading the file's security descriptor
	failed.  Explain why.
2009-11-08 10:22:28 +00:00
Corinna Vinschen b36d8c46e5 * globals.cc (ro_u_scr): New R/O unicode string.
(ro_u_sys): Ditto.
	* syscalls.cc (nt_path_has_suffix): Replace with ...
	(nt_path_has_executable_suffix): New function checking for explicit
	executable suffixes.
	(rename): Call nt_path_has_executable_suffix instead of
	nt_path_has_suffix.  Check oldpath for nt_path_has_executable_suffix
	as well to set old_explicit_suffix.
2009-11-06 20:51:03 +00:00
Corinna Vinschen 74ad9cc012 * shared.cc (inst_root_inited): New static bool variable.
(init_installation_root): Set inst_root_inited to true.
	(memory_init): Print installation root debug output only if
	inst_root_inited is true.
2009-11-06 13:06:36 +00:00
Corinna Vinschen ac4ad8bffc * syscalls.cc (nt_path_has_suffix): New function.
(rename): Don't append .exe suffix if binary target name has any suffix
	at all.
2009-11-05 14:44:12 +00:00
Corinna Vinschen e807aacea9 * spawn.cc (dll_suffixes): Disable. Explain why.
(perhaps_suffix): Use stat_suffixes instead of dll_suffixes.
2009-11-05 09:59:18 +00:00
Corinna Vinschen 18f7c50401 * security.cc (alloc_sd): Re-introduce setting the SE_DACL_PROTECTED
flag.  Remove INHERITED_ACE flag from all inherited ACEs.  Add comment.
	Fix ace_off counter in unrelated ACE loop.
	* wincap.cc: Re-add has_dacl_protect throughout.
	* wincap.h: Ditto.
2009-11-03 09:31:45 +00:00
Corinna Vinschen 1bb3825949 * security.cc (alloc_sd): Re-enable generating default permission
entries for directories.
2009-11-02 20:50:15 +00:00
Corinna Vinschen df95867087 * dlfcn.cc (get_full_path_of_dll): Drop enforcing a .dll suffix.
(dlopen): If last path component has no dot, append one to override
	automatic .dll suffix in LoadLibrary.
2009-11-02 14:39:08 +00:00
Corinna Vinschen a657970571 * miscfuncs.h (transform_chars): Declare. Define inline variation here.
* mount.cc (mount_info::from_fstab): Remove extern declaration of
	transform_chars.
	* path.cc (tfx_chars): Move to strfuncs.cc.
	(transform_chars): Ditto.
	* strfunc.cc (tfx_chars): Moved here from path.cc.
	(transform_chars): Ditto.
	(sys_cp_wcstombs): Make UNICODE private use area conversion roundtrip
	save for all characters.
	(sys_cp_mbstowcs): Ditto, by removing special case for UTF-8 sequences
	representing U+f0XX UNICODE chars.  Fix typo in comment.
2009-11-02 11:42:04 +00:00
Corinna Vinschen 0055caee0f * path.cc (tfx_chars): Constify. 2009-11-02 09:49:30 +00:00
Corinna Vinschen 526b0fbca3 * cygprops.h: New file.
* dtable.cc (handle_to_fn): Add check for correct installation_key
	string in object name for pipes and ttys.
	* external.cc (cygwin_internal): Add CW_GET_INSTKEY to allow fetching
	the installation_key from cygserver.
	* fhandler_fifo.cc (fhandler_fifo::fifo_name): Add installation_key
	to fifo name.
	* globals.cc: Include cygprops.h.
	(_RDATA): Move slightly and add comment.
	(cygwin_props): Define.
	* mount.cc (mount_info::init): Accommodate the fact that
	installation_root is now a global variable in DLL common shared memory,
	rather than a member of cygwin_shared.
	* pipe.cc (fhandler_pipe::create_selectable): Add installation_key to
	pipe name.
	* shared.cc (installation_root): Define here for storage in DLL
	common shared memory.
	(installation_key): Ditto.
	(installation_key_buf): Ditto.
	(init_installation_root): Convert from shared_info method to ordinary
	function.  Add initializing installation_key.  Invalidate
	installation_key depending of value of disable_key property.  Add
	comment to explain.
	(get_shared_parent_dir): Add installation_key to directory name.
	(get_session_parent_dir): Ditto.
	(shared_info::initialize): Move call to init_installation_root from
	here...
	(memory_init): ...to here.  Add debug output to print installation root
	and installation key.  Add comment to explain why.
	* shared_info.h (SHARED_INFO_CB): Recalculate.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Remove definition of installation_root and
	declaration of init_installation_root.
	(init_installation_root): Declare.
	(installation_root): Declare.
	(installation_key): Declare.
	* uinfo.cc (pwdgrp::load): Accommodate the fact that installation_root
	is now a global variable in DLL common shared memory.
	* include/cygwin/version.h: Bump API minor number.
	(CYGWIN_INFO_INSTALLATIONS_NAME): Add.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_INSTKEY.
2009-10-31 13:24:06 +00:00
Corinna Vinschen 7c16c02dbb * sec_helper.cc (security_descriptor::realloc): Call free first if
current security desriptor has been allocated by GetSecurityInfo.
2009-10-31 09:31:47 +00:00
Corinna Vinschen b42441d32b * sec_helper.cc (security_descriptor::free): If sd_size is 0, call
LocalFree instead of ::free.

	* sec_acl.cc: Throughout replace old ACE flag definitions with current
	definitions as used in MSDN man pages.
	* security.cc: Ditto.

	* fhandler.cc (fhandler_base::open): Make sure file has really been
	just created before fixing file permissions.  Add S_JUSTCREATED
	attribute to set_file_attribute call.
	* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Always create dir
	with default security descriptor and fix descriptor afterwards.
	Add S_JUSTCREATED flag to set_file_attribute call.
	* fhandler_socket.cc (fhandler_socket::bind): Ditto for AF_LOCAL
	socket files.
	* path.cc (symlink_worker): Ditto for symlinks.
	* security.cc (get_file_sd): Call GetSecurityInfo rather than
	NtQuerySecurityObject.  Explain why.  Change error handling accordingly.
	(alloc_sd): Skip non-inherited, non-standard entries in ACL if
	S_JUSTCREATED attribute is set.  Explain why.  Minor format fixes.
	* security.h (S_JUSTCREATED): New define.
	(security_descriptor::operator=): New operator.
2009-10-30 19:58:53 +00:00
Corinna Vinschen 53be6f3df6 * fhandler_random.cc (fhandler_dev_random::lseek): Revert change from
2009-10-23.
2009-10-30 10:53:54 +00:00
Corinna Vinschen 460af5f9c0 * smallprint.cc (hex_str): New const string.
(__rn): Drop str and use hex_str instead.
	(__small_vsprintf): If 'l' modifier has been found, print subsequent
	multibyte or wide char string using the s, S, or W options in extended
	hex value layout.

	* fhandler_disk_file.cc (fhandler_disk_file::readdir): Print WCHAR
	and resulting multibyte filename in extended hex value layout in
	debug output.
2009-10-30 09:02:30 +00:00
Charles Wilson 73ddc92062 Correct pseudo-reloc size bug wrt error messages 2009-10-26 14:50:09 +00:00
Charles Wilson 15c59df67f Sync pseudo-reloc.c with mingw64 2009-10-25 23:37:48 +00:00
Corinna Vinschen e83fef9d35 * fhandler.cc (fhandler_base::open): Remove unused variables sa and sd. 2009-10-24 08:40:15 +00:00
Corinna Vinschen 1647bf67c1 * fhandler.cc (fhandler_base::open): Always create file with default
security descriptor and fix descriptor afterwards.  Change comment to
	explain why.
	* security.cc (alloc_sd): Drop setting the SE_DACL_PROTECTED flag.
	* wincap.cc: Remove has_dacl_protect throughout.
	* wincap.h: Ditto.
2009-10-24 08:26:01 +00:00
Corinna Vinschen 959684bf05 * fhandler_random.cc (fhandler_dev_random::lseek): Allow negative
dummy file positions as on Linux.
2009-10-23 09:22:14 +00:00
Corinna Vinschen a4f31f1b1b * registry.cc (reg_key::get_int): Add alternative implementation
taking WCHAR strings.
	(reg_key::set_int): Ditto.
	(reg_key::get_string): Ditto.
	(reg_key::set_string): Ditto.
	* registry.h (struct reg_key): Add prototypes for added methods.
2009-10-20 14:54:47 +00:00
Corinna Vinschen c94a1006c6 * smallprint.cc (__small_vsprintf): Simplify UNICODE string handling
and allow empty strings.
2009-10-20 14:52:43 +00:00
Corinna Vinschen cbea3f7d93 * fhandler_disk_file.cc (fhander_disk_file::readdir): Handle a status
code STATUS_NOT_SUPPORTED.  Add matching comment.
2009-10-20 10:12:05 +00:00