Commit Graph

10860 Commits

Author SHA1 Message Date
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