summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/release
Commit message (Collapse)AuthorAgeFilesLines
* Return unique inode numbers when calling stat/fstat on pipes and IP socketsCorinna Vinschen2016-01-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fhandler.h (class fhandler_base): Convert unique_id to int64_t. (fhandler_base::set_ino): New protected inline method. (fhandler_base::get_unique_id): Convert to int64_t. (fhandler_base::set_unique_id): New inline method taking int64_t. (fhandler_pipe::fstat): Declare. (fhandler_pipe::init): Take extra parameter. (fhandler_pipe::create): Ditto. * fhandler_socket.cc (fhandler_socket::init_events): Set inode number to serial number. (fhandler_socket::fstat): Set device to DEV_TCP_MAJOR. Create st_ino from get_ino. * include/cygwin/signal.h (struct _sigcommune): Replace _si_pipe_fhandler with _si_pipe_unique_id. * pinfo.h (_pinfo::pipe_fhandler): Take unique id instead of HANDLE. * pinfo.cc (commune_process): Accommodate change to _si_pipe_unique_id. (_pinfo::commune_request): Ditto. (_pinfo::pipe_fhandler): Ditto. * pipe.cc (fhandler_pipe::init): Take unique id as argument and set inode number and unique_id from there. (fhandler_pipe::open): Rework to find any matching pipe from unique id in filename. (fhandler_pipe::get_proc_fd_name): Create filename using inode number. (fhandler_pipe::create): Generate and return unique id from process pid and pipe_unique_id. In outer method, call init with additional unique id as parameter. (fhandler_pipe::fstat): New method. (pipe_worker): Accommodate using 64 bit inode number in filename. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for previous commitCorinna Vinschen2016-01-091-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygpath: Try to return system directories with correct caseCorinna Vinschen2016-01-071-0/+4
| | | | | | | | | * cygpath.cc (do_sysfolders): Drop lame workaround to fix case of directory returned by GetSystemDirectoryW. Try to fix case of any path returned by this function in case it has to return a POSIX path to support case-sensitivity. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Convert utmp{x}name to int, return useful value. Define _PATH_UTMPXCorinna Vinschen2016-01-071-0/+3
| | | | | | | | | | | * syscalls.cc (utmpname): Convert to int. Return 0 if strdup worked, -1 otherwise. * include/utmpx.h (_PATH_UTMPX): Define as _PATH_UTMP. (utmpxname): Declare as int function. * include/sys/utmp.h (utmpname): Ditto. * include/cygwin/version.h: Bump API minor version. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* setfacl(1): Rewrite support for mask recomputationCorinna Vinschen2015-12-211-2/+4
| | | | | | | | | | | | | | | | * setfacl.cc (modacl): Move recomputing mask into new function. (check_got_mask): New function checking if mask is in input. (recompute_mask): New function to recompute mask. (addmissing): Align mask computation to Linux setfacl. (setfacl): Call check_got_mask and recompute_mask on Set, Delete and Modify actions. (usage): Rename --substitute to --set. (longopts): Add --set option. * utils.xml (setfacl): Rename --substitute to --set. * new-features.xml (ov-new2.4): Rephrase setfacl changes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for previous commitCorinna Vinschen2015-12-161-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add usertemp to 2.4.0 release textCorinna Vinschen2015-12-151-0/+3
|
* Allow cygwin_conv_path(3) and cygpath(1) to emit /proc/cygdrive prefixed pathCorinna Vinschen2015-12-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/sys/cygwin.h (CCP_PROC_CYGDRIVE): New flag. * mount.cc (mount_info::cygdrive_posix_path): Take flag values rather than just a trailing_slash_p bool. Emit /proc/cygdrive path if CCP_PROC_CYGDRIVE flag is given. (mount_info::conv_to_posix_path): Take flag values rather than just a keep_rel_p bool. Rename _p variables. Print flag value as hex in debug_printf. Call cygdrive_posix_path with flag values. * mount.h (mount_info::cygdrive_posix_path): Accommodate above change in declaration. (mount_info::conv_to_posix_path): Ditto. * fhandler_process.cc (format_process_exename): Accommodate change to mount_info::conv_to_posix_path. * path.cc (cygwin_conv_path): Ditto. * cygpath.cc (absolute_flag): Initialize to CCP_RELATIVE to simplify expressions. (cygdrive_flag): New global flag. (long_options): Add --proc-cygdrive option. (options): Add -U option. (usage): Add description for -U option. (do_sysfolders): Or cygdrive_flag to cygwin_conv_path call. (do_pathconv): Simply or absolute_flag to conv_func. Or cygdrive_flag to conv_func. (do_options): Initalize absolute_flag to CCP_RELATIVE. Initialize new cygdrive_flag. Set absolute_flag to CCP_ABSOLUTE on -a. Set cygdrive_flag to CCP_PROC_CYGDRIVE on -U. * new-features.xml (ov-new2.4): Document cygpath -U option. * utils.xml (cygpath): Ditto. * path.xml (func-cygwin-path): Add CCP_PROC_CYGDRIVE description. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for workaround added with previous commitsCorinna Vinschen2015-12-031-0/+7
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Belatedly create release notes for commits 2f4fef9 and 9471b0bCorinna Vinschen2015-11-271-0/+7
|
* Fix race condition when waiting for a signalCorinna Vinschen2015-11-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | * cygtls.h (_cygtls::wait_signal_arrived): Renamed from set_signal_arrived. (_cygtls::set_signal_arrived): New function signalling signal_arrived. (_cygtls::reset_signal_arrived): Don't reset will_wait_for_signal. (_cygtls::unwait_signal_arrived): New function only resetting will_wait_for_signal. (class wait_signal_arrived): Rename from set_signal_arrived. Accommodate name change throughout Cygwin. (wait_signal_arrived::~wait_signal_arrived): Call _cygtls::unwait_signal_arrived. Add comment. * cygserver_ipc.h (ipc_set_proc_info): Fetch signal_arrived handle via call to _cygtls::get_signal_arrived. * exceptions.cc (_cygtls::interrupt_setup): Signal signal_arrived via call to _cygtls::set_signal_arrived. (_cygtls::handle_SIGCONT): Ditto. * fhandler_socket.cc (fhandler_socket::wait_for_events): Generate WSAEVENT array prior to entering wait loop. Add cancel event object if available. Remove calls to pthread_testcancel and just call pthread::static_cancel_self if the cancel event object is signalled. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix numeric and monetary decimal point and thousands separator in fa_IR and ↵Corinna Vinschen2015-11-211-0/+3
| | | | | | | | | | | | | ps_AF locales * nlsfuncs.cc (setlocaleinfo): New macro calling __setlocaleinfo. (__setlocaleinfo): New function to set a locale-specific character to an explicit wchar_t value. (__set_lc_numeric_from_win): Handle fa_IR and ps_AF locales to return same decimal point and thousands separator characters as on Linux. (__set_lc_monetary_from_win): Ditto for monetary characters. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Mention strtold patch in Cygwin 2.4.0 release messageCorinna Vinschen2015-11-201-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Document new ACL codeCorinna Vinschen2015-11-181-0/+36
| | | | | | * new-features.xml (ov-new2.4): Add new ACL changes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* flock: Fix hang in object collision caseCorinna Vinschen2015-11-121-0/+5
| | | | | | | * flock.cc (lockf_t::create_lock_obj): Correctly recreate lock object attributes anew in each loop. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix crash at process init on 64 bit XP/2003 under WOW64Corinna Vinschen2015-11-121-0/+14
| | | | | | | | * init.cc (munge_threadfunc): Don't call NtQueryInformationThread with ThreadQuerySetWin32StartAddress info class on XP 64 and Server 2003 64. It crashes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Avoid deadlock in flock(2)Corinna Vinschen2015-11-051-0/+3
| | | | | | | | * fcntl.cc (fcntl64): Don't lock fd table when performing locking. * flock.cc (flock): Ditto. (lockf): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add missing release message for 68b4238f4a1276a1f6f18430580b62dfa0420ffdCorinna Vinschen2015-11-041-0/+3
|
* Add support for Parallels Desktop FS (prlfs)Corinna Vinschen2015-11-021-0/+2
| | | | | | | | | | | | | | | | | * mount.h (enum fs_info_type): Add prlfs (Parallels Desktop FS). (class fs_info): Add has_broken_fnoi flag. Implement prlfs FS flag. * mount.cc (fs_info::update): Handle PrlFS. Fill new has_broken_fnoi flag with life. (fs_names): Add prlfs. * globals.cc (ro_u_prlfs): Define. * path.h (path_conv::has_broken_fnoi): New method. * path.cc (symlink_info::check): Call file_get_fnoi utilizing new has_broken_fnoi filesystem flag. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Ditto. * new-features.xml (ov-new2.3): Document Parallels Desktop FS support. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Workaround bug in LocaleNameToLCID on Windows 10Corinna Vinschen2015-10-301-0/+3
| | | | | | | | * nlsfuncs.cc (__get_lcid_from_locale): Handle LocaleNameToLCID returning LOCALE_CUSTOM_UNSPECIFIED instead of failing in case of an unsupported locale on Windows 10. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix sigwait and pthread_kill return values in case of errorCorinna Vinschen2015-10-301-0/+4
| | | | | | | | * signal.cc (sigwait): Fix return value to reflect errno in case of error according to POSIX. Never return EINTR. * thread.cc (pthread_kill): Return errno if sig_send failed. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Check for correct funtion entry address in munge_threadfuncQian Hong2015-10-291-0/+3
| | | | | | | | * init.cc (munge_threadfunc): Check that we're actually replacing the correct original function address on the stack. * ntdll.h (enum _THREADINFOCLASS): Add ThreadQuerySetWin32StartAddress. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* strftime: Add support for %s (seconds since epoch)Brian Inglis2015-10-271-0/+2
| | | | | | | * libc/time/strftime.c (__strftime): add support for %s (seconds from Unix epoch). Fix whitespaces. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Export aligned_alloc, at_quick_exit, quick_exit.Corinna Vinschen2015-10-221-0/+2
| | | | | | | | | | | | * common.din (aligned_alloc): Export. (at_quick_exit): Export. (quick_exit): Export. * posix.xml (std-iso): New section. (std-deprec): Rearrange title text. * new-features.xml (ov-new2.3): Document aligned_alloc, at_quick_exit, Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Avoid SEGV when handling SIDs with 0 subauthoritiesCorinna Vinschen2015-10-221-0/+3
| | | | | | | * sec_helper.cc (cygsid::get_sid): Don't reject SIDs with missing subauthorities. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add release message for previous Cygwin patchCorinna Vinschen2015-10-221-0/+2
|
* Fix memory leak in pthread_getattr_npCorinna Vinschen2015-10-211-0/+2
| | | | | | | * thread.cc (pthread_getattr_np): Fix memory leak, remove usage of malloc for small local buffer. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix EIO error accessing certain (OS X SMB?) drivesCorinna Vinschen2015-10-211-0/+3
| | | | | | | * path.cc (symlink_info::check_reparse_point): Don't generate an EIO error if NtFsControlFile returns STATUS_NOT_A_REPARSE_POINT. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin 2.3.0: Add missing release messageCorinna Vinschen2015-09-081-0/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Allow sysconf to return CPU cache informationCorinna Vinschen2015-08-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/sys/unistd.h (_SC_LEVEL*): Add cache-related variables as on Linux. * fhandler_proc.cc (format_proc_cpuinfo): Fetch cache information from new cache functions in sysconf.cc, get_cpu_cache_intel and get_cpu_cache_amd. * sysconf.cc (__nt_query_system): New local helper. (get_nproc_values): Utilize __nt_query_system on pre-Windows 7 systems. Use GetLogicalProcessorInformationEx otherwise to handle more than 64 CPUs. Only handle _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN. (get_phys_pages): New helper to handle _SC_PHYS_PAGES. (cpuid2_cache_descriptor): New array to map Intel CPUID 2 descriptor values to cache type, cache size, associativity and linesize. (cpuid2_cache_desc_compar): Comparision function for bsearch over cpuid2_cache_descriptor. (get_cpu_cache_intel_cpuid2): New function to fetch cache info from Intel CPUID 2. (get_cpu_cache_intel_cpuid4): Ditto from Intel CPUID 4. (get_cpu_cache_intel): New function as CPU-specific entry point. (assoc): New array to map associativity values from AMD CPUID 0x80000006. (get_cpu_cache_amd): New function to fetch cache info from AMD CPUIDs 0x80000005 and 0x80000006. (get_cpu_cache): New function to fetch cache info. (sca): Call get_phys_pages if _SC_PHYS_PAGES is requested. Call get_cpu_cache for new _SC_* cache requests. (SC_MAX): Set to _SC_LEVEL4_CACHE_LINESIZE. (get_phys_pages(void)): Call get_phys_pages(int). * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * new-features.xml (ov-new2.3): Document sysconf cache addition. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement POSIX_MADV_WILLNEED/POSIX_MADV_DONTNEED for newer OSesCorinna Vinschen2015-08-271-0/+6
| | | | | | | | | | | | | | | | | | | * autoload.cc (DiscardVirtualMemory): Import. (PrefetchVirtualMemory): Import. * mmap.cc (posix_madvise): Actually implement POSIX_MADV_WILLNEED utilizing PrefetchVirtualMemory and POSIX_MADV_DONTNEED utilizing DiscardVirtualMemory on systems supporting them. * wincap.h (wincaps::has_broken_prefetchvm): New element. * wincap.cc: Implement above element throughout. (wincapc::init): Make sure has_broken_prefetchvm is only true on W10 under WOW64. * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2003. (CYGWIN_VERSION_API_MINOR): Reset to 0. * new-features.xml (ov-new2.3): New section, document posix_madvise POSIX_MADV_WILLNEED/POSIX_MADV_DONTNEED change. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* winsup.h: Claim Windows 10 supportCorinna Vinschen2015-08-251-0/+4
| | | | | | | * winsup.h (_WIN32_WINNT): Set to 0x0a00 for Windows 10. (WINVER): Ditto. Remove outdated comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix hang stracing forking processes but not following childCorinna Vinschen2015-08-241-0/+14
| | | | | | | | * ntdll.h (PROCESSINFOCLASS): Define ProcessDebugFlags. * sigproc.cc (child_info::child_info): Only propagate _CI_STRACED to child if strace is actually tracing child processes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Return port number from getservent in network byte orderCorinna Vinschen2015-08-181-0/+4
| | | | | | | * netdb.cc (parse_services_line): Convert port number to network byte order. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc: Drop including ucontext.h.Corinna Vinschen2015-08-181-0/+3
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Don't call LsaLookupSids if we're not utilizing Windows account DBsCorinna Vinschen2015-08-171-2/+3
| | | | | | | | | * grp.cc (internal_getgrfull): Drop asking caches. Explain why. (internal_getgroups): In case we're not utilizing the Windows account DBs, don't call LsaLookupSids but iterate over the group SIDs in the token and call internal_getgrsid for each of them. Explain why. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Improve 2.2.1 release notesCorinna Vinschen2015-08-151-9/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Try to fix potential data corruption in pipe writeCorinna Vinschen2015-08-151-0/+5
| | | | | | | | | | | | | | | * fhandler.cc (fhandler_base_overlapped::raw_write): When performing nonblocking I/O, copy user space data into own buffer. Add longish comment to explain why. * fhandler.h (fhandler_base_overlapped::atomic_write_buf): New member. (fhandler_base_overlapped::fhandler_base_overlapped): Initialize atomic_write_buf. (fhandler_base_overlapped::fhandler_base_overlapped): New destructor, free'ing atomic_write_buf. (fhandler_base_overlapped::copyto): Set atomic_write_buf to NULL in copied fhandler. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Don't perform RFC2307 account mapping without account DBCorinna Vinschen2015-08-141-0/+4
| | | | | | | | | * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Only try to map user and group info per RFC2307 if account info is fetched from Windows account DB. (convert_samba_sd): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix /proc/cpuinfo topology and cache size infoCorinna Vinschen2015-08-131-4/+6
| | | | | | | | | | | | | | | | * autoload.cc (GetLogicalProcessorInformationEx): Import. (SetThreadGroupAffinity): Import. * fhandler_proc.cc (add_size): New macro. (get_msb): New inline function. (mask_bits): Ditto. (format_proc_cpuinfo): Drop handling of old CPUs. Check if we're running on a OS version supporting porcessor groups. If so, use SetThreadGroupAffinity to set thread affinity. Improve cache info to include 3rd level cache on Intel CPUs. Improve multi core info. * wincap.h (wincaps::has_processor_groups): New element. * wincap.cc: Implement above element throughout. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Revert to leaving $HOME aloneCorinna Vinschen2015-08-101-0/+15
| | | | | | * uinfo.cc (cygheap_user::ontherange): Revert previous patch. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Fix x86_64 memcpy/memset for n > 2GBCorinna Vinschen2015-07-291-0/+4
| | | | | | | | | | | | | | | | https://cygwin.com/ml/cygwin/2015-07/msg00344.html: RtlFillMemory and RtlCopyMemory only work for size values up to 2GB. Fix this problem by using NetBSD code for memset and memcpy. Add entry points for memmove, wmemset, wmemmove, wmemcpy. Thanks to Roman Petrovski <RPetrovski@illumina.com> for pointing this out. * miscfuncs.cc (memset): x86_64 only: Implement in assembler. (memmove,memcpy): x86_64 only: Ditto. (wmemmove,wmemcpy): x86_64 only: Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygwin: Fix crashes under AllocationPreference=0x100000 conditionCorinna Vinschen2015-07-291-0/+3
| | | | | | | | | | | | | * cygtls.h: Include cygtls_padsize.h and define CYGTLS_PADSIZE there. * cygtls_padsize.h: New file. Define CYGTLS_PADSIZE. * environ.cc (parse_options): Fix NULL pointer access. * init.cc (threadfunc_fe): Do not force stack align on x86_64. * strace.cc (main2): Rename from main. (main): Make room for _cygtls area on stack and just call main2. Add comment to explain why. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Improve cygwin 2.2.0 release textCorinna Vinschen2015-07-231-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Ignore non-absolute $HOME when started from native processCorinna Vinschen2015-07-231-0/+3
| | | | | | | * uinfo.cc (cygheap_user::ontherange): Ignore $HOME if it's not starting with a slash (aka, absolute POSIX Path). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Implement siglongjmp and sigsetjmp functions.Corinna Vinschen2015-07-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | * libc/include/machine/setjmp.h (siglongjmp): Declare as function on Cygwin. (sigsetjmp): Ditto. (_longjmp): Mark as noreturn function on Cygwin. * common.din (siglongjmp): Export. (sigsetjmp): Export. * gendef: Change formatting of some comments. (sigsetjmp): Implement. (siglongjmp): Implement. (__setjmpex): x86_64 only: Drop entry point. (setjmp): x86_64 only: Store tls stackptr in Frame now, store MXCSR and FPUCW registers in Spare, as MSVCRT does. (longjmp): x86_64 only: Restore tls stackptr from Frame now, restore MXCSR and FPUCW registers from Spare. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * new-features.xml (ov-new2.2): Document sigsetjmp, siglongjmp. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add previous ldd fix to release fileCorinna Vinschen2015-07-201-0/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement getcontext, setcontext, makecontext, swapcontextCorinna Vinschen2015-07-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * common.din (getcontext): Export. (makecontext): Export. (setcontext): Export. (swapcontext): Export. * exceptions.cc (__unwind_single_frame): New static functions, 64 bit only. (setcontext): New function. (getcontext): New function. (swapcontext): New function. (__cont_link_context): New function. (makecontext): New function. * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2002. (CYGWIN_VERSION_API_MINOR): Bump. * include/ucontext.h (getcontext): Add prototype. (setcontext): Ditto. (swapcontext): Ditto. (makecontext): Ditto. * ntdll.h (NtContinue): Ditto. * new-features.xml (ov-new2.2): Add new section. Document getcontext, setcontext, makecontext, swapcontext. * posix.xml (std-deprec): Add getcontext, setcontext, makecontext, swapcontext. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* tzset: Check timezone and country case-insensitiveCorinna Vinschen2015-07-081-0/+4
| | | | | | * tzset.c (main): Check timezone and country case-insensitive. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement correct RLIMIT_STACK handlingCorinna Vinschen2015-07-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * miscfuncs.cc (struct pthread_wrapper_arg): Add member guardsize. (pthread_wrapper): Set thread stack guarantee according to guardsize. Tweak assembler code so that $rax/$eax is not required by GCC to prepare the wrapper_arg value. (CygwinCreateThread): Fix deadzone handling. Drop setting a "POSIX" guardpage (aka page w/ PAGE_NOACCESS). Always use Windows guard pages instead. On post-XP systems (providing SetThreadStackGuarantee) always set up stack Windows like with reserved/commited areas and movable guard pages. Only on XP set up stack fully commited if the guardpage size is not the default system guardpage size. Fill out pthread_wrapper_arg::guardsize. Improve comments. * resource.cc: Implement RSTACK_LIMIT Linux-like. (DEFAULT_STACKSIZE): New macro. (DEFAULT_STACKGUARD): Ditto. (rlimit_stack_guard): New muto. (rlimit_stack): New global variable holding current RSTACK_LIMIT values. (__set_rlimit_stack): Set rlimit_stack under lock. (__get_rlimit_stack): Initialize rlimit_stack from executable header and return rlimit_stack values under lock. (get_rlimit_stack): Filtering function to return useful default stacksize from rlimit_stack.rlim_cur value. (getrlimit): Call __get_rlimit_stack in RLIMIT_STACK case. (setrlimit): Call __set_rlimit_stack in RLIMIT_STACK case. * thread.cc (pthread::create): Fetch default stacksize calling get_rlimit_stack. (pthread_attr::pthread_attr): Fetch default guardsize calling wincap.def_guard_page_size. (pthread_attr_getstacksize): Fetch default stacksize calling get_rlimit_stack. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Remove. (PTHREAD_DEFAULT_GUARDSIZE): Remove. (get_rlimit_stack): Declare. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>