Commit Graph

5815 Commits

Author SHA1 Message Date
Christopher Faylor cf22fb91a1 * sigproc.cc (proc_terminate): Avoid releasing myself. 2012-03-28 17:28:27 +00:00
Corinna Vinschen 6680cb64f1 * times.cc (clock_setres): Set minperiod to period. 2012-03-28 07:38:35 +00:00
Corinna Vinschen cd24077999 * fhandler_process.cc (process_tab): Add entry for mountinfo.
(format_process_mountstuff): New function, derived from
	format_process_mounts.  Only open another user's user_info shared
	memory area if the process is owned by another user.  Actually
	access the opened shared user_info to get the right mount table.
	For other users, don't print remote cygdrive mount points.  Print
	mountinfo or mounts output depending on the bool mountinfo argument.
	(format_process_mounts): Just call format_process_mountstuff with
	mountinfo set to false.
	(format_process_mountinfo): Ditto with mountinfo set to true.

	* new-features.sgml (ov-new1.7.11): Add mountinfo.
2012-03-27 18:30:28 +00:00
Corinna Vinschen 4b6a427b0a * times.cc (clock_setres): Revert previous change. 2012-03-27 08:50:45 +00:00
Corinna Vinschen c2c7860fff * fhandler.h (class fhandler_dev_clipboard): Add fstat method.
* fhandler_clipboard.cc (cygcb_t): New type for Cygwin-specific
	clipboard format.
	(set_clipboard): Use new clipboard format to allow setting a timestamp.
	(fhandler_dev_clipboard::fstat): New method.  Read modification and
	access timestamp as well as length from clipboard data.
	(fhandler_dev_clipboard::read): Use new clipboard format.
2012-03-26 11:24:51 +00:00
Corinna Vinschen b54d64de05 * hires.h (hires_ms::dmsecs): Drop unused method.
* times.cc (JITTER): Remove.
	(gtod): Revert to process-local variable.
	(hires_ms::nsecs): Just return system time to disallow discrepancy with
	the OS.
	(hires_ms::resolution): Return coarsest timer value from OS.  Add
	comment to explain why.
	(clock_setres): Ditto.
2012-03-26 09:05:50 +00:00
Christopher Faylor d8a7ac6d18 * child_info.h: Reset magic number. 2012-03-21 17:23:57 +00:00
Christopher Faylor b7d95b5bb5 * child_info.h (child_info::postfork): Define new function.
* fork.cc (frok::parent): Call postfork to do all of the manipulation required
prior to calling pinfo::remember.
* pinfo.h (pinfo::set_rd_proc_pipe): Just set pinfo's rd_proc_pipe.  Don't
bother setting it to NULL.
* sigproc.cc (child_info_spawn::wait_for_myself): Call postfork to set up
myself for waiting.
* spawn.cc (child_info_spawn::worker): Avoid now-unnecessary global lock.
Consistently test mode rather than chtype when making wr_proc_pipe decisions.
Call postfork() to set up stuff prior to pinfo::remember.
2012-03-21 15:54:50 +00:00
Corinna Vinschen 5a519b88fa * cygtls.cc (well_known_dlls): Add advapi32.dll. 2012-03-21 10:42:24 +00:00
Christopher Faylor 6daf4afb11 * child_info.h: Reset magic number.
(child_info_spawn::wait_for_myself): Move function to sigproc.cc.
* pinfo.cc (is_toplevel_proc): Delete unneeded variable.
* sigproc.cc (child_info_spawn::wait_for_myself): Move function from header to
here.  Do all setup required to properly wait for top-level execed process to
exit.
* spawn.cc (child_info_spawn::worker): Attempt to properly handle _P_DETACH.
Set wr_proc_pipe if top-level process even when execing.  Just call
wait_for_myself() to...  wait for myself.  Don't call cleanup twice.
2012-03-21 05:23:13 +00:00
Christopher Faylor e102a69b3d * pinfo.cc (proc_waiter): Remove debugging. 2012-03-21 04:45:57 +00:00
Christopher Faylor 30fa154939 * dtable.cc (set_std_handle): Call SetStdHandle with NULL if fd is closed.
(dtable::release): "Close" standard handle if appropriate.
* dcrt0.cc (dll_crt0_0): Fix minor switch formatting problem.
* fork.cc (frok::parent): Make minor comment indentation change.
2012-03-20 23:13:40 +00:00
Corinna Vinschen c1c62a1368 * syscalls.cc (lseek): Fix debug output. 2012-03-20 20:39:32 +00:00
Corinna Vinschen 8ea7221511 * ntdll.h (SharedUserData): Add volatile qualifier. This fixes a
possible infinite loop in hires_ms::timeGetTime_ns.
2012-03-20 18:01:09 +00:00
Christopher Faylor 1fb6667f1c * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info::rd_proc_pipe): Declare new field.
(child_info::wr_proc_pipe): Ditto.
(child_info::prefork): Declare new function, derived from previous pinfo
version.
* dcrt0.cc (child_info_fork::handle_fork): Close previous wr_proc_pipe when
appropriate and assign new one from passed-in child_info block.
(child_info_spawn::handle_spawn): Assign our wr_proc_pipe handle from passed-in
child_info block.
* fork.cc (child_info::prefork): Define new function.
(frok::child): Clear rd_proc_pipe and wr_proc_pipe so they will not be closed
by the child_info destructor.
(frok::parent): Use child_info prefork handling, outside of retry loop.  Set
rd_proc_pipe in child's pinfo after successful CreateProcess.  Eliminate
postfork call.
* globals.cc (my_wr_proc_pipe): Define/declare new variable.
* pinfo.cc (pinfo::pending_rd_proc_pipe): Delete.
(pinfo::pending_wr_proc_pipe): Ditto.
(pinfo::prefork): Ditto.
(pinfo::postfork): Ditto.
(pinfo::postexec): Ditto.
(pinfo::wait): Assume that rd_proc_pipe is set up correctly prior to call.
(_pinfo::alert_parent): Replace "wr_proc_pipe" with "my_wr_proc_pipe".
* pinfo.h (_pinfo::_wr_proc_pipe): Delete declaration.
(_pinfo::set_rd_proc_pipe): Define new function.
(pinfo::pending_rd_proc_pipe): Delete declaration.
(pinfo::pending_wr_proc_pipe): Ditto.
(pinfo::prefork): Ditto.
(pinfo::postfork): Ditto.
(pinfo::postexec): Ditto.
(pinfo::wr_proc_pipe): Ditto.
* sigproc.cc (child_info::child_info): Clear rd_proc_pipe and wr_proc_pipe.
(child_info::cleanup): Close rd_proc_pipe and wr_proc_pipe if necessary.
(child_info_fork::child_info_fork): Set forker_finished to NULL by default.
(child_info_spawn::child_info_spawn): Use my_wr_proc_pipe rather than
myself->wr_proc_pipe.
(child_info::sync): Ditto.
(child_info_spawn::cleanup): Call child_info::cleanup.
* spawn.cc (child_info_spawn::worker): Remove call to myself.prefork().  Set
wr_proc_pipe when execing or set up new rd_proc_pipe/wr_proc_pipe via
child_info::prefork when spawning.  Remove call to pinfo::postexec.  Set
rd_proc_pipe in child pinfo when spawning.  Use my_wr_proc_pipe rather than
myself->wr_proc_pipe.  Remove call to postfork.
2012-03-20 15:07:30 +00:00
Christopher Faylor e9a6f9c625 * pinfo.cc (pinfo_init): Cosmetic change: unset "destroy" for myself.
(pinfo::wait): Change some comments.
(pinfo::prefork): Move a comment.
(pinfo::postfork): Set pending_*_pipe variables to NULL if closed.
(pinfo::postexec): Use right name when closing handle.
(_pinfo::alert_parent): Ditto.
* sigproc.h (hold_everything): Remove debugging label.
2012-03-20 02:08:14 +00:00
Christopher Faylor 33a6952b7f * cygserver_ipc.h: Include sigproc.h for signal_arrived declaration. 2012-03-19 20:18:18 +00:00
Christopher Faylor 374d215cca * cygprops.h: Use #pragma once.
* mkglobals_h: Ditto for generated globals.h file.
* globals.cc: Use specific NO_GLOBALS_H flag to control inclusion of globals.h.
* winsup.h: Honor NO_GLOBALS_H to control inclusion of globals.h.  Make
clear_procimptoken extern inline so that it is only defined when needed.
2012-03-19 17:49:40 +00:00
Corinna Vinschen d0d8b75350 * thread.cc (cancelable_wait): Don't malloc tbi, just make it a struct
on the stack to avoid memory leak.
2012-03-19 17:34:23 +00:00
Christopher Faylor d9492ab8d2 * pinfo.cc (pinfo::wait): Handle case where prefork was not called prior to
calling wait().  This is the case when we are reabsorbing processes after being
execed.
2012-03-19 16:51:30 +00:00
Christopher Faylor 4aeaedf961 * fork.cc (lock_signals): Move to sigproc.h.
(lock_pthread): Ditto.
(hold_everything): Ditto.
(frok::parent): Call myself.prefork() just before calling CreateProcess.  Call
myself.postfork () on function exit.
* pinfo.cc (pinfo::pending_rd_proc_pipe): Define.
(pinfo::pending_wr_proc_pipe): Ditto.
(_pinfo::dup_proc_pipe): Delete.
(pinfo::wait): Move pipe creation into pinfo::prefork.  Set pipe variables from
pending_*.
(_pinfo::sync_proc_pipe): Delete.
(_pinfo::proc_pipe_owner): Ditto.
(pinfo::prefork): Define new function.
(pinfo::postfork): Ditto.
(pinfo::postexec): Ditto.
(_pinfo::alert_parent): Remove obsolete call to sync_proc_pipe.
(_pinfo::dup_proc_pipe): Delete declaration.
(_pinfo::sync_proc_pipe): Ditto.
(pinfo::pending_rd_proc_pipe): Declare.
(pinfo::pending_wr_proc_pipe): Ditto.
(pinfo::prefork): Declare new function.
(pinfo::postfork): Ditto.
(pinfo::postexec): Ditto.
(pinfo::wr_proc_pipe): Define new wrapper function.
* sigproc.h: Include "sync.h".  Move locking functions from fork to here.
* spawn.cc (child_info_spawn::worker): Delete now-unneeded requirement to
record orig_wr_proc_pipe.  Call hold_everything prior to doing anything.  Call
myself.prefork() if spawning.  Replace wr_proc_pipe synchronization with call
to myself.postexec().  Call myself.postfork() if not execing.
* sync.h: Replace #ifdef wrapper with "#pragma once".
2012-03-16 20:20:29 +00:00
Corinna Vinschen b732246b87 * hookapi.cc (hook_or_detect_cygwin): Change condition when to use
importRVAMaxSize or importRVASize for the mapping size.  Make sure
	to map never more than the section size.  Change comments accordingly.
2012-03-13 17:15:28 +00:00
Corinna Vinschen d098f404d4 * include/netdb.h (h_errno): Add self-referencing macro and comment. 2012-03-13 09:13:02 +00:00
Christopher Faylor 3617fc8859 Christopher Faylor <me.cygwin2012@cgf.cx>
* fhandler.h (wait_return): Add overlapped_nullread.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Detect zero-byte
read as a special case.
(fhandler_base_overlapped::raw_read): Keep looping when zero-byte read detected
without EOF.
(fhandler_base_overlapped::raw_write): Quiet gcc warning by adding
overlapped_nullread to switch statement even though it will never actually be
hit.
2012-03-12 21:29:36 +00:00
Christopher Faylor 6c95669d23 * dtable.cc (fh_alloc): Treat pc.dev as unsigned.
* fhandler_console.cc (fhandler_console::set_unit): Use lock always to avoid
races between competing cygwin processes running on the console.
2012-03-10 17:51:33 +00:00
Corinna Vinschen e928291c63 * hookapi.cc (find_first_notloaded_dll): Fix a compiler warning. 2012-03-09 12:42:14 +00:00
Corinna Vinschen acb3c3e564 * hookapi.cc (rvadelta): Add parameter to return maximum available
size from start of import RVA table to end of section.
	(find_first_notloaded_dll): Take big executables into account.  Use
	offset and size computation as in hook_or_detect_cygwin, just simpler.
	(hook_or_detect_cygwin): Return NULL rather than false througout.
	Change computation of required mapping size to take non-gcc compilers
	into account.  Explain the differences and what we do against them.
	Don't alloca buf if fn is NULL.  Never use buf if fn is NULL.

	Fix name and address in previous ChangeLog entry.
2012-03-09 12:37:37 +00:00
Corinna Vinschen 3e25449aa5 * net.cc (call_gaa): New thread function to call GetAdaptersAddresses.
(get_adapters_addresses): Call call_gaa.  If necessary, call it as
	child thread.  Explain why that's necessary.
2012-03-08 16:02:44 +00:00
Corinna Vinschen efb1f061f1 * path.cc (readlink): Avoid calling strlen() twice. 2012-03-08 14:56:18 +00:00
Corinna Vinschen 75543537a1 * Throughout, replace usage of w32api's min with MIN from sys/param.h. 2012-03-08 09:36:11 +00:00
Christopher Faylor ab79e06445 * pinfo.cc (_pinfo::dup_proc_pipe): Reorganize to provide more information for
failing condition.
(pinfo::wait): Pass name of function to dup_proc_pipe.  Eliminate error check
for dup_proc_pipe since it never actually returned an error.
* pinfo.h (_pinfo::dup_proc_pipe): Add an argument.
* spawn.cc (child_info_spawn::worker): Pass name of function to dup_proc_pipe.
2012-03-07 17:09:37 +00:00
Corinna Vinschen 1d928241e1 * glob.cc (MAXPATHLEN): Reinstantiate with a value of 8192. 2012-03-07 10:12:28 +00:00
Corinna Vinschen 86b87ffa9b * pinfo.cc (_pinfo::dup_proc_pipe): Fix order of arguments in debug
output.
2012-03-05 12:12:10 +00:00
Corinna Vinschen 292cd759a1 * init.cc (dll_entry): Move wincap.init call back from here...
* dcrt0.cc (dll_crt0_0): ...to here.
2012-03-05 12:09:22 +00:00
Corinna Vinschen a3904c655e * cygheap.h (enum fcwd_version_t): Move here from path.cc.
(class fcwd_access_t): Ditto.  Only declare methods.
	(class cwdstuff): Move fast_cwd_ptr and fast_cwd_version from shared
	DLL section here.
	* path.cc: Keep fcwd_access_t method definitions.
	(fcwd_access_t::fast_cwd_version): New method.
	(find_fast_cwd_pointer): Change comment.  Mention test on W8CP.
	(cwdstuff::init): Initialize fast_cwd_ptr and fast_cwd_version.
2012-03-05 11:50:25 +00:00
Corinna Vinschen 75effa37fc * dll_init.cc (dll_list::operator[]): Extend comment a bit more to
explain previous patch.
2012-03-05 10:27:44 +00:00
Corinna Vinschen f5b0d9d414 * dll_init.cc (dll_list::alloc): Compare linked DLLs by basename only.
Explain why.  Add code to check if a DLL with the same basename but
	different path is the same DLL.  Bail out if not.
	(in_load_after_fork): New static NO_COPY bool to allow to differ
	between linked and loaded DLL at fork.
	(dll_list::load_after_fork): Set in_load_after_fork accordingly.
	(dll_dllcrt0_1): Don't treat DLL as linked if in_load_after_fork is set.
	Drop test for in_forkee.
2012-03-04 16:47:45 +00:00
Corinna Vinschen 50124fc056 * dll_init.cc: Revert pathname changes from 2012-02-08.
(dll_list::operator[]): Add long comment to explain the misery.
	(dll_list::alloc): Skip long pathname prefix potentially returned by
	GetModuleFileNameW.
	* dll_init.h (dll_list::find_by_modname): Add back declaration.
2012-03-04 13:50:12 +00:00
Corinna Vinschen cd78c479f4 * winver.rc: Bump copyright date. 2012-03-04 13:19:21 +00:00
Christopher Faylor bd7c945953 * fhandler_console.cc (fhandler_console::dup): Only set ctty when we haven't
specifically called setsid.
* fhandler_tty.cc (fhandler_pty_slave::dup): Ditto.  Also add comment
documenting research into rxvt problem.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Don't check specifically
for myself->ctty == -1.  Test for > 0 as that is the correct test.
(fhandler_termios::sigflush): Ditto.
2012-03-03 21:35:30 +00:00
Corinna Vinschen 56bed67046 * flock.cc (allow_others_to_sync): Reorder conditional expression to
check for DACL presence first, since otherwise dacl pointer value is
	undefined.  Add comment.
2012-03-02 17:20:11 +00:00
Corinna Vinschen b4ad7197fb * flock.cc (allow_others_to_sync): Use RtlGetDaclSecurityDescriptor
rather than accessing the SECURITY_DESCRIPTOR structure directly.
	Take no DACL and NULL DACL into account.
2012-03-02 17:07:17 +00:00
Corinna Vinschen 3118315f06 Fix typo in ChangeLog entry 2012-03-02 12:01:27 +00:00
Corinna Vinschen 109bc58303 * fhandler_console.cc (fhandler_console::input_tcsetattr): Revert
prevois patch.
	(fhandler_console::open_setup): Install Ctrl-C handler here, if this
	console is the controlling tty and the process hasn't been started by
	a Cygwin process.
2012-03-02 11:56:06 +00:00
Corinna Vinschen bfeed1643e * fhandler_console.cc (fhandler_console::input_tcsetattr): Set the
state of the Ctrl-C handler depending on the setting of
	ENABLE_PROCESSED_INPUT.
2012-03-02 10:17:16 +00:00
Eric Blake 580df3b6ae tcgetsid: fix return type
* include/sys/termios.h (tcgetsid): Fix return type.
* termios.cc (tcgetsid): Likewise.
* fhandler_termios.cc (fhandler_termios::tcgetsid): Likewise.
* fhandler.h (fhandler_base): Likewise.
* fhandler.cc (fhandler_base::tcgetsid): Likewise.
2012-02-28 14:03:03 +00:00
Corinna Vinschen d783d46cca * cygtls.cc (well_known_dlls): Add shlwapi.dll. 2012-02-28 09:44:14 +00:00
Corinna Vinschen 07a6b9dd22 * cygtls.cc (dll_cmp): New comparison function for bsearch.
(well_known_dlls): New array containing well-known DLLs.
	(_cygtls::call2): Add code for BLODA detection.
	* net.cc (fdsock): Ditto.
2012-02-27 11:55:27 +00:00
Corinna Vinschen 2c6df2a984 Drop "potentially" from latest ChangeLog entry. 2012-02-26 15:49:31 +00:00
Corinna Vinschen 97ad248f0c * environ.cc (enum settings): Add setbool. Rename justset to setdword
to avoid future problems.
	(struct parse_thing): Change all justset to setbool for bool variables.
	(parse_options): Add a case for setbool setting for bool variables
	since justset (now setdword) always writes a DWORD value, thus
	potentially overwriting adjacent memory locations.
	* external.cc (cygwin_internal): Drop extern declaration.
2012-02-26 15:47:43 +00:00
Corinna Vinschen b0af77452c * environ.cc (dos_file_warning): Drop declaration.
(ignore_case_with_glob): Ditto.
	(allow_winsymlinks): Ditto.
	(reset_com): Move definition to globals.cc.
	(struct parse_thing): Add "detect_bloda" option.
	* fhandler_serial.cc (fhandler_serial::open): Drop (incorrect)
	declaration of reset_com.
	* globals.cc (ignore_case_with_glob): Move definition into C++-only
	block.
	(dos_file_warning): Define.
	(allow_winsymlinks): Define.
	(reset_com): Define.
	(detect_bloda): Define.
	* path.cc (dos_file_warning): Drop definition here.
	(allow_winsymlinks): Drop definition here.
2012-02-26 14:01:32 +00:00
Corinna Vinschen dbf576fd86 * flock.cc (LOCK_DIR_NAME_FMT): Define.
(LOCK_DIR_NAME_LEN): Define.
	(LOCK_DIR_NAME_DEV_OFF): Define.
	(LOCK_DIR_NAME_INO_OFF): Define.
	(LOCK_OBJ_NAME_FMT): Define.  Add comment.
	(class lockf_t): Use bitsize-explicit types.  Declare from_obj_name,
	(class inode_t): Make use, unuse and inuse methods public.  Add a
	lock argument to get method declaration.
	(inode_t::get): Add lock argument.  Only lock node if lock arg is true.
	(inode_t::inode_t): Use LOCK_DIR_NAME_FMT as format string.
	(lockf_t::from_obj_name): New method to generate lockf_t content from
	lock event object basename.
	(inode_t::get_all_locks_list): Just call from_obj_name here and copy
	result into final lockf_t.
	(create_lock_obj_attr): Use LOCK_OBJ_NAME_FMT as format string.
	(create_lock_in_parent): New thread function to create lockf_t
	structure in parent process.
	(delete_lock_in_parent): New thread function to reap stale BSD locks in
	parent process.
	(lockf_t::create_lock_obj): Try to duplicate lock object handle into
	parent process and call create_lock_in_parent as parent remote thread.
	(lockf_t::del_lock_obj): Call delete_lock_in_parent as parent remote
	thread.
	(fhandler_disk_file::lock): Add lock arg to inode_t::get call.
2012-02-26 12:34:17 +00:00
Christopher Faylor 704bb69dcb * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 12. 2012-02-25 17:32:38 +00:00
Yaakov Selkowitz e587f14b6f * cygwin.din (scandirat): Export.
* posix.sgml (std-gnu): Add scandirat.
	* syscalls.cc (scandirat): New function.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/dirent.h (scandirat): Declare.
2012-02-22 01:58:24 +00:00
Corinna Vinschen 801bf9f272 * shared.cc (shared_info::init_obcaseinsensitive): Check actual state
of case sensitivity on post-Windows 2000 systems.
	* wincap.h (wincaps::kernel_is_always_casesensitive): New element.
	* wincap.cc: Implement above element throughout.
2012-02-21 17:03:51 +00:00
Corinna Vinschen 3c53eaeb5b * flock.cc (inode_t::del_my_locks): Drop useless counter lc. Close
lock object handle explicitely in case of called during fork.  Add
	comment to explain why.
	* fork.cc (frok::child): Drop declaration of fixup_lockf_after_fork.
2012-02-20 14:08:37 +00:00
Corinna Vinschen 2196614e3d * timer.cc (getitimer): Don't create another local ret variable in
timer_gettime calling branch.  Simplify conditional since timer_gettime
	always returns 0 or -1 anyway.
2012-02-17 17:34:01 +00:00
Corinna Vinschen 1cb1472404 * ntdll.h (struct _PEB): Add EnvironmentUpdateCount member.
* spawn.cc (child_info_spawn::worker): Speed up job recognition.  Expand
	comment to explain every little detail and so we never forget.
	* wincap.h (wincaps::has_program_compatibility_assitant): New element.
	* wincap.cc: Implement above element throughout.
2012-02-17 14:26:18 +00:00
Corinna Vinschen e86c278998 * mount.cc (get_disk_type): Drop unneeded toupper call. Convert case
constants to wide chars.
2012-02-17 14:17:12 +00:00
Corinna Vinschen 9de0461985 * autoload.cc (NetUseGetInfo): Define.
* fhandler_disk_file.cc (fhandler_cygdrive::opendir): Rename flptst
	to drive.  Call new get_disk_type function rather than is_floppy and
	check SMB drives with the NetUseGetInfo function.  Explain why.
	* mount.cc (get_disk_type): New function to evaluate disk type from
	native NT device name.
	(is_floppy): Remove.
	* mount.h (enum disk_type): Define.
	(get_disk_type): Declare.
	* path.h (is_floppy): Drop declaration.
2012-02-16 11:02:05 +00:00
Corinna Vinschen fb97e87479 * miscfuncs.cc: Revert change from 2012-02-13 which used the
Windows-provided stack rather than an own stack created in
	CygwinCreateThread.
	(struct thread_wrapper_arg): Rename commitsize to stacklimit.
	(CygwinCreateThread): Rename commitsize to real_stacklimit.
2012-02-15 21:34:06 +00:00
Corinna Vinschen 5e7c84e554 * dtable.cc (dtable::init_std_file_from_handle): Use tmp_pathbuf for
name.
	(handle_to_fn): Ditto for device.  Fix size in QueryDosDeviceW call.
2012-02-15 16:11:36 +00:00
Christopher Faylor a0f4e7d3f1 * smallprint.cc (tmpbuf): Declare new class holding a static buffer, protected
by a lock.
(__small_vsprintf): Use tmpbuf to hold large buffer.
(__small_vswprintf): Ditto.
2012-02-15 15:33:56 +00:00
Corinna Vinschen 5eb802f8ed * flock.cc (lf_setlock): Add timeout variable and set before calling
WFMO.  Drop debug output if process is not available.  Set timeout to
	0 instead.  Document timeout 0 in WFMO comment.
	(lf_getblock): Drop invalid F_POSIX lock type shortcut.  Only return
	overlap if event is not signalled.  Fix comment.
2012-02-15 14:43:07 +00:00
Christopher Faylor 1423a93374 . 2012-02-14 20:04:59 +00:00
Christopher Faylor 4eb5175d90 * pinfo.cc (_pinfo::set_ctty): Revert 2012-02-07 change to skip function if tty
in question == our ctty.
* syscalls.cc (setsid): Avoid two function calls.
* dtable.cc (dtable::dup_worker): Remove debugging.
* init.cc (search_for): Calculate for every new process rather than using
shared value.
(threadfunc_ix): Fill in for ever new process rather than sing shared value.
2012-02-14 19:08:20 +00:00
Corinna Vinschen 5401796acf * fhandler_disk_file.cc (fhandler_cygdrive::fstat): Don't bother to
set st_nlink correctly, just set it to 1 to avoid potential network
	timeouts.
2012-02-14 15:22:13 +00:00
Corinna Vinschen a8c8f19a43 * flock.cc (lf_setlock): Don't close waited lock object handle before
we own the node lock.  Fix comment.
2012-02-14 13:55:45 +00:00
Corinna Vinschen 8895d962d5 * cygheap.cc (init_cygheap::init_installation_root): Convert function
init_installation_root into a cygheap method.
	* cygheap.h (struct init_cygheap): Move installation_root,
	installation_key, and installation_key_buf from shared
	.cygwin_dll_common DLL section to cygheap.  Declare new method
	init_installation_root.
	* dtable.cc (handle_to_fn): Accommodate the move of installation strings
	to the cygheap.
	* external.cc (cygwin_internal): Ditto.
	* fhandler_console.cc (fhandler_console::open_shared_console): Ditto.
	* fhandler_mailslot.cc (fhandler_mailslot::get_object_attr): Ditto.
	* fhandler_tty.cc: Ditto, throughout.
	* mount.cc (mount_info::init): Ditto.
	* pipe.cc (fhandler_pipe::create): Ditto.
	* shared.cc: Ditto, throughout.
	(installation_root): Remove.
	(installation_key): Move to cygheap.
	(installation_key_buf): Ditto.
	(installation_root_inited): Remove.
	(SPIN_WAIT): Remove.
	(init_installation_root): Move to cygheap.
	(memory_init): Call cygheap->init_installation_root right after
	cygheap->user.init.  Drop call of init_installation_root function.
	* shared_info.h (init_installation_root): Drop declaration.
	(installation_root): Ditto.
	(installation_key): Ditto.
	* uinfo.cc (pwdgrp::load): Accommodate the move of installation strings
	to the cygheap.
2012-02-14 11:27:43 +00:00
Corinna Vinschen 78b5f9545d * thread.cc: Drop including unused headers. 2012-02-14 09:45:21 +00:00
Corinna Vinschen 722c69734d * miscfuncs.cc (struct thread_wrapper_arg): Convert char * to PBYTE.
Change related casts throughout.
	(thread_wrapper): Only do the thread change if the application provided
	the stack.  Otherwise, just use the Windows-provided stack.  Set up
	POSIX guardpage here, if necessary.  Move related comment from
	CygwinCreateThread here.
	(CygwinCreateThread): Never allocate and set up own stack here.  Just
	compute stack size to reserve and use value in CreateThread call if
	stack hasn't been provided by the application.
2012-02-13 15:23:03 +00:00
Corinna Vinschen d7bcd2a16f * Makefile.in (clean): Remove non-existant regexp dir.
* collate.h: New header.
	(__collate_range_cmp): Declare.
	(__collate_load_error): Define.
	* glob.cc: Pull in latest version from FreeBSD.  Simplify and reduce
	Cygwin-specific changes.
	* regex/regcomp.c: Include collate.h on Cygwin as well.
	(__collate_range_cmp): Move from here...
	* nlsfuncs.cc (__collate_range_cmp): ...to here.

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

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

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

	Handle user impersonation in /proc/registry access:
	* autoload.cc (RegOpenUserClassesRoot): Define.
	(RegOpenCurrentUser): Define.
	* fhandler_registry.cc (RegOpenUserClassesRoot): Declare function
	missing in w32api.
	(RegOpenCurrentUser): Ditto.
	(fetch_hkey): New function.
	(fhandler_registry::open): Call fetch_hkey to get root registry key.
	(open_key): Ditto.
2012-02-02 13:58:20 +00:00
Christopher Faylor 89c1003e78 Grr. Fix another typo. 2012-02-01 18:28:34 +00:00
Christopher Faylor 29b7448d58 * fcntl.cc (fcntl64): Add introductory debug statement. Call dup3 directory
via dtable method to avoid over-incrementing refcnt.
2012-02-01 17:38:07 +00:00
Christopher Faylor 8fa8b3a389 * dtable.cc (dtable::dup_worker): Add comment explaining why refcnt isn't
incremented here.
(dtable::dup3): Simplify slightly.  Add comment.
* syscalls.cc (dup3): Increment refcnt here, similarly to dup2.
2012-02-01 17:20:02 +00:00