Commit Graph

9313 Commits

Author SHA1 Message Date
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
Christopher Faylor f32d96ff99 * pinfo.cc (_pinfo::dup_proc_pipe): Fatalize a warning when debugging. 2011-11-14 18:22:46 +00:00
Christopher Faylor 07e7349db2 * strace.cc (handle_output_debug_string): Disable code which attempted to add
stuff in between '****' blocks since they no longer are the first thing output
by an straced process.
2011-11-14 17:31:20 +00:00
Christopher Faylor 18eaa70b5b Remove erroneously checked-in debugging statements.
* cygheap.cc (cygheap_fixup_in_child): Here.
* debug.cc (delete_handle): Here.
* sigproc.cc (child_info_spawn::cleanup): Here.
* spawn.cc (child_info_spawn::worker): Here.
2011-11-14 01:45:42 +00:00
Christopher Faylor 466e694855 update copyrights 2011-11-14 01:37:02 +00:00
Christopher Faylor 56a1971526 Throughout use "have_execed" macro rather than "hExeced" global handle.
Throughout rename _PROC_* to _CH_*.
* child_info.h: Include "pinfo.h".
(child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with similarly
named constants.
(_PROC_*): Delete unneeded aliases.
(PROC_*): Ditto.
(CURR_CHILD_INFO_MAGIC): Ditto.
(cchildren): Define using "pinfo_minimal".
(child_info::set_saw_ctrl_c): Move to
(child_info_spawn::set_saw_ctrl_c): Here.
(child_info_spawn::lock): New field.
(child_info_spawn::hExeced): Ditto.
(child_info_spawn::ev): Ditto.
(child_info_spawn::~child_info_spawn): Move to sigproc.cc.
(child_info_spawn::child_info_spawn): Ditto.
(child_info_spawn::cleanup): Declare new function.
(child_info_spawn::set_saw_ctrl_c): Move to this class.  Set flag only when
execed and return true when we have set the flag.
(child_info_spawn::child_info_spawn::signal_myself_exited): New function.
(child_info_spawn::wait_for_myself): Ditto.
(child_info_spawn::has_execed_cygwin): Ditto.
(child_info_spawn::has_execed): Ditto.  Replaces "hExeced" test.
(child_info_spawn::operator HANDLE&): New operator.
(child_info_spawn::worker): Define old "spawn_guts" as class member.
(ch_spawn): Declare.
(have_execed): Define.
(have_execed_cygwin): Ditto.
* cygheap.h: Update comment.
* dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums.
(child_info_spawn::handle_spawn): Ditto.
(dll_crt0_0): Ditto.
(multiple_cygwin_problem): Ditto.
* exceptions.cc (chExeced): Delete obsolete declaration.
(ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global.
* globals.cc (hExeced): Delete.
* pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for consistency in
handle naming when -DDEBUGGING.
(pinfo::init): Accommodate case where myself.h is known but h0 is passed in.
(pinfo::pinfo): New constructor for setting up a pinfo passed in by previous
exec'or.
(pinfo::proc_waiter): Don't handle subprocess if we're in the process of
exiting due to an exec of a cygwin process.  Don't close rd_proc_pipe here.
Close it when we actually are finished with the process.  Use new
ch_spawn.signal_myself_exited function to let exec stub know that subprocess
has exited.
(pinfo::wait): Clarify debugging output.
(pinfo::release): Use "close_h" to close all handles to avoid races.
(winpids::add): Assume that elements of the array do not need to be zeroed and
are properly initialized or suffer problems on pinfo::release.  Don't close
hProcess since release does that now.
* pinfo.h: Update comment.
(pinfo_minimal): Move some elements from pinfo here so that child_info_spawn
can use them.
(pinfo): Inherit from pinfo_minimal.
(pinfo::pinfo): Modify to accommodate new pinfo_minimal.
(pinfo::allow_remove): New function.
* sigproc.cc (proc_subproc): Use boolean values for true/false.  Implement
PROC_EXEC_CLEANUP.
(proc_terminate): Set ppid = 1 since the procs list will only be iterated when
the process has not execed.  Don't do any cleanup here since it is now handled
in pinfo::release.
(sigproc_init): Initialize sync_proc_subproc earlier.
(child_info::child_info): Assume that all important fields are properly
initialized and avoid memset().
(child_info_spawn::child_info_spawn): Specifically test for execing and then
set up appropriate fields in the struct.
(child_info_spawn::cleanup): Define new function.
(child_info_spawn::record_children): Specifically test for being execed here.
Fill in pinfo_minimal part of children array.
(child_info_spawn::reattach_children): Use constructor to duplicate information
for previous exec'or.  Add more debugging output.
(remove_proc): Force deletion of thread when exiting due to exec.  Rely on
pinfo::cleanup in release.
* sigproc.h (PROC_EXEC_CLEANUP): New enum.
(PROC_DETACHED_CHILD): Delete.
* spawn.cc (chExeced): Delete.
(child_info_spawn::worker): Rename from spawn_guts.  Use elements of
child_info_spawn throughout rather than ch.whatever.  Use ::cygheap to refer to
global rather than element of child_info.  Use wait_for_myself() rather than
waitpid().  Call child_info_spawn::cleanup on function return.
(spawnve): Reflect movement of spawn_guts functionality into
child_info_spawn::worker.
* syscalls.cc (popen): Ditto.
* winsup.h (spawn_guts): Delete declaration.
2011-11-14 01:29:49 +00:00
Corinna Vinschen 3fe1d750ba * new-features.sgml (ov-new1.7.10): Document ptsname_r. 2011-11-08 09:25:25 +00:00
Corinna Vinschen 84e9145ca4 * posix.sgml (std-gnu): Add ptsname_r. 2011-11-08 09:24:58 +00:00
Christopher Faylor 926014453f * fhandler.h (__ptsname): New macro.
* dtable.cc (decode_tty): Use __ptsname to generate the slave pty name.
* fhandler_tty.cc (fhandler_pty_master::ptsname_r): Ditto.
* bsdlib.cc: Add needed includes for openpty() changes.
(openpty): Use __ptsname to generate the slave pty name.  Close slave fd when
aslave == NULL.
2011-11-08 06:26:15 +00:00
Christopher Faylor 5d46c490dd * include/cygwin/stdlib.h: Update copyright. 2011-11-08 05:50:18 +00:00
Christopher Faylor 65a6152f18 * cygwin.din (ptsname_r): Export.
* fhandler.cc (fhandler_base::ptsname_r): Define.
* fhandler.h (fhandler_base::ptsname): Delete.
(fhandler_base::ptsname_r): Declare.
(fhandler_pty_master::ptsname_r): Declare.
* fhandler_tty.cc (fhandler_pty_master::ptsname): Delete.
(fhandler_pty_master::ptsname_r): New reentrant function derived from previous
ptsname.
* syscalls.cc (ptsname_r): Implement new function with functionality similar to
Linux.
(ptsname): Use ptsname_r () to fill out buf.
* include/cygwin/stdlib.h (ptsname_r): Declare.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 255 to reflect
export of ptsname_r.
* pinfo.cc (pinfo::wait): Return bool rather than int.
* pinfo.h (info::wait): Ditto.
(pinfo::reattach): Define !defined(_SIGPROC_H) case for consistency.
* sigproc.cc (child_info_spawn::reattach_children): Use correct dwProcessId
rather than pid when duplicating handle.
2011-11-07 20:05:49 +00:00
Corinna Vinschen 78942629ac * fhandler.cc (CHUNK_SIZE): Drop NO_COPY. 2011-11-07 10:06:45 +00:00
Corinna Vinschen 28fa2a72f8 * syscalls.cc (check_dir_not_empty): Check surplus directory entries
by calling NtQueryAttributesFile.  Make STATUS_DIRECTORY_NOT_EMPTY
	return value dependent on its status code.  Add long comment to explain.
	(unlink_nt): Add comment to explain flaw in checking the sharing mode.
	Set status to STATUS_SUCCESS instead of 0.  Add a retry loop to setting
	the delete disposition and trying to move a directory to bin to
	workaround rare cases of lingering, already deleted subdirectory
	entries.  Add long comment to explain.
	(rename): Set status to STATUS_SUCCESS instead of 0.
2011-11-07 10:03:30 +00:00
Christopher Faylor f6ba9446ed * pinfo.cc (status_exit): Recognize STATUS_ILLEGAL_INSTRUCTION.
(child_info::proc_retry): Ditto.
2011-11-05 18:47:39 +00:00
Jon TURNEY cd561fdb8b * faq-using.xml (faq.using.fixing-fork-failures): Add new FAQ.
* overview2.sgml (ov-hi-process-problems): Describe some difficulties
	in implementing fork()
2011-11-05 18:42:55 +00:00
Christopher Faylor 481b6ac0c8 * pinfo.cc (status_exit): Return complete error code. Handle
STATUS_ACCESS_VIOLATION correctly.
(pinfo::set_exit_code): Set self->exitcode directly from status_exit.
2011-11-05 18:29:51 +00:00
Christopher Faylor 26601df44c * pinfo.h (pinfo::reattach): Only set destroy to false when proc_subproc
succeeds.  Return true for success.
* sigproc.cc (child_info_spawn::reattach_children): Try harder to clean up on
error by detecting reattach failures too.
2011-11-04 17:07:21 +00:00
Christopher Faylor 705d704153 * sigproc.cc (child_info_spawn::reattach_children): Clean up handle when can't
open parent process or suffer handle leak.
2011-11-04 16:52:43 +00:00
Christopher Faylor f4bb53c4e0 * sigproc.cc (child_info::sync): Report on exit code in strace output.
(child_info::proc_retry): Don't consider STATUS_ACCESS_VIOLATION as a
restartable event.
2011-11-03 21:44:05 +00:00
Christopher Faylor 277753c80e * sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an error when
we can't duplicate from "parent" since it is probably ok if children of the
previous owner of the pid disappear.
2011-11-03 18:48:27 +00:00
Corinna Vinschen 516fbf67a0 * fhandler.cc (off_current): Define local in fhandler_base::raw_write.
Drop erroneous NO_COPY, add _RDATA to make R/O.
	(off_append): Ditto.
	* globals.cc (_RDATA): Move definition from here...
	* winsup.h: ...to here.
2011-11-03 17:47:33 +00:00
Christopher Faylor 7295e35690 Remove erroneous entry. 2011-10-30 05:21:07 +00:00
Christopher Faylor cd071d1363 * fhandler.h (fhandler_pipe::create_selectable): Remove optional argument, take
an options argument for CreateNamedPipe/CreateFile.  Change handle arguments to
expect pointers.
(fhandler_fifo::fifo_state): Delete.
(fhandler_fifo::dummy_client): Ditto.
(fhandler_fifo::open_nonserver): Ditto.
(fhandler_fifo::wait_state): Ditto.
(fhandler_fifo::raw_write): Ditto.
(fhandler_fifo::read_ready): New field.
(fhandler_fifo::write_ready): Ditto.
(fhandler_fifo::wait): Modify argument.
(fhandler_fifo::fifo_name): Add a new argument.
(fhandler_fifo::fixup_after_fork): New function.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove initialization of
expunged elements.  Initialize new handles to NULL.
(fhandler_fifo::open_nonserver): Delete.
(fnevent): New macro for creating a named event.
(fnpipe): New macro for creating a unique named pipe name.
(create_pipe): New macro for simplification of named pipe creation.
(fhandler_fifo::fifo_name): Use new argument when creating a shared name.
(fhandler_fifo::open): Rewrite.  Use events to synchronize.
(pure_debug_printf): New macro, active only when DEBUGGING.
(fhandler_fifo::wait): Rewrite to wait for new fifo events which are supplied
as a parameter.
(fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect
client-side disconnect.
(fhandler_fifo::raw_write): Delete.
(fhandler_fifo::close): Remove accommodations for expunged fields.  Close event
handles.
(fhandler_fifo::dup): Remove accommodations for expunged fields.  Duplicate
event handles.
(fhandler_fifo::fixup_after_fork): New function.  Perform fixups on event
handles.
(fhandler_fifo::set_close_on_exec): Remove accommodations for expunged fields.
Set inheritance for new handle fields.
* miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in
fhandler_pipe::create_selectable.
* tty.cc (tty::not_allocated): Ditto.
* pipe.cc (fhandler_pipe::create): Ditto.
(fhandler_pipe::create_selectable): Accept an extra open_mode argument.  Pass
arguments by reference and allow opening one end of the pipe at a time.
* sys/strace.h (debug_only_printf): Define new macro which calls debug_printf
only when DEBUGGING is defined.
2011-10-30 04:50:36 +00:00
Christopher Faylor 673a691372 * exceptions.cc (sigpacket::process): Avoid a potential deadlock when exiting
due to a signal.
2011-10-28 17:32:38 +00:00
Corinna Vinschen 8b5e267bb8 * new-features.sgml (ov-new1.7.10): Document getgrouplist. 2011-10-28 09:27:18 +00:00
Corinna Vinschen 0c1d8aaaf1 * cygwin.din (getgrouplist): Export.
* grp.cc (get_groups): New static function to run the core functionality
	of initgroups and getgrouplist.
	(initgroups32): Call get_groups and just create supplementary group
	list in cygheap.  Rename name of first argument to "user".  Add an
	assertion to test for a NULL user name.
	(initgroups): Rename name of first argument to "user".
	(getgrouplist): New function.
	* posix.sgml (std-bsd): Add getgrouplist.
	* include/cygwin/grp.h (getgrouplist): Declare.
	* include/cygwin/version.h: Bump API minor number.
2011-10-28 09:26:42 +00:00
Christopher Faylor b79b15e9e3 * child_info.h (cchildren): New struct.
(child_info_spawn::nchildren): Rename from nprocs.
(child_info_spawn::children): Change type to cchildren for more bookkeeping
possibilities.
(child_info_spawn::child_info_spawn): Clear nchildren.
(child_info_spawn::record_children): Declare new function.
(child_info_spawn::reattach_children): Ditto.
* dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to gather
list of processes we are potentially waiting for.
* pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
(pinfo::reattach): New function.
* sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
(get_proc_lock): Don't bother with a lock during DLL initialization.
(proc_subproc): Handle PROC_REATTACH_CHILD.
(proc_terminate): Orphan children only when we are not an execed process or
when the pid is about to be occupied by a non-cygwin process.
(child_info_spawn::record_children): Define new function.
(child_info_spawn::reattach_children): Ditto.
* sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
elements.
* spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if about to
exec a cygwin process.
* sigproc.cc (sig_send): Fix harmless transposition of fifth and six arguments
to DuplicateHandle().
(child_info::child_info): Ditto.
* globals.cc (hExeced): Make NO_COPY.
2011-10-26 19:42:39 +00:00
Corinna Vinschen be2280986d * hookapi.cc (hook_or_detect_cygwin): Take additional handle
to a file mapping as parameter.  If this handle is not NULL,
	create another file mapping for the IAT.
	* spawn.cc (av::fixup): Only map the first 64K of an image and
	keep the mapping handle to use as argument to hook_or_detect_cygwin.
	* winsup.h (hook_or_detect_cygwin): Add mapping handle as default
	parameter in declaration.
2011-10-25 16:35:58 +00:00
Corinna Vinschen 53e93974c8 * syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status
value in case setting the delete disposition returns with
	STATUS_DIRECTORY_NOT_EMPTY.
2011-10-24 14:02:32 +00:00
Corinna Vinschen b3480fbefb * shared.cc (open_shared): Fix memory reservation of essential shared
memory regions.  Drop delta computations since delta is always 0 in
	non-relocated case.  Add a comment.
2011-10-24 09:19:58 +00:00
Christopher Faylor 31d2bedc58 * fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for testing
ReadFile return.
* pipe.cc (fhandler_pipe::create_selectable): Open the write side of the pipe
in message-mode to force writing as "chunks".  Explain why.
2011-10-23 19:01:47 +00:00
Christopher Faylor 1f012519e4 * path.cc (path_conv::get_nt_native_path): Avoid dereferencing path when it is
NULL.
2011-10-23 17:19:17 +00:00
Christopher Faylor 6ae28c2263 * dtable.cc (dtable::delete_archetype): Improve debugging output.
(dtable::init_std_file_from_handle): Close console handle early, before
initialization.  Build up openflags for passing to open_setup, just to be safe.
(last_tty_dev): New variable.
(fh_last_tty_dev): New macro.
(fh_alloc): Try again to keep track of previously opened tty, this time by just
saving the device and using that to potentially open an archetype.  Avoid
setting the "/dev/tty" name if the creation of the fhandler failed.
(build_fh_pc): Remove unused second argument.  Reorganize how and where the
name is set.  Set last_tty_dev as appropriate.  Avoid a NULL dereference in a
debug printf.
* dtable.h (build_fh_pc): Reflect removal of second parameter.
* fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc since it
preserves any potentially previously set name.
(fhandler_base::set_name): Ditto.
* fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate new
fhandler, primarily to make sure that pc field is properly zeroed.
(fhandler_termios::last): Eliminate.
(fhandler_termios): Remove setting of last.
(fhandler_base::~fhandler_termios): Ditto.
* fhandler_console.cc (fhandler_console::open): Don't make decisions about
opening close-on-exec handles here since it makes no sense for archetypes.
(fhandler_console::init): Assume that input handle has already been opened.
* fhandler_termios.cc (fhandler_termios::last): Delete.
* path.h (path_conv::eq_worker): New function.  Move bulk of operator = here.
(operator <<): New function.
(operator =): Use eq_worker to perform old functionality.
2011-10-22 16:26:30 +00:00
Corinna Vinschen 22e671336e * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Check invalid
success only on Samba shares.
	* mount.cc (fs_info::update): Drop has_buggy_basic_info flag for
	NcFsd.
	* syscalls.cc (unlink_nt): Fix typo in comment.
2011-10-21 17:43:00 +00:00
Christopher Faylor 2cd3283c8f Check in missing ChangeLog entry. 2011-10-21 12:24:58 +00:00
Corinna Vinschen 69178ca038 * globals.cc (ro_u_ncfsd): New R/O unicode string.
* mount.cc (fs_info::update): Check for "NcFsd" FS.  Set flags and
	change comments accordingly.
	(fs_names): Add entry for NcFsd FS.
	* mount.h (enum fs_info_type): Add ncfsd.
	(class fs_info): Add ncfsd flag and accessor methods.
	* path.h (class path_conv): Add fs_is_ncfsd method.
	* syscalls.cc (unlink_nt): Experimentally try delete-on-close on NcFsd
	in STATUS_CANNOT_DELETE case.
2011-10-21 08:29:19 +00:00
Christopher Faylor b2099ee728 * fhandler.h (fhandler*::copyto): Free path_conv strings first.
* path.h (cfree_and_null): Rename and expand from cfree_maybe.
(path_conv &operator =): Call free_strings rather than freeing strings
directly.
2011-10-20 21:35:59 +00:00
Christopher Faylor 38d732a152 Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.
* devices.cc: Regenerate.
* dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we opened.
(build_fh_pc): Preserve any existing name.
* fhandler.cc (fhandler_base::open_with_arch): Ditto.
* fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the name to
/dev/ptmx while preserving other pty master device information.
* path.h (cfree_maybe): New macro.
(path_conv::operator =): Free any allocated strings in target.
(path_conv::free_strings): Delete unused function.
* sigproc.cc (proc_terminate): Remove previous accommodation for execed
processes since it didn't have the desired effect.  Change comment to a FIXME.
* spawn.cc (chExeced): Mark NO_COPY.
(exe_suffixes): Ditto.
2011-10-20 14:02:54 +00:00
Corinna Vinschen aa982024d1 * syscalls.cc (try_to_bin): Improve debug output.
(check_dir_not_empty): Take additional path_conv argument.  Improve
	debug output.  Change syscall_printf to debug_printf.
	(unlink_nt): Improve debug output.  Change syscall_printf to
	debug_printf.
	(unlink): Change syscall_printf to debug_printf.

	* cygthread.h: Fix copyright dates.
2011-10-20 10:59:01 +00:00
Corinna Vinschen 53609fd238 * path.cc: Extend two comments. Mention the name RtlpCurDirRef
for reference.
2011-10-18 08:47:08 +00:00
Christopher Faylor ce68abe0b4 * dcrt0.cc (dll_crt0_1): Copy argv before passing to main(). 2011-10-17 18:25:04 +00:00
Christopher Faylor e4257c7366 * sigproc.cc (proc_terminate): Avoid setting ppid to 1 if we're execing. 2011-10-17 15:35:26 +00:00
Christopher Faylor 23771fa1f7 * cygerrno.h (__set_errno): Modify debugging output to make searching strace
logs easier.  Throughout, change /dev/tty* to /dev/pty*.  Throughout, add flags
argument to fhandler_*::dup methods.
* devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN.  Add /dev/ptymN
devices for pty masters.
* devices.cc: Regenerate.
* devices.h (MAX_CONSOLES): Set to max number supported by devices.in.
(fh_devices::FH_PTMX): Rename from FH_PTYM.
(device::operator int): Return by reference.
* dtable.cc (fh_alloc): Take pc as an argument rather than just the device.
This makes debugging easier since more information is available.  Actually
implement handling for already-allocated pty master devices.  Make different
decisions when generating fhandler for not-opened devices.  Add kludge to deal
with opening /dev/tty.
(cnew_no_ctor): New macro.
(build_fh_pc): Make debugging output more verbose.  Use new clone() fhandler
interface to duplicate archetypes.  Reset last term opened.
(dtable::dup_worker): Use Use new clone() fhandler interface to duplicate
archetypes.  Pass flags to child dup handler.
(dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr.
* fhandler.cc (fhandler_base::reset): Rename from operator =() and reduce
functionality and sense of copy direction.
(fhandler_base::open_with_arch): Use published interface to query io_handle().
Use new copyto() fhandler method to copy from/to found archetype.
* fhandler.h: Throughout, delete size(), add copyout, clone, and fhandler_*
(void *) methods.
(fhandler_base::reset): Rename from operator =().
(fhandler_termios::is_dev_tty): Delete.
(fhandler_termios): change "protected" region to "private".
(fhandler_termios::is_dev_tty): Delete.
(fhandler_termios): Rearrange protected/public.
(fhandler_termios::fhandler_termios): Remember last fhandler_termios "opened".
(fhandler_termios::~fhandler_termios): Forget last fhandler_termios opened.
(ioctl): Rename from ioctl_termios.  Take a void * argument.  Reflect argument
change in pinfo::set_ctty.
(fhandler_console::dup): Declare new function.  Set ctty here if appropriate.
(fhandler_pty_master::from_master): Privatize.
(fhandler_pty_master::to_master): Ditto.
(fhandler_pty_master::dwProcessId): Ditto.
(fhandler_pty_master::fhandler_pty_master): Add an `int' argument.
(fhandler_pty_master::open_setup): Declare new function.
(fhandler_pty_master::~fhandler_pty_master): Declare new method.
(fhandler_nodevice): Remove commented out function declaration.
* fhandler_console.cc: Use get_ttyp() instead of tc() throughout.
(fhandler_console::dup): Define new function to set controlling ctty on dup, as
appropriate.
(fhandler_console::ioctl): Reflect ioctl_termios name change.
(fhandler_console::setup): Rename from get_tty_stuff.
(fhandler_console::open_setup): Reflect argument change in pinfo::set_ctty.
(fhandler_console::fhandler_console): Set _tc here.
* fhandler_termios.cc (handler_termios::ioctl): Rename.  Take a void * arg like
other ioctl functions.
* fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to
potentially reset the controlling terminal.
(fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios.
(fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument.  Call setup()
here so that we will know the unit number of this fhandler as soon as possible.
Set the unit as appropriate.
(handler_pty_master::open): Move most stuff to constructor and open_setup.
(handler_pty_slave::open_setup): Reflect argument change in pinfo::set_ctty.
(handler_pty_master::open_setup): Define new function.
(fhandler_pty_master::cleanup): Clear handles as a flag that the destructor
does not have to do "close" operations.
(fhandler_pty_master::close): Ditto.
(fhandler_pty_master::~fhandler_pty_master): Define new method.
(fhandler_pty_master::ioctl): Reflect name/arg change for ioctl_termios.
(fhandler_pty_master::setup): Allocate tty here.  Rely on handles being
returned from allocated test rather than opening them here.  Avoid setting
_need_nl here since it is already zeroed in the constructor.  Set up device
information with DEV_TTYM_MAJOR.
* path.h (path_conv &operator =): Take a const argument.
(path_conv::dup): Ditto.
(pathconv_arg::PC_OPEN): New enum.
(pathconv_arg::PC_CTTY): Ditto.
(path_types::PATH_CTTY): Ditto.
(path_types::PATH_OPEN): Ditto.
(path_conv::isopen): New method.
(path_conv::isctty_capable): Ditto.
* path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as appropriate.
* pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle.
* syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty on
non-std* handles.
* tty.cc (tty_list::allocate): Pass out handles for allocated tty.  use
`not_allocated' to find unallocated ttys.  Avoid keeping the lock since the
allocation of the tty should be sufficient to prevent multiple access.
(tty::not_allocated): Clarify comment.  Rename.  Return handles when an unused
tty is found.  Simply test for existing tty.
(tty::exists): Rewrite to use `not_allocated'.
* tty.h (NTTYS): Reset down to actual number supported by devices.in.
(tty::not_allocated): Declare new function.
(tty_list::allocate): Pass out read/write tty handles.  Zero them when not
found.
* fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX.
* pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in.
* pinfo.cc (pinfo::set_ctty): Ditto.  Just use tc() built into the passed-in
fhandler_termios pointer.  Return true if ctty is assigned.
* syscalls.cc (open): Call build_fh_pc with PC_OPEN flag.  Set PC_CTTY if
appropriate.
(stat_worker): Remove is_dev_tty () stuff.
2011-10-15 22:37:30 +00:00
Corinna Vinschen a9cc13a8e0 * fhandler_process.cc (dos_drive_mappings::fixup_if_match): Convert
native NT network paths into DOS UNC paths.
2011-10-15 19:13:57 +00:00
Corinna Vinschen c52fd6cd47 * sec_auth.cc (get_token_group_sidlist): Add CONSOLE LOGON SID on
systems supporting it.  Never add SERVICE SID but keep code in for
	future reference.  Explain why.
	(get_priv_list): Add cygpsid pointer parameter.  Point it to the
	mandatory integrity SID which matches account and privileges.
	(create_token): Fetch mandatory integrity SID from call to
	get_priv_list.
	(lsaauth): Call get_priv_list with additional NULL pointer.  Change
	comment accordingly.
	* sec_helper.cc (well_known_console_logon_sid): New static SID.
	(cygpriv): Change to structure containing extra flag to store info
	about required integrity level.
	(privilege_luid): Accommodate changes to cygpriv.  Return integrity
	level in new high_integrity parameter.
	(privilege_name): Accommodate changes to cygpriv.
	(set_privilege): Drop trailing \n from debug output.
	(set_cygwin_privileges): Don't set SE_CREATE_GLOBAL_PRIVILEGE anymore
	since it's just not needed, but keep code in for future reference.
	Change comment accordingly.
	* security.h (well_known_console_logon_sid): Declare.
	(privilege_luid): Align declaration to above change.
	* wincap.h (wincaps::has_console_logon_sid): New element.
	* wincap.cc: Implement above element throughout.
2011-10-15 16:31:57 +00:00