Commit Graph

9357 Commits

Author SHA1 Message Date
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
Christopher Faylor 8a929d731f fix another typo in ChangeLog 2011-12-10 18:34:00 +00:00
Christopher Faylor 83ebb09239 * sigproc.h (cygwait): Delete duplicate va_start and add matching va_end. 2011-12-10 18:12:28 +00:00
Christopher Faylor bc1d321c57 Add ChangeLog entry for previous change and revert erroneously checked in
changes to dcrt0.cc and init.cc
2011-12-10 18:10:22 +00:00
Christopher Faylor dfbab81589 Clarify entry 2011-12-10 17:40:20 +00:00
Keith Marshall 51d406aaa7 Build system clean-up (phase 1) 2011-12-10 17:24:25 +00:00
Christopher Faylor c1dedea603 * exceptions.cc (ctrl_c_handler): YA in a series or reversions. Put back
_my_tls.remove along with a comment.
(sigpacket::process): Remove code which now causes a gdb deadlock.
* sigproc.cc (_cygtls::signal_exit): Signal debugger with signal number
earlier.
2011-12-10 01:33:56 +00:00
Christopher Faylor 83b25b0eb7 * dllfixdbg: Work around annoying gdb warning about missing .gnu_debuglink. 2011-12-09 17:46:12 +00:00
Christopher Faylor 57af01797e Rename cygWFMO to cygwait throughout and use the magic of polymorphism to "wait
for stuff".
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use simplified arg
form of cygwait.
* fhandler_console.cc (fhandler_console::read): Ditto.
* fhandler_audio.cc (fhandler_dev_dsp::Audio_out::waitforspac): Ditto.
(fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
* fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
* fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
(fhandler_serial::raw_write): Ditto.
* select.cc (cygwin_select): Ditto.
* sigproc.h (cygwait): Rename from cygWFMO.  Define two argument and single
argument forms of this function.
* fhandler_tty.cc (fhandler_pty_slave::open): Use method to query if tty is
open.
(fhandler_pty_slave::read): Send SIGHUP when master is detected as closed.
(fhandler_pty_common::close): Close input_available_event in callers since
master may need to signal it first.
(fhandler_pty_master::close): Lie and set input_available_event when closing,
then close input_available_event.
(fhandler_pty_slave::close): Close input_available_event explicitly here.
* tty.h (tty::is_master_closed): Declare new method.
2011-12-09 16:02:56 +00:00
Christopher Faylor aaaaefc090 Revert erroneous checkin 2011-12-09 06:57:21 +00:00
Christopher Faylor e35f1d1655 * sigproc.cc (signal_exit): Revert reversion of 2011-12-04 change since,
otherwise, you see hangs when the signal pipe is closed.
2011-12-09 06:49:10 +00:00
Christopher Faylor 8714982cef * select.cc (cygwin_select): Fifth time is the charm. 2011-12-09 03:19:41 +00:00
Christopher Faylor 203f973789 * select.cc (cygwin_select): Make sure that 0 is returned when sel.wait times
out.
2011-12-08 20:24:33 +00:00
Christopher Faylor 2398bcaea4 * include/sys/wait.h: Add in all c++ functions. 2011-12-08 18:24:24 +00:00
Christopher Faylor 53257dacae * select.cc (select_stuff::wait): Temporarily disallow APCS. 2011-12-08 07:03:14 +00:00
Christopher Faylor 263acfa613 * include/sys/wait.h: Ensure that C++ functions are only used when using C++. 2011-12-08 06:58:10 +00:00
Christopher Faylor 986da7853d * select.cc (cygwin_select): Make sure that poll is called when appropriate. 2011-12-08 06:49:56 +00:00
Christopher Faylor 5025bf330b * dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we're
dynamically loaded since fork() doesn't work in that scenario anyway.
(dll_dllcrt0_1): Don't accommodate dynamically loaded dlls.
* exceptions.cc (ctrl_c_handler): Don't lock the process; there's too much risk
of deadlock.
* sigproc.cc (_cygtls::remove_wq): Don't try to remove anything from the waitq
if there is obviously nothing there.
* strace.cc (strace::activate): Allow stracing dynamically loaded cygwin1.dll.
2011-12-08 06:17:49 +00:00
Christopher Faylor 069e637c0e * fhandler_termios.cc (tty_min::kill_pgrp): Don't send __SIGSETPGRP since
presumably we are already initialized.
2011-12-08 04:09:22 +00:00
Christopher Faylor d4f8245048 * select.cc (cygwin_select): Add common introducer and leaver debug output.
(select_stuff::poll): Remove unneeded debugging.
2011-12-07 23:14:47 +00:00
Christopher Faylor 13b4946d2a * exceptions.cc (ctrl_c_handler): Remove _my_tls.remove since it can cause
deadlocks during exec and will eventually be handled anyway.
2011-12-07 13:54:54 +00:00
Corinna Vinschen 47de562e7c * spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB
to all spawned processes.  Explain why.
2011-12-07 10:48:17 +00:00
Christopher Faylor 9bab9bfeb5 * fhandler_fifo.cc (fhandler_fifo::wait): Fix stupid typo and actually wait for
the handle.
2011-12-07 03:07:25 +00:00
Christopher Faylor 08d944e19f * sigproc.cc (close_my_readsig): New function.
(_cygtls::signal_exit): Close my_readsig via close_my_readsig(), avoiding
communication with the signal pipe.
(wait_sig): Close my_readsig via close_my_readsig().
2011-12-05 15:59:06 +00:00
Corinna Vinschen 8912b2e56f * mmap.cc (mlock): Replace LOCK_VM_IN_WSL with correct MAP_PROCESS.
(munlock): Ditto.
	* ntdll.h: Rearrange to have all preprocessor definitions at the start
	of the file.  Add comments to each definition block.
	(MAP_PROCESS): Rename from LOCK_VM_IN_WSL.
	(MAP_SYSTEM): Rename from LOCK_VM_IN_RAM.
2011-12-05 15:46:26 +00:00
Christopher Faylor 536e00784e correct name of function 2011-12-04 18:40:51 +00:00
Christopher Faylor 79e59d522a * sigproc.cc (cygWFMO): Don't assume that cancellable event is always
available.
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::waitforspace): Use cygWFMO
instead of WaitForMultipleObjects.
(fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
* fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
* fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
(fhandler_serial::raw_write): Ditto.
* fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
* select.cc (cygwin_select): Ditto for degenerate case.
2011-12-04 18:32:00 +00:00
Christopher Faylor 4510afa90d * sigproc.h (cygWFMO): Move inside "INSIDE_CYGWIN" #ifdef. 2011-12-04 18:15:36 +00:00
Christopher Faylor 8f937028d9 * exceptions.cc (exception::handle): Drop abbreviation for "exception" since I
never remember what it stands for.
(sig_handle_tty_stop): Remove obsolete call to sig_handle_tty_stop.
(_cygtls::call_signal_handler): Rework to grab signal information from
_main_tls if none is set for _my_tls.  Try harder to keep thread locked.
(reset_signal_arrived): Delete.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use new cygWFMO call
to wait for an event + standard cygwin stuff.  Modify debug output to
acccomodate new function.
* fhandler_console.cc (fhandler_console::read): Replace WaitForMultipleObjects
with cygWFMO.
* fhandler_socket.cc (get_inet_addr): Add comment.
* gendef (_sigdelayed): Remove call to reset_signal_arrived.
* sigproc.cc (_cygtls::signal_exit): Don't close my_readsig here unless we're
in the signal thread.
(create_signal_arrived): Create signal_arrived as auto-reset so that only one
thread is woken when a signal arrives.
* sigproc.h (cygWFMO): New function.
(reset_signal_arrived): Delete declaration.
2011-12-04 17:58:24 +00:00
Christopher Faylor 69864e48cb * mmap.cc (mlock): Add standard syscall return value debugging output.
(munlock): Ditto.
(posix_madvise): Ditto.
* signal.cc: Remove obsolete sigcatchers stuff throughout.
(sigaction_worker): Add function name parameter and use it to show standard
syscall return value debugging output.  Also add fault protection.
(sigaction): Accommodate extra argument to sigaction_worker.
(siginterrupt): Ditto.
* syscalls.cc (read): Remove obsolete sigcatchers stuff.
(readv): Ditto.
2011-12-03 23:55:21 +00:00
Christopher Faylor 6455755743 fix incorrectly named file in old ChangeLog entry 2011-12-03 23:49:03 +00:00
Corinna Vinschen 447354e13c * mmap.cc (mlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Drop
outdated comment.  Call NtLockVirtualMemory with LOCK_VM_IN_WSL flag.
	(munlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE.  Call
	NtUnlockVirtualMemory with LOCK_VM_IN_WSL flag.
2011-12-03 23:03:15 +00:00
Christopher Faylor b9aa81491f Throughout, remove extra space after function name from debugging output.
Throughout, change syscalls to report on return values using new %R format
option.
* smallprint.cc (__small_vsprintf): Add parsing for %R to report on return
values and possible errno from syscalls.
* errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
* fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use
shorter name to reduce debuggging output.
* select.cc (start_thread_pipe): Ditto.
(start_thread_serial): Ditto.
(start_thread_socket): Ditto.
(start_thread_mailslot): Ditto.
* sigproc.cc (talktome): Ditto.
2011-12-03 21:43:27 +00:00
Corinna Vinschen 8b25478267 * fhandler.cc (fhandler_base::open): Fix comment a bit more. 2011-12-03 20:35:36 +00:00
Corinna Vinschen 5687f6834a * fhandler.cc (fhandler_base::open): Fix typos in comment. 2011-12-03 14:21:30 +00:00
Corinna Vinschen 71148bfcd5 * Makefile.in (cygpath.exe): Add -luserenv to ALL_LDFLAGS.
* cygpath.cc: Throughout, use cygwin_conv_path WIN_W rather than WIN_A
	conversion.
	(get_long_path_name_w32impl): Remove.
	(get_long_name): Drop pre-Windows 2000 accommodations.  Just call
	GetLongPathNameW here directly.
	(get_special_folder): Convert first parameter to WCHAR buffer pointer.
	Drop conversion of result from WCHAR * to char *.
	(do_sysfolders): Accommodate change to get_special_folder and only
	convert result to char * last.  Drop pre-Windows 2000 accommodations
	and just call GetProfilesDirectoryW directly.  Replace call to
	GetWindowsDirectoryW with call to GetSystemWindowsDirectoryW.
	Just call GetShortPathNameW directly.
	(do_pathconv): Simplify buffer handling.
2011-12-02 16:15:26 +00:00
Corinna Vinschen a887cf0ef5 * path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
Allow all types of CCP conversions.  Accommodate throughout.
	(cygwin_conv_path): Use current ANSI or OEM codepage for WIN_A
	conversions, depending on current file API codepage setting.
	(cygwin_conv_path_list): Allow all CCP conversion types.
	* include/sys/cygwin.h (CCP_CONVTYPE_MASK): Add to cygwin_conv_path_t
	enum for convenience.
2011-12-02 16:06:10 +00:00
Corinna Vinschen 13a20f9565 * mkgroup.c: Drop support for NT4 domains.
* mkpasswd.c: Ditto.
	(psx_dir): Remove.
	(current_user): Drop support for -m option.  Use $HOME as is since it's
	a POSIX path anyway.
	(enum_users): Drop support for -m option.
	(usage): Mention -m option as ignored.
	(main): Drop support for -m option.  Mark ignored options as deprecated.
	* utils.sgml (mkpasswd): Remove description of -m option.
2011-12-01 13:06:13 +00:00
Chris Sutcliffe 1aca2cb5f4 2011-11-30 Ozkan Sezer <sezero@users.sourceforge.net>
* include/io.h (_wfindfirst, _wfindnext, _wfindfirst32, _wfindnext32,
        _wfindfirsti64, _wfindnexti64, _wfindfirst32i64, _wfindfirst64i32,
        _wfindnext32i64, _wfindnext64i32, _wfindnext64): Update to use intptr_t.
2011-12-01 00:24:35 +00:00
Chris Sutcliffe 21224765f1 2011-11-30 Earnie Boyd <earnie@users.sourceforge.net>
* include/stdio.h (getc, putc, getchar, putchar, fopen64, ftello64): Add
        function definitions to fix warnings when building GCC.
2011-12-01 00:13:52 +00:00
Chris Sutcliffe a1690e62ab 2011-11-30 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
* tlssup.c (__dyn_tls_init): Reapply patch from 3105314.

        Thank you to Earnie for creating the patch file.
2011-11-30 23:49:46 +00:00
Christopher Faylor 26bb3098fd * sigproc.cc (get_proc_lock): Remove extra NULL check. Return false on
failure.
2011-11-29 17:41:01 +00:00
Christopher Faylor 6a28849237 * sync.cc: Fix comment.
* dll_init.cc (dll_list::reserve_space): Use %p rather than %lx to show
reserved space.
2011-11-29 17:26:57 +00:00
Christopher Faylor 480b13a37a * sigproc.cc (remove_proc): Don't terminate the currently executing thread. 2011-11-29 15:34:49 +00:00
Christopher Faylor 806e25759b fix older description 2011-11-29 05:38:12 +00:00
Corinna Vinschen c1af7c27eb * locale.cc (print_locale_with_codeset): Fetch Windows path as UNICODE
path and convert that to POSIX.
2011-11-28 17:58:48 +00:00
Corinna Vinschen 8ae61a8d6c * external.cc (fillout_pinfo): Store program name as POSIX path in
ep.progname_long.
2011-11-28 17:53:18 +00:00
Corinna Vinschen c47ec78d7a * ps.cc: Remove all Win 9x considerations. Use psapi functions
directly.  Drop support for older Cygwin DLLs.  Just use progname_long
	as is since it's already a POSIX path now.  Rename "tty" to "pty" as in
	the Cygwin DLL.  Call setlocale to make sure wcstombs does the right
	thing according to the current locale.
	* Makefile.in (ps.exe): Link against psapi.dll.
2011-11-28 17:49:56 +00:00
Corinna Vinschen 9c29e82edb * pinfo.cc (pinfo::exit): Call TerminateProcess to avoid potential
busy loop in ntdll.dll when calling ExitProcess. Only call ExitProcess
	as a fallback.
2011-11-28 16:00:07 +00:00
Christopher Faylor 0e5d7582d5 * init.cc (dll_entry): Revert previous change since it caused inexplicable fork
problems.
2011-11-27 19:00:33 +00:00
Keith Marshall 1b60bb36b0 Clean up DIRENT errno handling; make it more POSIX conformant. 2011-11-26 22:12:51 +00:00
Christopher Faylor d8e7e40416 * init.cc (remove): Don't bother calling through thread removal cleanup if we
are exiting.
2011-11-26 19:20:13 +00:00
Christopher Faylor 4ab568c60c * exceptions.cc (stackdump): Make global.
(signal_exit): Move to sigproc.cc.
* sigproc.cc (signal_exit): Move here.  Declare stackdump extern.  Set
my_sendsig to indicate that signals are no longer available.
(my_readsig): Make Static again.
(sig_send): Interpret ERROR_BROKEN_PIPE as ESRCH.  Remove special-case EACCESS
errno setting, just setting errno generally, even for "its_me" case.
2011-11-26 19:14:22 +00:00
Christopher Faylor 1d04c4c6c3 * exceptions.cc (sigpacket::process): Move signal_exit processing into...
(_cygtls::signal_exit): ...here.  Close my_readsig and comment on why.
* pinfo.cc (pinfo::exit): Move sigproc_terminate earlier.  Set exiting flag in
lock_process.
* sigproc.cc (my_readsig): Make global.
* sync.cc (muto::exiting_thread): Delete.
(muto::acquire): Delete #if 0'ed code.
* sync.h (muto::exiting_thread): Delete.
(set_exiting_thread): Ditto.
(lock_process::lock_process): Don't worry about setting the exiting thread
since it had no meaning.
2011-11-26 02:35:49 +00:00
Christopher Faylor 505bce274f * strace.cc (attach_process): Use NT_SUCCESS to figure out if
NtSetInformationProcess succeeded.
(handle_output_debug_string): Put back DebugActiveProcess since it seems to
still be needed (on my system at least).  Detect new format
_STRACE_INTERFACE_ACTIVATE_ADDR which informs whether this is a forked process
or not.  Use that to decide if forkdebug should be handled.
2011-11-24 21:54:41 +00:00
Christopher Faylor e553226cfa missed this in previous checkin 2011-11-24 21:38:17 +00:00
Christopher Faylor ef8bff85be * cygthread.h (cygthread::name): Default name to "main" if we are early in the
process of setting up the DLL and no name is known.
* dcrt0.cc (initial_env): Remove CYGWIN_SLEEP stuff.
(get_cygwin_startup_info): Activate strace here as appropriate.
(dll_crt0_0): Move get_cygwin_startup_info as early as possible to avoid
missing strace output.
* fork.cc (frok::child): Move debugging statement to point where ppid will be
set.
* pinfo.cc (pinfo::thisproc): Remove obsolete call to strace.hello.  Tweak
debug output slightly.
* select.cc (select_stuff::wait): Allow APCS to be triggered while waiting
since we use them now.  Report when that happens.
* sigproc.cc (child_info::child_info): Use strace.active() rather than
strace.attached().
* spawn.cc (child_info_spawn::worker): Only write strace child pid when we know
it's a cygwin process.  Accommodate change to write_child argument list.
* strace.cc (strace::hello): Delete.  Move functionality...
(strace::activate): ...to here.
(mypid): Just use raw GetCurrentProcessId () if myself isn't set.
(strace::write_childpid): Don't wait for subproc_ready.  Remove arg which was
required for it.
* include/sys/strace.h (strace::hello): Delete.
(strace::write_childpid): Delete first argument.
2011-11-24 21:36:53 +00:00
Christopher Faylor 8942ed09ac * child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.
* dcrt0.cc (get_cygwin_startup_info): Signal readiness when stracing since
strace::write_child relies on it.  Use strace.activate to notify strace
process, passing in arg indicating whether we're forked.
* sigproc.cc (wait_sig): Accommodate new strace::activate argument.
* spawn.cc (child_info_spawn::worker): Oops.  Previous suspended test was
actually correct.  Revert and document.
* strace.cc (strace::activate): Send additional flag indicating whether this is
an attempt to activate a forked process.
(strace::hello): Report on windows pid.
* include/sys/strace.h (strace::strace): Make a dummy.
(strace::activate): Modify declaration to accept an argument.
(strace::write_childpid): Set regparm.
2011-11-24 02:17:55 +00:00
Christopher Faylor 5f38ec4681 * pipe.cc (fhandler_pipe::create): Avoid derefencing a NULL pointer.
* child_info.h (child_info): Reorganize some elements so that the ones which
are initialized in a constructor are all together.
* sigproc.cc (child_info::child_info): Initialize values via the constructor
rather than as C statements and make sure that flags is set to zero initially.
* spawn.cc (child_info_spawn::worker): Use iscygwin() test for determining when
to send strace info since it is more foolproof than checking the suspend state.
2011-11-23 21:58:43 +00:00
Christopher Faylor 9f65451e3e * fhandler.h (fhandler_pipe::create): Rename from the misnamed
"create_selectable".  Change return to DWORD.
(fhandler_pty_common::pipesize): New constant.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect create_selectable
name change.
* miscfuncs.cc (CreatePipeOverlapped): Ditto.
* pipe.cc (fhandler_pipe::create): Ditto.
(fhandler_pipe::create): Rename from the misnamed "create_selectable".  Return
DWORD.  Only set pipe size to default when it is passed in as zero.
* fhandler_tty.cc (fhandler_pty_master::setup): Ditto.  Use
fhandler_pty_common::pipesize rather than a raw constant.
* tty.cc (tty::not_allocated): Ditto.
* sigproc.cc (sigproc_init): Use create_selectable to create the signal pipe to
get a more appropriate message based pipe.
2011-11-23 18:56:57 +00:00
Christopher Faylor cc07096c5c * sigproc.cc (remove_proc): Don't do busy loop when exiting since it doesn't
matter.
2011-11-21 21:09:33 +00:00
Christopher Faylor 15660c23ab * sigproc.cc (remove_proc): Don't do busy loop when execing since thread could
have been terminated prior to setting flag.
* signal.cc (sigwaitinfo): Zero event before closing to signal other threads
that it is no longer available.
2011-11-21 19:13:30 +00:00
Corinna Vinschen 8b0e312bf1 * faq-using.xml (faq.using.weirdchars): Rewrite. 2011-11-21 09:16:23 +00:00
Corinna Vinschen c5785504f8 * shared.cc (get_shared_parent_dir): Use global shared_parent_dir
instead of local dir variable and create handle not inheritable to
	avoid accumulating stray handles in child processes.
	(get_session_parent_dir): Ditto with session_parent_dir variable.
2011-11-18 17:38:04 +00:00
Corinna Vinschen 6a8a9ad8d8 * faq-using.xml (faq.using.converting-paths): Remove reference to
cygwin.bat.
	(faq.using.emacs): Drop "CYGWIN=tty" setting.
	* pathnames.sgml (pathnames-posixdevices): Align list of device names
	with changes in 1.7.10.
	* setup2.sgml (setup-env-ov): Drop text which assumes that Cygwin
	processes are started in console window.  Align wording to lessened
	relevance of $CYGWIN.  Don't use dropped CYGWIN setting in example.
	(setup-locale-how): Put using console and Cygwin.bat file into
	perspective.
	(setup-locale-problems): Ditto.
2011-11-18 11:39:31 +00:00
Corinna Vinschen 4cc465db9a * shared.cc (shared_info::create): Open global shared data section
non-inheritable to avoid accumulating stray handles in child processes.
2011-11-17 22:08:14 +00:00
Christopher Faylor 7b2740dda3 * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(cygheap_exec_info::nchildren): Move from child_info_spawn.
(cygheap_exec_info::cchildren): Ditto.
(cygheap_exec_info::record_children): Declare new function.
(cygheap_exec_info::reattach_children): Ditto.
(cygheap_exec_info::alloc): Ditto.
(child_info_spawn::nchildren): Move to cygheap_exec_info.
(child_info_spawn::cchildren): Ditto.
* sigproc.cc (cygheap_exec_info::alloc): Define new function.
(child_info_spawn::cleanup): Accommodate move of children info to
cygheap_exec_info.
(cygheap_exec_info::record_children): Define new function.
(cygheap_exec_info::reattach_children): Ditto.
(child_info_spawn::record_children): Use cygheap_exec_info function to
accomplish this task.
(child_info_spawn::reattach_children): Ditto.
* spawn.cc (child_info_spawn::worker): Allocate moreinfo using
cygheap_exec_info::alloc.
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Use abort for the error to
avoid a retry.
2011-11-16 04:09:33 +00:00