Commit Graph

5686 Commits

Author SHA1 Message Date
Corinna Vinschen cd1a95f55a * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::write): Set
bytes_to_write to 0 in case it fits into the buffer, otherwise suffer
	early EOF in caller.
2012-02-09 15:23:17 +00:00
Corinna Vinschen 9eba4de269 * dll_init.h (struct dll): Re-add modname.
* dll_init.cc: Throughout, use modname where it was used before.
	(dll_list::operator[]): Use modname.  Move comment from dll_list::alloc
	here and remove hint about GetModuleBaseNameW.
	(dll_list::alloc): Store full path in name, pointer to basename in
	modname.  Search dll using modname.
2012-02-09 14:41:21 +00:00
Christopher Faylor 06f46dc379 * dtable.cc (dtable::init_std_file_from_handle): Reinstate opening tty handles
with O_RDWR permissions.
2012-02-09 01:20:55 +00:00
Corinna Vinschen 461c56569f * thread.cc (__pthread_cond_wait_init): New static function replacing
__pthread_cond_dowait.  Only check and potentially initialize cond and
	mutex, drop call to (*cond)->wait.
	(pthread_cond_timedwait): Replace call to __pthread_cond_dowait with
	separate calls to __pthread_cond_wait_init and (*cond)->wait to be
	able to initialize cond before accessing its clock_id member.
	(pthread_cond_wait): Ditto (more or less).
2012-02-08 19:58:37 +00:00
Christopher Faylor 30c66cea49 * include/sys/wait.h: Remove C++ inline functions for `union wait'. For C++
use `void *' as __wait_status_ptr_t instead.  This is less type safe but fixes
compile error on `wait(NULL)'.  Remove extra `;'.
2012-02-08 19:51:13 +00:00
Corinna Vinschen bb2b641c13 * sigproc.cc (child_info_fork::abort): Call TerminateProcess rather
than ExitProcess.
2012-02-08 19:43:14 +00:00
Corinna Vinschen 7dc730e8ee * uinfo.cc (cygheap_user::env_userprofile): Simplify since network
drives are not supported here.
2012-02-08 17:51:34 +00:00
Corinna Vinschen a7a03a3920 * uinfo.cc (cygheap_user::env_userprofile): Convert native
userprofile path returned from get_registry_hive_path to Win32 path.
2012-02-08 17:45:43 +00:00
Corinna Vinschen 8f4ea5f005 * dll_init.cc: Throughout, drop usage of modname in favor of name.
(dll_list::find_by_modname): Remove.
	(dll_list::alloc): Only store module basename in name.  Add comment to
	explain why.  Simplify address check.  Fix formatting in comment.
	* dll_init.h (struct dll): Drop modname and find_by_modname.
2012-02-08 17:35:02 +00:00
Corinna Vinschen 25e67cd634 * dll_init.cc (dll_list::alloc): Add DLL name to fabort output. Fix
fabort string in case of bss start.
2012-02-08 14:41:51 +00:00
Corinna Vinschen 9553860f41 * include/sys/sysmacros.h: Include sys/types.h. 2012-02-08 14:08:58 +00:00
Corinna Vinschen b23ef0bc0a * mount.cc (mount_info::create_root_entry): Fix format specifier in
api_fatal message.
2012-02-07 17:34:29 +00:00
Corinna Vinschen 3b8698d7be * include/process.h: Move here from include/cygwin subdir.
* exec.cc: Change include of process.h to reflect the fact that it's
	now back in include.
	* spawn.cc: Ditto.
	* syscalls.cc: Ditto.
2012-02-07 17:15:07 +00:00
Christopher Faylor 3e9c8f2e81 * cygheap.cc (init_cygheap::manage_console_count): Delete.
* cygheap.h (init_cygheap::manage_console_count): Ditto.
(init_cygheap::console_count): Ditto.
* fhandler.h (fhandler_console::has_a): Ditto.
(fhandler_console::free_console): Declare new function.
* fhandler_console.cc (fhandler_console::free_console): Define new function.
(fhandler_console::open_setup): Delete call to manage_console_count.
(fhandler_console::close): Ditto.  Replace with call to free_console().
* fhandler_tty.cc (fhandler_pty_slave::open): Delete call to
manage_console_count.
(fhandler_pty_slave::cleanup): Ditto.
(fhandler_pty_slave::close): Call fhandler_console::free_console() if this is
our controlling tty.
* pinfo.cc (_pinfo::set_ctty): Skip function if tty in question == our ctty.
Delete call to manage_console_count.
* syscalls.cc (close_all_files): Avoid locking and avoid setting errno when
iterating over fds.
2012-02-07 16:54:14 +00:00
Christopher Faylor a72ada654e * include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 11. 2012-02-07 16:50:19 +00:00
Corinna Vinschen 02f63d4720 * grp.cc (pwdgrp::parse_group): Convert grp from macro to reference.
* passwd.cc (pwdgrp::parse_passwd): Ditto for res.
2012-02-03 12:26:08 +00:00
Christopher Faylor ab1fb53505 * syscalls.cc (close_all_files): Use cygheap_fdget to manipulate fhandler. Use
debug_only_printf.
2012-02-02 16:58:13 +00:00
Corinna Vinschen b2ec6677ed Fix memory and handle leaks due to fdopendir:
* dir.cc (closedir): Call global close instead of just releasing the
	fhandler.
	* fhandler_disk_file.cc (fhandler_disk_file::closedir): Don't close
	fhandler handle here, rely on global closedir doing the right thing.
	* fhandler_registry.cc (fhandler_registry::readdir): Also delete
	d_hash when closing registry key.
	(fhandler_registry::rewinddir): Ditto.

	Avoid infinite recursion in VirtualStore under UAC:
	* fhandler_registry.cc (VIRT_CLASSES_KEY_PREFIX): Define.
	(VIRT_CLASSES_KEY_SUFFIX): Ditto.
	(VIRT_CLASSES_KEY): Ditto.
	(VIRT_CLASSES_LINKTGT): Ditto.
	(fhandler_registry::exists): Return virt_symlink as file type if
	this is a Classes key under the VirtualStore.
	(fhandler_registry::fstat): Handle virt_symlink.
	(fhandler_registry::readdir): Return DT_LNK as d_type if this is a
	Classes key under the VirtualStore.
	(fhandler_registry::fill_filebuf): Handle Classes symlink.

	Handle user impersonation in /proc/registry access:
	* autoload.cc (RegOpenUserClassesRoot): Define.
	(RegOpenCurrentUser): Define.
	* fhandler_registry.cc (RegOpenUserClassesRoot): Declare function
	missing in w32api.
	(RegOpenCurrentUser): Ditto.
	(fetch_hkey): New function.
	(fhandler_registry::open): Call fetch_hkey to get root registry key.
	(open_key): Ditto.
2012-02-02 13:58:20 +00:00
Christopher Faylor 89c1003e78 Grr. Fix another typo. 2012-02-01 18:28:34 +00:00
Christopher Faylor 29b7448d58 * fcntl.cc (fcntl64): Add introductory debug statement. Call dup3 directory
via dtable method to avoid over-incrementing refcnt.
2012-02-01 17:38:07 +00:00
Christopher Faylor 8fa8b3a389 * dtable.cc (dtable::dup_worker): Add comment explaining why refcnt isn't
incremented here.
(dtable::dup3): Simplify slightly.  Add comment.
* syscalls.cc (dup3): Increment refcnt here, similarly to dup2.
2012-02-01 17:20:02 +00:00
Christopher Faylor 4c68bf65c8 fix typo 2012-02-01 05:43:30 +00:00
Christopher Faylor ee766fda68 * fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Don't block
GetOverlappedResult since previous IsEventSignalled will have reset the handle.
* select.cc (cygwin_select): Remove space before parentheses in syscall
debugging output.
(pipe_data_available): Streamline if block.
2012-02-01 05:27:42 +00:00
Christopher Faylor d3cb1dffef * syscalls.cc (dup3): Fix debug typo.
* fhandler.cc (flush_async_io): Assume only called for writer.  Call
GetOverlappedResult directly rather than kluding call to has_ongoing_io.
(fhandler_base_overlapped::close): Only start flush thread when closing write
handle.  Only cancel I/O when reading.
2012-01-31 23:52:52 +00:00
Corinna Vinschen e2c22341c2 * cygwin.din: Fix order (DATA first). 2012-01-28 14:44:01 +00:00
Corinna Vinschen deeffc5036 * dcrt0.cc (is_dos_path): New macro to recognize drive letter and UNC
DOS paths.
	(globify): Call is_dos_path instead of isdrive.
2012-01-27 09:28:38 +00:00
Christopher Faylor c9241c2619 * sigproc.cc (child_info::retry_count): Actually that should have been 0. 2012-01-26 18:14:11 +00:00
Christopher Faylor bd4174619e * sigproc.cc (child_info::retry_count): Default to 1. 2012-01-26 16:35:34 +00:00
Corinna Vinschen 5ad6d0a486 * syscalls.cc (gethostid): Simplify. Just fetch MachineGuid and
create hash from there.
2012-01-23 12:59:44 +00:00
Christopher Faylor 1ad58ee709 * fhandler.h (fhandler_fifo::arm): Declare new function.
* fhandler_fifo.cc (fhandler_fifo::arm): Define new function.
(fhandler_fifo::open): Fix handling of RDWR pipes to avoid opening a second
handle.  Use arm() function to set events.
(fhandler_fifo::raw_read): Correctly go into "connect again logic" when we
detect another writer is available.  Use arm() function to set event.
* pipe.cc (fhandler_pipe::create): Add more detail to debugging output.
2012-01-22 21:43:25 +00:00
Christopher Faylor 0646a508aa * cygheap.h (cygheap_fdmanip::release): Simplify.
* dtable.cc (dtable::release): Make void again.  Skip not_open check since it
is guaranteed to be open.  Don't bother deleting here since actual deletion
will be handled in cygheap_fdget::~cygheap_fdget.
* dtable.h (dtable::release): Make void again.
* syscalls.cc (dup2): Bump fhandler use count on successful dup.
2012-01-22 07:27:57 +00:00
Christopher Faylor ad87edbe61 * cygheap.h (cygheap_fdget::~cygheap_fdget): Simplify now that refcnt reports
reference count changes itself.
* fhandler.cc (fhandler_base::reset): Set _refcnt to 0.
* fhandler.h (fhandler_base::refcnt): Report refcnt when debugging.
* select.cc (cygwin_select): Set return_on_signal to indicate when select
should be interrupted.
(select_stuff::wait): Keep looping unless return_on_signal is set.
* select.h (select_stuff::return_on_signal): New variable.
(select_stuff::select_stuff): Zero return_on_signal.
2012-01-22 06:45:08 +00:00
Corinna Vinschen 5259273091 * fhandler.h (fhandler_registry::opendir): Declare.
* fhandler_registry.cc (fhandler_registry::opendir): New function.
2012-01-20 12:53:26 +00:00
Yaakov Selkowitz e55564646d * include/cygwin/config.h (_GLIBC_EXTENSION): Define. 2012-01-13 09:15:22 +00:00
Christopher Faylor 74f2cb574e * spawn.cc (child_info_spawn::worker): Delete debugging. 2012-01-11 22:38:52 +00:00
Christopher Faylor 0e1f0840d2 Update copyright on all files checked in so far this year.
* fhandler.h: Use #pragma once rather than ifdef guards.
(fhandler_console::tc_getpgid): Return our pgid if we have never opened a
console.
* fork.cc: Rearrange includes to accommodate fhandler.h use of pinfo.h.
* sigproc.cc: Ditto.
* spawn.cc: Ditto.
(child_info_spawn::worker): Query myself->pgid rather than calling expensive
function.
* thread.h: Use #pragma once rather than ifdef guards.
* pinfo.h: Use #pragma once rather than ifdef guards.
(pinfo::remember): Don't define if sigproc.h has not been included.
(pinfo::reattach): Ditto.
* sigproc.h: Use #pragma once rather than ifdef guards.  Use different test to
see if pinfo.h has been included.
2012-01-11 19:07:11 +00:00
Corinna Vinschen 02c8acc1b4 * include/cygwin/process.h: Move here from newlib.
* exec.cc: Change include of process.h to reflect the fact that it's
	now in the include/cygwin subfolder.
	* spawn.cc: Ditto.
	* syscalls.cc: Ditto.
2012-01-09 17:03:39 +00:00
Corinna Vinschen cde9b54e71 * miscfuncs.cc (thread_wrapper): Make sure stack is 16 byte aligned
to make gcc-3 compiled pthread applications happy.
2012-01-09 14:19:56 +00:00
Christopher Faylor a345dc55f9 * dtable.cc (dtable::stdio_init): Always initialize console when we have one.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Use a better method to
print tty name for debugging.
(fhandler_termios::bg_check): Ditto.
* pinfo.cc (_pinfo::set_ctty): Remove leftover debugging stuff.  Simplify
behavior when setting tty's sid and pgid to avoid overwriting previously set
values.
* spawn.cc (ch_spawn): Cosmetic change.
2012-01-08 06:24:17 +00:00
Yaakov Selkowitz 50350cafb3 * cygwin.din (pthread_sigqueue): Export.
* posix.sgml (std-gnu): Add pthread_sigqueue.
	* thread.cc (pthread_sigqueue): New function.
	* include/thread.h (pthread_sigqueue): New function.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2012-01-06 07:12:18 +00:00
Christopher Faylor b9f131c820 * path.cc (get_current_dir_name): Avoid memory leak. Don't return PWD contents
if directory doesn't actually exist.
2012-01-02 17:45:51 +00:00
Yaakov Selkowitz 0b5355f17c * cygwin.din (get_current_dir_name): Export.
* path.cc (get_current_dir_name): New function.
	* posix.sgml (std-gnu): Add get_current_dir_name.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2012-01-01 18:54:25 +00:00
Christopher Faylor d27d202f56 Bump ChangeLog 2012-01-01 16:57:25 +00:00
Yaakov Selkowitz d5f3e0ba9a * cygwin.din (getpt): Export.
* posix.sgml (std-gnu): Add getpt.
	* tty.cc (getpt): New function.
	* include/cygwin/stdlib.h [!__STRICT_ANSI__] (getpt): Declare.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-12-30 20:22:28 +00:00
Yaakov Selkowitz 3abbe5ea8e * thread.cc: Mark pthread_rwlock_timedrdlock and
pthread_rwlock_timedwrlock as not yet implemented in the list of
	cancellation points.
2011-12-30 06:47:13 +00:00
Christopher Faylor 3fc91be72b * fhandler_dsp.cc (fhandler_dev_dsp::fhandler_dev_dsp): Set up device.
* syscalls.cc (open): Very minor formatting tweak.
2011-12-25 04:05:31 +00:00
Corinna Vinschen 855ea3fddd * path.cc (struct symlink_info): Add bool argument to declaration of
check_reparse_point.
	(symlink_info::check_reparse_point): Add bool argument to indicate
	remote drive.  Handle STATUS_PENDING.  Don't evaluate junctions on
	remote drives.  Fix comments.
	(symlink_info::check): Drop check for is_remote_drive and associated
	comment here.  Add fs.is_remote_drive as second parameter to
	check_reparse_point call.
2011-12-24 13:11:34 +00:00
Corinna Vinschen 9ffe887f6c * pinfo.cc (pinfo_basic::pinfo_basic): Fix formatting. Set uid and gid
to default values to accommodate early initialization of shared user
	info.  Add comment.
2011-12-23 17:12:10 +00:00
Corinna Vinschen a4ea75600c * spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB
to c_flags only if current process is member of a job and breakaway
	is allowed.
2011-12-22 14:33:08 +00:00
Corinna Vinschen 3a24189bba * external.cc (cygwin_internal): Implement CW_ALLOC_DRIVE_MAP,
CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
	* fhandler_process.cc: Include mount.h.
	(get_volume_path_names_for_volume_name): Move to mount.cc.
	(struct dos_drive_mappings): Ditto.
	* mount.cc (get_volume_path_names_for_volume_name): Move here.
	(dos_drive_mappings::dos_drive_mappings): Ditto.
	(dos_drive_mappings::fixup_if_match): Ditto.
	(dos_drive_mappings::~dos_drive_mappings): Ditto.
	* mount.h (class dos_drive_mappings): Declare her.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_ALLOC_DRIVE_MAP,
	CW_MAP_DRIVE_MAP, CW_FREE_DRIVE_MAP.
	* include/cygwin/version.h: Bump API minor number.
2011-12-22 12:25:10 +00:00