Commit Graph

9323 Commits

Author SHA1 Message Date
Corinna Vinschen 8895d962d5 * cygheap.cc (init_cygheap::init_installation_root): Convert function
init_installation_root into a cygheap method.
	* cygheap.h (struct init_cygheap): Move installation_root,
	installation_key, and installation_key_buf from shared
	.cygwin_dll_common DLL section to cygheap.  Declare new method
	init_installation_root.
	* dtable.cc (handle_to_fn): Accommodate the move of installation strings
	to the cygheap.
	* external.cc (cygwin_internal): Ditto.
	* fhandler_console.cc (fhandler_console::open_shared_console): Ditto.
	* fhandler_mailslot.cc (fhandler_mailslot::get_object_attr): Ditto.
	* fhandler_tty.cc: Ditto, throughout.
	* mount.cc (mount_info::init): Ditto.
	* pipe.cc (fhandler_pipe::create): Ditto.
	* shared.cc: Ditto, throughout.
	(installation_root): Remove.
	(installation_key): Move to cygheap.
	(installation_key_buf): Ditto.
	(installation_root_inited): Remove.
	(SPIN_WAIT): Remove.
	(init_installation_root): Move to cygheap.
	(memory_init): Call cygheap->init_installation_root right after
	cygheap->user.init.  Drop call of init_installation_root function.
	* shared_info.h (init_installation_root): Drop declaration.
	(installation_root): Ditto.
	(installation_key): Ditto.
	* uinfo.cc (pwdgrp::load): Accommodate the move of installation strings
	to the cygheap.
2012-02-14 11:27:43 +00:00
Corinna Vinschen 78b5f9545d * thread.cc: Drop including unused headers. 2012-02-14 09:45:21 +00:00
Corinna Vinschen 722c69734d * miscfuncs.cc (struct thread_wrapper_arg): Convert char * to PBYTE.
Change related casts throughout.
	(thread_wrapper): Only do the thread change if the application provided
	the stack.  Otherwise, just use the Windows-provided stack.  Set up
	POSIX guardpage here, if necessary.  Move related comment from
	CygwinCreateThread here.
	(CygwinCreateThread): Never allocate and set up own stack here.  Just
	compute stack size to reserve and use value in CreateThread call if
	stack hasn't been provided by the application.
2012-02-13 15:23:03 +00:00
Corinna Vinschen d7bcd2a16f * Makefile.in (clean): Remove non-existant regexp dir.
* collate.h: New header.
	(__collate_range_cmp): Declare.
	(__collate_load_error): Define.
	* glob.cc: Pull in latest version from FreeBSD.  Simplify and reduce
	Cygwin-specific changes.
	* regex/regcomp.c: Include collate.h on Cygwin as well.
	(__collate_range_cmp): Move from here...
	* nlsfuncs.cc (__collate_range_cmp): ...to here.

	* miscfuncs.cc (thread_wrapper): Fix typo in comment.
	(CygwinCreateThread): Take dead zone of Windows stack into account.
	Change the way how the stack is commited and how to handle guardpages.
	Explain how and why.
	* thread.h (PTHREAD_DEFAULT_STACKSIZE): Change definition.  Explain why.
2012-02-13 13:12:37 +00:00
Yaakov Selkowitz e633eaec08 * include/pthread.h: Include time.h as required by POSIX. 2012-02-13 01:46:46 +00:00
Christopher Faylor e52a43f101 * exception.h (stackdump): Declare.
* exceptions.cc (stackdump): Rework to perform all operations needed for a
stackdump and to avoid recursion.
(exception::handle): Use simplified stackdump interface.
* sigproc.cc (signal::exit): Ditto.  Delete now, uneeded declaration.
2012-02-12 22:43:33 +00:00
Corinna Vinschen ce48510394 * miscfuncs.cc (DEFAULT_STACKSIZE): Remove.
(CygwinCreateThread): Simplify code by assuming that now stack-related
	input values are undefined.  Set stack protection to PAGE_READWRITE,
	as is default on Windows.  Add lengthy comment to explain POSIX
	guardpage.
	* thread.cc (pthread_attr::pthread_attr): Initialize stacksize as
	PTHREAD_DEFAULT_STACKSIZE.  Initialize guardsize as
	PTHREAD_DEFAULT_GUARDSIZE.
	* thread.h (PTHREAD_DEFAULT_STACKSIZE): Define.  Add comment to explain.
	(PTHREAD_DEFAULT_GUARDSIZE): Define.
2012-02-11 17:37:02 +00:00
Corinna Vinschen 793371f584 * miscfuncs.cc (DEFAULT_STACKSIZE): Set to 1 Megs. Drop comment about
RLIMIT_STACK.

	* registry.cc (get_registry_hive_path): Expect the user hive path to
	be never longer than MAX_PATH.  Don't prepend native NT path prefix
	here.  Add comment.
	(load_registry_hive): Prepend native NT path prefix here.  Additionally
	try to load user's classes hive.
	* uinfo.cc (cygheap_user::env_userprofile): Reduce size of
	userprofile_env_buf to MAX_PATH.  Add comment.
2012-02-10 20:56:22 +00:00
Christopher Faylor c38a2d8373 * syscalls.cc (setsid): On second thought, in the spirit of keeping things
kludgy, set ctty to -2 here as a special flag, and...
(open): ...only eschew setting O_NOCTTY when that case is detected.
2012-02-10 16:43:36 +00:00
Christopher Faylor 93b18fd232 * syscalls.cc (open): Semi-revert (?) to allowing open of a tty to become
controlling tty if there is no controlling tty.
2012-02-10 16:33:53 +00:00
Christopher Faylor 3b20fd9324 * exceptions.cc (setup_handler): Reduce system_printf to sigproc_printf since
it is for a transient situation which will undoubtedly be handled.
2012-02-09 16:05:23 +00:00
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
Corinna Vinschen a442c9cddc * passwd.cc: Add -v option to print version information as well, since
it's used in older csih.
2012-02-09 10:11:26 +00:00
Corinna Vinschen e7420de9a2 *** empty log message *** 2012-02-09 09:04:10 +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 dbf404f258 * faq-using.xml (faq.using.sshd-in-domain): Document autoload error
1114 when loading user32.dll as potential problem when not using
	a domain service account.
2012-02-08 10:04:16 +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 9ccb2ee84a * new-features.sgml (ov-new1.7.10): Fix typo. 2012-02-05 16:26:48 +00:00
Corinna Vinschen 91cf7ba960 * legal.sgml: Fix copyright. 2012-02-05 14:29:14 +00:00
Corinna Vinschen f5f62dd281 *** empty log message *** 2012-02-05 14:27:25 +00:00
Corinna Vinschen 35d81b4cde * setup2.sgml: Fix more typos.
* setup-net.sgml: Ditto.
2012-02-04 20:19:48 +00:00
Corinna Vinschen 56f115b527 * utils.sgml: Fix typos. 2012-02-04 11:42:04 +00:00
Corinna Vinschen e618492ea8 * faq-using.xml: Fix typos.
* ntsec.sgml: Ditto.
	* pathnames.sgml: Ditto.
	* setup2.sgml: Ditto.
	* setup-net.sgml: Ditto.
	(setup-dir): Drop paragraph on Unix/DOS file mode.
2012-02-04 11:40:44 +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
Keith Marshall 002a1b18e6 More performance enhancements and POSIX compliance corrections. 2012-02-01 21:26:39 +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
Christopher Faylor 44e1d662cb * strace.cc (proc_child): Don't right-shift exit value.
(main): Call ExitProcess() to exit exactly the same way as any straced child.
2012-01-31 18:06:51 +00:00
Corinna Vinschen 54c743c8f8 * tzset.c: Throughout use wide characters to be locale agnostic.
(main): Call setlocale.
2012-01-29 12:06:23 +00:00
Corinna Vinschen 1b79b38101 * Makefile.in (CYGWIN_BINS): Add tzset.
* tzset.c: New tool, new file.
	* utils.sgml (tzset): New section.

	* new-features.sgml (ov-new1.7.10): Add tzset.

	* release/1.7.10: Add tzset.
2012-01-29 09:41:06 +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 2d5a2c1b35 * pathnames.sgml (mount-table): Rephrase a few expressions for
clearness.
2012-01-24 09:48:59 +00:00
Yaakov Selkowitz abd9714a7b * ldd.cc (start_process): Handle .oct and .so as DLLs. 2012-01-24 06:29:01 +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 5b09af7a51 clarify wording 2012-01-22 17:57:52 +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
Keith Marshall d409f31ff3 Correct misused 'rm -r' command in uninstall rules. 2012-01-16 20:37:25 +00:00
Keith Marshall ec54dd65e2 Generalise makefile references to subdirectories of lib. 2012-01-16 20:26:49 +00:00
Corinna Vinschen 32bd06e544 * configure: Regenerate and re-add to repository.
* .cvsignore: Fix accordingly.
2012-01-16 08:44:37 +00:00
Keith Marshall 47c607cdca Add 'check' as GCS conforming alias for make's 'test' goal. 2012-01-15 21:30:48 +00:00
Keith Marshall fe493b0f4b More makefile code refactoring; remove redundant INCLUDES references. 2012-01-15 20:56:25 +00:00
Keith Marshall 71992560f7 Add smart identification of auxiliary header file paths. 2012-01-15 19:11:09 +00:00
Keith Marshall f485d8ffb4 More makefile code refactoring; fix top_srcdir references. 2012-01-15 15:31:11 +00:00
Keith Marshall 6208cfce7a Update and correct makefile rebuilding rules. 2012-01-15 15:10:09 +00:00
Keith Marshall f0449b5092 More formatting adjustments. 2012-01-15 14:28:17 +00:00
Keith Marshall 300dfd2a1b Miscellaneous formatting adjustments. 2012-01-15 14:20:36 +00:00
Keith Marshall c6a4777d85 Improve self-documentation of 'for' loop commands. 2012-01-15 12:39:00 +00:00
Keith Marshall 3ef7500436 Generalise 'all' rule to arbitrary prerequisite sub-directories. 2012-01-15 12:27:13 +00:00
Keith Marshall 09223354f9 Derive package release index from configure time specification. 2012-01-15 12:20:09 +00:00
Keith Marshall 124e2b274b Discontinue CVS tracking of generated 'configure' script. 2012-01-14 21:19:12 +00:00
Yaakov Selkowitz e83fe04100 Document support of printf %m conversion flag. 2012-01-13 10:01:12 +00:00
Yaakov Selkowitz df3da8e12e * new-features.sgml (ov-new1.7.10): Document support for the %m
conversion flag in printf functions.
2012-01-13 09:59:53 +00:00
Yaakov Selkowitz e55564646d * include/cygwin/config.h (_GLIBC_EXTENSION): Define. 2012-01-13 09:15:22 +00:00
Yaakov Selkowitz b2af74282b Document tgmath.h. 2012-01-12 23:43:21 +00:00
Yaakov Selkowitz 9da2914941 * new-features.sgml (ov-new1.7.10): Document tgmath.h. 2012-01-12 23:42:11 +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
Corinna Vinschen df8c8e18eb * Makefile.common (MINGW_LDFLAGS): Correctly use -L rather than -B here. 2012-01-09 09:50:44 +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 04243e461d Add my recent API additions. 2012-01-08 01:32:17 +00:00
Keith Marshall 1f250fc805 Ensure Makefile.comm source is included in distribution tarballs. 2012-01-06 22:01:15 +00:00
Chris Sutcliffe c7cee543f0 2012-01-06 Chris Sutcliffe <ir0nh34d@users.sf.net>
* include/windef.h (WINVER): Back off to 0x0500.
2012-01-06 18:51:33 +00:00
Yaakov Selkowitz 8f60405b3d * new-features.sgml (ov-new1.7.10): Document pthread_sigqueue. 2012-01-06 07:13:11 +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
Chris Sutcliffe 1f94817747 2012-01-05 Chris Sutcliffe <ir0nh34d@users.sf.net>
* include/windef.h (WINVER): Bump to 0x0501.
2012-01-05 19:39:01 +00:00
Chris Sutcliffe 70284e10d0 2012-01-03 Chris Sutcliffe <ir0nh34d@users.sf.net>
Return value, identified by 'make test'.

        * include/gdiplus/gdiplustypes.h (Gdiplus::GdiplusAbort::Abort()): Return
        NO_ERROR in virtual definition.
2012-01-04 02:32:08 +00:00
Chris Sutcliffe b018c06fa9 2012-01-03 Chris Sutcliffe <ir0nh34d@users.sf.net>
Remove duplicate definitions, identified by 'make test'.

        * include/wincrypt.h (CRYPT_NEWKEYSET, CRYPT_DELETEKEYSET,
        CRYPT_MACHINE_KEYSET, CRYPT_SILENT, CRYPT_EXPORTABLE, CRYPT_USER_PROTECTED,
        CRYPT_CREATE_SALT, CRYPT_UPDATE_KEY, CRYPT_NO_SALT, CRYPT_PREGEN,
        CRYPT_RECIPIENT, CRYPT_INITIATOR, CRYPT_ONLINE, CRYPT_SF, CRYPT_CREATE_IV,
        CRYPT_KEK, CRYPT_DATA_KEY, CRYPT_VOLATILE, CRYPT_SGCKEY): Remove duplicate
        definitions.
        * include/winerror.h (CRYPT_E_REVOKED): Removed - already defined in
        wincrypt (which is where it should be defined according to MSDN).
2012-01-04 01:32:07 +00:00
Keith Marshall 2a4b36abb7 Correct misuse of #ifdef, identified by 'make test'. 2012-01-03 19:09:39 +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 7e89497328 * new-features.sgml (ov-new1.7.10): Document get_current_dir_name. 2012-01-01 18:55:40 +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
Christopher Faylor 594a229a80 Add a couple other items which have been changed since initial call for testing 2011-12-31 19:23:05 +00:00
Christopher Faylor 03062ffa8e Initial checkin of text Corinna sent to cygwin-announce. 2011-12-31 19:18:23 +00:00
Yaakov Selkowitz d0813bfdf0 * new-features.sgml (ov-new1.7.10): Document getpt. 2011-12-30 20:24:18 +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 964a927fe6 * include/winnt.h (JOB_OBJECT_LIMIT_BREAKAWAY_OK): Define.
(JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK): Define.
	(JOB_OBJECT_BREAKAWAY_OK): Define as JOB_OBJECT_LIMIT_BREAKAWAY_OK
	and mark as kept for backward compatibility only.
	(JOB_OBJECT_SILENT_BREAKAWAY): Define as
	JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK and mark as kept for backward
	compatibility only.
2011-12-22 14:31:46 +00:00
Corinna Vinschen 185ad82d2d Don't leave Windows 2000 behind.
* Makefile.in (ps.exe): Revert previous change.
	* ps.cc: Include psapi.h again.
	(main): In CW_GETPINFO_FULL case.  Evaluate minimal process access mask
	required per OS and use that in OpenProcess call.  Use
	GetModuleFileNameExW on Windows 2000 or if fetching the drive mapping
	failed.  Handle empty process name.
2011-12-22 13:48:05 +00:00
Corinna Vinschen a6ae9400a7 * include/winnt.h: Add missing PROCESS_QUERY_LIMITED_INFORMATION. 2011-12-22 13:46:11 +00:00
Corinna Vinschen 1281d5fc02 * Makefile.in (ps.exe): Drop -lpsapi from ALL_LDFLAGS.
* ps.cc: Don't include psapi.h.
	(dosdevs): Drop.
	(unicode_buf): Define.
	(main): Simplify path evaluation in CW_GETPINFO_FULL case. Fetch drive
	map from Cygwin DLL.  Use it to convert NT device paths to Win32 paths.
2011-12-22 12:40:26 +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
Corinna Vinschen 3a03267d6d * fhandler_process.cc: Drop unneeded includes. 2011-12-22 11:25:44 +00:00
Corinna Vinschen 177dc6c7f6 Throughout use wincap.allocation_granularity instead of getpagesize.
Throughout use wincap.page_size instead of getsystempagesize.
	Throughout use "status" as variable name to hold NTSTATUS values.
	* fhandler_mem.cc: Check for NT_SUCCESS rather than for STATUS_SUCCESS.
	Fix debug_printf output.  Rectify long statements.  Fix comment
	formatting.
	* fhandler_proc.cc: Ditto.
	(format_proc_swaps): Drop useless test for ERROR_PROC_NOT_FOUND.
	* fhandler_process.cc: Ditto as in fhandler_mem.cc.
	(get_process_state): Rearrange allocation loop.  Use malloc/realloc.
	(get_mem_values): Fix potential NULL pointer usage.  Drop unused
	variable.
	* pinfo.cc (winpids::enum_processes): Handle low memory gracefully.
	* sec_auth.cc (get_priv_list): Drop local variable ret.
	* shared.cc (memory_init): Drop outdated call to getpagesize.
	* syscalls.cc (getsystempagesize): Remove.
	* sysconf.cc: Check for NT_SUCCESS rather than for STATUS_SUCCESS.
	(sysinfo): Constify sizeof_stodi.  Drop useless test for
	ERROR_PROC_NOT_FOUND.
	* thread.cc (pthread_getattr_np): Cast pointers to uintptr_t rather
	than to int for pointer arithmetic.
	* winsup.h (getsystempagesize): Drop declaration.
2011-12-22 11:02:36 +00:00
Christopher Faylor 8176232ddc * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use correct value in
switch statement.
2011-12-21 18:34:57 +00:00
Corinna Vinschen f500a700b1 * dcrt0.cc (_dll_crt0): Rephrase comments. Set $ebp to NULL, as in
the pthread stack setup.
	* wow64.cc (wow64_revert_to_original_stack): Rephrase some comments.
	Return _tlsbase-16 rather than _main_tls-4 so as not to waste stack.
2011-12-21 17:19:48 +00:00
Corinna Vinschen 18d0c0fb8b * syscalls.cc (rename): Fix typo in comment. Fix condition to handle
the case oldpath is no .lnk symlink and newpath points to an existing
	.lnk symlink or .exe file and no explicit .lnk suffix has been given
	in oldpath.  Add a comment to explain.
2011-12-19 17:01:37 +00:00
Corinna Vinschen f08bc85858 * dcrt0.cc (dll_crt0_0): Check for wincap.wow64_has_secondary_stack
rather than for wincap.is_wow64.  Accommodate name change from
	wow64_has_64bit_parent to wow64_needs_stack_adjustment.  Align comment.
	(_dll_crt0): Ditto.
	* wincap.h (wincaps::wow64_has_secondary_stack): New element.
	* wincap.cc: Implement above element throughout.
	(wincapc::init): Set wow64_has_secondary_stack to false on non-64 bit
	systems.
	* wow64.cc (wow64_needs_stack_adjustment): Rename (hopefully the last
	time) from wow64_has_64bit_parent.
	(wow64_eval_expected_main_stack): Fix comment to reflect real life.
	(wow64_test_for_64bit_parent): Fix comment.
	* wow64.h (wow64_needs_stack_adjustment): Accommodate new name.
2011-12-19 12:50:35 +00:00
Christopher Faylor 9d69c75f6e clarify entry 2011-12-19 00:15:24 +00:00
Christopher Faylor d004a27971 * fhandler.cc (fhandler_base::close): Move setting isclosed() from here to
closed().
(fhandler_base_overlapped::close): Correct comment.
(fhandler_base_overlapped::destroy_overlapped): Signal overlapped event before
closing it to potentially wake up a waiting thread.
(fhandler_base_overlapped::wait_overlapped): Expand setting of err when closed
to encompass non-signal event.  Test for a cancel event before making
nonblocking decisions.
* syscalls.cc (close): Set closed flag here so that any concurrently executing
functions will be notified ASAP.
2011-12-18 04:07:47 +00:00
Christopher Faylor 1b23b30b29 Clean up whitespace. 2011-12-17 23:39:47 +00:00
Corinna Vinschen 988d896c0a * dcrt0.cc (_dll_crt0): Fix formatting. 2011-12-17 10:24:09 +00:00
Corinna Vinschen d329320822 * wow64.cc (wow64_revert_to_original_stack): Fix comment.
* wow64.h (wow64_respawn_process): Declare noreturn.
2011-12-17 10:05:25 +00:00
Christopher Faylor ce3318344c * exceptions.cc (set_signal_mask): Remove useless debugging output.
* fhandler.cc (fhandler_base::write): Ditto.
(fhandler_base_overlapped::close): Cancel any ongoing I/O before closing.
* syscalls.cc (write): Default to always reporting all writes in strace output
via syscall_printf.
* wait.cc (wait4): Fix debugging output.  Use standard syscall leaver output.
2011-12-17 07:01:21 +00:00
Christopher Faylor 60cd6a7798 Fix formatting. Fix typo. 2011-12-17 00:15:31 +00:00
Christopher Faylor ca35d41cec Implement fhandler reference counting.
* cygheap.h
(cygheap_fdmanip::release): Make virtual.
(cygheap_fdnew::~cygheap_fdnew): New destructor increments reference count when
fd has been allocated.
(cygheap_fdget::fh): New (old?) field.
(cygheap_fdget::cygheap_fdget): Increment reference count when we've found an
active fd.  Set fh appropriately.
(cygheap_fdget::~cygheap_fdget): Decrement reference count when appropriate.
Delete fh if reference count goes to zero.
(cygheap_fdget::release): New function.  Do more bookkeping on release.
* dtable.cc (dtable::release): Change from void to boolean return.  Only delete
the fhandler when its reference count is <= 0 (this should be a fairly unusual
case).  Return true if fhandler has been deleted.
(cygwin_attach_handle_to_fd): Increment reference count when fh is assigned.
(dtable::init_std_file_from_handle): Ditto.
* dtable.h (dtable::release): Change return to boolean.
* fhandler.cc (fhandler_base::fhandler_base): Set new isclosed flag to false.
Set _refcnt to zero.
(fhandler_base::close): Simplify paranoid debugging output.  Set new isclosed()
flag.
(fhandler_base_overlapped::wait_overlapped): Use isclosed() flag to avoid
querying the exception handle.
* fhandler.h (fhandler_base::_refcnt): New field.
(fhandler_base::refcnt): New function.
(fhandler_base::isclosed): Implement.
(fhandler_base::fhandler_base): Set isclosed to false.
* syscalls.cc: Remove space after function before parentheses for several
strace printfs.
(dup): Add standard strace "leaver" code.
(dup2): Ditto.
(dup3): Ditto.
(remove): Ditto.
(getpid): Ditto.
(getppid): Ditto.
(lseek64): Fix strace debugging to correctly use %R.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Avoid sending signals to
other processes if we're debugging since it can cause a deadlock with the
calling debugger.
* exceptions.cc (_cygtls::call_signal_handler): Add debugging-only strace
output.
2011-12-17 00:03:31 +00:00
Corinna Vinschen 6eee66418c * dcrt0.cc (child_info_fork::alloc_stack): Correctly check if the
parent stack fits into the child stack.  Align comment.
	* wow64.cc (wow64_eval_expected_main_stack): New function to fetch
	expected addresses of main thread stack from PE/COFF image header
	values.
	(wow64_test_for_64bit_parent): Fix comment.  Check current stack
	against real expected main thread stack addresses.
	(wow64_revert_to_original_stack): Fix and add comments. Check memory
	against real expected main thread stack addresses.  Use orignal stack
	if reserved area is >= 256K.
2011-12-16 18:09:43 +00:00
Christopher Faylor 56d06b9af3 * gendef (sigdelayed): Remember to pop all of the saved registers.
(sigreturn): Add "leave" label.
2011-12-16 16:32:25 +00:00
Christopher Faylor 6bd406f9ed * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Fix unresolved
access of wores in successful situations.
2011-12-16 16:29:34 +00:00
Corinna Vinschen 344e68b166 * Makefile.in (DLL_OFILES): Add wow64.o.
* dcrt0.cc (CYGWIN_GUARD): Drop execute permission for stack, it's
	not used for stacks by the OS either.
	(child_info_fork::alloc_stack_hard_way): Ditto.
	(child_info_fork::alloc_stack): Don't alloc_stack_hard_way under WOW64
	if forked from a 64 bit parent.  Set child's StackBase to parent's
	StackBase.  Add comments to explain why.
	(wow64_respawn): Move to wow64.cc.
	(wow64_started_from_native64): Move to wow64.cc.
	(respawn_wow64_process): Move to wow64.cc.
	(dll_crt0_0): Drop wow64_test_stack_marker and move stack test into
	wow64_test_for_64bit_parent function.  Don't return early if WOW64
	process has been started from native 64 bit process.
	(_dll_crt0): Implement moving stack for WOW64 processes started from
	native 64 bit process.
	* wow64.cc: New file.
	(wow64_has_64bit_parent): Rename from wow64_respawn.
	(wow64_test_for_64bit_parent): Rename from wow64_started_from_native64.
	Change comment.
	(wow64_revert_to_original_stack): New function.
	(wow64_respawn_process): Rename from respawn_wow64_process for symmetry.
	* wow64.h: New file.
2011-12-16 11:58:03 +00:00
Christopher Faylor 08e4b6acb7 * exceptions.cc (_cygtls::call_signal_handler): Fix debugging to not go to
console.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Add temporary kludge
to work around problem of make closing a handler while it is being read.
* gendef (sigdelayed): Don't call a function if sig has been cleared.
* sigproc.h (cygwait): Simplify slightly.
2011-12-16 05:27:15 +00:00
Corinna Vinschen e74758408e Don't leave Windows 2000 behind.
* autoload.cc (GetSystemWow64DirectoryW): Define.
	(GetVolumePathNamesForVolumeNameW): Define.
	* fhandler_process.cc (get_volume_path_names_for_volume_name): New
	static function to workaround missing GetVolumePathNamesForVolumeNameW
	function in Windows 2000.
	(dos_drive_mappings::dos_drive_mappings): Call
	get_volume_path_names_for_volume_name instead of
	GetVolumePathNamesForVolumeNameW.
2011-12-14 20:23:27 +00:00
Keith Marshall f46fcfebd1 Factor common code from subdirectory makefiles into Makefile.comm.in 2011-12-13 20:46:53 +00:00
Keith Marshall 5cc68751fd Prepare for factoring out common makefile code. 2011-12-13 20:10:42 +00:00
Christopher Faylor eab07b8789 add missing change 2011-12-13 20:08:10 +00:00
Christopher Faylor 45d7b637fa * dcrt0.cc (init_windows_system_directory): Record system_wow64_directory
information.
* exceptions.cc (_cygtls::inside_kernel): Modernize comment.  Consider
executing a DLL from the Wow64 directory as being "in the kernel".
(_cygtls::call_signal_handler): For now, only deal with main_tls signals if
main_tls is known to be executing in the cygwin DLL.  To more closely emulate
linux, consider the operation to be restartable if not executing in the main
thread.
* globals.cc (windows_system_directory): Remove NO_COPY.
(windows_system_directory_length): Ditto.
(system_wow64_directory): New variable.
(system_wow64_directory_length): Ditto.
* select.cc (cygwin_select): Don't issue a EINTR on non-main threads since that
seems to be what Linux does.  Add missing break to signal case/switch.
(select_stuff::wait): Don't issue a EINTR on non-main threads since that seems
to be what Linux does.  Remove now-unneeded accommodation for
WAIT_IO_COMPLETION.  Add a comment.
* sigproc.h (cygwait): Ditto.  Don't return if signal_received noticed and it's
not the main thread.
* signal.cc (sigprocmask): Add standard syscall debug stuff.
* thread.cc (pthread_sigmask): Ditto.
2011-12-13 20:06:31 +00:00
Corinna Vinschen 8d1bda71b4 * netdb.cc (open_system_file): Avoid MS-DOS path warning. 2011-12-13 17:46:08 +00:00
Corinna Vinschen 5250e27f71 * path.cc (conv_path_list): Fix a condition.
(cygwin_conv_path): Revert WIN_A conversion to current locale codeset.
2011-12-13 14:53:10 +00:00
Corinna Vinschen 3780d205cd * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Call
file_get_fnoi instead of NtQueryInformationFile.
	* path.cc (file_get_fnoi): New helper function to collect a
	FILE_NETWORK_OPEN_INFORMATION block.
	(symlink_info::check): Call file_get_fnoi rather than
	NtQueryInformationFile to collect a FILE_NETWORK_OPEN_INFORMATION block.
	* path.h (file_get_fnoi): Declare.
2011-12-13 11:54:28 +00:00
Corinna Vinschen 74365d9715 * times.cc (hires_ns::resolution): Don't return less than 1. 2011-12-13 11:38:12 +00:00
Christopher Faylor 8cb58e8566 * cygthread.h (cygthread::name): Very minor formatting tweak.
* exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging output.
* sigproc.h (cygwait): Call signal handler when signal is detected and loop as
appropriate.
* fhandler.h (fhandler_base_overlapped::wait_return): Remove overlapped_signal.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove restartable
signal accommodations in light of cygwait improvements.
(fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop behavior.
(fhandler_base_overlapped::raw_write): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
* fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
(fhandler_serial::raw_write): Ditto.
* fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
* ioctl.cc (ioctl): Add standard syscall introducer and leaver debug output.
2011-12-13 04:11:48 +00:00
Christopher Faylor a7ea1550ff * faq-using.xml: Remove obsolete entry about the standard console window.
* new-features.sgml: Remove obsolete entry which references cygwin.bat.
* setup-net.sgml: Clarify new shortcut behavior for the "Cygwin Terminal".
2011-12-13 03:54:59 +00:00
Corinna Vinschen 01ba99e8cd * fhandler_process.cc (dos_drive_mappings): Partially rewrite to
handle volumes mounted into juntion points correctly.
2011-12-12 21:38:08 +00:00
Keith Marshall 1e10d23a56 Correct makefile error; remove unnecessary FLAGS_TO_PASS macro 2011-12-12 20:02:33 +00:00
Corinna Vinschen 735415570a * fhandler_process.cc (dos_drive_mappings::dos_drive_mappings): Fully
resolve symbolic links returned by QueryDosDeviceW.  Explain why.
2011-12-12 17:27:18 +00:00
Corinna Vinschen 7a7a9e7179 * mount.cc (fs_info::update): Set has_buggy_reopen for Netapps as well. 2011-12-12 11:03:01 +00:00
Corinna Vinschen cdce73f183 * dcrt0.cc (wow64_respawn): New static variable.
(wow64_started_from_native64): New function to check if a WOW64
	process got started from a native 64 bit process.
	(respawn_wow64_process): New function to respawn process.
	(dll_crt0_0): When started from a native parent, check if parent
	is a 64 bit process.  If so, return early.
	(_dll_crt0): Respawn WOW64 process here if required.
	* init.cc (respawn_wow64_process): Remove.
	(dll_entry): Rename wow64_test_stack_marker to test_stack_marker.
	Drop WOW64 test here.
2011-12-12 10:16:53 +00:00
Christopher Faylor b11797ad17 * pipe.cc (fhandler_pipe::create): Use debug_printf to print debugging info
since this isn't a "syscall".
(pipe_worker): New function created from _pipe().
(_pipe): Use pipe_worker to create a pipe.  Use standard syscall strace
reporting on exit.
(pipe): Ditto.
(pipe2): Ditto.
2011-12-12 01:22:29 +00:00
Christopher Faylor fc25f200f4 * select.cc (select_stuff::wait): Very minor formatting fix.
(peek_windows): Report on HWND handle used in queries.
* select.h: Update copyright.
* sigproc.h (cygwait): Eliminate multi-argument variety since more general
implementation may cause odd problems in select.  Also force to always be
inline.
2011-12-11 01:25:20 +00:00
Keith Marshall 14bb21fe45 Correct defective configure checkin 2011-12-10 21:43:09 +00:00