Commit Graph

4845 Commits

Author SHA1 Message Date
Corinna Vinschen 59cb363a5f * path.cc (cygwin_conv_path): Add band-aid including comment to avoid
conversion from POSIX "." to Win32 ".\\".
2009-12-21 16:44:37 +00:00
Corinna Vinschen 6d63272b53 * exec.cc (execvp): Call find_exec with FE_NNF flag to enforce
a NULL return when executable isn't found in $PATH.  Convert NULL
	to "".
	(execvpe): Ditto.
	* spawn.cc (spawn_guts): Return with EFAULT if prog_arg is NULL.
	Return with ENOENT if prog_arg is empty string.  Add a comment.
2009-12-21 15:16:28 +00:00
Corinna Vinschen b2d6e5dfd3 * fhandler_console.cc (get_nonascii_key): Generate ESC prefix
for Alt modifier generically for function keys and keypad keys.
	Distinguish Normal, Ctrl, Shift, Ctrl-Shift rather
	than Normal, Ctrl, Shift, Alt, so that in combination with generic
	Alt handling all 8 combinations of these modifiers are distinguished.
	(keytable): Add escape sequences for remaining modified
	function keys as a compatible extension using rxvt escape codes.
	Also distinguish keypad keys modified with Ctrl, Shift, Ctrl-Shift
	using xterm-style modifier coding.
2009-12-21 10:11:27 +00:00
Corinna Vinschen 1b71ce005c Throughout, revert ill-conceived replacement of hMainThread with
GetCurrentThread/NtCurrentThread.
	* dcrt0.cc (dll_crt0_0): Duplicate main thread handle to hMainThread
	again.
2009-12-21 09:38:25 +00:00
Corinna Vinschen 57a2873a5d * fhandler_console.cc (__vt100_conv): Minor formatting change. 2009-12-19 15:40:31 +00:00
Corinna Vinschen 8fd4bd2bf1 * fhandler_console.cc (write_console): Check for VT100
graphics mode and transform wide characters in ASCII small
	letter range to corresponding graphics.
	(__vt100_conv): Table to transform small ASCII letters to line
	drawing graphics for use in VT100 graphics mode.
	(write_normal): Check for SO/SI control characters to
	enable/disable VT100 graphics mode.
	(base_chars): Enable SO/SI control characters for detection.
	(write): Check for ESC ( 0 / ESC ( B escape sequences to
	enable/disable VT100 graphics mode. Also detect ">" while
	parsing ESC [ sequences to distinguish specific requests.
	(char_command): Distinguish Secondary from Primary Device Attribute
	request to report more details about cygwin console terminal version.
	* fhandler.h (vt100_graphics_mode_active): New flag to indicate mode.
	(saw_greater_than_sign): New parse flag for ESC [ > sequences.
	(gotparen, gotrparen): New state values to parse ESC ( / ) sequences.

	* fhandler_console.cc (read): Allow combined Alt-AltGr modifiers
	to also produce an ESC prefix like a plain Alt modifier, e.g. to make
	Alt-@ work on a keyboard where @ is AltGr-q.
2009-12-19 15:37:10 +00:00
Eric Blake d954168ddb * signal.cc (nanosleep): Fix bug in previous patch. 2009-12-19 00:58:34 +00:00
Corinna Vinschen f16706de97 Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcess
according to context.  Throughout, replace hMainThread with
	GetCurrentThread/NtCurrentThread according to context.
	* dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to
	hMainProc.  Drop duplication of GetCurrentThread to hMainThread.
	* dtable.cc (dtable::stdio_init): Remove useless comment.
	* globals.cc (hMainProc): Remove.
	(hMainThread): Remove.
	* ntdll.h (NtCurrentProcess): Define.
	(NtCurrentThread: Define.
2009-12-18 20:32:04 +00:00
Corinna Vinschen 333a47d316 * fhandler.h (fhandler_registry::value_name): Convert to wchar_t*.
* fhandler_registry.cc: Call UNICODE registry functions throughout
	and convert to multibyte using current locale's charset.  Accommodate
	throughout.
	(must_encode): Take wchar_t.
	(encode_regname): Convert from wchar_t *.
	(decode_regname): Convert to wchar_t *.
2009-12-18 17:14:21 +00:00
Corinna Vinschen ae8547442b * path.sgml (func-cygwin-conv-path): Clarify meaning of size parameter.
(func-cygwin-conv-path-list): Fix typo.
	(func-cygwin-posix-path-list-p): Ditto.
2009-12-18 10:11:56 +00:00
Corinna Vinschen 314c2d2fed * syscalls.cc (try_to_bin): Handle remote shares as well. Just rename
files in this case, instead of moving them to the recycler.  Create
	even more unique filename.  Add comment to explain filename.
	(unlink_nt): Remove code returning with EBUSY on remote shares.
	Set bin_stat to move_to_bin except on NFS.  Add comment to explain.
2009-12-17 18:33:05 +00:00
Eric Blake 214f44da10 * signal.cc (nanosleep): Support 'infinite' sleep times.
(sleep): Avoid uninitialized memory.
2009-12-17 14:04:04 +00:00
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
Corinna Vinschen 8d648dc555 * syscalls.cc (internal_setlocale): Only convert $PATH if there is a
$PATH.
2009-10-19 19:47:15 +00:00
Corinna Vinschen b3f5fb3718 * spawn.cc (av::fixup): Treat non-readable, but executable files as
Cygwin executables.
2009-10-19 08:33:00 +00:00
Corinna Vinschen a6f3658d44 * uinfo.cc (uinfo_init): Deimpersonate, don't reimpersonate, if
not in a setuid condition.
2009-10-18 09:07:13 +00:00
Eric Blake 4cd31fc8f9 Consistently use va_end.
* external.cc (cygwin_internal): Use va_end.
* fork.cc (child_copy): Likewise.
* libc/bsdlib.cc (warn, warnx, err, errx): Likewise.
* pinfo.cc (commune_request): Likewise.
* strace.cc (strace::prntf, strace_printf): Likewise.
2009-10-14 04:17:05 +00:00
Corinna Vinschen bc3aedd061 * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. 2009-10-13 12:08:22 +00:00
Corinna Vinschen 0191627a26 * include/sys/cygwin.h: Add new cygwin_getinfo_type
CW_SET_EXTERNAL_TOKEN.
	Add new enum CW_TOKEN_IMPERSONATION, CW_TOKEN_RESTRICTED.
	* cygheap.h (cyguser): New flags ext_token_is_restricted,
	curr_token_is_restricted and setuid_to_restricted.
	* external.cc (cygwin_internal): Add CW_SET_EXTERNAL_TOKEN.
	* sec_auth.cc (set_imp_token): New function.
	(cygwin_set_impersonation_token): Call set_imp_token ().
	* security.h (set_imp_token): New prototype.
	* spawn.cc (spawn_guts): Use CreateProcessAsUserW if restricted token
	was enabled by setuid().  Do not create new window station in this case.
	* syscalls.cc (seteuid32): Add handling of restricted external tokens.
	Set HANDLE_FLAG_INHERIT for primary token.
	(setuid32): Set setuid_to_restricted flag.
	* uinfo.cc (uinfo_init): Do not reimpersonate if restricted token was
	enabled by setuid ().  Initialize user.*_restricted flags.
2009-10-13 10:23:31 +00:00
Eric Blake b8a35083c6 Improve clock_gettime and utimensat resolution.
* hires.h (hires_ms): Change initime_us to initime_ns, with 10x
more resolution.
(hires_ms::nsecs): New prototype.
(hires_ms::usecs, hires_ms::msecs, hires_ms::uptime): Adjust.
* times.cc (systime_ns): New helper function.
(hires_ms::prime): Use it for more resolution.
(hires_ms::usecs): Change to...
(hires_ms::nsecs): ...with more resolution.
(clock_gettime): Use more resolution.
(systime): Rewrite in terms of systime_ns.
(timespec_to_filetime): Rewrite math to reflect true operation.
* fhandler_disk_file.cc (utimens_fs): Use higher resolution.
2009-10-13 02:26:33 +00:00
Corinna Vinschen 2fc007681e * external.cc (cygwin_internal): Return 0 in CW_SET_DOS_FILE_WARNING
and CW_SETERRNO cases.
2009-10-12 19:26:08 +00:00
Corinna Vinschen d358c9e9b0 * fhandler_disk_file.cc (fhandler_disk_file::link): Only append .lnk
if the original device had one, too.  Add comment.

	* fhandler_socket.cc (fhandler_socket::fstat): Always return a size of
	0 on sockets.
2009-10-12 11:57:29 +00:00
Corinna Vinschen 9fa1c6420b * path.cc (tfx_chars): Convert all ASCII control characters except
ASCII NUL as well.  Change layout to make the conversions more clear.
	Add comment.
2009-10-09 11:17:17 +00:00
Corinna Vinschen 1441f6a3d1 * include/cygwin/config.h (DEFAULT_LOCALE): Define as "C.UTF-8". 2009-10-09 08:36:21 +00:00
Christopher Faylor 5391a40c89 * exceptions.cc (_cygtls::signal_exit): There's no need to set signal_arrived
if we're exiting.
2009-10-08 15:56:14 +00:00
Eric Blake 80636211bc * fhandler_disk_file.cc (utimens_fs): Plug fd leak on EINVAL. 2009-10-08 11:13:45 +00:00
Charles Wilson dc4e4aabba Support pseudo-reloc version 2 2009-10-07 15:47:38 +00:00
Corinna Vinschen dfbf36f8db * syscalls.cc (seteuid32): Call set_cygwin_privileges on primary token
as well.
2009-10-07 08:20:49 +00:00
Corinna Vinschen b4311a9067 * fhandler.h (fhandler_pty_master::tcgetpgrp): Declare.
* fhandler_termios.cc (fhandler_termios::tcgetpgrp): Only return
	valid pgid if tty is controlling tty.  Set errno to ENOTTY and
	return -1 otherwise.
	(fhandler_pty_master::tcgetpgrp): New function.  Return 0 for
	master side of pty if it's not the controlling tty of the process.
2009-10-07 07:52:30 +00:00
Charles Wilson c8ee587a8e Add cygwin wrapper for ExitProcess and TerminateProcess. 2009-10-06 21:51:17 +00:00
Christopher Faylor a12518a37c * exceptions.cc: Move global variable sigExeced...
* globals.cc: here.
* pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Remove now unneeded
declaration.
2009-10-06 03:39:38 +00:00
Dave Korn 3772467948 * Makefile.in (CFLAGS): Add -mno-use-libstdc-wrappers. 2009-10-04 17:48:05 +00:00
Corinna Vinschen 960624f47e * syscalls.cc (internal_setlocale): Add comment. 2009-10-04 11:32:07 +00:00
Corinna Vinschen 0ca6c6b802 * dcrt0.cc (dll_crt0_1): Drop calls to setlocale/_setlocale_r. Just
call initial_setlocale from here.
	* syscalls.cc (initial_setlocale): Set internal charset and revert
	application locale to "C".
	(setlocale): Don't set Cygwin's internal charset here.
2009-10-02 14:58:10 +00:00
Christopher Faylor 284c5ea0a5 * dcrt0.cc (dll_crt0_1): Move cxx_malloc reset kluge from here.
(check_sanity_and_sync): to here.
* path.cc (has_dot_last_component): Rewrite to detect some corner cases that
were previously uncaught.
2009-10-02 06:04:57 +00:00
Corinna Vinschen 4180b64df4 * fhandler_console.cc (beep): Move up to avoid forward declaration.
(fhandler_console::read): Just beep on characters invalid in current
	charset.  Add comment.
2009-09-30 09:23:45 +00:00
Eric Blake 1c0909882c * syscalls.cc (rename): Fix regression in rename("dir","d/"). 2009-09-30 02:11:05 +00:00
Corinna Vinschen 4abcdf2717 * fhandler_socket.cc (fhandler_socket::recv_internal): Always call
WSARecv on SOCK_STREAM sockets.
2009-09-29 08:46:29 +00:00
Corinna Vinschen 587b75f7bd * fhandler.h (class dev_console): Constify charset parameter of
str_to_con.
	* fhandler_console.cc (dev_console::con_to_str): Simplify.  Always
	default to the current internal locale.
	(dev_console::get_console_cp): Always use codepage 437 for alternate
	charset.
	(dev_console::str_to_con): Constify charset parameter.
	(fhandler_console::write_normal): Always use codepage 437 for alternate
	charset.  Otherwise always default to the current internal locale.
	Replace ASCII SO with ASCII CAN.
	* strfuncs.cc: Tweka comments according to below changes.
	(sys_cp_wcstombs): Constify charset parameter.  Convert all wchar_t
	values in the Unicode private use area U+F0xx to the singlebyte
	counterpart.  Drop special handling creating ASCII SO sequence from
	U+DCxx value.  Rearrange for performance.  Replace ASCII SO with
	ASCII CAN.
	(sys_cp_mbstowcs): Constify charset parameter.  Replace ASCII SO with
	ASCII CAN.  Drop special case for U+DCxx ASCII SO sequences.  Always
	create a replacement from the Unicode private use area U+F0xx for
	invalid byte values in a multibyte sequence.  Do the same for wchar_t
	values from the U+F0xx range to make them roundtrip safe.
	* wchar.h (sys_cp_wcstombs): Constify charset parameter.
	(sys_cp_mbstowcs): Ditto.
2009-09-28 12:10:32 +00:00
Corinna Vinschen d856640e1c * cygheap.cc (cygheap_init): Default locale.charset to "UTF-8".
* dcrt0.cc (dll_crt0_1): Call setlocale (LC_CTYPE, "") here, just
	before resetting application locale to "C".
	* environ.cc (environ_init): Drop code setting locale here.
	* syscalls.cc (check_codepage): Break out check for required codepage
	from internal_setlocale.
	(internal_setlocale): Just convert CWD and $PATH from old charset to
	new charset and set internal charset.
	(setlocale): Change accordingly.  Don't require LC_ALL or LC_CTYPE to
	store old locale value.  Always call internal_setlocale if charset
	changed due to locale environment changes.
2009-09-28 10:43:49 +00:00
Eric Blake 15e9ecd14a Add fexecve, execvpe.
* exec.cc (fexecve): New function.
* cygwin.din (execvpe, fexecve): Export new fexecve and existing
execvpe.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* posix.sgml: Mention them.
2009-09-26 21:01:10 +00:00
Eric Blake 52dba6a5c4 Fix some POSIX-compliance bugs in link, rename, mkdir.
* syscalls.cc (link): Delete obsolete comment.  Reject directories
and missing source up front.
(rename): Use correct errno for trailing '.'.  Detect empty
strings.  Allow trailing slash to newpath iff oldpath is
directory.
* dir.cc (mkdir): Reject dangling symlink with trailing slash.
* fhandler_disk_file.cc (fhandler_disk_file::link): Reject
trailing slash.
* fhandler.cc (fhandler_base::link): Match Linux errno.
2009-09-26 15:51:53 +00:00
Eric Blake 2bf78f0928 Provide euidaccess, canonicalize_file_name; fix fchmodat.
* syscalls.cc (fchmodat): lchmod is not yet implemented.
(euidaccess): New function.
* path.cc (realpath): Update comment.
(canonicalize_file_name): New function.
* include/cygwin/stdlib.h (canonicalize_file_name): Declare it.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* cygwin.din: Export canonicalize_file_name, eaccess, euidaccess.
* posix.sgml: Mention them.
2009-09-25 23:55:00 +00:00
Eric Blake 3dbe243afa Fix faccessat(,0) and access() semantics.
* fhandler.h (fhandler_base::fhaccess): Add parameter.
* security.h (check_file_access, check_registry_access): Likewise.
* security.cc (check_file_access, check_registry_access)
(check_access): Implement new parameter.
* fhandler.cc (fhandler_base::fhaccess): Likewise.
(device_access_denied): Update caller.
* syscalls.cc (access, faccessat): Update callers.
* spawn.cc (find_exec, fixup): Likewise.
2009-09-25 13:44:45 +00:00
Corinna Vinschen 599d462dfa * posix_ipc.cc (mq_open): Avoid closing the same descriptor twice in
case of errors.
	(sem_open): Ditto.
2009-09-24 09:25:35 +00:00
Corinna Vinschen 1c23aff7a3 * kernel32.cc (CreateMutexW): Use correct access mask.
(CreateSemaphoreW): Ditto.
2009-09-24 09:09:45 +00:00
Corinna Vinschen 8e3607fcee * strfuncs.cc (__set_charset_from_codepage): Fetch current ANSI
codepage if cp is 0.
2009-09-23 17:13:55 +00:00
Corinna Vinschen 565d6ede3f Fix typo. 2009-09-23 12:01:42 +00:00
Corinna Vinschen e664429d77 * strfuncs.cc (sys_cp_wcstombs): Convert lone surrogate pair
second halves to unambiguous ASCII SO sequence.  When converting
	chars invalid in current codepage to ASCII SO sequence, make
	sure to check for surrogate pair second half only if ct least
	one wide characters is left.  Decrement nwc if valid second half has
	been converted.
	(sys_cp_mbstowcs): Improve ASCII SO handling.  Never break from loop
	if invalid character has been found.  Recognize ASCII SO sequence
	representing originally invalid mulitbyte char converted into a
	lone surrogate pair second half.  Convert accordingly.
2009-09-23 11:31:00 +00:00
Corinna Vinschen 5e8d7527af * autoload.cc (WSARecv): Define.
* fhandler_socket.cc (fhandler_socket::recv_internal): Call WSARecv
	instead of WSARecvFrom if no name parameter is given.  Explain why.
2009-09-22 14:27:57 +00:00
Eric Blake 74a67d01a5 Make *at functions more like Linux.
* syscalls.cc (faccessat): Fix typo, reject bad flags.
(fchmodat, fchownat, fstatat, utimensat, linkat, unlinkat): Reject
bad flags.
2009-09-22 12:13:53 +00:00
Corinna Vinschen abe6b5a3e2 * strfuncs.cc (sys_cp_mbstowcs): Reset shift state after handling
invalid multibyte sequence.
2009-09-22 09:44:32 +00:00
Corinna Vinschen 4401b147bb * path.cc (symlink_worker): Rework error handling to generate Linux
compatible errno in case of trailing slash in newpath.
2009-09-22 09:24:30 +00:00
Eric Blake 29bca9bb0c Match dup2 and fcntl error values to POSIX.
* dtable.h (OPEN_MAX_MAX): New macro.
* resource.cc (getrlimit) [RLIMIT_NOFILE]: Use it.
* dtable.cc (dtable::extend): Likewise.
* fcntl.cc (fcntl64): Obey POSIX rule with too-large F_DUPFD.
* syscalls.cc (dup2): Likewise.
2009-09-22 04:09:03 +00:00
Corinna Vinschen ee42ccd3a2 * cygheap.h (cwdstuff::get_posix): Convert to const inline method just
returning pointer to posix path.
	(cwdstuff::reset_posix): Convert to non-inline method taking a wchar_t
	pointer.
	* path.cc (cwdstuff::set): Revert change from 2009-05-13.  Set posix
	to valid incoming path again.
	(cwdstuff::reset_posix): New implementation setting posix path from
	incoming wchar_t path.  Explain usage.
	(cwdstuff::get_posix): Drop implementation.
	(cwdstuff::get): Drop special case to handle empty posix path.
	* syscalls.cc (internal_setlocale): Store old posix cwd as wide char
	path.  Restore posix cwd using new charset.  Explain why.
2009-09-21 19:29:16 +00:00
Corinna Vinschen 6cabe044dd * fhandler_disk_file.cc (fhandler_disk_file::link): Drop faking hardlink
creation on filesystems not supporting hardlinks.
2009-09-21 10:56:50 +00:00
Christopher Faylor 92c4330f5b * dcrt0.cc (dll_crt0_1): Add another hack to REALLY make sure that cxx_malloc
is always set to the cygwin version.
2009-09-21 02:32:06 +00:00
Christopher Faylor adfbdcdb07 * external.cc (cygwin_internal): Add hack to always reset cxx_malloc to proper
value.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Relocate wayward comment.
2009-09-21 02:19:31 +00:00
Christopher Faylor 50a8741474 * exceptions.cc (sigpacket::process): Explicitly set thread-specific handler
function to zero to avoid transferring to incorrect location.
(_cygtls::call_signal_handler): Don't transfer to handler if there is no
handler to transfer to.
2009-09-19 15:34:19 +00:00
Christopher Faylor 7b9f3ce02c * exceptions.cc (sigpacket::process): Give sigwait() processing precedence even
when a handler is present.
* syscalls.cc (getpagesize): Change return to 'int'.
2009-09-18 21:27:02 +00:00
Christopher Faylor a7f0112577 * ntea.c (write_ea): Don't abort if not-samba. 2009-09-16 16:23:51 +00:00
Christopher Faylor d984eb88db * select.cc (peek_console): Always check window size when there is ANY keyboard
activity.
2009-09-01 14:25:10 +00:00
Corinna Vinschen 2671595b4a * path.h (INTERIX_SYMLINK_COOKIE): Define.
* path.cc (symlink_info::check_sysfile): Read Interix symlinks as well.
2009-08-26 20:32:35 +00:00
Corinna Vinschen 50bd7b0bb6 * fhandler.cc (fhandler_base::open): Only set R/O attribute if ACLs
are not used.
2009-08-26 19:37:34 +00:00
Corinna Vinschen c177980e75 * mount.cc (fs_info::update): Add comment.
* path.cc (symlink_info::check_reparse_point): Return -1 for volume
	mount points.  Explain why.
	(symlink_info::check): Call fs.update again for volume mount points.
	Explain why.
2009-08-25 11:27:03 +00:00
Corinna Vinschen 11788f8ce0 * globals.cc (ro_u_volume): New R/O unicode string.
* path.cc (symlink_info::check_reparse_point): Fix check for volume
	mount points to work on Vista and later as well.
2009-08-24 11:14:30 +00:00
Christopher Faylor f3b6fef631 * cygwin/strfuncs.cc (__set_charset_from_codepage): Add codepages 20866
(KOI8-R) and 21866 (KOI8-U).

* doc/setup2.sgml (setup-locale-charsetlist): Add KOI8-R and KOI8-U to list of
supported charsets.
2009-08-22 15:01:03 +00:00
Christopher Faylor 6282fe16dd * dll_init.h (has_dtors): New flag.
(run_dtors): New wrapper function which avoids calling dtors more than once.
* dll_init.cc (dll_global_dtors): Use dll.run_dtors wrapper.
(dll_list::detach): Ditto.
(dll_list::alloc): Set has_dtors flag.
2009-08-21 21:32:06 +00:00
Christopher Faylor e41f43a1a6 * fcntl.cc (fcntl64): Detect negative fd as error. 2009-08-21 21:19:45 +00:00
Corinna Vinschen a2c5f4b4e4 * mmap.cc (mmap64): Allocate fh_disk_file on cygheap. Delete
explicitely before returning.
2009-08-21 08:47:59 +00:00
Corinna Vinschen 1c1b04b84c * dtable.cc (build_fh_dev): Take additional bool parameter indicating
whether set_name should be called or not.
	(dtable::dup_worker): Call build_fh_pc with new second parameter set
	to false.  Explain why.  If fhandler's dup failed, delete rather than
	cfree newfh and set newfh to NULL to indicate failure correctly.
	* dtable.h (build_fh_pc): Change declaration according to above change.
	Default set_name parameter to true.
	* mmap.cc (mmap_record::free_fh): Delete rather than cfree fh.
2009-08-20 08:34:21 +00:00
Christopher Faylor 421ba492fa * dtable.cc (dtable::fixup_after_exec): Close any popen'ed file handles here.
* fhandler.h (fhandler_*::ispipe): New function.
(fhandler_base::get_popen_pid): Define virtual function.
(fhandler_*::isdevice): Make const.
(fhandler_*::isfifo): Ditto.
2009-08-18 15:21:47 +00:00
Christopher Faylor 4315703af7 * syscalls.cc (popen): Reorganize slightly for clarity. Fix a comment. 2009-08-18 01:51:35 +00:00
Christopher Faylor d5c44ae231 * syscalls.cc (popen): Rewrite to accommodate situations where stdin, stdout,
or stderr are closed.
2009-08-18 01:40:46 +00:00
Christopher Faylor 28c054b720 * pipe.cc (fhandler_pipe::create_selectable): Add -pipe to default pipe names.
* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Use bool/true/false for
what is actually a boolean variable.
2009-08-17 12:45:51 +00:00
Corinna Vinschen 719ffe8792 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fix length
check for ".." dir.
2009-08-14 18:27:18 +00:00
Corinna Vinschen e684ace44e * fhandler_disk_file.cc (fhandler_disk_file::readdir): Change comment
to be fair.
2009-08-14 14:10:31 +00:00
Corinna Vinschen e575678945 * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Remove
ill-advised attempt to optimize "." and ".." handling by checking for
	specific position in directory listing.  Explain why.
	(fhandler_disk_file.cc (fhandler_disk_file::readdir): Ditto.
	Special-case opening file on NFS to fetch inode number and add longish
	comment to explain why.
2009-08-14 13:39:07 +00:00
Corinna Vinschen c1999c4b0c * (fhandler_socket::getsockname): Fix length returned for unbound
AF_LOCAL sockets.
	(fhandler_socket::getpeername): Ditto.
	* net.cc (socketpair): Don't set sun_path and peer_sun_path to
	make sure getsockname and getpeername return the correct values
	for AF_LOCAL sockets.
2009-08-14 06:58:44 +00:00
Corinna Vinschen 95a1cc7024 * fhandler_socket.cc (fhandler_socket::accept): Use sizeof rather
then constant size.  Truncate returned data, but return full address
	length as per POSIX.
	(fhandler_socket::getsockname): Truncate returned data, but return full
	address length as per POSIX.
	(fhandler_socket::getpeername): Ditto.
2009-08-13 15:44:29 +00:00
Corinna Vinschen d3d4aa96aa * fhandler.h (class fhandler_socket): Add peer_sun_path member.
(fhandler_socket::set_peer_sun_path): New method.
	(fhandler_socket::get_peer_sun_path): New method.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	peer_sun_path to NULL.
	(fhandler_socket::~fhandler_socket): Free peer_sun_path if necessary.
	(fhandler_socket::dup): Duplicate peer_sun_path.
	(fhandler_socket::accept): Ditto.  Return fake unbound peer content
	and len in case of AF_LOCAL sockets.
	(fhandler_socket::getsockname): Always use local sockaddr_storage to
	store socket address and copy over to incoming address.  Handle every
	namelen correctly per POSIX.
	(fhandler_socket::getpeername): Ditto.  Add code path to return
	correct value for AF_LOCAL sockets.
	(fhandler_socket::set_peer_sun_path): New method.
	* net.cc (socketpair): Set peer_sun_path to empty string, just like
	sun_path.
2009-08-13 10:26:42 +00:00
Corinna Vinschen ce5eb135a2 * cxx.cc (default_cygwin_cxx_malloc): Enhance commenting.
* dll_init.cc (dll_dllcrt0_1): Likewise.
	* dlfcn.cc (dlopen): Prevent dlopen()'d DLL from installing any
	cxx malloc overrides.
	* include/cygwin/cygwin_dll.h (__dynamically_loaded): New variable.
	* lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Check it and only
	install cxx malloc overrides when statically loaded.  Extend comments.
2009-08-13 07:35:50 +00:00
Corinna Vinschen a73a3f438b * fhandler_socket.cc (fhandler_socket::accept): Always use local
sockaddr_storage to store peer address and copy over to incoming
	peer address if available.  Truncate data as necessary according
	to POSIX.
2009-08-12 14:48:16 +00:00
Corinna Vinschen b1ce1770ea * include/limits.h (NGROUPS_MAX): Set to a more sane value.
* include/sys/param.h (NGROUPS): Ditto.
2009-08-11 07:28:22 +00:00
Corinna Vinschen 9043b49e63 * spawn.cc (av::fixup): Check shell scripts for executability only on
filesystems/mounts supporting real permissions.
2009-08-10 18:36:28 +00:00
Corinna Vinschen 019fc8d880 * dtable.cc (DEV_SOCKET): New static WCHAR string. Name of
the native NT socket device.
	(dtable::init_std_file_from_handle): Remove unused tmp_pathbuf
	variable.  Move check for sockets into FILE_TYPE_PIPE clause.
	Rely on handle_to_fn having recognized socket, or check if
	getsockopt works to accommodate NT4 shortcoming.
	(handle_to_fn): Use tmp_pathbuf for OBJECT_NAME_INFORMATION
	buffer and simplify code due to that.  Check name returned by
	NtQueryObject for socket device.
2009-08-10 15:38:37 +00:00
Christopher Faylor 78d959ce6f * fhandler_console.cc (create_invisible_console_workaround): Fix size of cmd in
the way originally intended.
2009-08-10 15:25:58 +00:00
Corinna Vinschen 264ae244af * fhandler_console.cc (create_invisible_console_workaround): Fix
size of cmd to take spaces into account.
2009-08-10 08:54:51 +00:00
Corinna Vinschen 7be107ce24 * dtable.cc (dtable::init_std_file_from_handle): Fix comment to
document change in the Windows 7 workaround.
	* wincap.cc (wincapc::init): Don't set has_console_handle_problem
	to false on 32 bit systems.
2009-08-08 20:24:54 +00:00
Corinna Vinschen 19753e1dbf * net.cc (cygwin_getnameinfo): Force setting NI_NUMERICSERV only
on Windows 2003 and earlier, only if the port number doesn't
	resolve to a well-known service.  Change comment accordingly.
2009-08-06 14:55:49 +00:00
Christopher Faylor a99345591f * cygheap.h (cygheap_debug::endh): Delete.
* debug.cc (lock_debug::acquired): Delete.
(lock_debug::lock_debug): Simplify.
(lock_debug::unlock): Ditto.
(find_handle): Don't set endh here.
(add_handle): Add new handle to beginning of the list rather than trying to
maintain an end list pointer.
(delete_handle): Minor optimization.
(mark_closed): Make logic clearer.
(verify_handle): Lock handle list before scanning.
(setclexec): Ditto.
(modify_handle): Ditto.
(newh): Don't lock handle list here.  Assume caller did this.
(mark_closed): Ditto.
(close_handle): Remove unneeded #if.
* dtable.cc (dtable::dup2): Tweak debug output.
2009-08-05 04:44:27 +00:00
Christopher Faylor 7f01964f06 * path.cc (patch_conv::check): Zero path before setting it. 2009-08-05 03:18:48 +00:00
Christopher Faylor 631681619e * fhandler_socket.cc (fhandler_socket::send_internal): Just use wmem size if
the length exceeds it.
* net.cc (fdsock): Use 65535 as window size, just like the comment says or we
run into problems with DuplicateHandle.
* path.cc (patch_conv::check): Use set_path to set invalid filename.
* path.h (path_conv::path_conv): Ditto.
2009-08-04 22:35:35 +00:00
Christopher Faylor 3b689b97bd * fhandler.h (pdrive_buf): Defensively allocate one extra byte. 2009-08-04 04:31:08 +00:00
Christopher Faylor 824d851859 * fhandler.h (fhandler_cygdrive:DRVSZ): New enum.
(pdrive_buf): New place to hold information about cygdrive.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Store drive info in
pdrive_buf since get_win32_name() could now be too small to hold everything.
(fhandler_cygdrive::rewinddir): Reset pdrive to pdrive_buf.
(fhandler_cygdrive::closedir): Ditto.
* pipe.cc (fhandler_pipe::init): Be more defensive when referencing
get_win32_name().  Rework logic which made a copy of the POSIX path and then
never used it.
2009-08-04 04:20:36 +00:00
Christopher Faylor ff7b364c12 * sigproc.cc (stopped_or_terminated): Don't return a match when stopsig ==
SIGCONT and not WCONTINUED.
* termios.cc (tcsetpgrp): Improve debugging output.
2009-08-02 21:38:40 +00:00
Christopher Faylor fafbf75509 * cygheap_malloc.h: New file.
* cygheap.h: Remove stuff now included in cygheap_malloc.h and include that
file.  Make cygheap_init a standard c++ function.  Remove unneeded child_info
declaration.
* path.h: Include cygheap_malloc.h.  Remove extra cstrdup declaration.
(path_conv): Reorganize to group variables together.
(path_conv::path): Make const char *.
(path_conv::known_suffix): Ditto.
(path_conv::normalized_path): Ditto.
(path_conv::path_conv): Reorganize initializers to reflect new element
ordering.
(path_conv::get_win32): Change return value to const char *.
(path_conv::set_path): Move back here from spawn.cc.
(parh_conv::modifiable_path): New function.
* path.cc (path_conv::add_ext_from_sym): Accommodate const'ness of
known_suffixes.
(path_conv::set_normalized_path): Ditto for normalized_path.
(path_conv::check): Use modifiable_path whereever we need to modify the path
element.  Use set_path to set the path.
(path_conv::~path_conv): Accommodate new const'ness.
* spawn.cc (perhaps_suffix): Declare ext as const since that's what is being
returned.
(path_conv::set_path): Move back to path.h.
* winf.f (linebuf): Perform minor cleanup.
(linebuf::fromargv): Change second parameter to const.
* winf.cc (linebuf::fromargv): Ditto.
2009-08-01 19:52:46 +00:00
Christopher Faylor 8cc84a8ce3 * path.h (path_conv::set_path): Change return value.
* spawn.cc (path_conv::set_path): Return newly set value.
(find_exec): Set retval to newly set value when calling set_path.
2009-08-01 17:55:58 +00:00
Christopher Faylor a3a060b596 * spawn.cc (find_exec): Fix one more path where retval was not set. 2009-08-01 03:36:44 +00:00
Christopher Faylor 5f297dc330 * spawn.cc (find_exec): Stop relying on the ability to set retval to a fixed
path_conv buffer and set it on the fly instead.
2009-08-01 03:27:51 +00:00
Corinna Vinschen eeb6806f87 * path.h (cstrdup): Fix declaration. 2009-07-30 20:19:54 +00:00