Jon TURNEY | 1 Apr 15:19 2015
Picon

[PATCH 0/3] Make detailed exception information available to signal handlers (v4)

Thanks for your comments so far.

Changes since v3:

Rename cr2 member of struct __ucontext to ctxflags
Add cr2 member after oldmask to struct __ucontext
Keep __COPY_CONSTRUCT_SIZE as it's historical value

Add uc_flags member to ucontext_t in case of future need
Set uc_sigmask
Use RtlCopyContext() if we don't have a context
Add a FIXME for uc_stack mentioning sigaltstack
Simplify additions to call_signal_handler() since a ucontext_t is now always passed
Just include signal.h in sys/ucontext.h

Change CW_EXCEPTION_RECORD_FROM_SIGINFO_T to return a copy of the EXCEPTION_RECORD
#define CW_EXCEPTION_RECORD_FROM_SIGINFO_T 

Jon TURNEY (3):
  Rename struct ucontext to struct __mcontext
  Provide ucontext to signal handlers
  Add cygwin_internal() operation to retrieve the EXCEPTION_RECORD from
    a siginfo_t *

 winsup/cygwin/ChangeLog               | 21 +++++++++++++++++++++
 winsup/cygwin/exception.h             |  1 +
 winsup/cygwin/exceptions.cc           | 22 ++++++++++++++++++++--
 winsup/cygwin/external.cc             | 14 ++++++++++++++
 winsup/cygwin/include/cygwin/signal.h | 28 +++++++++++++++++++---------
 winsup/cygwin/include/sys/cygwin.h    |  5 ++++-
(Continue reading)

Renato Silva | 31 Mar 20:23 2015
Picon

Fix error mapping in gethostname

The gethostname function has a problem where a small buffer size will
not produce an accurate errno. This is because the Windows error is
not being appropriately mapped. This causes programs such as hostname
from coreutils to fail because they are not informed about the long
name.

Changelog entry:
2015-03-31  Renato Silva  <br.renatosilva <at> gmail.com>
    * net.cc: Fix buffer size error handling in cygwin_gethostname.

-----

/* Test case */

#include <errno.h>
#include <stdio.h>
#include <windows.h>

int main(int argc, char **argv) {

    if (argc < 2) {
        printf("Please provide a buffer length.\n");
        return 1;
    }
    DWORD HOSTNAME_LENGTH = atoi(argv[1]);
    char hostname[HOSTNAME_LENGTH];
    char error_message[256];
    int return_value;

    printf("gethostname %s\n", gethostname(hostname, HOSTNAME_LENGTH)?
(Continue reading)

Jon TURNEY | 31 Mar 19:50 2015
Picon

[PATCH] Fix documentation of cygwin_internal()'s return type.

	* misc-funcs.xml (cygwin_internal): Correct return type.
---
 winsup/doc/ChangeLog      | 4 ++++
 winsup/doc/misc-funcs.xml | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index 814e651..b04210f 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
 <at>  <at>  -1,3 +1,7  <at>  <at> 
+2015-03-31  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* misc-funcs.xml (cygwin_internal): Correct return type.
+
 2015-03-13  Jon TURNEY  <jon.turney <at> dronecode.org.uk>

 	* Makefile.in (prefix): Define.
diff --git a/winsup/doc/misc-funcs.xml b/winsup/doc/misc-funcs.xml
index 06776d9..b164341 100644
--- a/winsup/doc/misc-funcs.xml
+++ b/winsup/doc/misc-funcs.xml
 <at>  <at>  -34,7 +34,7  <at>  <at>  much.</para>
 <title>cygwin_internal</title>

 <funcsynopsis><funcprototype>
-<funcdef>extern "C" DWORD
+<funcdef>extern "C" uintptr_t
 <function>cygwin_internal</function></funcdef>
 <paramdef>cygwin_getinfo_types <parameter>t</parameter></paramdef>
(Continue reading)

Jon TURNEY | 31 Mar 19:46 2015
Picon

[PATCH 0/3] Make detailled exception information available to signal handlers

Thanks for your help so far.  Here's another attempt at this.

Questions:

The ContextFlags member of the CONTEXT type is named cr2 in struct __mcontext. I 
don't understand how that can be right.

For a non-exception signal, we won't have aCONTEXT to provide.  Is one that is 
all zeroes acceptable?

Jon TURNEY (3):
  Rename struct ucontext to struct __mcontext
  Make mcontext and stack information available to signal handlers
  Add cygwin_internal() operation to convert siginfo_t * to
    EXCEPTION_RECORD *

 winsup/cygwin/ChangeLog               | 20 ++++++++++++++++++++
 winsup/cygwin/exception.h             |  1 +
 winsup/cygwin/exceptions.cc           | 20 ++++++++++++++++++--
 winsup/cygwin/external.cc             | 13 +++++++++++++
 winsup/cygwin/include/cygwin/signal.h | 18 +++++++++++-------
 winsup/cygwin/include/sys/cygwin.h    |  4 +++-
 winsup/cygwin/include/sys/ucontext.h  | 26 ++++++++++++++++++++++++++
 winsup/cygwin/include/ucontext.h      | 16 ++++++++++++++++
 8 files changed, 108 insertions(+), 10 deletions(-)
 create mode 100644 winsup/cygwin/include/sys/ucontext.h
 create mode 100644 winsup/cygwin/include/ucontext.h

--

-- 
2.1.4
(Continue reading)

Jon TURNEY | 26 Mar 16:25 2015
Picon

[PATCH] Make EXCEPTION_POINTERS available to signal handlers

Add ucontext.h header, defining ucontext_t and mcontext_t types.

Provide sigaction sighandlers with a ucontext_t parameter containing a
mcontext_t with exception context information, if available.

	* include/sys/ucontext.h (__ucontext): New header.
	* include/ucontext.h (_UCONTEXT_H): Ditto.
	* exception.h (cygwin_exception): Add exception_record accessor.
	* exceptions.cc (call_signal_handler): Provide ucontext_t
	parameter to signal handler function, if available.

Signed-off-by: Jon TURNEY <jon.turney <at> dronecode.org.uk>
---
 winsup/cygwin/ChangeLog              |  8 ++++++++
 winsup/cygwin/exception.h            |  1 +
 winsup/cygwin/exceptions.cc          | 16 ++++++++++++++--
 winsup/cygwin/include/sys/ucontext.h | 27 +++++++++++++++++++++++++++
 winsup/cygwin/include/ucontext.h     | 16 ++++++++++++++++
 5 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 winsup/cygwin/include/sys/ucontext.h
 create mode 100644 winsup/cygwin/include/ucontext.h

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 869beee..ce09390 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
 <at>  <at>  -1,3 +1,11  <at>  <at> 
+2015-03-26  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* include/sys/ucontext.h (__ucontext): New header.
(Continue reading)

Yaakov Selkowitz | 26 Mar 06:25 2015
Picon

[PATCH] 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.
---
This depends on the newlib patch currently under discussion.

 winsup/cygwin/common.din |  1 +
 winsup/cygwin/path.cc    | 28 ++++++++++++++++++++++++++++
 winsup/doc/posix.xml     |  6 +++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 42098ff..f14b331 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
 <at>  <at>  -61,6 +61,7  <at>  <at>  __fsetlocking SIGFE
 __fwritable NOSIGFE
 __fwriting NOSIGFE
 __getreent NOSIGFE
+__gnu_basename NOSIGFE
 __infinity NOSIGFE
 __isinfd NOSIGFE
 __isinff NOSIGFE
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 47c687f..b05333f 100644
--- a/winsup/cygwin/path.cc
(Continue reading)

Jon TURNEY | 13 Mar 15:25 2015
Picon

[PATCH] 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.
---
 winsup/doc/ChangeLog   | 4 ++++
 winsup/doc/Makefile.in | 1 +
 2 files changed, 5 insertions(+)

diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index aefb41e..814e651 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
 <at>  <at>  -1,3 +1,7  <at>  <at> 
+2015-03-13  Jon TURNEY  <jon.turney <at> dronecode.org.uk>
+
+	* Makefile.in (prefix): Define.
+
 2015-03-12  Corinna Vinschen  <corinna <at> vinschen.de>

 	* ntsec.xml (ntsec-mapping-nsswitch-desc): Fix typo.
diff --git a/winsup/doc/Makefile.in b/winsup/doc/Makefile.in
index 55fd850..5b2f0ed 100644
--- a/winsup/doc/Makefile.in
+++ b/winsup/doc/Makefile.in
 <at>  <at>  -12,6 +12,7  <at>  <at>  SHELL =  <at> SHELL <at> 
 srcdir =  <at> srcdir <at> 
(Continue reading)

Alexey Pavlov | 12 Mar 19:18 2015
Picon

braces around scalar initializer for type

Building MSYS2 runtime I'm get:

/build2/msys2-runtime/src/msys2-runtime/winsup/cygwin/net.cc:82:56:
error: braces around scalar initializer for type 'u_char {aka unsigned
char}'
 const struct in6_addr in6addr_any = {{IN6ADDR_ANY_INIT}};

                          ^
/build2/msys2-runtime/src/msys2-runtime/winsup/cygwin/net.cc:83:66:
error: braces around scalar initializer for type 'u_char {aka unsigned
char}'
 const struct in6_addr in6addr_loopback = {{IN6ADDR_LOOPBACK_INIT}};

                                               ^
/build2/msys2-runtime/src/msys2-runtime/winsup/cygwin/../Makefile.common:43:
recipe for target 'net.o' failed

So I think next patch can be applied:

From 9c11fcf2fc74601eb48e8060b6575b56be111a02 Mon Sep 17 00:00:00 2001
From: Alexpux <alexey.pawlow <at> gmail.com>
Date: Thu, 12 Mar 2015 14:33:39 +0300
Subject: [PATCH] Fix error "braces around scalar initializer for type"

---
 winsup/cygwin/net.cc                   | 4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index e06fd52..f9b317c 100644
(Continue reading)

Alexey Pavlov | 12 Mar 18:30 2015
Picon

Fix typo

From 9c11fcf2fc74601eb48e8060b6575b56be111a02 Mon Sep 17 00:00:00 2001
From: Alexpux <alexey.pawlow <at> gmail.com>
Date: Thu, 12 Mar 2015 14:33:39 +0300
Subject: [PATCH] Fix typos.

---
 winsup/cygwin/include/cygwin/version.h | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/winsup/cygwin/include/cygwin/version.h
b/winsup/cygwin/include/cygwin/version.h
index b46fe24..71d118e 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
 <at>  <at>  -467,7 +467,7  <at>  <at>  details. */
            putwc_unlocked, putwchar_unlocked.
       284: Export sockatmark.
       285: Export wcstold.
-      285: Export cabsl, cimagl, creall, finitel, hypotl, sqrtl.
+      286: Export cabsl, cimagl, creall, finitel, hypotl, sqrtl.
       287: Export issetugid.
      */

--

-- 
2.3.0

Jon TURNEY | 12 Mar 15:05 2015
Picon

[PATCH] Improve stackdumps on x86_64


I was looking at the crash reported at [1]. Processing the stackdump gives:

> 0x000000018006ff23    signal_exit                                exceptions.cc:1234
> 0x00000001800713ea    _cygtls::call_signal_handler()             exceptions.cc:1490
> 0x0000000180121d04    sig_send(_pinfo*, siginfo_t&, _cygtls*)    sigproc.cc:714
> 0x000000018011ee5e    _pinfo::kill(siginfo_t&)                   signal.cc:252
> 0x000000018011f32b    kill0                                      signal.cc:303
> 0x000000018011f4fc    raise                                      signal.cc:289
> 0x000000018011f7bf    abort                                      signal.cc:376
> 0x00000001801528c5    dlfree                                     malloc.cc:4762
> 0x00000001800c52b3    free                                       sync.h:36
> 0x000000018011ae5b    ??                                         sigfe.s:43

Which is not entirely helpful.

We can see that an abort signal is being raised inside free, but the 
stacktrace stops at _sigbe, because unwinding that frame requires 
special measures.

Presumably run has some invalid heap use going on, but annoyingly the 
stackdump stops short of identifying the problem line.

Attached is a patch which teaches stack_info::walk() how to unwind these 
frames on x86_64.

Also attached is a small testcase, which currently produces a similar 
stackdump truncated at _sigbe, or with my patch applied:

> 0x0000000180070238    signal_exit                                exceptions.cc:1321
(Continue reading)

Yaakov Selkowitz | 10 Mar 17:26 2015
Picon

[PATCH] cygwin: fix __x86_64__ conditional in stdint.h

Signed-off-by: Yaakov Selkowitz <yselkowi <at> redhat.com>
---
 winsup/cygwin/ChangeLog        | 4 ++++
 winsup/cygwin/include/stdint.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 550490a..cd2dbb9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
 <at>  <at>  -1,3 +1,7  <at>  <at> 
+2015-03-10  Yaakov Selkowitz  <yselkowitz <at> cygwin.com>
+
+	* include/stdint.h: Fix __x86_64__ conditional.
+
 2015-03-05  Corinna Vinschen  <corinna <at> vinschen.de>

 	* tty.h (tty::set_master_ctl_closed): Rename from set_master_closed.
diff --git a/winsup/cygwin/include/stdint.h b/winsup/cygwin/include/stdint.h
index b670884..94b6b76 100644
--- a/winsup/cygwin/include/stdint.h
+++ b/winsup/cygwin/include/stdint.h
 <at>  <at>  -114,7 +114,7  <at>  <at>  typedef unsigned long long uintmax_t;
 #if !defined (__cplusplus) || defined (__STDC_LIMIT_MACROS) \
     || defined (__INSIDE_CYGWIN__)

-#if __x86_64__
+#ifdef __x86_64__
 # define __I64(n) n ## L
 # define __U64(n) n ## UL
(Continue reading)


Gmane