Commit Graph

10977 Commits

Author SHA1 Message Date
Corinna Vinschen cb2ab5fd01 Cygwin: Return port number from getservent in network byte order
* netdb.cc (parse_services_line): Convert port number to network byte
        order.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-18 13:12:07 +02:00
Corinna Vinschen f9f3d44f27 exceptions.cc: Drop including ucontext.h.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-18 11:09:25 +02:00
Corinna Vinschen 4cb24051f4 Don't call LsaLookupSids if we're not utilizing Windows account DBs
* 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>
2015-08-17 22:45:02 +02:00
Corinna Vinschen 88dce3abd8 Try harder to avoid LDAP access for RFC2307 mapping
* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Rearrange
        to fall back to myself uid/gid in case we don't utilize Windows
        account DBs, just as prior to 1.7.34.
        * sec_helper.cc (cygpsid::get_id): Disable Samba user/group mapping per
        RFC2307 if we're not utilizing Windows account DBs.
        * security.cc (convert_samba_sd): Revert previous patch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-17 20:24:49 +02:00
Corinna Vinschen 37b6936f8b Fix /proc/cpuinfo topology info on newer AMD CPUs
* fhandler_proc.cc (format_proc_cpuinfo): Handle AMDs providing
        extended topology info in CPUID leaf 0x8000001e.  Fix handling of
        AMD CPUs providing extended legacy core info in CPUID leaf 0x80000008.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-17 16:35:41 +02:00
Orgad Shaneh ede983934c mkglobals_h: Handle CRLF earlier.
When globals.cc has CRLF line endings, winsup.h is not removed, and
	compilation fails for duplicate definitions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-17 11:05:43 +02:00
Corinna Vinschen 861a27db66 Support cpb and eff_freq_ro power mgmt flags in /proc/cpuinfo
* fhandler_proc.cc (format_proc_cpuinfo): Print cpb and eff_freq_ro
        power management flags.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-17 10:04:33 +02:00
Corinna Vinschen b5f56ec286 Cygwin: Improve 2.2.1 release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-15 13:32:31 +02:00
Corinna Vinschen 344860a104 Cygwin: Try to fix potential data corruption in pipe write
* 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>
2015-08-15 12:30:09 +02:00
Corinna Vinschen 36d500e425 Fix copy/paste error in previous patch
* security.cc (convert_samba_sd): Fix copy/paste error in previous
	patch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-14 21:55:42 +02:00
Corinna Vinschen 5de7f2e6c3 Don't perform RFC2307 account mapping without account DB
* 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>
2015-08-14 21:41:37 +02:00
Corinna Vinschen c19f1b9f8e Evaluate all group perms in ACL to emulate POSIX user perms
* security,cc (get_attribute_from_acl): Merge all group perms into
        user perms if user is member of group.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-14 10:10:34 +02:00
Corinna Vinschen e0d48debed Fix /proc/cpuinfo topology and cache size info
* 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>
2015-08-13 17:59:47 +02:00
Corinna Vinschen 1e15b46737 miscfuncs.cc: Fix comment preceeding x86_64 memset and friends.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-10 12:07:22 +02:00
Corinna Vinschen 1641a85e8f Revert to leaving $HOME alone
* uinfo.cc (cygheap_user::ontherange): Revert previous patch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-10 12:00:12 +02:00
Jon TURNEY 49380b7ee3 Improve FAQ answer on debugging Cygwin
Improve FAQ answer on debugging Cygwin to mention the cygwin-debuginfo package
and the gdb command 'set cygwin-exceptions on'.

2015-08-03  Jon Turney  <jon.turney@dronecode.org.uk>

	* faq-programming.xml: Improve debugging-cygwin answer.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-08-05 20:17:55 +01:00
Corinna Vinschen 09d458b5c7 Bump Cygwin DLL minor number.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-03 21:46:55 +02:00
Corinna Vinschen fe24411770 strace: Handle ofile descriptor more carefully.
Fix coverity CIDs 128250 - 128252

        * strace.cc (main2): Don't call setvbuf on NULL descriptor.
        Explicitely fclose ofile.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-03 12:02:17 +02:00
Corinna Vinschen 7666b3634b Cygwin: Fix x86_64 memcpy/memset for n > 2GB
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>
2015-07-29 22:09:34 +02:00
Corinna Vinschen d32ea61ae4 cygwin: Fix copyright dates
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-29 13:45:46 +02:00
Corinna Vinschen 6ab56bdd3f cygwin: Fix crashes under AllocationPreference=0x100000 condition
* 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>
2015-07-29 13:32:29 +02:00
Corinna Vinschen 03c8afda17 Improve cygwin 2.2.0 release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-23 21:19:43 +02:00
Corinna Vinschen be8183701a Fix potential buffer overflow in makecontext trampoline
glibc's tst-makecontext2 testcase uncovered a bug in
	__cont_link_context.  If the function misses to reserve
	shadow space for the calls to setcontext/cygwin_exit,
	both functions could overwrite memory beyond the stack
	configured in uc_stack.

        * exceptions.cc (__cont_link_context): x86_64: align stack and reserve
        shadow space for subsequent function calls, otherwise suffer potential
        buffer overflow.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-23 20:25:22 +02:00
Corinna Vinschen 1e80973f28 Ignore non-absolute $HOME when started from native process
* 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>
2015-07-23 17:42:07 +02:00
Corinna Vinschen 7c96ab0b43 Cygwin: Implement siglongjmp and sigsetjmp functions.
* 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>
2015-07-21 17:31:02 +02:00
Corinna Vinschen b723ec272e Add previous ldd fix to release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-20 18:43:16 +02:00
Corinna Vinschen 23ad79d7de Fix potential hang in ldd if DLL encounters missing entry point
* ldd.cc (STATUS_DLL_NOT_FOUND): Drop definition.
        (report): Handle STATUS_ENTRYPOINT_NOT_FOUND exception.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-20 18:32:24 +02:00
Corinna Vinschen e437a7d826 Lower Cygwin's MINSIGSTKSZ and SIGSTKSZ
* include/cygwin/signal.h (MINSIGSTKSZ): Define as 8K, unconditionally.
        (SIGSTKSZ): Define as 32K, unconditionally.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-19 22:40:29 +02:00
Corinna Vinschen 4889f730c1 Reduce stack pressure throughout Cygwin
* dcrt0.cc (initial_env): Reduce size of local path buffers to
        PATH_MAX.  Allocate debugger_command from process heap.
        (init_windows_system_directory): Very early initialize new global
        variable global_progname.
        * dll_init.cc (dll_list::alloc): Make path buffer static.  Explain why.
        (dll_list::populate_deps): Use tmp_pathbuf for local path buffer.
        * exceptions.cc (debugger_command): Convert to PWCHAR.
        (error_start_init): Allocate debugger_command and fill with wide char
        strings.  Only allocate if NULL.
        (try_to_debug): Just check if debugger_command is a NULL pointer to
        return.  Drop conversion from char to WCHAR and drop local variable
        dbg_cmd.
        * globals.cc (global_progname): New global variable to store Windows
        application path.
        * pinfo.cc (pinfo_basic::pinfo_basic): Just copy progname over from
        global_progname.
        (pinfo::status_exit): Let path_conv create the POSIX path to
        avoid local buffer.
        * pseudo_reloc.cc (__report_error): Utilize global_progname, drop local
        buffer.
        * smallprint.cc (__small_vsprintf): Just utilize global_progname for
        %P format specifier.
        (__small_vswprintf): Ditto.
        * strace.cc (PROTECT): Change to reflect x being a pointer.  Reformat.
        (CHECK): Ditto.  Reformat.
        (strace::activate): Utilize global_progname, drop local buffer.
        Fix formatting.
        (strace::vsprntf): Reduce size of local progname buffer to NAME_MAX.
        Copy and, if necessary, convert only the last path component to
        progname.
        (strace_buf_guard): New muto.
        (buf): New static pointer.
        (strace::vprntf): Use buf under strace_buf_guard lock only.  Allocate
        buffer space for buf on Windows heap.
        * wow64.cc (wow64_respawn_process): Utilize global_progname, drop
        local path buffer.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-19 22:38:30 +02:00
Corinna Vinschen 93a8435f82 Remove x86_64 __sjfault/__ljfault
* gendef: Remove unused 64 bit versions of __sjfault and __ljfault.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-18 14:48:32 +02:00
Corinna Vinschen 877b02be08 Rearrange makecontext and add lots of comments
* exceptions.cc (makecontext): Rearrange order of initialization and
        document at great length.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-18 12:35:23 +02:00
Corinna Vinschen b2df1577c7 Fix ucontext creation in call_signal handler
* exceptions.cc (__unwind_single_frame): Define empty macro on i686.
        (_cygtls::call_signal_handler): Try to make sure signal context makes
        sense in case we're generating context here.  Add comment to explain.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-17 18:29:52 +02:00
Corinna Vinschen 16d2d9f131 Comment fixup
* exceptions.cc (getcontext/x86_64): Drop comment on RtlCaptureContext.
        (swapcontext/x86_64): Fix comment yet again.
        (getcontext/i686): Move comment from x86_64 getcontext, slightly
        rearranged, to preceeding comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-17 16:47:14 +02:00
Corinna Vinschen b3ccf998cc Reuse __unwind_single_frame where appropriate
* exceptions.cc (__unwind_single_frame): Move up in file to be
        accessible from other places.  Move comment to getcontext.
        (stack_info::walk): Call __unwind_single_frame in 64 bit case.  Fix
        preceeding comment.
        (myfault_altstack_handler): Call __unwind_single_frame.
        (getcontext): Give comment from __unwind_single_frame a new home.
        (swapcontext): Fix comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-17 16:29:41 +02:00
Corinna Vinschen 1020bb292a Implement getcontext, setcontext, makecontext, swapcontext
* 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>
2015-07-17 14:31:12 +02:00
Corinna Vinschen 9a69aac0ed Document the fact that we forgot to bump for sigaltstack and sethostname
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-17 14:02:43 +02:00
Corinna Vinschen 211cd495c4 exceptions.cc: Reenable code only disabled for debug purposes
* exceptions.cc (exception::handle): Reenable code only disabled for
	debug purposes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-13 16:08:29 +02:00
Corinna Vinschen b90a91a618 tzset: Check timezone and country case-insensitive
* tzset.c (main): Check timezone and country case-insensitive.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-08 10:25:49 +02:00
Corinna Vinschen e6b882b957 Add accidentally missing ChangeLog entry for previous patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-07 20:49:02 +02:00
Corinna Vinschen 60f10c64aa x86_64: Handle myfault exceptions when running on alternate signal stack
x86_64 only:
        * cygtls.cc (san::leave): Restore _my_tls.andreas.
        * cygtls.h (class san):  Add _clemente as in 32 bit case.  Add ret and
        frame members.
        (san::san): Handle _my_tls.andreas as on 32 bit.  Take parameter and
        write it to new member ret.  Store current stack pointer in frame.
        (san::~san): New destructor to restore _my_tls.andreas.
        (__try): Use __l_except address as parameter to san::san.
        * dcrt0.cc (dll_crt0_0): Add myfault_altstack_handler as vectored
        continuation handler.
        * exception.h (myfault_altstack_handler): Declare.
        * exceptions.cc (myfault_altstack_handler): New function.  Explain what
        it's good for.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-07 20:45:06 +02:00
Corinna Vinschen 29a1263227 Simplify stack allocation code in child after fork
* child_info.h (CURR_CHILD_INFO_MAGIC): Update.
        (child_info_fork::alloc_stack_hard_way): Drop declaration.
        * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Fold into
        child_info_fork::alloc_stack.
        (getstack): Remove.
        (child_info_fork::alloc_stack): Simplify check for application-provided
        stack in "hard way" code.  Don't call getstack for each page, just
        reallocate stack immediately as required.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-07 17:24:49 +02:00
Corinna Vinschen 606013bcf1 Simplify fork code setting up child stack info
* fork.cc (frok::parent): Simplify code propagating stack setup to
        child process.  Tweak comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-07 17:05:20 +02:00
Yaakov Selkowitz c9b3716279 winsup/cygwin: rework basename redefinition handling in path.cc
This fixes the compile after commit 79e419de62.

* path.cc: Rework basename redefinition handling.  Explain why.
2015-07-06 15:18:09 -05:00
Jon TURNEY 910087f70f winsup/doc: Add a configure test to find docbook2xtexi
Fedora installs docbook2texi under the name db2x_docbook2texi
Other distros and Cygwin install docbook2texi under the name docbook2x-texi

Add a configure test to find either.

2015-07-05  Jon Turney  <jon.turney@dronecode.org.uk>

	* configure.ac: Add check for DOCBOOK2XTEXI
	* configure: Regenerate.
	* Makefile.in (DOCBOOK2XTEXI): Use.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-07-05 19:09:46 +01:00
Corinna Vinschen 14e3fd1b22 Align hard stack allocation to pthread stack setup changes
* dcrt0.cc (CYGWIN_GUARD): Remove.
	(child_info_fork::alloc_stack_hard_way): Align stack commit to changes
	of thread stack setup in CygwinCreateThread.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-05 17:45:29 +02:00
Corinna Vinschen a54bc198b1 Implement correct RLIMIT_STACK handling
* 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>
2015-07-05 15:51:37 +02:00
Corinna Vinschen e426213a88 Disable fetching heap info on 64 bit XP/2003
* fhandler_process.cc (heap_info::heap_info): Disable fetching heap info
        on 64 bit XP/2003.  Explain why.
        * wincap.h (wincaps::has_broken_rtl_query_process_debug_information):
        New element.
        * wincap.cc: Implement above element throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-05 12:53:30 +02:00
Corinna Vinschen f0464fbf9d Add missing wincap changes to previous ChangeLog entry
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-05 12:48:05 +02:00
Corinna Vinschen 2cd7eb7f60 Fix original stack when running signal handler on alternate stack
* autoload.cc (SetThreadStackGuarantee): Import.
        * cygtls.h (struct _cygtls): Replace thread_context with a ucontext_t
        called context.
        * exceptions.cc (exception::handle): Exit from process via signal_exit
        in case sig_send returns from handling a stack overflow SIGSEGV.
        Explain why.
        (dumpstack_overflow_wrapper): Thread wrapper to create a stackdump
        from another thread.
        (signal_exit): Fix argument list to reflect three-arg signal handler.
        In case we have to create a stackdump for a stack overflow condition,
        do so from a separate thread.  Explain why.
        (sigpacket::process): Don't run signal_exit on alternate stack.
        (altstack_wrapper): Wrapper function to do stack correction when
        calling the signal handler on an alternate stack to handle a stack
        overflow.  Make sure to have lots of comments.
        (_cygtls::call_signal_handler): Drop local context variable to reduce
        stack pressure.  Use this->context instead.  Change inline assembler
        to call altstack_wrapper.
        (_cygtls::signal_debugger): Accommodate aforementioned change to
        struct _cygtls.
        * tlsoffset.h: Regenerate.
        * tlsoffset64.h: Regenerate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-04 22:49:30 +02:00
Corinna Vinschen fc22f77503 Document previous change
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-01 15:50:18 +02:00
Corinna Vinschen e3d345c5c3 Fix fork after recovered stack overflow
* fork.cc (frok::parent): Set stacktop value based on requested stack
	pointer value in child.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-01 15:28:16 +02:00
Corinna Vinschen 0f3e631571 Add comment to sigaltstack to explain setting ss_flags here
* signal.cc (sigaltstack): Add comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-30 20:43:50 +02:00
Corinna Vinschen c2c1b84309 Handle ss_flags value longjmp safe.
* exceptions.cc (_cygtls::call_signal_handler): Drop manipulating
	thread's ss_flags here.  It's not safe against longjmp.
	* signal.cc (sigaltstack): Check if we're running on the alternate
	stack and set ss_flags returned in oss to SS_ONSTACK.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-27 12:08:07 +02:00
Corinna Vinschen ba170254e6 Define larger MINSIGSTKSZ and SIGSTKSZ values for Cygwin
* include/cygwin/signal.h: Revert to define MINSIGSTKSZ and SIGSTKSZ
	here with bigger values to allow _cygtls to reside on signal stack,
	should it turn out to be required at one point.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-26 21:41:26 +02:00
Corinna Vinschen 2ecaa3c176 Fix values returned by getrlimit(RLIMIT_STACK)
* resource.cc (getrlimit): Fix values returned by RLIMIT_STACK.
	Explain why this had to be changed.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-26 20:41:54 +02:00
Jon TURNEY 06105fa9de winsup/doc: Update ancient README about building documentation
Update list of pre-requisites, everything else is obsolete.

Future work: Ensure that the list of pre-requisites in FAQ 6.21 "How do I build
Cygwin" remains synchronized with this list.

2015-06-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* README: Update.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 12:07:47 +01:00
Jon TURNEY 7e87f1ea1e winsup/doc: Use xidepend to generate the source list for FAQ targets as well
2015-06-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (FAQ_SOURCES): Remove and generate with xidepend.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 12:07:41 +01:00
Jon TURNEY 8d720d6ac7 winsup/doc: Remove 'Usage' prefix from synopses
Remove redundant 'Usage' prefix from synopses.

2015-06-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* utils.xml: Remove 'Usage' prefix from synopses.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 12:07:36 +01:00
Jon TURNEY b769b6cc73 winsup/doc: Add intro man pages from cygwin-doc
v2:
intro.1 and cygwin.1 are identical. Make cygwin.1 a link to intro.1
Update dates in static man pages

v3:
Use doclifter to convert intro.[13] to DocBook XML
Clean up markup and fix a couple of spelling mistakes.
Build and install manpages from XML

v4:
Update to refer to GPLv3+, SUSv4
Simplify ulinks where anchor text is the same as the URL

2015-06-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (intro2man.stamp): Add.
	* intro.xml: New file.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 12:05:40 +01:00
Jon TURNEY 5ea698c437 winsup/doc: Create info pages from cygwin documentation
v2:
Updated to use docbook2x-texi not docbook2texi, since source is now docbook XML.
Tweak DocBook XML so info directory entry has a description.

v3:
Use a custom charmap to handle &reg;

v4:
Proper build avoidance
texinfo node references may not contain ':', so provide alternate text for a few
xref targets

2015-06-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (install-info, cygwin-ug-net.info)
	(cygwin-api.info): Add.
	* cygwin-ug-net.xml: Add texinfo-node.
	* cygwin-api.xml: Ditto.
	* ntsec.xml (db_home): Add texinfo-node for titles containing a
	':' which are the targets of an xref.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 12:05:29 +01:00
Ken Brown d04fd9d5f7 Complement SIGEV_* enums with macros
* include/cygwin/signal.h (SIGEV_*): Add macros.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-23 10:39:06 +02:00
Corinna Vinschen f4abb28ea8 Don't push on original stack during alternate signal stack setup
* exceptions.cc (_cygtls::call_signal_handler): Drop pushing a register
	on the original stack, it confuses GCC.  Rearrange the assembler code
	so that $rax/$eax is not used by GCC to prepare an argument value.
	Use $rax/$eax without saving.  Drop clearing $rbp/$epb.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-22 13:09:55 +02:00
Corinna Vinschen b6c18f2a64 Safe all clobbered volatile registers when using alternate stack
* exceptions.cc (_cygtls::call_signal_handler): Drop subtracting 16
	bytes from the alternate stack, it's not necessary.  Safe all clobbered
	registers.  Safe one on the orignal stack, the others on the alternate
	stack on both platforms.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-21 13:58:57 +02:00
Corinna Vinschen 44745e3165 Fix comments
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 20:56:55 +02:00
Corinna Vinschen a88afecce6 ChangeLog entries for Cygwin's alternate signal stack implementation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 20:36:16 +02:00
Corinna Vinschen b782f869bf Add alternate signal stack to docs
* new-features.xml (ov-new2.1): Add alterante signal stack info.
	* posix.xml (std-susv4): Move sigaltstack here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 20:30:17 +02:00
Corinna Vinschen 0cbf19283b Implement using alternate signal stack in Cygwin
* exceptions.cc (_cygtls::call_signal_handler): Implement alternate
	signal stack handling.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 20:21:02 +02:00
Corinna Vinschen 6442e914d9 Use MINSIGSTKSZ and SIGSTKSZ from newlib for Cygwin as well
* libc/include/sys/signal.h: Move altstack macros completely
	outside of rtems block.

	* include/cygwin/signal.h: Remove definitions of MINSIGSTKSZ
	and SIGSTKSZ here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 19:05:51 +02:00
Corinna Vinschen 74d272cc02 Handle exceptions in sigaltstack
* signal.cc (sigaltstack): Add fault handler.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-20 18:48:09 +02:00
Corinna Vinschen 22465796ed Preliminary infrastructure to implement alternate stack
* libc/include/sys/signal.h: Define SS_ONSTACK and SS_DISABLE
	unconditionally.
	(sigaltstack): Enable prototype on Cygwin.

	* common.din (sigaltstack): Export.
	* cygtls.cc (_cygtls::init_thread): Initialize altstack.
	* cygtls.h (__tlsstack_t): Rename from __stack_t to distinguish
	more clearly from stack_t.  Accommodate throughout.
	(_cygtls): Add altstack member.
	* exceptions.cc (exception::handle): Set SIGSEGV handler to SIG_DFL
	if we encounter a stack overflow, and no alternate stack has been
	defined.
	* include/cygwin/signal.h (MINSIGSTKSZ): Define
	(SIGSTKSZ): Define.
	(SA_ONSTACK): Define.
	* signal.cc (sigaltstack): New function.
	* tlsoffset.h: Regenerate.
	* tlsoffset64.h: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-19 16:12:45 +02:00
Corinna Vinschen 715ac1e872 Formatting fixes in exceptions.cc
* Makefile.in (install-man): Exclude release subdir from search paths.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-19 16:12:10 +02:00
Jon TURNEY b992833969 winsup/doc: Fix command to create man3 install directory
Fix a cut and paste error in the command to create the man3 install directory,
added in 94f16969

2015-06-19  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (install-man): Fix command to create man3 install
	directory.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-19 15:02:48 +01:00
Corinna Vinschen 0d3304af38 Disallow installing "man pages" from release subdir
* Makefile.in (install-man): Exclude release subdir from search paths.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-18 22:04:58 +02:00
Jon TURNEY e9549aef38 winsup/doc: Add man.xsl customization stylesheet
2015-06-17  Jon Turney  <jon.turney@dronecode.org.uk>

	* man.xsl: New file.
	* Makefile.in (utils2man.stamp, api2man.stamp): Use it.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-18 11:32:08 +01:00
Jon TURNEY 94f16969d3 winsup/doc: Make and install cygwin-api function manpages
Use 'xmlto man' to make manpages for utils

This will generate multiple .1 files as an output, but we don't know what they
will be called, so use a timestamp for build avoidance

2015-06-17  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (api2man.stamp): Add rules to build and install
	manpages for cygwin-api.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-18 11:32:05 +01:00
Jon TURNEY cf1c6cd395 winsup/doc: Convert cygwin-api function documentation to refentry elements
Convert cygwin-api from using a sect2 element to using a refentry element for
each function.  This makes it possible to generate manpage-style output for
those elements.

Note that the chunked html now generates a page for each function, rather than
one containing all functions.

Also:

Remove pointless and incorrect date

Move introductory paragraph from the first section to the start of the chapter

Add a funcsynopsisinfo element with the header file to be included to each
function prototype

Remove extern "C" which doesn't process into all formats successfully

2015-06-17  Jon Turney  <jon.turney@dronecode.org.uk>

	* cygwin-api.xml: Move introductory paragraph here.
	* logon-funcs.xml: Convert from using a sect2 element to using a
	refentry element for each function.
	* misc-funcs.xml: Ditto.
	* path.xml: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-18 11:32:03 +01:00
Jon TURNEY a197d1d504 winsup/doc: Generate ANSI rather than K&R style function prototypes
Since K&R style prototypes appear to be the default for HTML and FO, customize
the stylesheets rendering of funcsynopsis elements to generate ANSI style
prototypes instead.

2015-06-17  Jon Turney  <jon.turney@dronecode.org.uk>

	* fo.xsl: Render funcsynopsis elements as ANSI style function
	prototypes.
	* html.xsl: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-18 11:32:00 +01:00
Jon TURNEY 73afd1315c winsup/doc: Rename cygwin.xsl as html.xsl
For clarity, rename cygwin.xsl as html.xsl, because that's what it is

2015-06-17  Jon Turney  <jon.turney@dronecode.org.uk>

	* html.xsl: Renamed from cygwin.xsl.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-18 11:31:57 +01:00
Corinna Vinschen e4bdbca6eb Add sethostname to API list
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-17 11:22:14 +02:00
Corinna Vinschen 50b00d2b93 Add sethostname
* net.cc (sethostname): New function.
	* common.din (sethostname): Export
	* include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2001.
	(CYGWIN_VERSION_DLL_MINOR): Set to 0.

	* new-features.xml (ov-new): Rename from ov-new1.7.
	(ov-new2.1): Add new section.  Document sethostname.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-17 11:11:02 +02:00
Corinna Vinschen c7af199237 Add release/2.0.5 file 2015-06-17 10:37:10 +02:00
Jon TURNEY d396a37c84 winsup/doc: Make and install manpages for utils
Use 'xmlto man' to make manpages for utils
(docbook2x-man could also be used, but since we already use xmlto...)

This will generate multiple .1 files as an output, but we don't know what they
will be called, so use a timestamp file for build avoidance when the
dependencies haven't changed.

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (install-man, utils2man.stamp): Add rules to build
	and install manpages for utils.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 18:29:22 +01:00
Jon TURNEY 646745cbf3 winsup/doc: Convert utils.xml to using refentry elements
Convert utils.xml from using a sect2 element to using a refentry element for
each utility program.  This makes it possible to generate manpage-style output
for those elements.

Note that the chunked html now generates a page for each utility, rather than
one containing all utilities.

A small customization to TOC generation for HTML and PDF is needed to ensure
that it appears as before, containing an entry for each utility command.

Future work: synopsis and options sections could use more detailed markup than
just wrapping the whole thing in <screen>

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* utils.xml : Convert from using a sect2 element to using a
	refentry element for each utility program.
	* cygwin.xsl: Customize autotoc to include refentries.
	* fo.xsl: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 18:28:40 +01:00
Jon TURNEY 07605dccd2 winsup/doc: Fix an issue with parallel make
The cygwin-ug-net-nochunks.html.gz target does not ensure that the
cygwin-ug-net/ directory exists, so it can fail if run on it's own, or if the
cygwin-ug-net/cygwin-ug-net.html target has not yet created it in a parallel
make.

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (cygwin-ug-net/cygwin-ug-net-nochunks.html.gz):
	Ensure cygwin-ug-net directory exists.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 10:29:28 +01:00
Jon TURNEY 38529ea03a winsup/doc: Make it easier to extend xidepend to more targets
Change xidepend to create a variable containing all the XIncluded sources, which
can be used as a dependency, rather than writing the dependency target itself.

Future work: Makefile.dep should depend on xidepend, but xidepend should not be
passed to itself.

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* xidepend: Write a Makefile fragment defining variables
	containing all the XIncluded sources, rather than a dependency on
	those sources.
	* Makefile.in: Use that variable to express the dependency.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 10:28:49 +01:00
Jon TURNEY c46fe19460 winsup/doc: Use fo.xsl to customize PDF generation from DocBook XML
fo.xsl doesn't seem to be used since c2f50c40 switched back from xsltproc to
xmlto

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (cygwin-ug-net/cygwin-ug-net.pdf)
	(cygwin-api/cygwin-api.pdf): Use fo.xsl to customized DocBook
	XML->PDF conversion.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 10:23:06 +01:00
Jon TURNEY 7177456cf0 winsup/doc: Some preparatory XML fixes
Remove the inconsistent .exe suffix in strace and umount usage lines.

Tidy up some trailing whitespace.

Tabs inside <screen> are not consistently formatted by all formatters, replace
with spaces.

Remove pointlesss and incorrect date

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* cygwin-ug-net.xml: Remove incorrect unused date.
	* utils.xml : Remove .exe suffix inconsistently added in a few
	places.  Tidy up some trailing whitespace.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 10:20:06 +01:00
Jon TURNEY 2ef3009068 winsup/doc: Fix xidepend to handle relative pathnames
It seems that xidepend doesn't work correctly if we are ./configure'd using a
relative pathname to the srcdir:

$ make
cd ../../../../src/winsup/doc && ./xidepend ../../../../src/winsup/doc/cygwin-ug-net.xml ../../../../src/winsup/doc/cygwin-api.xml >"/wip/cygwin/build/x86_64-unknown-cygwin/winsup/doc/Makefile.dep"
grep: ../../../../src/winsup/doc/cygwin-ug-net.xml: No such file or directory
grep: ../../../../src/winsup/doc/cygwin-api.xml: No such file or directory

Although it might be better to fix this by making xidepend use pathnames, rather
than ignoring them and assuming everything is in the current directory...

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* xidepend: Fix to handle relative pathnames.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 10:13:29 +01:00
Jon TURNEY efc0b0094b winsup/doc: Remove tarball target from .PHONY
Left over after 4885352e.

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in (.PHONY): Remove tarball target.
2015-06-16 10:13:26 +01:00
Corinna Vinschen 79d65a1ed2 Try to handle concurrent close on socket more gracefully
* fhandler_socket.cc (LOCK_EVENTS): Don't enter critical section with
	invalid mutex handle since then socket has been closed.
	(UNLOCK_EVENTS): Close critical section.
	(fhandler_socket::evaluate_events): Handle calling connect on shutdown
	socket.
	(fhandler_socket::wait_for_events): Try for pthread_testcancel in case
	of WAIT_FAILED.  Try to come up with a better errno in case we waited
	on an invalid handle.
	(fhandler_socket::release_events): Change wsock_mtx and wsock_evt to
	NULL under lock to avoid accessing invalid handle.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-15 18:29:56 +02:00
Corinna Vinschen 6f9e2f3ed5 Handle more Winsock error codes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-15 16:17:16 +02:00
Corinna Vinschen 95c5a3f6b7 Don't enforce SA_RESTART in non-main threads
* exceptions.cc (_cygtls::call_signal_handler): Disable enforcing
	SA_RESTART in non-main threads to allow returning with EINTR from
	system calls.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-15 16:15:54 +02:00
Corinna Vinschen b81a830f1a Fix ChangeLog entry 2015-06-11 15:39:34 +02:00
Jon TURNEY 5c4129d937 Improve strace to log most Windows debug events
Not sure if this is wanted, but on a couple of occasions recently I have been
presented with strace output which contains an exception at an address in an
unknown module (i.e. not in the cygwin DLL or the main executable), so here is a
patch which adds some more information, including DLL load addresses, to help
interpret such straces.

v2:
Use NtQueryObject() for HANDLE -> filename conversion
Add new '-e' option to toggle this additional logging

2015-06-07  Jon Turney  <jon.turney@dronecode.org.uk>

	* strace.cc (proc_child): Log process and thread create and exit,
	and DLL load and unload.
	(GetFileNameFromHandle): New function.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-11 12:00:51 +01:00
Corinna Vinschen 5979b17401 Bump minor DLL version to 5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-11 12:59:12 +02:00
Corinna Vinschen 7701a023ff Drop Windows 2000 considerations in ps, fix uid field length
* ps.cc (main): Widen UID field in long format to accommodate longer
	UIDs since Cygwin 1.7.34.  Remove Windows 2000 considerations.  Fix
	comments accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-10 11:07:27 +02:00
Corinna Vinschen 6261fb30a9 Avoid compiler warning in latest patch
* pinfo.cc (_pinfo::cwd): Initialize s to avoid comiler warning.
	(_pinfo::cmdline): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 21:55:11 +02:00
Corinna Vinschen 575ec00a43 Evaluate /proc/$PID/{root,cwd,cmdline} for native processes
* pinfo.cc (_pinfo::root): Fake default root for native processes.
	(open_commune_proc_parms): New helper function to access process
	parameter block.
	(_pinfo::cwd): Fetch missing cwd for native processes from processes
	parameter block.
	(_pinfo::cmdline): Ditto for command line.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 21:48:13 +02:00
Corinna Vinschen 79511853f7 add bind mount fix to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 17:48:34 +02:00
Corinna Vinschen 117ebc802f Bind mounts require POSIX paths
* path.cc (from_fstab_line): Don't convert slashes to backslashes for
	bind mounts.  Explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 17:37:55 +02:00
Jon TURNEY 4885352e16 winsup/doc: Remove ancient unused Makefile rules to make documentation tarball
This used to be used by cygwin-doc to make a tarball which would be used with a
ssh script to run docbook tools on a linux host since they weren't available on
Cygwin or something crazy like that...

2015-06-04  Jon Turney  <jon.turney@dronecode.org.uk>

	* Makefile.in: Remove ancient unused rules to make a documentation
	tarball.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-08 15:19:23 +01:00
Corinna Vinschen 95868172f3 Avoid delays trying to fetch Cygwin info from non-Cygwin processes
* pinfo.cc (_pinfo::commune_request): Don't try to send commune
	requests to non-Cygwin processes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 14:38:30 +02:00
Takashi Yano 511eb2f264 Generate SIGHUP for terminal process group on tty master close
* fhandler_tty.cc (fhandler_pty_slave::write): Move causing of SIGHUP
	into fhandler_pty_master::close().
	(fhandler_pty_slave::read): Ditto.
	(fhandler_pty_master::close): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 14:07:42 +02:00
Corinna Vinschen 4c3946c350 Bump minor DLL version to 4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-08 13:58:39 +02:00
Corinna Vinschen 64848af0bf Add Cygwin 2.0.3 release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-03 13:38:19 +02:00
Corinna Vinschen da1611493a Bump minor DLL version to 3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-06-02 14:10:30 +02:00
Jon TURNEY 3c932910e6 Remove mention of installing everything
An estimate of the size of installing of "hundreds of megabytes" is wildly out
of date.  Just remove mention of installing everything, since it is nearly
always not a good idea.

2015-06-01  Jon Turney  <jon.turney@dronecode.org.uk>

	* ov-ex-unix.xml: Remove unhelpful mention of and inaccurate size
	estimate for installing everything.
	* ov-ex-win.xml: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-01 17:13:32 +01:00
Corinna Vinschen 712811e9bb Use NtQueryObject to detect closing the last master handle
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-28 16:09:46 +02:00
Takashi Yano 3afe8808b9 * net.cc: Define _NETIOAPI_H_ to accomodate newer w32api.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-27 13:30:20 +02:00
Corinna Vinschen 761a123a4f Bump minor DLL version to 2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-05-03 12:28:39 +02:00
Corinna Vinschen d4058c6686 Bump minor DLL version to 1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-30 17:53:15 +02:00
Corinna Vinschen b07326d29e Use all ACEs from original ACL on Samba share
* security.cc (convert_samba_sd): Fix accidental dropping of all
	non-Unix User, non-Unix Group accounts.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-30 17:26:55 +02:00
Yaakov Selkowitz 37ab32da30 Fix more typos in ntsec.xml
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2015-04-29 12:55:03 -05:00
Corinna Vinschen 49c051c133 Define __s64 and __u64
* include/asm/types.h: Add __s64 and __u64 types.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-27 14:40:27 +02:00
Mike DePaulo a3e0771eda cygserver.xml: Add new section. How to install Cygserver.
* cygserver.xml (install-cygserver): Add new section. How to install
	Cygserver.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-27 11:32:25 +02:00
Corinna Vinschen f21c9bface Document previous unlink patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:04:59 +02:00
Corinna Vinschen 5abb0ed13c Handle unlinking in-use files on virtual drives
* path.cc (path_conv::set_nt_native_path): New function.
        * path.h (path_conv::set_nt_native_path): Add prototype.
        * syscall.cc (try_to_bin): Handle moving files to the recycler
        accessed via a local virtual drive (subst).  Fix a problem renaming
        the file to the unique replacement name on Samba.  Align comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:04:59 +02:00
Corinna Vinschen 4e99630cfd Fix closing too many handles in pty fchown/fchmod
* fhandler_tty.cc (fhandler_pty_slave::fch_close_handles): Don't close
	handles not opened via fhandler_pty_slave::fch_open_handles.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:04:59 +02:00
Takashi Yano c846bca992 Fix OPOST for non-Cygwin pty slaves
* fhandler.h (class fhandler_base): Add virtual function
	get_io_handle_cyg() to get handle from which OPOST-processed output is
	read on PTY master.
	(class fhandler_pty_slave): Add variable output_handle_cyg to store a
	handle to which OPOST-processed output is written. Add two functions,
	i.e., set_output_handle_cyg() and get_output_handle_cyg(), regarding
	variable output_handle_cyg. Now, output_handle is used only by native
	windows program. The data before OPOST-processing is written to
	output_handle and OPOST-processing is applied in the master-side. For a
	cygwin process, OPOST-processing is applied in the slave-side, and the
	data after OPOST-processing is written to output_handle_cyg.
	(class fhandler_pty_master): Add two variables, i.e., io_handle_cyg and
	to_master_cyg, to store handles of a pipe through which OPOST-processed
	output passes. Add pty_master_fwd_thread and function
	pty_master_fwd_thread() for a thread which applies OPOST-processing
	and forwards data from io_handle to to_master_cyg. Add function
	get_io_handle_cyg() regarding variable io_handle_cyg. Now, the pipe
	between io_handle and to_master are used only by native windows program
	for applying OPOST-processing in the master-side. For a cygwin process,
	the pipe between io_handle_cyg and to_master_cyg is used for passing
	through the data which is applied OPOST-processing in the slave-side.
	* fhandler_tty.cc (struct pipe_reply): Add member to_master_cyg.
	(fhandler_pty_master::process_slave_output): Read slave output from
	io_handle_cyg rather than io_handle.
	(fhandler_pty_slave::fhandler_pty_salve): Initialize output_handle_cyg.
	(fhandler_pty_slave::open): Set output_handle_cyg by duplicating handle
	to_master_cyg on PTY master.
	(fhandler_pty_slave::close): Close handle output_handle_cyg.
	(fhandler_pty_slave::write): Write data to output_handle_cyg rather
	than output_handle.
	(fhandler_pty_slave::fch_close_handles): Close handle output_handle_cyg.
	(fhandler_pty_master::fhandler_pty_master): Initialize io_handle_cyg,
	to_master_cyg and master_fwd_thread.
	(fhandler_pty_master::cleanup): Clean up to_master_cyg as well.
	(fhandler_pty_master::close): Print to_master_cyg as well in debug
	message. Terminate master forwarding thread. Close handles
	to_master_cyg and io_handle_cyg.
	(fhandler_pty_master::ioctl): Use io_handle_cyg rather than to_master.
	(fhandler_pty_master::pty_master_thread): Add code for duplicating
	handle to_master_cyg.
	(fhandler_pty_master::pty_master_fwd_thread): New function for a thread
	to forward OPOST-processed data from io_handle to to_master_cyg.  This
	thread applies OPOST-processing to the output of native windows program.
	(::pty_master_fwd_thread): Ditto.
	(fhandler_pty_master::setup): Create a new pipe to pass thruegh OPOST-
	processed output. Create new thread to forward data from io_handle to
	to_master_cyg. Set handle to_master_cyg to tty. Print io_handle_cyg as
	well in debug message. Close handles io_handle_cyg and to_master_cyg in
	case of error.
	(fhandler_pty_master::fixup_after_fork): Set handle to_master_cyg to
	tty. Copy handle to_master_cyg from arch->to_master_cyg.
	(fhandler_pty_master::fixup_after_exec): Clean up to_master_cyg.
	* select.cc: Check handle returned by get_io_handle_cyg() rather than
	get_handle().
	* tty.h (class tty): Add variable _to_master_cyg to store a handle to
	which OPOST-processed data is written. Add two functions,
	to_master_cyg() and set_to_master_cyg(), regarding _to_master_cyg.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:04:24 +02:00
Corinna Vinschen 6d099d5bae Undef basename before defining function.
* path.cc (basename): Undefine basename before defining function to
        avoid type collision with prototype in string.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:03:45 +02:00
Corinna Vinschen e0aa6d23fb Remove Cygwin's libgen.h
* include/libgen.h: Remove in favor of newlib version.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:03:45 +02:00
Corinna Vinschen 68994d6828 Asia/Calcutta -> Asia/Kolkata (not on unicode.org)
* tzmap-from-unicode.org: Convert Calcutta to Kolkata.
        * tzmap.h: Regenerate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:03:45 +02:00
David Macek bbc87a02fd Fix inconsistencies in docs regarding fstab and executable file detection
The inline list of mount options seemed redundant, so the paragraph now points
to the list below it.

List of executable extensions updated according to fhandler_disk_file.cc. List
of executable magic numbers updated according to path.h (has_exec_chars).

	* pathnames.xml: Fix inconsistencies in docs regarding fstab and
	executable file detection

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:02:47 +02:00
Corinna Vinschen 5dc398f1d9 Fix broken SID in passwd/group entry for unkown account
* uinfo.cc (pwdgrp::fetch_account_from_windows): Always revert SID
        subauth count after checking for known domain.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:01:53 +02:00
Corinna Vinschen 83b3f891c4 Fix broken PSID problem on cygheap in account handling
* pwdgrp.h: Add comment to explain below change.
        (struct pg_pwd): Convert sid member to BYTE array.
        (struct pg_grp): Ditto.
        * grp.cc (pwdgrp::parse_group): Accommodate above change.
        * passwd.cc (pwdgrp::parse_passwd): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 22:01:53 +02:00
Corinna Vinschen 023be4aedb Don't rely on size argument in shmget call
* shm.cc (shmget): Fetch segment size from server rather than using
	size argument to accommodate existing segments.  Add comment to explain
	why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:59:49 +02:00
Corinna Vinschen 5778304f16 Bump Cygwin version to 2.0.0.
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2000.
	(CYGWIN_VERSION_DLL_MINOR): Set to 0.

	* new-features.xml (ov-new2.0): Rename from ov-new1.7.36 and change
	version number to 2.0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:58:33 +02:00
Jon TURNEY bccc0e83e8 Set mcontext.cr2 to the faulting address
* exceptions.cc (call_signal_handler): Set mcontext.cr2 to the
	faulting address.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:58:33 +02:00
Jon TURNEY 9043956ce8 Only construct ucontext for SA_SIGINFO signal handlers
* exceptions.cc (call_signal_handler): Only bother to construct
	the ucontext for signal handlers with SA_SIGINFO set.  Set
	mcontext.oldmask.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:58:32 +02:00
Jon TURNEY 65c071bc4d Initialize context before RtlContextCapture
* exceptions.cc (call_signal_handler): Zero initialize context and set
	context flags, as RlCaptureContext doesn't.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:58:32 +02:00
Corinna Vinschen 19dc6ee82c Call open_null to open fake handle
* fhandler_dsp.cc (fhandler_dev_dsp::open): Call open_null.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:13 +02:00
Corinna Vinschen 853fcd8936 Introduce sidfromuid and sidfromgid
* pwdgrp.h (sidfromuid): New inline function.
	(sidfromgid): Ditto.
	* fhandler_disk_file.cc (fhandler_disk_file::fchown): Use sidfromuid.
	* quotactl.cc (quotactl): Use sidfromuid and sidfromgid.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:12 +02:00
Corinna Vinschen 651bb62ae2 Remove __acl16 from official header
* include/cyggwin/acl.h (struct __acl16): Move from here...
	* sec_acl.cc: ...to here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:12 +02:00
Corinna Vinschen 84b8db8e7a Remove unused 32/64 bit tty code
* tty.h (class tty): Remove unused 32/64 bit interoperability
	considerations.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:12 +02:00
Corinna Vinschen 19c6889c37 Raise # of ptys to 128.
* tty.h (NTTYS): Raise to 128.
	* devices.in: Change pty, ptym, and cons expressions accordingly.
	* devices.cc: Regenerate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:12 +02:00
Jon TURNEY 4f28e8a0e5 Compile exceptions.cc with -fno-omit-frame-pointer on x86
Selectively using -fomit-frame-pointer when -O is used doesn't make sense
anymore, apparently since gcc 4.6, -O implies -fomit-frame-pointer.

exceptions.cc must be compiled with -fno-omit-frame-pointer on x86, as it uses
RtlCaptureContext, which requires a frame pointer.

	* Makefile.in : Remove setting -fomit-frame-pointer for compiling
	various files, it is already the default.  Set
	-fno-omit-frame-pointer for exceptions.cc on x86.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:11 +02:00
Takashi Yano 252a07b0ad Cygwin hangs up if several keys are typed during outputting a lot of texts.
* fhandler_tty.cc (fhandler_pty_slave::read): Change calculation of
	"readlen" not to use "bytes_in_pipe" value directly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:11 +02:00
David A. Wheeler f33e34f333 Add FAQ entry on how Cygwin counters install and update MITM attacks
* faq-setup.xml: Document how Cygwin secures installation and
	update against man-in-the-middle (MITM) attacks.  Note that
	setup embeds a public key to check the signature of setup.ini,
	and that setup.ini includes SHA-512 cryptographic hashes.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2015-04-23 21:57:11 +02:00
Jon TURNEY 383ff5fc47 Try to make sure struct _mcontext is 16-byte aligned
On x86_64, RtlCaptureContext() uses fxsave to save FPU/MMX/SSE state.

fxsave requires that the destination address is 16-byte aligned, or it will
fault.

CONTEXT is already annotated __attribute__ ((aligned (16))), do the same with
struct _mcontext.

Rearrange ucontext_t so that it's struct _mcontext element is also correctly
aligned.

	* include/cygwin/signal.h (struct __mcontext): 16-byte align.
	* include/sys/ucontext.h (ucontext_t): Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:11 +02:00
Corinna Vinschen bbf1475e02 Drop local stdint.h and inttypes.h in favor of newlib files
* include/cygwin/types.h: Include sys/_stdint.h rather than stdint.h.
	* include/stdint.h: Drop in favor of newlib version.
	* include/inttypes.h: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:11 +02:00
Jon TURNEY 9e8932d6da Provide ucontext to signal handlers
Add ucontext.h header, defining ucontext_t and mcontext_t types.

Provide sigaction sighandlers with a ucontext_t parameter, containing stack and
context information.

	* include/sys/ucontext.h : New header.
	* include/ucontext.h : Ditto.
	* exceptions.cc (call_signal_handler): Provide ucontext_t
	parameter to signal handler function.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:10 +02:00
Jon TURNEY d89cc26903 Add cygwin_internal() operation to retrieve the EXCEPTION_RECORD from a siginfo_t *
* external.cc (cygwin_internal): Add operation to retrieve a copy
	of the EXCEPTION_RECORD from a siginfo_t *.
	* include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
	* exception.h (cygwin_exception): Add exception_record accessor.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:10 +02:00
Jon TURNEY 9afde4dff4 Rename struct ucontext to struct __mcontext
* include/cygwin/signal.h : Rename struct ucontext to struct
	__mcontext.  Fix layout differences from the Win32 API CONTEXT
	type.  Remove unused member _internal.  Rename member which
	corresponds to ContextFlags.  Add cr2 member.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:10 +02:00
Corinna Vinschen 9b42474f29 Fix UTF-16 surrogate handling in wctomb and friends.
* libc/stdlib/wctomb_r.c (__utf8_wctomb): Fix check for handling a
	lone high surrogate.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Corinna Vinschen 71a897e40d Avoid potential crash at startup or in getgroups(2).
* grp.cc (internal_getgroups): Handle negative domain index to avoid
	crashes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Jon TURNEY adbc3d4bb1 Fix documentation of cygwin_internal()'s return type.
* misc-funcs.xml (cygwin_internal): Correct return type.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-04-23 21:57:09 +02:00
Renato Silva f7ddc49f40 Fix buffer size error handling in gethostname.
* net.cc (cygwin_gethostname): Fix buffer size error handling.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Corinna Vinschen 7b90cc4b9c Add release msg
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Corinna Vinschen 2e3968cefa Document GNU basename.
* new-features.xml (ov-new1.7.36): Add new section.  Document GNU
	basename.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Corinna Vinschen f0b38a8af6 Don't allow fully qualified Windows account names.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Don't allow fully
	qualified Windows account names (domain\user or user@domain).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:09 +02:00
Corinna Vinschen c117793326 Add _tzset_unlocked and _tzset_unlocked_r
newlib:

	* libc/time/local.h (_tzset_unlocked_r): Add prototype.
	(_tzset_unlocked): Ditto.
	* libc/time/tzset.c (_tzset_unlocked): New function, call
	_tzset_unlocked_r.
	(tzset): Lock and call _tzset_unlocked_r.
	* libc/time/tzset_r (_tzset_unlocked_r): Remove locking and rename
	from _tzset_r.
	(_tzset_r): Lock and call _tzset_unlocked_r.

cygwin:

	* localtime.cc (tzset_unlocked): Export as _tzset_unlocked.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:08 +02:00
Yaakov Selkowitz 75d5f68aab cygwin: add GNU basename(3)
winsup/cygwin/
* common.din (__gnu_basename): Export.
* path.cc (__gnu_basename): New function.

winsup/doc/
* posix.xml (std-gnu): Add basename.
(std-notes): Add note about two forms of basename.
2015-04-23 21:57:08 +02:00
Corinna Vinschen d4f8c94a9b Try best to handle user from domain not in trusted domain list.
* cygheap.h (cygheap_domain_info::add_domain): Add prototype.
	* uinfo.cc (cygheap_domain_info::add_domain): New method.
	(pwdgrp::fetch_account_from_windows): Try to add domain explicitely
	if it was not in the original list of trusted domains and go ahead
	rather than bailing out.  Add comment to explain why.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:07 +02:00
Corinna Vinschen 3fb21f9143 Prepare to rename/reuse struct ucontext.
* cygtls.h (struct _cygtls): Convert thread_context to type CONTEXT.
	* exceptions.cc (_cygtls::signal_debugger): Use sizeof (CONTEXT) for
	size of CONTEXT copied for GDB's digestion.
	* include/cygwin/signal.h: Add a preliminary comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:07 +02:00
Corinna Vinschen 03d5584c4b Add CMIN and CTIME definitions
* include/sys/termios.h: Add CMIN and CTIME.
	* fhandler_termios.cc (fhandler_termios::tcinit): Use CMIN and CTIME.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:07 +02:00
Corinna Vinschen e6c735f685 Bump tty.cc copyright date 2015-04-23 21:57:07 +02:00
Takashi Yano 8c1a778e7d TIOCPKT mode of PTY is broken if ONLCR bit is cleared.
* tty.h (class tty_min): Remove variable "write_error" to which any
	errors are not currently set at anywhere.
	(class tty): Add variable "column" for handling ONOCR.
	* tty.cc (tty::init): Add initialization code for variable "column".
	* fhandler.h (class fhandler_pty_master): Remove variable "need_nl"
	which is not necessary any more. "need_nl" was needed by OPOST process
	in fhandler_pty_master::process_slave_output().
	(class fhandler_pty_common): Add function process_opost_output() for
	handling post processing for OPOST in write process.
	* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Count
	TIOCPKT control byte into length to be read in TIOCPKT mode. Move
	post processing for OPOST to write process. Remove code related to
	variable "write_error". Return with EIO error if slave is already
	closed.
	(fhandler_pty_master::fhandler_pty_master): Remove initialization
	code for variable "need_nl".
	(fhandler_pty_common::process_opost_output): Add this function for
	handling of OPOST in write process. Add code to avoid blocking in
	non-blocking mode when output is suspended by ^S.
	(fhandler_pty_slave::write): Call fhandler_pty_common::
	process_opost_output() instead of WriteFile(). Remove code related to
	variable "write_error".
	(fhandler_pty_master::doecho): Call fhandler_pty_common::
	 process_opost_output() instead of WriteFile().
	* select.cc (peek_pipe): Remove code related to variable "need_nl".

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:07 +02:00
Corinna Vinschen 7befea740d Ignore __STDC_{FORMAT,LIMIT,CONSTANT}_MACROS
Per glibc BZ #15366:
	* inttypes.h: Drop __STDC_FORMAT_MACROS consideration.
	* stdint.h: Drop __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
	consideration.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:06 +02:00
Corinna Vinschen dd3d3b10e2 Drop cygwin/_types.h.
* include/cygwin/_types.h: Drop unused file.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-23 21:57:06 +02:00
Corinna Vinschen 4a9636b1d6
Implmenet faster getfrompw/getfromgr
* grp.cc (pwdgrp::parse_group): Call cygsid::getfromgr_passwd.
	* passwd.cc (pwdgrp::parse_passwd): Call cygsid::getfrompw_gecos.
	* pwdgrp.h (cygsid::getfrompw): Implement as inline method here,
	accessing pg_pwd's sid member directly.
	(cygsid::getfromgr): Implement as inline method here, accessing
	pg_grp's sid member directly.
	* sec_auth.cc (extract_nt_dom_user): Call cygsid::getfrompw_gecos.
	Explain why.
	* sec_helper.cc (cygsid::getfrompw): Drop implementation.
	(cygsid::getfromgr): Ditto.
	* security.h (cygsid::getfrompw_gecos): Implement former getfrompw
	inline here.
	(cygsid::getfromgr_passwd): Implement former getfromgr inline here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-18 17:15:27 +01:00
Corinna Vinschen 1d91d469ee
Drop unneeded passwd argument from security functions
* sec_auth.cc (get_server_groups): Drop unused passwd argument.  Adjust
	calls throughout.
	(get_initgroups_sidlist): Ditto.
	(get_setgroups_sidlist): Ditto.
	(create_token): Ditto.
	(lsaauth): Ditto.
	* security.h (create_token): Adjust prototype to above change.
	(lsaauth): Ditto.
	(get_server_groups): Ditto.
	* grp.cc (get_groups): Adjust call to get_server_groups.
	* syscalls.cc (seteuid32): Adjust calls to lsaauth and create_token.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-18 16:54:19 +01:00
Corinna Vinschen 6f93f1d6a5
Drop unused timeoput paramter to internal_getlogin
* grp.cc (internal_getgroups): Drop unused timeout parameter.
	* pwdgrp.h (internal_getgroups): Ditto in prototype.
	* uinfo.cc (internal_getlogin): Ditto in usage.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-17 15:42:59 +01:00
Corinna Vinschen 8f00fa7f36
Avoid name change if script is called via symlink from execvp et al.
* spawn.cc (find_exec): Fix a name change in case of a symlink which
	can be opened as is.

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
2015-03-17 11:40:12 +01:00
Jon TURNEY b7f2a6c0a7 Fix winsup/doc to install into prefix
By default, docdir and htmldir are defined in terms of prefix, so make sure to
define it, so their values are prefix-relative.

Without this, 'make install' installs the documentation into /share/doc/ unless
configured otherwise.

	* Makefile.in (prefix): Define.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-03-16 14:53:05 +00:00
Jon TURNEY e9e47b8ce6 Teach stackinfo::walk() how to virtually unwind the tls sigstack
This improves how stackinfo::dumpstack() dumps _sigbe and sigdelayed frames

	* exceptions.cc (stack_info): Add sigstackptr member.
	(walk): Unwind sigstackptr inside _sigbe and sigdelayed.
	* gendef (_sigdelayed_end): Add symbol to mark end of sigdelayed.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-03-13 13:05:52 +00:00
Corinna Vinschen 63c9ffeed8
Remove now useless include/cygwin/sys_time.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-13 13:22:19 +01:00
Alexey Pavlov aaa7d1f14a
net.cc: Remove extra braces.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-13 10:38:49 +01:00
Alexey Pavlov 63b41daeb6
Fix typo in include/cygwin/version.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-12 18:48:59 +01:00
Corinna Vinschen f9d35f473b
Drop defining _BSDTYPES_DEFINED before including winsup.h.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-12 17:11:19 +01:00
Takashi Yano 32fd5b0fe1
Let pty slave detect closure of last master handle
* fhandler_tty.cc (fhandler_pty_master::close): Add code to make slave
	detect closure of master. Fix typo in error message.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-12 15:48:10 +01:00
Corinna Vinschen a34ebbad28
Fix more typos in ntsec.xml
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-12 11:14:57 +01:00
Corinna Vinschen 1aa532fec2
Fix typos in ntsec.xml
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-12 10:53:33 +01:00
Corinna Vinschen 6e90585ad8
Include sys/_timespec.h in cygwin/types.h to adjust to newlib
* include/cygwin/types.h: Include <sys/_timespec.h>

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-11 15:47:19 +01:00
Corinna Vinschen 6bd719beeb
* autoload.cc (CreateEnvironmentBlock): Make loading non-fatal.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-11 12:56:53 +01:00
Corinna Vinschen f085e9d321 Fix condition in DLL loading loop 2015-03-11 12:22:45 +01:00
Yaakov Selkowitz 2a6db5083c cygwin: fix __x86_64__ conditional in stdint.h
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2015-03-10 16:32:52 -05:00
Corinna Vinschen 84195ba6c5 whitespace fix 2015-03-10 16:07:07 +01:00
Corinna Vinschen 9272d8f942 Change CVS->GIT in docs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-03-10 14:19:42 +01:00
Corinna Vinschen e479f4ffb7 mv .cvsignore to .gitignore
Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
2015-03-09 21:40:26 +01:00
Corinna Vinschen 5e99eb1104 * tty.h (tty::set_master_ctl_closed): Rename from set_master_closed.
(tty::is_master_closed): Drop method.
	* fhandler_tty.cc (fhandler_pty_slave::open): Remove code prematurely
	bailing out if master control thread is not running.
	(fhandler_pty_slave::read): Don't generate SIGHUP if master control
	thread is not running.
	(fhandler_pty_master::close): Rearrange code to avoid stopping master
	control thread twice in multi-threaded scenarios.
2015-03-05 13:58:03 +00:00
Corinna Vinschen 3bf693dde1 * fhandler.h (fhandler_base::get_echo_handle): New virtual method.
(class fhandler_pty_master): Add echo_r and echo_w handles constituting
	read and write side of new echo pipe.
	* select.cc (peek_pipe): On pty masters, check additionally if input
	from the echo pipe is available.
	* fhandler_tty.cc (fhandler_pty_master::doecho): Drop output_mutex
	locking.  Write output to echo pipe.
	(fhandler_pty_master::process_slave_output): Check if input is available
	in echo pipe and prefer to read from it, if so.
	(fhandler_pty_slave::write): Drop output_mutex locking.
	(fhandler_pty_master::fhandler_pty_master): Initialize echo pipe
	handles to NULL.
	(fhandler_pty_master::close): Close and NULL echo pipe handles.
	(fhandler_pty_master::setup): Create echo pipe, close in case of error.
2015-03-05 12:57:34 +00:00
Corinna Vinschen e8ef9994cf * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 36. 2015-03-04 11:46:02 +00:00
Corinna Vinschen 1d7a60f56c * posix.xml (std-bsd): Add issetugid. 2015-03-04 11:44:07 +00:00
Corinna Vinschen 694626a5f5 * new-features.xml (ov-new1.7.35): Add SIGSYS change. 2015-03-03 17:10:54 +00:00
Corinna Vinschen 8ac0306085 * msg.cc: Throughout, drop raising SIGSYS if cygserver is not running.
* sem.cc: Ditto.
	* shm.cc: Ditto.
2015-03-03 17:09:30 +00:00
Corinna Vinschen 73c0c53cf4 * new-features.xml (ov-new1.7.35): Add new section. 2015-03-03 13:02:21 +00:00
Corinna Vinschen 37e87b843f * common.din (issetugid): Export.
* glob.cc (issetugid): Drop macro.
	* sec_auth.cc (issetugid): New exported function.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2015-03-03 12:58:34 +00:00
Corinna Vinschen f9f1fbe47e * security.cc (get_attribute_from_acl): Don't spill Everyone permissions
into group permissions if owner SID == group SID.
	(alloc_sd): Add parenthesis for clarity.
2015-03-02 10:52:07 +00:00
Corinna Vinschen 583d56ee20 * utils.xml (getfacl): Adjust options to option nmame change. 2015-02-28 13:15:53 +00:00
Corinna Vinschen f33558a084 *** empty log message *** 2015-02-28 13:14:30 +00:00
Corinna Vinschen 3da543e5bd * getfacl.c (usage): Change --all to --access, --dir to --default.
Align text to output of Linux tool.
	(longopts): Add --access and --default options.
2015-02-28 13:13:19 +00:00
Corinna Vinschen 146200310f * uinfo.cc (pwdgrp::add_line): Return NULL if parsing a line failed.
(pwdgrp::add_account_post_fetch): Check return value from add_line and
	return NULL if add_line returns NULL.
2015-02-28 12:12:34 +00:00
Corinna Vinschen fab17cf934 *** empty log message *** 2015-02-27 16:08:26 +00:00
Corinna Vinschen 9f6688dfc5 * security.cc (alloc_sd): For directories, mark inherited ACEs
inheritable to better follow POSIX 1003.1e rules.
2015-02-27 15:54:15 +00:00
Corinna Vinschen 83b0e8cffe * sec_acl.cc (getacl): Add mask even if all group and secondary account
permissions are 0.
2015-02-27 14:51:00 +00:00
Corinna Vinschen 211cb4df18 * uinfo.cc (pwdgrp::fetch_account_from_windows): Drop redundant test
for SidTypeUser.
2015-02-27 14:03:29 +00:00
Corinna Vinschen 06371539bd * sec_acl.cc (setacl): Fix bug which leads to ACE duplication in
case owner SID == group SID.
	(getacl): Reverse order of SID test against group or owner sid to
	prefer owner attributes over group attributes.  Disable setting group
	permissions equivalent to owner permissions if owner == group.  Add
	comment to explain why.  Fix indentation.
	* security.cc (get_attribute_from_acl): Change type of local variables
	containing permission to mode_t.  Apply deny mask to group if group SID
	== owner SID to avoid Everyone permissions to spill over into group
	permissions.  Disable setting group permissions equivalent to owner
	permissions if owner == group.  Add comment to explain why.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Allow user SID as
	group account if user is a "Microsoft Account".  Explain why.  Drop
	workaround enforcing primary group "Users" for "Microsoft Accounts".
2015-02-27 12:59:09 +00:00
Corinna Vinschen 0fb41ffa65 * ldap.cc (cyg_ldap::wait): Call cygwait with cw_infinite timeout value
and with cw_sig_restart instead of cw_sig_eintr.  Drop useless
	_my_tls.call_signal_handler call.  Return EIO if cygwait failed.
2015-02-26 17:27:59 +00:00
Corinna Vinschen 51a60543f0 * posix_ipc.cc (ipc_mutex_lock): Revert unneeded call to signal handler. 2015-02-26 17:19:27 +00:00
Corinna Vinschen c6d1382a1a * posix_ipc.cc (ipc_mutex_lock): Add bool parameter to influence if
cygwait should be in EINTR or in restart mode.  Call signal handler
	if in EINTR mode.
	(mq_getattr): Call ipc_mutex_lock in restart mode.
	(mq_setattr): Ditto.
	(mq_notify): Ditto.
	(_mq_send): Call ipc_mutex_lock in EINTR mode.
	(_mq_receive): Ditto.
2015-02-26 17:00:11 +00:00