[newlib-cygwin] cygcheck: expand common_apps list

2019-06-04 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5c2a3661c1aeefb0591ce46e8ab3274f0c6d9112

commit 5c2a3661c1aeefb0591ce46e8ab3274f0c6d9112
Author: Yaakov Selkowitz 
Date:   Thu May 23 11:47:36 2019 -0400

cygcheck: expand common_apps list

An increasing number of tools are being included in Windows which have the
same names as those included in Cygwin packages.  Indicating which one is
first in PATH can be helpful in diagnosing behavioural discrepencies
between them.

Also, fix the alphabetization of ssh.

Diff:
---
 winsup/utils/cygcheck.cc | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index d5972c0..2cc25d9 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -99,28 +99,43 @@ static common_apps[] = {
   {"awk", 0},
   {"bash", 0},
   {"cat", 0},
+  {"certutil", 0},
+  {"clinfo", 0},
+  {"comp", 0},
+  {"convert", 0},
   {"cp", 0},
   {"cpp", 1},
   {"crontab", 0},
+  {"curl", 0},
+  {"expand", 0},
   {"find", 0},
+  {"ftp", 0},
   {"gcc", 0},
   {"gdb", 0},
   {"grep", 0},
+  {"hostname", 0},
   {"kill", 0},
+  {"klist", 0},
   {"ld", 0},
   {"ls", 0},
   {"make", 0},
   {"mv", 0},
+  {"nslookup", 0},
   {"patch", 0},
   {"perl", 0},
+  {"replace", 0},
   {"rm", 0},
   {"sed", 0},
-  {"ssh", 0},
   {"sh", 0},
+  {"shutdown", 0},
+  {"sort", 0},
+  {"ssh", 0},
   {"tar", 0},
   {"test", 0},
+  {"timeout", 0},
   {"vi", 0},
   {"vim", 0},
+  {"whoami", 0},
   {0, 0}
 };


[newlib-cygwin] Cygwin: document secure_getenv

2019-02-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a62b29bfec6d8c6cf3f285b4c7a5edcf4abf33e1

commit a62b29bfec6d8c6cf3f285b4c7a5edcf4abf33e1
Author: Yaakov Selkowitz 
Date:   Tue Feb 19 14:34:18 2019 -0600

Cygwin: document secure_getenv

Signed-off-by: Yaakov Selkowitz 

Diff:
---
 winsup/cygwin/release/3.0.1 | 2 ++
 winsup/doc/new-features.xml | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/release/3.0.1 b/winsup/cygwin/release/3.0.1
index 1894c5c..467bf23 100644
--- a/winsup/cygwin/release/3.0.1
+++ b/winsup/cygwin/release/3.0.1
@@ -1,6 +1,8 @@
 What's new:
 ---
 
+- New API: secure_getenv.
+
 
 What changed:
 -
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 8fc0ac6..ab369ab 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -43,7 +43,7 @@ Support Linux-specific open(2) flag O_PATH.
 
 
 
-- Support Linux-specific linkat(2) flag AT_EMPTY_PATH.
+Support Linux-specific linkat(2) flag AT_EMPTY_PATH.
 
 
 
@@ -52,8 +52,8 @@ siginfo_t::si_overrun).
 
 
 
-New APIs: signalfd, timerfd_create, timerfd_gettime, timerfd_settime,
-timer_getoverrun.
+New APIs: secure_getenv, signalfd, timerfd_create, timerfd_gettime,
+timerfd_settime, timer_getoverrun.
 
 
 


[newlib-cygwin] Cygwin: add secure_getenv

2019-02-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=850705f92e3371bc0c56cee270327add84cd441a

commit 850705f92e3371bc0c56cee270327add84cd441a
Author: Yaakov Selkowitz 
Date:   Mon Feb 18 23:06:11 2019 -0600

Cygwin: add secure_getenv

Signed-off-by: Yaakov Selkowitz 

Diff:
---
 newlib/libc/include/stdlib.h   |  3 +++
 winsup/cygwin/common.din   |  1 +
 winsup/cygwin/environ.cc   | 10 ++
 winsup/cygwin/include/cygwin/version.h |  3 ++-
 winsup/doc/posix.xml   |  1 +
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 9773d36..933d181 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -94,6 +94,9 @@ void  exit (int __status) _ATTRIBUTE ((__noreturn__));
 void   free (void *) _NOTHROW;
 char *  getenv (const char *__string);
 char * _getenv_r (struct _reent *, const char *__string);
+#if __GNU_VISIBLE
+char *  secure_getenv (const char *__string);
+#endif
 char * _findenv (const char *, int *);
 char * _findenv_r (struct _reent *, const char *, int *);
 #if __POSIX_VISIBLE >= 200809
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index f620d81..68b95d4 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1255,6 +1255,7 @@ sched_rr_get_interval SIGFE
 sched_setparam SIGFE
 sched_setscheduler SIGFE
 sched_yield SIGFE
+secure_getenv NOSIGFE
 seed48 NOSIGFE
 seekdir SIGFE
 select = cygwin_select SIGFE
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 495c340..21f1373 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -549,6 +549,16 @@ _getenv_r (struct _reent *, const char *name)
   return findenv_func (name, );
 }
 
+/* Like getenv, but returns NULL if effective and real UID/GIDs do not match */
+extern "C" char *
+secure_getenv (const char *name)
+{
+  int offset;
+  if (cygheap->user.issetuid ())
+return NULL;
+  return findenv_func (name, );
+}
+
 /* Return number of environment entries, including terminating NULL. */
 static int __stdcall
 envsize (const char * const *in_envp)
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index 2c55f4b..d865f29 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -508,12 +508,13 @@ details. */
   335: Change size of utsname, change uname output.
   336: New Cygwin PID algorithm (yeah, not really an API change)
   337: MOUNT_BINARY -> MOUNT_TEXT
+  338: Export secure_getenv.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 337
+#define CYGWIN_VERSION_API_MINOR 338
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 8e9b1a5..0755bed 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1377,6 +1377,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 removexattr
 scandirat
 sched_getcpu
+secure_getenv
 setxattr
 signalfd
 sincos


[newlib-cygwin] Cygwin: fpathconf: update _PC_ASYNC_IO return value

2018-07-27 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7e09931ad95a10d15b7a93b49faeadfe25f63464

commit 7e09931ad95a10d15b7a93b49faeadfe25f63464
Author: Yaakov Selkowitz 
Date:   Wed Jul 25 15:00:43 2018 -0500

Cygwin: fpathconf: update _PC_ASYNC_IO return value

Signed-off-by: Yaakov Selkowitz 

Diff:
---
 winsup/cygwin/fhandler.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index ded12cc..22dbdb0 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1875,6 +1875,7 @@ fhandler_base::fpathconf (int v)
   set_errno (EINVAL);
   break;
 case _PC_ASYNC_IO:
+  return 1;
 case _PC_PRIO_IO:
   break;
 case _PC_SYNC_IO:


[newlib-cygwin] Cygwin: define _POSIX_ASYNCHRONOUS_IO

2018-07-25 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f6417be2aa98e9da0aca22fbbe2a2a7c39a6f45b

commit f6417be2aa98e9da0aca22fbbe2a2a7c39a6f45b
Author: Yaakov Selkowitz 
Date:   Wed Jul 25 10:48:55 2018 -0500

Cygwin: define _POSIX_ASYNCHRONOUS_IO

This feature is now available as of the recent AIO commits.

Signed-off-by: Yaakov Selkowitz 

Diff:
---
 newlib/libc/include/sys/features.h | 2 +-
 winsup/cygwin/sysconf.cc   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/features.h 
b/newlib/libc/include/sys/features.h
index 2900b33..f28dd07 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -425,7 +425,7 @@ extern "C" {
 #endif
 
 #define _POSIX_ADVISORY_INFO   200809L
-/* #define _POSIX_ASYNCHRONOUS_IO  -1 */
+#define _POSIX_ASYNCHRONOUS_IO 200809L
 #define _POSIX_BARRIERS200809L
 #define _POSIX_CHOWN_RESTRICTED 1
 #define _POSIX_CLOCK_SELECTION 200809L
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index ff98f57..753febc 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -528,7 +528,7 @@ static struct
   {cons, {c:SIGQUEUE_MAX}},/*  18, _SC_SIGQUEUE_MAX */
   {cons, {c:TIMER_MAX}},   /*  19, _SC_TIMER_MAX */
   {nsup, {c:0}},   /*  20, _SC_TZNAME_MAX */
-  {cons, {c:-1L}}, /*  21, _SC_ASYNCHRONOUS_IO */
+  {cons, {c:_POSIX_ASYNCHRONOUS_IO}},  /*  21, _SC_ASYNCHRONOUS_IO */
   {cons, {c:_POSIX_FSYNC}},/*  22, _SC_FSYNC */
   {cons, {c:_POSIX_MAPPED_FILES}}, /*  23, _SC_MAPPED_FILES */
   {cons, {c:-1L}}, /*  24, _SC_MEMLOCK */


[newlib-cygwin] Cygwin: fix build with GCC 7

2018-04-17 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=67609efeb0bcb198463a952a6a214813794a9c2b

commit 67609efeb0bcb198463a952a6a214813794a9c2b
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Apr 16 22:46:11 2018 -0500

Cygwin: fix build with GCC 7

GCC 7 is able to see straight through this trick, so use a more formal
method to avoid the warning.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/random.cc | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/winsup/cygwin/random.cc b/winsup/cygwin/random.cc
index 802c33b..163fc04 100644
--- a/winsup/cygwin/random.cc
+++ b/winsup/cygwin/random.cc
@@ -279,14 +279,6 @@ srandom(unsigned x)
(void)random();
 }
 
-/* Avoid a compiler warning when we really want to get at the junk in
-   an uninitialized variable. */
-static unsigned long
-dummy (unsigned volatile long *x)
-{
-  return *x;
-}
-
 /*
  * srandomdev:
  *
@@ -313,7 +305,11 @@ srandomdev()
unsigned long junk;
 
gettimeofday(, NULL);
-   srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ 
dummy());
+   /* Avoid a compiler warning when we really want to get at the
+  junk in an uninitialized variable. */
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+   srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
+#pragma GCC diagnostic pop
return;
}


[newlib-cygwin] cygwin: update docs for 2.10.0

2018-01-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=00bf01789e3f1e794b3424dab683c569cab72f17

commit 00bf01789e3f1e794b3424dab683c569cab72f17
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Jan 19 00:36:15 2018 -0600

cygwin: update docs for 2.10.0

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/release/2.10.0 | 27 +++
 winsup/doc/new-features.xml  | 27 ++-
 winsup/doc/posix.xml |  6 +++---
 3 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0
index 0c6b406..ad71229 100644
--- a/winsup/cygwin/release/2.10.0
+++ b/winsup/cygwin/release/2.10.0
@@ -7,12 +7,39 @@ What's new:
 
 - scanf now handles the %l[ conversion.
 
+- Improved hostprogs compatibility for cross-compiling the Linux kernel.
+New headers: , .
+
+- Built-in implementation of Stack Smashing Protection compiler feature.
+New APIs: __stack_chk_fail, __stack_chk_guard.
+
+- Built-in implementation of _FORTIFY_SOURCE guards for functions in
+, , , , , ,
+, and .
+New APIs:  __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, __mempcpy_chk,
+__memset_chk, __snprintf_chk, __sprintf_chk, __stpcpy_chk, __stpncpy_chk,
+__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk,
+__vsprintf_chk.
+
+- Built-in implementation of POSIX.1-2001 message catalog support.
+New APIs: catclose, catgets, catopen.  New tool: gencat.
+
 - New APIs: sigtimedwait, wmempcpy.
 
 
 What changed:
 -
 
+- Standard headers no longer use macros to support K C.
+
+- confstr(3) and getconf(1) accept LFS_CFLAGS, LFS_LDFLAGS, etc.
+
+- The __always_inline and __nonnull macros in  are now
+compatible with glibc.
+
+- Feature Test Macros improvements in , , ,
+, and .
+
 
 Bug Fixes
 -
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index b3d2588..59af6ef 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -17,7 +17,32 @@ scanf/wscanf now handle the POSIX %m modifier.
 
 
 
-- scanf now handles the %l[ conversion.
+scanf now handles the %l[ conversion.
+
+
+
+Improved hostprogs compatibility for cross-compiling the Linux kernel.
+New headers: asm/bitsperlong.h, asm/posix_types.h.
+
+
+
+Built-in implementation of Stack Smashing Protection compiler feature.
+New APIs: __stack_chk_fail, __stack_chk_guard.
+
+
+
+Built-in implementation of _FORTIFY_SOURCE guards for functions in
+stdio.h, stdlib.h, string.h, strings.h,
+unistd.h, wchar.h, sys/poll.h, and 
sys/socket.h.
+New APIs:  __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, __mempcpy_chk,
+__memset_chk, __snprintf_chk, __sprintf_chk, __stpcpy_chk, __stpncpy_chk,
+__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk,
+__vsprintf_chk.
+
+
+
+Built-in implementation of POSIX.1-2001 message catalog support.
+New APIs: catclose, catgets, catopen.  New tool: gencat.
 
 
 
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 2664159..8b4bab1 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -86,9 +86,9 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 catanhf
 catanhl
 catanl
-catclose   (available in external "catgets" library)
-catgets(available in external "catgets" library)
-catopen(available in external "catgets" library)
+catclose
+catgets
+catopen
 cbrt
 cbrtf
 cbrtl


[newlib-cygwin] cygwin: add gencat tool

2018-01-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e5d52a2db9996dcd7c17a1eb6b7bb93d29413ab4

commit e5d52a2db9996dcd7c17a1eb6b7bb93d29413ab4
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Thu Jan 18 23:28:27 2018 -0600

cygwin: add gencat tool

This is needed for compiling catalog files used in catgets(3) calls.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/utils/Makefile.in |   2 +-
 winsup/utils/gencat.c| 696 +++
 2 files changed, 697 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in
index 0ad73fb..be525d0 100644
--- a/winsup/utils/Makefile.in
+++ b/winsup/utils/Makefile.in
@@ -54,7 +54,7 @@ MINGW_CXX  := @MINGW_CXX@
 
 # List all binaries to be linked in Cygwin mode.  Each binary on this list
 # must have a corresponding .o of the same name.
-CYGWIN_BINS := ${addsuffix .exe,cygpath getconf getfacl ldd locale kill 
minidumper mkgroup \
+CYGWIN_BINS := ${addsuffix .exe,cygpath gencat getconf getfacl ldd locale kill 
minidumper mkgroup \
 mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset 
umount}
 
 # List all binaries to be linked in MinGW mode.  Each binary on this list
diff --git a/winsup/utils/gencat.c b/winsup/utils/gencat.c
new file mode 100644
index 000..a583a88
--- /dev/null
+++ b/winsup/utils/gencat.c
@@ -0,0 +1,696 @@
+/* ex:ts=4
+ */
+
+/* $NetBSD: gencat.c,v 1.18 2003/10/27 00:12:43 lukem Exp $*/
+
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND MIT
+ *
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by J.T. Conklin.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/***
+Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
+
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that Alfalfa's name not be used in
+advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+If you make any modifications, bugfixes or other changes to this software
+we'd appreciate it if you could send a copy to us so we can keep things
+up-to-date.  Many thanks.
+   Kee Hinckley
+   Alfalfa Software, Inc.
+   267 Allston St., #3
+   Cambridge, MA 02139  USA
+   naz...@alfalfa.com
+
+**/
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#define _NLS_PRIVATE
+
+#include 
+#include 
+
+#include  /* for htonl() */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct _msgT {
+   longmsgI

[newlib-cygwin] cygwin: add catopen, catgets, catclose

2018-01-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cadc12f69584626fbc7fd5b2f92345dba34f58d9

commit cadc12f69584626fbc7fd5b2f92345dba34f58d9
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Thu Jan 18 23:26:41 2018 -0600

cygwin: add catopen, catgets, catclose

The implementation is taken from FreeBSD with #ifdef __CYGWIN__ 
modifications.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/Makefile.in  |   1 +
 winsup/cygwin/common.din   |   3 +
 winsup/cygwin/include/cygwin/version.h |   3 +-
 winsup/cygwin/include/nl_types.h   | 100 +++
 winsup/cygwin/libc/msgcat.c| 478 +
 5 files changed, 584 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index c1de26c..b75774a 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -333,6 +333,7 @@ DLL_OFILES:= \
mktemp.o \
mmap.o \
msg.o \
+   msgcat.o \
mount.o \
net.o \
netdb.o \
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 91f2915..6e8bf91 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -274,6 +274,9 @@ catanh NOSIGFE
 catanhf NOSIGFE
 catanhl NOSIGFE
 catanl NOSIGFE
+catclose SIGFE
+catgets SIGFE
+catopen SIGFE
 cbrt NOSIGFE
 cbrtf NOSIGFE
 cbrtl NOSIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index aa7c14e..fa9137d 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -493,12 +493,13 @@ details. */
   322: [w]scanf %m modifier.
   323: scanf %l[ conversion.
   324: Export sigtimedwait.
+  325: Export catclose, catgets, catopen.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 324
+#define CYGWIN_VERSION_API_MINOR 325
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/cygwin/include/nl_types.h b/winsup/cygwin/include/nl_types.h
new file mode 100644
index 000..b9c06f6
--- /dev/null
+++ b/winsup/cygwin/include/nl_types.h
@@ -0,0 +1,100 @@
+/* $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $  */
+
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ *
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by J.T. Conklin.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _NL_TYPES_H_
+#define _NL_TYPES_H_
+
+#include 
+#include 
+
+#ifdef _NLS_PRIVATE
+/*
+ * MESSAGE CATALOG FILE FORMAT.
+ *
+ * The NetBSD/FreeBSD message catalog format is similar to the format used by
+ * Svr4 systems.  The differences are:
+ *   * fixed byte order (big endian)
+ *   * fixed data field sizes
+ *
+ * A message catalog contains four data types: a catalog header, one
+ * or more set headers, one or more message headers, and one or more
+ * text strings.
+ */
+
+#define _NLS_MAGIC 0xff88ff89
+
+struct _nls_cat_hdr {
+   int32_t __magic;
+   int32_t __nsets;
+   int32_t __mem;
+   int32_t __msg_hdr_offset;
+   int32_t __msg_txt_offset;
+} ;
+
+struct _nls_set_hdr {
+   int32_t __setno;/* set number: 0 < x <= NL_SETMAX */
+   int32_t __nmsgs;/* number of messages in the set  */
+   int32_t __index;/* index of first msg_hd

[newlib-cygwin] cygwin: make completely visible from

2018-01-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=061710370c6e02b87f5e366310d41f99ae73e5df

commit 061710370c6e02b87f5e366310d41f99ae73e5df
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Jan 15 21:19:59 2018 -0600

cygwin: make  completely visible from 

While POSIX mandates that certain socket types shall be defined by the
inclusing of , it also says that this header may also make
visible all  symbols.  Glibc does this, and without out it,
some packages end up requiring an additional #include .

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/cygwin/in.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/include/cygwin/in.h 
b/winsup/cygwin/include/cygwin/in.h
index 9d7331d..42b7766 100644
--- a/winsup/cygwin/include/cygwin/in.h
+++ b/winsup/cygwin/include/cygwin/in.h
@@ -18,7 +18,7 @@
 #ifndef _CYGWIN_IN_H
 #define _CYGWIN_IN_H
 
-#include 
+#include 
 
 #ifndef _IN_ADDR_T_DECLARED
 typedef__uint32_t  in_addr_t;


[newlib-cygwin] cygwin: remove inclusion of from

2018-01-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=fa47495755489a0807104a2a7c7347f57dc5d1f1

commit fa47495755489a0807104a2a7c7347f57dc5d1f1
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Jan 19 12:06:00 2018 -0600

cygwin: remove inclusion of  from 

POSIX does not mention the inclusion of  in 
or , nor is there anything in the latter two that would
require the former.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/sys/socket.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/winsup/cygwin/include/sys/socket.h 
b/winsup/cygwin/include/sys/socket.h
index 9e897a9..e6b92ee 100644
--- a/winsup/cygwin/include/sys/socket.h
+++ b/winsup/cygwin/include/sys/socket.h
@@ -11,7 +11,6 @@ details. */
 
 #include 
 #include 
-#include 
 
 #ifdef __cplusplus
 extern "C"


[newlib-cygwin] ansification: remove _EXFUN, _EXFUN_NOTHROW

2018-01-17 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=70ee6b17df9b055a05cdcc4d3fe1813d7b57e2d8

commit 70ee6b17df9b055a05cdcc4d3fe1813d7b57e2d8
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Sun Dec 3 23:54:48 2017 -0600

ansification: remove _EXFUN, _EXFUN_NOTHROW

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 libgloss/aarch64/syscalls.c  |   2 +-
 libgloss/arm/syscalls.c  |   2 +-
 libgloss/mcore/write.c   |   2 +-
 libgloss/sparc_leon/asm-leon/clock.h |   4 +-
 libgloss/write.c |   2 +-
 newlib/libc/ctype/local.h|   2 +-
 newlib/libc/iconv/ces/table.c|   8 +-
 newlib/libc/iconv/lib/ucsconv.c  |   4 +-
 newlib/libc/include/_ansi.h  |   9 -
 newlib/libc/include/alloca.h |   2 +-
 newlib/libc/include/assert.h |   8 +-
 newlib/libc/include/ctype.h  |  32 +-
 newlib/libc/include/envlock.h|   4 +-
 newlib/libc/include/getopt.h |  28 +-
 newlib/libc/include/iconv.h  |  16 +-
 newlib/libc/include/ieeefp.h |  16 +-
 newlib/libc/include/libgen.h |   4 +-
 newlib/libc/include/locale.h |   8 +-
 newlib/libc/include/pthread.h| 352 +++
 newlib/libc/include/rpc/xdr.h| 102 ++---
 newlib/libc/include/setjmp.h |   6 +-
 newlib/libc/include/signal.h |  10 +-
 newlib/libc/include/spawn.h  |  81 ++--
 newlib/libc/include/stdio.h  | 638 +--
 newlib/libc/include/stdio_ext.h  |  18 +-
 newlib/libc/include/stdlib.h | 270 ++--
 newlib/libc/include/string.h | 104 ++---
 newlib/libc/include/sys/iconvnls.h   |  22 +-
 newlib/libc/include/sys/reent.h  |   4 +-
 newlib/libc/include/sys/resource.h   |   2 +-
 newlib/libc/include/sys/signal.h |  47 +-
 newlib/libc/include/sys/stat.h   |  42 +-
 newlib/libc/include/sys/time.h   |  24 +-
 newlib/libc/include/sys/times.h  |   4 +-
 newlib/libc/include/sys/unistd.h | 266 +--
 newlib/libc/include/time.h   |  85 ++--
 newlib/libc/include/wchar.h  | 326 +++---
 newlib/libc/include/wctype.h |  36 +-
 newlib/libc/machine/powerpc/machine/malloc.h |  12 +-
 newlib/libc/machine/powerpc/machine/stdlib.h |  78 ++--
 newlib/libc/machine/spu/c99ppe.h |   4 +-
 newlib/libc/misc/__dprintf.c |   8 +-
 newlib/libc/stdio/asnprintf.c|   8 +-
 newlib/libc/stdio/asprintf.c |   8 +-
 newlib/libc/stdio/dprintf.c  |   8 +-
 newlib/libc/stdio/fprintf.c  |   8 +-
 newlib/libc/stdio/fscanf.c   |   8 +-
 newlib/libc/stdio/fvwrite.h  |   4 +-
 newlib/libc/stdio/getline.c  |   2 +-
 newlib/libc/stdio/local.h| 106 ++---
 newlib/libc/stdio/nano-vfprintf.c|  14 +-
 newlib/libc/stdio/nano-vfscanf.c |  22 +-
 newlib/libc/stdio/printf.c   |   8 +-
 newlib/libc/stdio/scanf.c|   8 +-
 newlib/libc/stdio/snprintf.c |   8 +-
 newlib/libc/stdio/sprintf.c  |   8 +-
 newlib/libc/stdio/sscanf.c   |   8 +-
 newlib/libc/stdio/vasnprintf.c   |   8 +-
 newlib/libc/stdio/vasprintf.c|   8 +-
 newlib/libc/stdio/vdprintf.c |   8 +-
 newlib/libc/stdio/vfprintf.c |   8 +-
 newlib/libc/stdio/vfscanf.c  |   6 +-
 newlib/libc/stdio/vfwprintf.c|  12 +-
 newlib/libc/stdio/vprintf.c  |   6 +-
 newlib/libc/stdio/vscanf.c   |   6 +-
 newlib/libc/stdio/vsnprintf.c|   8 +-
 newlib/libc/stdio/vsprintf.c |   8 +-
 newlib/libc/stdio/vsscanf.c  |   8 +-
 newlib/libc/stdlib/local.h   |   2 +-
 newlib/libc/stdlib/mbctype.h |   8 +-
 newlib/libc/stdlib/mprec.h   |  46 +-
 newlib/libc/stdlib/rand48.h  |   2 +-
 newlib/libc/stdlib/system.c  |   2 +-
 newlib/libc/string/local.h   |   2 +-
 newlib/libc/sys/arm/syscalls.c   |   2 +-
 newlib/libc/sys/linux/include/setjmp.h   |   8 +-
 newlib/libc/sys/linux/include/time.h |  68 ++-
 newlib/libc/sys/linux/sys/signal.h   |  20 +-
 newlib/libc/sys/linux/sys/stat.h |  18 +-
 newlib/libc/sys/linux/sys/stdio.h|   2 +-
 newlib/libc/sys/linux/sys/string.h   |   2 +-
 newlib/libc/sys/linux/sys/time.h |  12 +-
 newlib/libc/sys/linux/

[newlib-cygwin] ansification: remove _PARAMS

2018-01-17 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=eea249da3bc81776246ad5163f5eb887afdd3659

commit eea249da3bc81776246ad5163f5eb887afdd3659
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Sun Dec 3 20:41:16 2017 -0600

ansification: remove _PARAMS

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 libgloss/aarch64/_exit.c |   2 +-
 libgloss/aarch64/_kill.c |   2 +-
 libgloss/aarch64/svc.h   |   6 +-
 libgloss/aarch64/syscalls.c  |  62 ++---
 libgloss/arm/_exit.c |   4 +-
 libgloss/arm/_kill.c |   2 +-
 libgloss/arm/swi.h   |   6 +-
 libgloss/arm/syscalls.c  |  62 ++---
 newlib/libc/include/_ansi.h  |   6 -
 newlib/libc/include/malloc.h |  54 ++--
 newlib/libc/include/math.h   | 448 +++
 newlib/libc/include/reent.h  |  50 ++--
 newlib/libc/include/sys/_default_fcntl.h |  18 +-
 newlib/libc/include/sys/errno.h  |   2 +-
 newlib/libc/include/sys/reent.h  |   2 +-
 newlib/libc/include/sys/timeb.h  |   2 +-
 newlib/libc/machine/cris/sys/errno.h |   2 +-
 newlib/libc/machine/cris/sys/fcntl.h |  12 +-
 newlib/libc/machine/powerpc/ufix64toa.c  |   4 +-
 newlib/libc/machine/powerpc/vfprintf.c   |  22 +-
 newlib/libc/search/qsort.c   |   4 +-
 newlib/libc/stdio/nano-vfprintf_local.h  |   4 +-
 newlib/libc/stdio/nano-vfscanf_i.c   |   2 +-
 newlib/libc/stdio/vfprintf.c |   8 +-
 newlib/libc/stdio/vfscanf.c  |   2 +-
 newlib/libc/stdio/vfwprintf.c|   8 +-
 newlib/libc/stdio/vfwscanf.c |   6 +-
 newlib/libc/stdlib/atexit.h  |   4 +-
 newlib/libc/stdlib/cxa_atexit.c  |   2 +-
 newlib/libc/stdlib/exit.c|   2 +-
 newlib/libc/stdlib/setenv.c  |   2 +-
 newlib/libc/stdlib/setenv_r.c|   2 +-
 newlib/libc/string/strerror.c|   2 +-
 newlib/libc/sys/arm/syscalls.c   |  62 ++---
 newlib/libc/sys/linux/sys/errno.h|   2 +-
 newlib/libc/sys/linux/sys/fcntl.h|  10 +-
 newlib/libc/sys/phoenix/sys/errno.h  |   2 +-
 newlib/libc/sys/sparc64/sys/fcntl.h  |   6 +-
 winsup/cygwin/include/cygwin/stdlib.h|   4 +-
 winsup/cygwin/include/fcntl.h|   4 +-
 winsup/cygwin/include/sys/file.h |   2 +-
 41 files changed, 451 insertions(+), 457 deletions(-)

diff --git a/libgloss/aarch64/_exit.c b/libgloss/aarch64/_exit.c
index 1a6b015..16564bb 100644
--- a/libgloss/aarch64/_exit.c
+++ b/libgloss/aarch64/_exit.c
@@ -26,7 +26,7 @@
 #include <_ansi.h>
 #include "svc.h"
 
-void _exit _PARAMS ((int));
+void _exit (int);
 
 __attribute__ ((noreturn)) void
 _exit (int status)
diff --git a/libgloss/aarch64/_kill.c b/libgloss/aarch64/_kill.c
index 1d42371..8109ace 100644
--- a/libgloss/aarch64/_kill.c
+++ b/libgloss/aarch64/_kill.c
@@ -28,7 +28,7 @@
 #include 
 #include "svc.h"
 
-int _kill _PARAMS ((int, int));
+int _kill (int, int);
 
 int
 _kill (int pid, int sig)
diff --git a/libgloss/aarch64/svc.h b/libgloss/aarch64/svc.h
index 60bd00f..2c3da13 100644
--- a/libgloss/aarch64/svc.h
+++ b/libgloss/aarch64/svc.h
@@ -72,9 +72,9 @@
 #define SH_EXT_STDOUT_STDERR_BITNUM0x1
 
 #if !defined (__ASSEMBLER__)
-extern int _get_semihosting_exts _PARAMS ((char*, int, int));
-extern int _has_ext_exit_extended _PARAMS ((void));
-extern int _has_ext_stdout_stderr _PARAMS ((void));
+extern int _get_semihosting_exts (char*, int, int);
+extern int _has_ext_exit_extended (void);
+extern int _has_ext_stdout_stderr (void);
 #endif
 
 #if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__)
diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c
index 4de4e0d..5aeb3d0 100644
--- a/libgloss/aarch64/syscalls.c
+++ b/libgloss/aarch64/syscalls.c
@@ -47,37 +47,37 @@
   (param_block_t)(unsigned long) (PTR)
 
 /* Forward prototypes.  */
-int _system _PARAMS ((const char *));
-int _rename _PARAMS ((const char *, const char *));
-int _isatty _PARAMS ((int));
-clock_t _times _PARAMS ((struct tms *));
-int _gettimeofday _PARAMS ((struct timeval *, void *));
-int _unlink _PARAMS ((const char *));
-int _link _PARAMS ((void));
-int _stat _PARAMS ((const char *, struct stat *));
-int _fstat _PARAMS ((int, struct stat *));
-int _swistat _PARAMS ((int fd, struct stat * st));
-caddr_t _sbrk _PARAMS ((int));
-int _getpid _PARAMS ((int));
-int _close _PARAMS ((int));
-clock_t _clock _PARAMS ((void));
-int _swiclose _PARAMS ((int));
-int _open _PARAMS ((const char *, int, ...));
-int _swiopen _PARAMS ((const char *, int));
-int _write _PARAMS ((int, char *, int));
-int _swiwrite _PARAMS ((int, char *, int));
-int _lseek _PARAMS ((int, int, int));
-int _swilseek _PARAMS ((int, int, int));
-int _read _PARAMS ((int, char *, int));
-int _swiread _PARAMS ((int, c

[newlib-cygwin] ansification: remove _PTR

2018-01-17 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e6321aa6a668376c40bc2792a3bd392e94c29ad6

commit e6321aa6a668376c40bc2792a3bd392e94c29ad6
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Sun Dec 3 20:53:22 2017 -0600

ansification: remove _PTR

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/_ansi.h  |  2 -
 newlib/libc/include/malloc.h | 34 -
 newlib/libc/include/stdio.h  | 56 ++--
 newlib/libc/include/stdlib.h | 38 +--
 newlib/libc/include/string.h | 20 +-
 newlib/libc/include/sys/reent.h  | 22 +--
 newlib/libc/machine/powerpc/machine/malloc.h | 12 +++---
 newlib/libc/machine/powerpc/machine/stdlib.h | 12 +++---
 newlib/libc/machine/powerpc/vec_calloc.c |  2 +-
 newlib/libc/machine/powerpc/vec_free.c   |  2 +-
 newlib/libc/machine/powerpc/vec_malloc.c |  2 +-
 newlib/libc/machine/powerpc/vec_realloc.c|  4 +-
 newlib/libc/machine/powerpc/vfscanf.c|  2 +-
 newlib/libc/machine/spu/fread.c  |  2 +-
 newlib/libc/machine/spu/fwrite.c |  2 +-
 newlib/libc/machine/xstormy16/mallocr.c  | 10 ++---
 newlib/libc/reent/readr.c|  2 +-
 newlib/libc/reent/writer.c   |  2 +-
 newlib/libc/search/bsearch.c | 12 +++---
 newlib/libc/stdio/fdopen.c   |  2 +-
 newlib/libc/stdio/fgets.c|  6 +--
 newlib/libc/stdio/fopen.c|  2 +-
 newlib/libc/stdio/fread.c| 10 ++---
 newlib/libc/stdio/freopen.c  |  2 +-
 newlib/libc/stdio/fseeko.c   |  2 +-
 newlib/libc/stdio/fvwrite.c  |  4 +-
 newlib/libc/stdio/fvwrite.h  |  2 +-
 newlib/libc/stdio/fwrite.c   |  4 +-
 newlib/libc/stdio/makebuf.c  |  2 +-
 newlib/libc/stdio/nano-vfprintf.c|  4 +-
 newlib/libc/stdio/nano-vfprintf_local.h  |  2 +-
 newlib/libc/stdio/nano-vfscanf.c |  2 +-
 newlib/libc/stdio/setvbuf.c  |  2 +-
 newlib/libc/stdio/stdio.c|  2 +-
 newlib/libc/stdio/ungetc.c   |  4 +-
 newlib/libc/stdio/vfprintf.c | 12 +++---
 newlib/libc/stdio/vfscanf.c  |  8 ++--
 newlib/libc/stdio/vfwprintf.c|  6 +--
 newlib/libc/stdio/vfwscanf.c |  6 +--
 newlib/libc/stdio64/fdopen64.c   |  2 +-
 newlib/libc/stdio64/fopen64.c|  2 +-
 newlib/libc/stdio64/freopen64.c  |  2 +-
 newlib/libc/stdlib/__call_atexit.c   |  6 +--
 newlib/libc/stdlib/atexit.h  |  4 +-
 newlib/libc/stdlib/calloc.c  |  2 +-
 newlib/libc/stdlib/cxa_atexit.c  |  2 +-
 newlib/libc/stdlib/exit.c|  2 +-
 newlib/libc/stdlib/malign.c  |  2 +-
 newlib/libc/stdlib/malloc.c  |  4 +-
 newlib/libc/stdlib/msize.c   |  2 +-
 newlib/libc/stdlib/on_exit.c |  4 +-
 newlib/libc/stdlib/realloc.c |  4 +-
 newlib/libc/stdlib/reallocf.c|  8 ++--
 newlib/libc/stdlib/valloc.c  |  4 +-
 newlib/libc/string/memccpy.c | 10 ++---
 newlib/libc/string/memchr.c  |  4 +-
 newlib/libc/string/memcmp.c  |  4 +-
 newlib/libc/string/memcpy.c  |  8 ++--
 newlib/libc/string/memmove.c |  6 +--
 newlib/libc/string/mempcpy.c |  6 +--
 newlib/libc/string/memrchr.c |  4 +-
 newlib/libc/string/memset.c  |  4 +-
 newlib/libc/string/rawmemchr.c   |  4 +-
 newlib/libc/sys/linux/pread.c|  4 +-
 newlib/libc/sys/linux/pread64.c  |  2 +-
 newlib/libc/sys/linux/pwrite.c   |  4 +-
 newlib/libc/sys/linux/pwrite64.c |  2 +-
 newlib/libc/sys/rtems/crt0.c | 10 ++---
 newlib/libc/unix/pread.c |  4 +-
 newlib/libc/unix/pwrite.c|  4 +-
 newlib/libc/xdr/xdr_sizeof.c |  2 +-
 winsup/cygwin/include/cygwin/stdlib.h|  4 +-
 72 files changed, 228 insertions(+), 230 deletions(-)

diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h
index 5e2eac9..e955138 100644
--- a/newlib/libc/include/_ansi.h
+++ b/newlib/libc/include/_ansi.h
@@ -47,7 +47,6 @@
 #endif
 
 #ifdef _HAVE_STDC
-#define_PTRvoid *
 #define_VOLATILE   volatile
 #define_SIGNED signed
 #define _VOID void
@@ -69,7 +68,6 @@
 #define _LONG_DOUBLE long double
 #endif
 #else  
-#define_PTRchar *
 #define_VOLATILE
 #define_SIGNED
 #define _VOID void
diff --git a/newlib/libc/include/malloc.h b/newlib/

[newlib-cygwin] ansification: remove _CONST

2018-01-17 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0bda30e1ffd23488aa4a9b73f228089463fbee1a

commit 0bda30e1ffd23488aa4a9b73f228089463fbee1a
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Sun Dec 3 20:25:16 2017 -0600

ansification: remove _CONST

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/ctype/ctype_.c|   6 +-
 newlib/libc/ctype/ctype_.h|   2 +-
 newlib/libc/ctype/ctype_cp.h  |   4 +-
 newlib/libc/ctype/ctype_iso.h |   4 +-
 newlib/libc/iconv/ccs/big5.c  |  10 +--
 newlib/libc/iconv/ccs/ccs.h   |  10 +--
 newlib/libc/iconv/ccs/ccsbi.c |   2 +-
 newlib/libc/iconv/ccs/ccsbi.h |  82 +++
 newlib/libc/iconv/ccs/cns11643_plane1.c   |  10 +--
 newlib/libc/iconv/ccs/cns11643_plane14.c  |  10 +--
 newlib/libc/iconv/ccs/cns11643_plane2.c   |  10 +--
 newlib/libc/iconv/ccs/cp775.c |   6 +-
 newlib/libc/iconv/ccs/cp850.c |   6 +-
 newlib/libc/iconv/ccs/cp852.c |   6 +-
 newlib/libc/iconv/ccs/cp855.c |   6 +-
 newlib/libc/iconv/ccs/cp866.c |   6 +-
 newlib/libc/iconv/ccs/iso_8859_1.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_10.c   |   6 +-
 newlib/libc/iconv/ccs/iso_8859_11.c   |   6 +-
 newlib/libc/iconv/ccs/iso_8859_13.c   |   6 +-
 newlib/libc/iconv/ccs/iso_8859_14.c   |   6 +-
 newlib/libc/iconv/ccs/iso_8859_15.c   |   6 +-
 newlib/libc/iconv/ccs/iso_8859_2.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_3.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_4.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_5.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_6.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_7.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_8.c|   6 +-
 newlib/libc/iconv/ccs/iso_8859_9.c|   6 +-
 newlib/libc/iconv/ccs/iso_ir_111.c|   6 +-
 newlib/libc/iconv/ccs/jis_x0201_1976.c|   6 +-
 newlib/libc/iconv/ccs/jis_x0208_1990.c|  10 +--
 newlib/libc/iconv/ccs/jis_x0212_1990.c|  10 +--
 newlib/libc/iconv/ccs/koi8_r.c|   6 +-
 newlib/libc/iconv/ccs/koi8_ru.c   |   6 +-
 newlib/libc/iconv/ccs/koi8_u.c|   6 +-
 newlib/libc/iconv/ccs/koi8_uni.c  |   6 +-
 newlib/libc/iconv/ccs/ksx1001.c   |  10 +--
 newlib/libc/iconv/ccs/mktbl.pl|  14 ++--
 newlib/libc/iconv/ccs/win_1250.c  |   6 +-
 newlib/libc/iconv/ccs/win_1251.c  |   6 +-
 newlib/libc/iconv/ccs/win_1252.c  |   6 +-
 newlib/libc/iconv/ccs/win_1253.c  |   6 +-
 newlib/libc/iconv/ccs/win_1254.c  |   6 +-
 newlib/libc/iconv/ccs/win_1255.c  |   6 +-
 newlib/libc/iconv/ccs/win_1256.c  |   6 +-
 newlib/libc/iconv/ccs/win_1257.c  |   6 +-
 newlib/libc/iconv/ccs/win_1258.c  |   6 +-
 newlib/libc/iconv/ces/cesbi.c |  68 +--
 newlib/libc/iconv/ces/cesbi.h |  40 +--
 newlib/libc/iconv/ces/euc.c   |  18 ++---
 newlib/libc/iconv/ces/mkdeps.pl   |  24 +++
 newlib/libc/iconv/ces/table-pcs.c |  10 +--
 newlib/libc/iconv/ces/table.c |  56 
 newlib/libc/iconv/ces/ucs-2-internal.c|   6 +-
 newlib/libc/iconv/ces/ucs-2.c |   8 +--
 newlib/libc/iconv/ces/ucs-4-internal.c|   6 +-
 newlib/libc/iconv/ces/ucs-4.c |   8 +--
 newlib/libc/iconv/ces/us-ascii.c  |   6 +-
 newlib/libc/iconv/ces/utf-16.c|  10 +--
 newlib/libc/iconv/ces/utf-8.c |   8 +--
 newlib/libc/iconv/lib/aliasesbi.c |   2 +-
 newlib/libc/iconv/lib/aliasesi.c  |  30 -
 newlib/libc/iconv/lib/conv.h  |  18 ++---
 newlib/libc/iconv/lib/iconv.c |  18 ++---
 newlib/libc/iconv/lib/iconvnls.c  |  32 -
 newlib/libc/iconv/lib/local.h |   2 +-
 newlib/libc/iconv/lib/nullconv.c  |   8 +--
 newlib/libc/iconv/lib/ucsconv.c   |  24 +++
 newlib/libc/iconv/lib/ucsconv.h   |  26 +++
 newlib/libc/include/_ansi.h   |   2 -
 newlib/libc/include/ctype.h   |   2 +-
 newlib/libc/include/iconv.h   |   6 +-
 newlib/libc/include/pthread.h |  54 +++
 newlib/libc/include/rpc/xdr.h |  10 +--
 newlib/libc/include/stdio.h   |   4 +-
 newlib/libc/include/stdlib.h  |   4 +-
 newlib/libc/include/sys/errno.h   |   2 +-
 newlib/libc/include/sys/iconvnls.h|  12 ++--
 newlib/libc/include/sys/reent.h   |   2 +-
 newlib/libc/include/unctrl.h  |   4 +-
 newlib/libc/locale/locale.c   |   4 +-
 newlib/libc/machine/cris/sys/errno.h  |   2 +-
 newlib/libc/machine/microblaze/strcmp.c   |   4 +-
 newlib/libc/machine/microblaze/strcpy.c   |   6 +-
 newlib/libc/machine/microblaze/strl

[newlib-cygwin] cygwin: add asm/bitsperlong.h, dummy asm/posix_types.h headers

2018-01-17 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1e39db3062f941778e748f833e1f88dd5c7399a3

commit 1e39db3062f941778e748f833e1f88dd5c7399a3
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Jan 17 03:03:23 2018 -0600

cygwin: add asm/bitsperlong.h, dummy asm/posix_types.h headers

These changes are necessary for cross-compiling the Linux kernel.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/asm/bitsperlong.h | 18 ++
 winsup/cygwin/include/asm/posix_types.h | 14 ++
 winsup/cygwin/include/asm/types.h   |  2 ++
 3 files changed, 34 insertions(+)

diff --git a/winsup/cygwin/include/asm/bitsperlong.h 
b/winsup/cygwin/include/asm/bitsperlong.h
new file mode 100644
index 000..48037b6
--- /dev/null
+++ b/winsup/cygwin/include/asm/bitsperlong.h
@@ -0,0 +1,18 @@
+/* asm/bitsperlong.h
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef __ASM_BITSPERLONG_H
+#define __ASM_BITSPERLONG_H
+
+#ifdef __x86_64__
+#define __BITS_PER_LONG 64
+#else
+#define __BITS_PER_LONG 32
+#endif
+
+#endif /* __ASM_BITSPERLONG_H */
diff --git a/winsup/cygwin/include/asm/posix_types.h 
b/winsup/cygwin/include/asm/posix_types.h
new file mode 100644
index 000..4e9aac0
--- /dev/null
+++ b/winsup/cygwin/include/asm/posix_types.h
@@ -0,0 +1,14 @@
+/* asm/posix_types.h
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _ASM_POSIX_TYPES_H
+#define _ASM_POSIX_TYPES_H
+
+/* This is just a placeholder to simplify cross-compiling the Linux kernel */
+
+#endif /* _ASM_POSIX_TYPES_H */
diff --git a/winsup/cygwin/include/asm/types.h 
b/winsup/cygwin/include/asm/types.h
index c2342ef..e1e9470 100644
--- a/winsup/cygwin/include/asm/types.h
+++ b/winsup/cygwin/include/asm/types.h
@@ -9,6 +9,8 @@ details. */
 #ifndef _ASM_TYPES_H
 #define _ASM_TYPES_H
 
+#include 
+
 typedef __signed__ char __s8;
 typedef unsigned char __u8;


[newlib-cygwin] cygwin: add LFS_CFLAGS etc. to confstr/getconf

2018-01-16 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2cb24159fbb2a5f8a28d87413b517e6f2b242a0f

commit 2cb24159fbb2a5f8a28d87413b517e6f2b242a0f
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Jan 15 21:15:28 2018 -0600

cygwin: add LFS_CFLAGS etc. to confstr/getconf

These are used, for instance, when cross-compiling the Linux kernel.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/sys/unistd.h | 4 
 winsup/cygwin/sysconf.cc | 6 +-
 winsup/utils/getconf.c   | 4 
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index 0596221..c811eb6 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -582,6 +582,10 @@ int_EXFUN(unlinkat, (int, const char *, int));
 #define _CS_POSIX_V7_THREADS_LDFLAGS  19
 #define _CS_V7_ENV20
 #define _CS_V6_ENV_CS_V7_ENV
+#define _CS_LFS_CFLAGS21
+#define _CS_LFS_LDFLAGS   22
+#define _CS_LFS_LIBS  23
+#define _CS_LFS_LINTFLAGS 24
 #endif
 
 #ifdef __cplusplus
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index ecd9aeb..9563b88 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -719,10 +719,14 @@ static struct
   {ls ("")},   /* _CS_POSIX_V7_THREADS_CFLAGS */
   {ls ("")},   /* _CS_POSIX_V7_THREADS_LDFLAGS */
   {ls ("POSIXLY_CORRECT=1")},  /* _CS_V7_ENV */
+  {ls ("")},   /* _CS_LFS_CFLAGS */
+  {ls ("")},   /* _CS_LFS_LDFLAGS */
+  {ls ("")},   /* _CS_LFS_LIBS */
+  {ls ("")},   /* _CS_LFS_LINTFLAGS */
 };
 
 #define CS_MIN _CS_PATH
-#define CS_MAX _CS_V7_ENV
+#define CS_MAX _CS_LFS_LINTFLAGS
 
 extern "C" size_t
 confstr (int in, char *buf, size_t len)
diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c
index 256bddb..5ac84ab 100644
--- a/winsup/utils/getconf.c
+++ b/winsup/utils/getconf.c
@@ -97,6 +97,10 @@ static const struct conf_variable conf_table[] =
   { "XBS5_WIDTH_RESTRICTED_ENVS",  CONFSTR,
_CS_XBS5_WIDTH_RESTRICTED_ENVS  },
   { "V7_ENV",  CONFSTR,_CS_V7_ENV  },
   { "V6_ENV",  CONFSTR,_CS_V6_ENV  },
+  { "LFS_CFLAGS",  CONFSTR,_CS_LFS_CFLAGS  },
+  { "LFS_LDFLAGS", CONFSTR,_CS_LFS_LDFLAGS },
+  { "LFS_LIBS",CONFSTR,_CS_LFS_LIBS
},
+  { "LFS_LINTFLAGS",   CONFSTR,_CS_LFS_LINTFLAGS   
},
 
   /* Symbolic constants from  */
   { "_POSIX_AIO_LISTIO_MAX",   CONSTANT,   _POSIX_AIO_LISTIO_MAX   
},


[newlib-cygwin] cygwin: export wmempcpy

2017-11-30 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f636eae26f70b7c5bae5fb7ec7386cf92aca125d

commit f636eae26f70b7c5bae5fb7ec7386cf92aca125d
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Nov 29 19:47:13 2017 -0600

cygwin: export wmempcpy

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/common.din   | 1 +
 winsup/cygwin/include/cygwin/version.h | 3 ++-
 winsup/doc/posix.xml   | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index a482cf2..14b9c2c 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1609,6 +1609,7 @@ wmemchr NOSIGFE
 wmemcmp NOSIGFE
 wmemcpy NOSIGFE
 wmemmove NOSIGFE
+wmempcpy NOSIGFE
 wmemset NOSIGFE
 wordexp NOSIGFE
 wordfree NOSIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index d8bb3ee..7510f42 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -489,12 +489,13 @@ details. */
__stack_chk_fail, __stack_chk_guard, __stpcpy_chk, __stpncpy_chk,
__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
__vsnprintf_chk, __vsprintf_chk.
+  321: Export wmempcpy.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 320
+#define CYGWIN_VERSION_API_MINOR 321
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index c99e003..ab57430 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1396,6 +1396,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 wcstoll_l
 wcstoul_l
 wcstoull_l
+wmempcpy
 
 
 


[newlib-cygwin] cygwin: add Object Size Checking to sys/poll.h

2017-11-30 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b3281de25fd8c1d856cc45dfb814593a537bce80

commit b3281de25fd8c1d856cc45dfb814593a537bce80
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Nov 29 11:38:17 2017 -0600

cygwin: add Object Size Checking to sys/poll.h

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/ssp/poll.h | 26 ++
 winsup/cygwin/include/sys/poll.h |  4 
 2 files changed, 30 insertions(+)

diff --git a/winsup/cygwin/include/ssp/poll.h b/winsup/cygwin/include/ssp/poll.h
new file mode 100644
index 000..831e626
--- /dev/null
+++ b/winsup/cygwin/include/ssp/poll.h
@@ -0,0 +1,26 @@
+#ifndef _SSP_POLL_H_
+#define _SSP_POLL_H_
+
+#include 
+
+#if __SSP_FORTIFY_LEVEL > 0
+__BEGIN_DECLS
+
+__ssp_decl(int, poll, (struct pollfd *__fds, nfds_t __nfds, int __timeout))
+{
+  __ssp_check (__fds, __nfds * sizeof(*__fds), __ssp_bos);
+  return __ssp_real_poll (__fds, __nfds, __timeout);
+}
+
+#if __GNU_VISIBLE
+__ssp_decl(int, ppoll, (struct pollfd *__fds, nfds_t __nfds, const struct 
timespec *__timeout_ts, const sigset_t *__sigmask))
+{
+  __ssp_check (__fds, __nfds * sizeof(*__fds), __ssp_bos);
+  return __ssp_real_ppoll (__fds, __nfds, __timeout_ts, __sigmask);
+}
+#endif
+
+__END_DECLS
+
+#endif /* __SSP_FORTIFY_LEVEL > 0 */
+#endif /* _SSP_POLL_H_ */
diff --git a/winsup/cygwin/include/sys/poll.h b/winsup/cygwin/include/sys/poll.h
index 0da4c3f..65822ed 100644
--- a/winsup/cygwin/include/sys/poll.h
+++ b/winsup/cygwin/include/sys/poll.h
@@ -47,4 +47,8 @@ extern int ppoll __P ((struct pollfd *fds, nfds_t nfds,
 
 __END_DECLS
 
+#if __SSP_FORTIFY_LEVEL > 0
+#include 
+#endif
+
 #endif /* _SYS_POLL_H */


[newlib-cygwin] cygwin: add Object Size Checking to sys/socket.h

2017-11-30 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=da4839ec18cac49fc1c2cee732104c7dabdc2d4c

commit da4839ec18cac49fc1c2cee732104c7dabdc2d4c
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Nov 29 11:38:54 2017 -0600

cygwin: add Object Size Checking to sys/socket.h

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/ssp/socket.h | 20 
 winsup/cygwin/include/sys/socket.h |  4 
 2 files changed, 24 insertions(+)

diff --git a/winsup/cygwin/include/ssp/socket.h 
b/winsup/cygwin/include/ssp/socket.h
new file mode 100644
index 000..3abbddb
--- /dev/null
+++ b/winsup/cygwin/include/ssp/socket.h
@@ -0,0 +1,20 @@
+#ifndef _SSP_SOCKET_H_
+#define _SSP_SOCKET_H_
+
+#include 
+
+#if __SSP_FORTIFY_LEVEL > 0
+__BEGIN_DECLS
+
+__ssp_redirect0(ssize_t, recv, \
+(int __fd, void *__buf, size_t __len, int __flags), \
+(__fd, __buf, __len, __flags));
+
+__ssp_redirect0(ssize_t, recvfrom, \
+(int __fd, void *__buf, size_t __len, int __flags, struct sockaddr 
*__from, socklen_t *__fromlen), \
+(__fd, __buf, __len, __flags, __from, __fromlen));
+
+__END_DECLS
+
+#endif /* __SSP_FORTIFY_LEVEL > 0 */
+#endif /* _SSP_SOCKET_H_ */
diff --git a/winsup/cygwin/include/sys/socket.h 
b/winsup/cygwin/include/sys/socket.h
index 8bab35b..9e897a9 100644
--- a/winsup/cygwin/include/sys/socket.h
+++ b/winsup/cygwin/include/sys/socket.h
@@ -50,4 +50,8 @@ extern "C"
 };
 #endif
 
+#if __SSP_FORTIFY_LEVEL > 0
+#include 
+#endif
+
 #endif /* _SYS_SOCKET_H */


[newlib-cygwin] cygwin: create libssp compatibility import library

2017-11-29 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=552a20ab4e2736d7cbd0293f8a69d7fbf8761fa8

commit 552a20ab4e2736d7cbd0293f8a69d7fbf8761fa8
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Nov 27 23:56:30 2017 -0600

cygwin: create libssp compatibility import library

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/Makefile.in | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index a70f28d..c1de26c 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -540,7 +540,7 @@ endif
 API_VER:=$(srcdir)/include/cygwin/version.h
 
 LIB_NAME:=libcygwin.a
-SUBLIBS:=libpthread.a libutil.a ${CURDIR}/libm.a ${CURDIR}/libc.a libdl.a 
libresolv.a librt.a libacl.a
+SUBLIBS:=libpthread.a libutil.a ${CURDIR}/libm.a ${CURDIR}/libc.a libdl.a 
libresolv.a librt.a libacl.a libssp.a
 EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a libtextreadmode.a
 INSTOBJS:=automode.o binmode.o textmode.o textreadmode.o
 TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) 
$(INSTOBJS) $(EXTRALIBS)
@@ -745,6 +745,9 @@ librt.a: ${LIB_NAME} posix_ipc.o
 libacl.a: ${LIB_NAME} sec_posixacl.o
${speclib} ${@F}
 
+libssp.a: ${LIB_NAME} $(newlib_build)/libc/ssp/lib.a
+   ${speclib} ${@F}
+
 ${EXTRALIBS}: lib%.a: %.o
$(AR) cru $@ $?


[newlib-cygwin] cygwin: export SSP functions

2017-11-29 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6a848db44242a24d6570ef7994918c66ce483fd2

commit 6a848db44242a24d6570ef7994918c66ce483fd2
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Nov 27 23:55:11 2017 -0600

cygwin: export SSP functions

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/common.din   | 19 +++
 winsup/cygwin/include/cygwin/version.h |  7 ++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 55fa9b1..a482cf2 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -7,6 +7,7 @@ __cygwin_user_data DATA
 __mb_cur_max DATA
 __progname DATA
 __rcmd_errstr DATA
+__stack_chk_guard DATA
 _check_for_executable DATA
 _ctype_ DATA
 _daylight DATA
@@ -42,6 +43,7 @@ __assertfail NOSIGFE
 __b64_ntop NOSIGFE
 __b64_pton NOSIGFE
 __bsd_qsort_r NOSIGFE
+__chk_fail SIGFE
 __cxa_atexit = cygwin__cxa_atexit SIGFE
 __cxa_finalize SIGFE
 __dn_comp SIGFE
@@ -62,6 +64,7 @@ __fwritable NOSIGFE
 __fwriting NOSIGFE
 __getpagesize = getpagesize SIGFE
 __getreent NOSIGFE
+__gets_chk SIGFE
 __gnu_basename NOSIGFE
 __infinity NOSIGFE
 __isinfd = isinf NOSIGFE
@@ -72,7 +75,11 @@ __locale_ctype_ptr NOSIGFE
 __locale_ctype_ptr_l NOSIGFE
 __locale_mb_cur_max NOSIGFE
 __main NOSIGFE
+__memcpy_chk NOSIGFE
+__memmove_chk NOSIGFE
 __mempcpy = mempcpy NOSIGFE
+__mempcpy_chk NOSIGFE
+__memset_chk NOSIGFE
 __opendir_with_d_ino SIGFE
 __res_close SIGFE
 __res_init SIGFE
@@ -92,10 +99,22 @@ __res_state SIGFE
 __signbitd NOSIGFE
 __signbitf NOSIGFE
 __signgam NOSIGFE
+__snprintf_chk SIGFE
+__sprintf_chk SIGFE
 __srget SIGFE
 __srget_r SIGFE
+__stack_chk_fail SIGFE
+__stack_chk_fail_local = __stack_chk_fail SIGFE
+__stpcpy_chk NOSIGFE
+__stpncpy_chk NOSIGFE
+__strcat_chk NOSIGFE
+__strcpy_chk NOSIGFE
+__strncat_chk NOSIGFE
+__strncpy_chk NOSIGFE
 __swbuf SIGFE
 __swbuf_r SIGFE
+__vsnprintf_chk SIGFE
+__vsprintf_chk SIGFE
 __wrap__ZdaPv NOSIGFE   # void operator delete[](void *p) throw()
 __wrap__ZdaPvRKSt9nothrow_t NOSIGFE # void operator delete[](void *p, const 
std::nothrow_t ) throw()
 __wrap__ZdlPv NOSIGFE   # void operator delete(void *p) throw()
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index 8b85f86..d8bb3ee 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -484,12 +484,17 @@ details. */
   317: Export renameat2.
   318: Export strnstr.
   319: Define O_TMPFILE, O_NOATIME.
+  320: Export __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk,
+   __mempcpy_chk, __memset_chk, __snprintf_chk, __sprintf_chk,
+   __stack_chk_fail, __stack_chk_guard, __stpcpy_chk, __stpncpy_chk,
+   __strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk,
+   __vsnprintf_chk, __vsprintf_chk.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 319
+#define CYGWIN_VERSION_API_MINOR 320
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared


[newlib-cygwin] cygwin: fix getconf after commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47

2017-11-28 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c37171b528502aad4b55d329ff91a55335b641ad

commit c37171b528502aad4b55d329ff91a55335b641ad
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Nov 28 11:35:13 2017 -0600

cygwin: fix getconf after commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/utils/getconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c
index e6b319e..256bddb 100644
--- a/winsup/utils/getconf.c
+++ b/winsup/utils/getconf.c
@@ -27,6 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define _XOPEN_SOURCE
 #include 
 #include 
 #include 


[newlib-cygwin] cygwin: define _POSIX_TIMEOUTS

2017-11-28 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f2b27ce620b98c3cd3bc22b7e2207a9e89eec3d8

commit f2b27ce620b98c3cd3bc22b7e2207a9e89eec3d8
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Nov 28 04:03:29 2017 -0600

cygwin: define _POSIX_TIMEOUTS

Since commit 8128f5482f2b1889e2336488e9d45a33c9972d11, we have all the
non-tracing functions listed in posixoptions(7).  The tracing functions
are gated by their own option, and are obsolecent anyway.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/sys/features.h | 2 +-
 winsup/cygwin/sysconf.cc   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/features.h 
b/newlib/libc/include/sys/features.h
index c9133af..95d2053 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -448,7 +448,7 @@ extern "C" {
 #define _POSIX_THREAD_SAFE_FUNCTIONS   200809L
 /* #define _POSIX_THREAD_SPORADIC_SERVER   -1 */
 #define _POSIX_THREADS 200809L
-/* #define _POSIX_TIMEOUTS -1 */
+#define _POSIX_TIMEOUTS200809L
 #define _POSIX_TIMERS  200809L
 /* #define _POSIX_TRACE-1 */
 /* #define _POSIX_TRACE_EVENT_FILTER   -1 */
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index a24a985..ecd9aeb 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -588,7 +588,7 @@ static struct
   {cons, {c:SYMLOOP_MAX}}, /*  79, _SC_SYMLOOP_MAX */
   {cons, {c:_POSIX_THREAD_CPUTIME}},   /*  80, _SC_THREAD_CPUTIME */
   {cons, {c:-1L}}, /*  81, _SC_THREAD_SPORADIC_SERVER */
-  {cons, {c:-1L}}, /*  82, _SC_TIMEOUTS */
+  {cons, {c:_POSIX_TIMEOUTS}}, /*  82, _SC_TIMEOUTS */
   {cons, {c:-1L}}, /*  83, _SC_TRACE */
   {cons, {c:-1L}}, /*  84, _SC_TRACE_EVENT_FILTER */
   {nsup, {c:0}},   /*  85, _SC_TRACE_EVENT_NAME_MAX */


[newlib-cygwin] Feature test macros overhaul: Cygwin limits.h, part 2

2017-11-28 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=032aa2dba5a5bf90c198d930c8d309b5de57cb47

commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Nov 27 22:07:13 2017 -0600

Feature test macros overhaul: Cygwin limits.h, part 2

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
https://sourceware.org/ml/newlib/2017/msg01133.html

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/limits.h | 30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h
index cf3c8d0..fe1b8b4 100644
--- a/winsup/cygwin/include/limits.h
+++ b/winsup/cygwin/include/limits.h
@@ -24,6 +24,7 @@ details. */
 #undef CHAR_BIT
 #define CHAR_BIT __CHAR_BIT__
 
+#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
 /* Number of bits in a `long'.  */
 #undef LONG_BIT
 #define LONG_BIT (__SIZEOF_LONG__ * __CHAR_BIT__)
@@ -31,6 +32,7 @@ details. */
 /* Number of bits in a `int'.  */
 #undef WORD_BIT
 #define WORD_BIT (__SIZEOF_INT__ * __CHAR_BIT__)
+#endif /* __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 */
 
 /* Maximum length of a multibyte character.  */
 #ifndef MB_LEN_MAX
@@ -118,6 +120,7 @@ details. */
 #define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
 #endif
 
+#if __ISO_C_VISIBLE >= 1999
 /* Minimum and maximum values a `signed long long int' can hold.  */
 #undef LLONG_MIN
 #define LLONG_MIN (-LLONG_MAX-1)
@@ -127,6 +130,7 @@ details. */
 /* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
 #undef ULLONG_MAX
 #define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
+#endif /* __ISO_C_VISIBLE >= 1999 */
 
 /* Maximum size of ssize_t. Sadly, gcc doesn't give us __SSIZE_MAX__
the way it does for __SIZE_MAX__.  On the other hand, we happen to
@@ -171,9 +175,11 @@ details. */
 #undef ARG_MAX
 #define ARG_MAX 32000
 
+#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
 /* Maximum number of functions that may be registered with atexit(). */
 #undef ATEXIT_MAX
 #define ATEXIT_MAX 32
+#endif
 
 /* Maximum number of simultaneous processes per real user ID. */
 #undef CHILD_MAX
@@ -187,9 +193,11 @@ details. */
 #undef HOST_NAME_MAX
 #define HOST_NAME_MAX 255
 
+#if __XSI_VISIBLE
 /* Maximum number of iovcnt in a writev (an arbitrary number) */
 #undef IOV_MAX
 #define IOV_MAX 1024
+#endif
 
 /* Maximum number of characters in a login name. */
 #undef LOGIN_NAME_MAX
@@ -212,9 +220,11 @@ details. */
 
 /* Size in bytes of a page. */
 #undef PAGESIZE
-#undef PAGE_SIZE
 #define PAGESIZE 65536
+#if __XSI_VISIBLE
+#undef PAGE_SIZE
 #define PAGE_SIZE PAGESIZE
+#endif
 
 /* Maximum number of attempts made to destroy a thread's thread-specific
data values on thread exit. */
@@ -381,6 +391,7 @@ details. */
 
 /* Runtime Increasable Values */
 
+#if __POSIX_VISIBLE >= 2
 /* Maximum obase values allowed by the bc utility. */
 #undef BC_BASE_MAX
 #define BC_BASE_MAX 99
@@ -428,6 +439,7 @@ details. */
using the interval notation \{m,n\} */
 #undef RE_DUP_MAX
 #define RE_DUP_MAX 255
+#endif /* __POSIX_VISIBLE >= 2 */
 
 
 /* POSIX values */
@@ -435,6 +447,7 @@ details. */
 /* They represent the minimum values that POSIX systems must support.
POSIX-conforming apps must not require larger values. */
 
+#if __POSIX_VISIBLE
 /* Maximum Values */
 
 #define _POSIX_CLOCKRES_MIN 2000
@@ -478,7 +491,9 @@ details. */
 #define _POSIX_TRACE_USER_EVENT_MAX   32
 #define _POSIX_TTY_NAME_MAX   9
 #define _POSIX_TZNAME_MAX  6
+#endif /* __POSIX_VISIBLE */
 
+#if __POSIX_VISIBLE >= 2
 #define _POSIX2_BC_BASE_MAX  99
 #define _POSIX2_BC_DIM_MAX 2048
 #define _POSIX2_BC_SCALE_MAX 99
@@ -487,23 +502,34 @@ details. */
 #define _POSIX2_EXPR_NEST_MAX32
 #define _POSIX2_LINE_MAX   2048
 #define _POSIX2_RE_DUP_MAX  255
+#endif /* __POSIX_VISIBLE >= 2 */
 
+#if __XSI_VISIBLE
 #define _XOPEN_IOV_MAX16
 #define _XOPEN_NAME_MAX  255
 #define _XOPEN_PATH_MAX 1024
+#endif
 
 /* Other Invariant Values */
 
 #define NL_ARGMAX  9
+#if __XSI_VISIBLE
 #define NL_LANGMAX14
+#endif
+#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
 #define NL_MSGMAX  32767
-#define NL_NMAX  INT_MAX
 #define NL_SETMAX255
 #define NL_TEXTMAX  _POSIX2_LINE_MAX
+#endif
+#if __POSIX_VISIBLE < 200809
+#define NL_NMAX  INT_MAX
+#endif
 
+#if __XSI_VISIBLE
 /* Default process priority. */
 #undef NZERO
 #define NZERO20
+#endi

[newlib-cygwin] cygwin: fix gethostbyaddr argument types

2017-10-10 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=747f31854a572b3dd64912997dde2dc984b1f2d8

commit 747f31854a572b3dd64912997dde2dc984b1f2d8
Author: Yaakov Selkowitz 
Date:   Tue Sep 26 20:36:35 2017 -0500

cygwin: fix gethostbyaddr argument types

The first argument of gethostbyaddr needs to accept a generic pointer
to be compatible with e.g. struct in_addr *.  This caused an issue
compiling krb5-1.15.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/netdb.h | 2 +-
 winsup/cygwin/net.cc  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h
index e46e341..91e9172 100644
--- a/winsup/cygwin/include/netdb.h
+++ b/winsup/cygwin/include/netdb.h
@@ -228,7 +228,7 @@ voidendnetent (void);
 void   endprotoent (void);
 void   endservent (void);
 void   endrpcent  (void);
-struct hostent *gethostbyaddr (const char *, int, int);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
 struct hostent *gethostbyname (const char *);
 #if __MISC_VISIBLE
 struct hostent *gethostbyname2 (const char *, int);
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index fd903b1..8969e7c 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1152,13 +1152,13 @@ cygwin_gethostbyname (const char *name)
 
 /* exported as gethostbyaddr: standards? */
 extern "C" struct hostent *
-cygwin_gethostbyaddr (const char *addr, int len, int type)
+cygwin_gethostbyaddr (const void *addr, socklen_t len, int type)
 {
   hostent *res = NULL;
 
   __try
 {
-  res = dup_ent (gethostbyaddr (addr, len, type));
+  res = dup_ent (gethostbyaddr ((const char *) addr, len, type));
   if (res)
debug_printf ("h_name %s", res->h_name);
   else


[newlib-cygwin] Feature test macros overhaul: Cygwin netdb.h

2017-10-10 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0b45b053e833d2e87dd71a4a5198fd8158d53a1d

commit 0b45b053e833d2e87dd71a4a5198fd8158d53a1d
Author: Yaakov Selkowitz 
Date:   Tue Sep 26 20:36:34 2017 -0500

Feature test macros overhaul: Cygwin netdb.h

herror etc. are MISC, rcmd etc. are BSD, addrinfo functions are
POSIX.1-2001, except for IDN functionality which is GNU.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/netdb.h | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h
index 968847b..e46e341 100644
--- a/winsup/cygwin/include/netdb.h
+++ b/winsup/cygwin/include/netdb.h
@@ -117,7 +117,7 @@ struct rpcent {
int r_number;   /* rpc program number */
 };
 
-#ifndef __INSIDE_CYGWIN_NET__
+#if __POSIX_VISIBLE >= 200112 && !defined(__INSIDE_CYGWIN_NET__)
 struct addrinfo {
   int ai_flags;/* input flags */
   int ai_family;   /* address family of socket */
@@ -135,6 +135,8 @@ struct addrinfo {
  * (left in extern int h_errno).
  */
 
+#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809
+
 #ifdef  __INSIDE_CYGWIN_NET__
 extern int h_errno;
 #else
@@ -152,6 +154,10 @@ extern __declspec(dllimport) int h_errno;
 #defineNO_DATA 4 /* Valid name, no data record of requested 
type */
 #defineNO_ADDRESS  NO_DATA /* no address, look for MX 
record */
 
+#endif /* __MISC_VISIBLE || __POSIX_VISIBLE < 200809 */
+
+#if __POSIX_VISIBLE >= 200112
+
 /* Flag values for getaddrinfo function. */
 #define AI_PASSIVE  0x1/* Intend socket address for bind. */
 #define AI_CANONNAME0x2/* Return canonical node name. */
@@ -161,6 +167,7 @@ extern __declspec(dllimport) int h_errno;
 #define AI_ADDRCONFIG   0x400  /* Only return address types available on
   this host. */
 #define AI_V4MAPPED 0x800  /* IPv4 mapped addresses are acceptable. */
+#ifdef __GNU_VISIBLE
 /* Glibc extensions. We use numerical values taken by winsock-specific
extensions. */
 #define AI_IDN  0x4000 /* Encode IDN input from current local to
@@ -171,6 +178,7 @@ extern __declspec(dllimport) int h_errno;
   input string.  */
 #define AI_IDN_USE_STD3_ASCII_RULES 0x2 /* Filter ASCII chars according to
   STD3 rules.  */
+#endif /* __GNU_VISIBLE */
 
 /* Flag values for getnameinfo function. */
 #define NI_NOFQDN   0x1/* Don't lookup hostname. */
@@ -178,6 +186,7 @@ extern __declspec(dllimport) int h_errno;
 #define NI_NAMEREQD 0x4/* Not being able to resolve is an error. */
 #define NI_NUMERICSERV  0x8/* Return port number, rather than name. */
 #define NI_DGRAM0x10   /* Lookup datagram (UDP) service. */
+#ifdef __GNU_VISIBLE
 /* Glibc extensions. We use numerical values taken by winsock-specific
extensions. */
 #define NI_IDN  0x4000 /* Decode name from punycode to IDN in
@@ -186,6 +195,7 @@ extern __declspec(dllimport) int h_errno;
   output string.  */
 #define NI_IDN_USE_STD3_ASCII_RULES 0x2 /* Filter ASCII chars according to
   STD3 rules.  */
+#endif /* __GNU_VISIBLE */
 
 #define NI_MAXHOST  1025   /* Best effort maximum hostname length. */
 #define NI_MAXSERV  32 /* Best effort maximum service name length. */
@@ -205,8 +215,12 @@ extern __declspec(dllimport) int h_errno;
 #define EAI_BADHINTS12 /* Invalid value for hints */
 #define EAI_PROTOCOL13 /* Resolved protocol is unknown */
 #define EAI_OVERFLOW14 /* An argument buffer overflowed */
+#ifdef __GNU_VISIBLE
 /* Glibc extensions. */
 #define EAI_IDN_ENCODE 15  /* Parameter string not correctly encoded */
+#endif
+
+#endif /* __POSIX_VISIBLE >= 200112 */
 
 #ifndef __INSIDE_CYGWIN_NET__
 void   endhostent (void);
@@ -216,7 +230,9 @@ voidendservent (void);
 void   endrpcent  (void);
 struct hostent *gethostbyaddr (const char *, int, int);
 struct hostent *gethostbyname (const char *);
+#if __MISC_VISIBLE
 struct hostent *gethostbyname2 (const char *, int);
+#endif
 struct hostent *gethostent (void);
 struct netent  *getnetbyaddr (uint32_t, int);
 struct netent  *getnetbyname (const char *);
@@ -230,20 +246,25 @@ struct servent*getservent (void);
 struct rpcent  *getrpcent (void);
 struct rpcent  *getrpcbyname (const char *);
 struct rpcent  *getrpcbynumber (int);
+#if __MISC_VISIBLE
 const char  *hstrerror (int);
 void   herror (const char *);
+#endif
 void   sethostent (int);
 void   setnetent (int);
 void   setprotoent (int);
 void   setservent (int);
 void   setrpcent (int);
+#if __

[newlib-cygwin] cygwin: workaround GCC 6 changes

2017-09-12 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=05cfd1aed8b262e82f62acc2de2858d2d2b6679c

commit 05cfd1aed8b262e82f62acc2de2858d2d2b6679c
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Sep 12 14:30:34 2017 -0500

cygwin: workaround GCC 6 changes

GCC 6 includes a number of new warnings which cause Cygwin to either not
compile, or not work properly even if said warnings are ignored:

https://cygwin.com/ml/cygwin-developers/2017-09/msg0.html
https://gcc.gnu.org/gcc-6/porting_to.html

For now, we use the flags necessary to revert to GCC 5 behaviour until we
can fix the code properly.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/Makefile.in | 4 ++--
 winsup/cygwin/crt0.c  | 2 ++
 winsup/cygwin/init.cc | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 10e6b1f..98727c0 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -73,11 +73,11 @@ CRT0:=$(cygwin_build)/crt0.o
 #
 MT_SAFE:=@MT_SAFE@
 CCEXTRA=
-COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer 
$(CCEXTRA)
+COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fno-delete-null-pointer-checks 
-fmerge-constants -ftracer $(CCEXTRA)
 ifeq ($(target_cpu),x86_64)
 COMMON_CFLAGS+=-mcmodel=small
 endif
-COMPILE.cc+=${COMMON_CFLAGS}
+COMPILE.cc+=${COMMON_CFLAGS} -std=gnu++98
 COMPILE.c+=${COMMON_CFLAGS}
 
 AR:=@AR@
diff --git a/winsup/cygwin/crt0.c b/winsup/cygwin/crt0.c
index f0103b4..271f5b9 100644
--- a/winsup/cygwin/crt0.c
+++ b/winsup/cygwin/crt0.c
@@ -20,7 +20,9 @@ void
 mainCRTStartup ()
 {
 #ifdef __i386__
+#pragma GCC diagnostic ignored "-Wframe-address"
   (void)__builtin_return_address(1);
+#pragma GCC diagnostic pop
   asm volatile ("andl $-16,%%esp" ::: "%esp");
 #endif
 
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc
index 5b84b1c..2d4299e 100644
--- a/winsup/cygwin/init.cc
+++ b/winsup/cygwin/init.cc
@@ -23,7 +23,9 @@ static void WINAPI
 threadfunc_fe (VOID *arg)
 {
 #ifndef __x86_64__
+#pragma GCC diagnostic ignored "-Wframe-address"
   (void)__builtin_return_address(1);
+#pragma GCC diagnostic pop
   asm volatile ("andl $-16,%%esp" ::: "%esp");
 #endif
   _cygtls::call ((DWORD (*)  (void *, void *)) TlsGetValue (_my_oldfunc), arg);


[newlib-cygwin] Revert "cygwin: only expose /dev/con{in, out, sole} when started from a Windows console"

2017-09-11 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=21a39b20a53d6c26959296765a7006af377ce37b

commit 21a39b20a53d6c26959296765a7006af377ce37b
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Sep 11 13:21:46 2017 -0500

Revert "cygwin: only expose /dev/con{in,out,sole} when started from a 
Windows console"

This caused serious regressions when running from a cmd window:

https://cygwin.com/ml/cygwin/2017-09/msg00114.html

This reverts commit b706c6b479422d31f0124b92c21b4cb536bbddff.

    Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/fhandler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index cd73e6e..153e384 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1439,7 +1439,7 @@ private:
   ssize_t __stdcall write (const void *ptr, size_t len);
   void doecho (const void *str, DWORD len) { (void) write (str, len); }
   int close ();
-  static bool exists () {return shared_console_info && !!GetConsoleCP ();}
+  static bool exists () {return !!GetConsoleCP ();}
 
   int tcflush (int);
   int tcsetattr (int a, const struct termios *t);


[newlib-cygwin] cygwin: Document crypt_r

2017-09-02 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ff53f489fa2f7ddf4306fe256de5609ff7a131b0

commit ff53f489fa2f7ddf4306fe256de5609ff7a131b0
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Sep 1 17:26:40 2017 -0500

cygwin: Document crypt_r

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/doc/posix.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 6e96272..c99e003 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1286,6 +1286,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 clog10
 clog10f
 clog10l
+crypt_r(available in external "crypt" library)
 dladdr (see chapter "Implementation Notes")
 dremf
 dup3


[newlib-cygwin] cygwin: add explicit_bzero, elf.h changes to release

2017-08-02 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=109a3a02a3855bae4be5ab6fe641366c7694b978

commit 109a3a02a3855bae4be5ab6fe641366c7694b978
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Aug 2 04:38:01 2017 -0500

cygwin: add explicit_bzero, elf.h changes to release

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/release/2.8.3 | 4 
 1 file changed, 4 insertions(+)

diff --git a/winsup/cygwin/release/2.8.3 b/winsup/cygwin/release/2.8.3
index 5cecabb..c76d571 100644
--- a/winsup/cygwin/release/2.8.3
+++ b/winsup/cygwin/release/2.8.3
@@ -1,10 +1,14 @@
 What's new:
 ---
 
+- New API: explicit_bzero.
+
 
 What changed:
 -
 
+- Improved implementation of .
+
 
 Bug Fixes
 -


[newlib-cygwin] Add elf.h to newlib

2017-08-02 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4aaec3cb88b333731ab844046d6f01145f81e9e1

commit 4aaec3cb88b333731ab844046d6f01145f81e9e1
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Aug 2 01:15:31 2017 -0500

Add elf.h to newlib

This is copied from musl (MIT license).  This is newer and more thorough
than that of FreeBSD currently shipped only on Cygwin.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/elf.h   | 3146 +++
 winsup/cygwin/include/elf.h |   41 -
 winsup/cygwin/include/machine/elf.h |  117 --
 winsup/cygwin/include/sys/elf.h |   41 -
 winsup/cygwin/include/sys/elf32.h   |  245 ---
 winsup/cygwin/include/sys/elf64.h   |  248 ---
 winsup/cygwin/include/sys/elf_common.h  | 1110 ---
 winsup/cygwin/include/sys/elf_generic.h |   88 -
 8 files changed, 3146 insertions(+), 1890 deletions(-)

diff --git a/newlib/libc/include/elf.h b/newlib/libc/include/elf.h
new file mode 100644
index 000..1b62db5
--- /dev/null
+++ b/newlib/libc/include/elf.h
@@ -0,0 +1,3146 @@
+/*
+From musl include/elf.h
+
+Copyright © 2005-2014 Rich Felker, et al.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _ELF_H
+#define _ELF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+typedef uint32_t Elf32_Word;
+typedefint32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedefint32_t  Elf64_Sword;
+
+typedef uint64_t Elf32_Xword;
+typedefint64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedefint64_t  Elf64_Sxword;
+
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+typedef Elf32_Half Elf32_Versym;
+typedef Elf64_Half Elf64_Versym;
+
+#define EI_NIDENT (16)
+
+typedef struct {
+  unsigned chare_ident[EI_NIDENT];
+  Elf32_Half   e_type;
+  Elf32_Half   e_machine;
+  Elf32_Word   e_version;
+  Elf32_Addr   e_entry;
+  Elf32_Offe_phoff;
+  Elf32_Offe_shoff;
+  Elf32_Word   e_flags;
+  Elf32_Half   e_ehsize;
+  Elf32_Half   e_phentsize;
+  Elf32_Half   e_phnum;
+  Elf32_Half   e_shentsize;
+  Elf32_Half   e_shnum;
+  Elf32_Half   e_shstrndx;
+} Elf32_Ehdr;
+
+typedef struct {
+  unsigned chare_ident[EI_NIDENT];
+  Elf64_Half   e_type;
+  Elf64_Half   e_machine;
+  Elf64_Word   e_version;
+  Elf64_Addr   e_entry;
+  Elf64_Offe_phoff;
+  Elf64_Offe_shoff;
+  Elf64_Word   e_flags;
+  Elf64_Half   e_ehsize;
+  Elf64_Half   e_phentsize;
+  Elf64_Half   e_phnum;
+  Elf64_Half   e_shentsize;
+  Elf64_Half   e_shnum;
+  Elf64_Half   e_shstrndx;
+} Elf64_Ehdr;
+
+#define EI_MAG00
+#define ELFMAG00x7f
+
+#define EI_MAG11
+#define ELFMAG1'E'
+
+#define EI_MAG22
+#define ELFMAG2'L'
+
+#define EI_MAG33
+#define ELFMAG3'F'
+
+
+#defineELFMAG  "\177ELF"
+#defineSELFMAG 4
+
+#define EI_CLASS   4
+#define ELFCLASSNONE   0
+#define ELFCLASS32 1
+#define ELFCLASS64 2
+#define ELFCLASSNUM3
+
+#define EI_DATA5
+#define ELFDATANONE0
+#define ELFDATA2LSB1
+#define ELFDATA2MSB2
+#define ELFDATANUM 3
+
+#define EI_VERSION 6
+
+
+#define EI_OSABI   7
+#define ELFOSABI_NONE  0
+#define ELFOSABI_SYSV  0
+#define ELFOSABI_HPUX  1
+#define ELFOSABI_NETBSD2
+#define ELFOSABI_LINUX 3
+#define ELFOSABI_GNU   3
+#define ELFOSABI_SOLARIS   6
+#define ELFOSABI_AIX   7
+#define ELFOSABI_IRIX  8
+#define ELFOSABI_FREEBSD   9
+#define ELFOSABI_TRU64 10
+#define ELFOSABI_MODESTO 

[newlib-cygwin] cygwin: Export explicit_bzero

2017-08-02 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2c83bc950fec04feb76a018a994598deb3787256

commit 2c83bc950fec04feb76a018a994598deb3787256
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Aug 2 01:09:49 2017 -0500

cygwin: Export explicit_bzero

This was added to newlib together with timingsafe_*cmp but never exported.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/common.din   | 1 +
 winsup/cygwin/include/cygwin/version.h | 3 ++-
 winsup/doc/posix.xml   | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 08baa9e..73e6768 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -433,6 +433,7 @@ exp2f NOSIGFE
 exp2l NOSIGFE
 expf NOSIGFE
 expl NOSIGFE
+explicit_bzero NOSIGFE
 expm1 NOSIGFE
 expm1f NOSIGFE
 expm1l NOSIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index bbb6326..ce548b1 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -478,12 +478,13 @@ details. */
   311: Export __xpg_sigpause.
   312: Export strverscmp, versionsort.
   313: Export fls, flsl, flsll.
+  314: Export explicit_bzero.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 313
+#define CYGWIN_VERSION_API_MINOR 314
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index bc50643..5ce5988 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1139,6 +1139,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 endusershell
 err
 errx
+explicit_bzero
 feof_unlocked
 ferror_unlocked
 fflush_unlocked


[newlib-cygwin] cygwin: document signal.h fixes

2017-07-12 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5fac663b295dae0ffa9b1c9c86fbf9994d99bec8

commit 5fac663b295dae0ffa9b1c9c86fbf9994d99bec8
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Jul 12 03:24:50 2017 -0500

cygwin: document signal.h fixes

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/release/2.8.2 | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/release/2.8.2 b/winsup/cygwin/release/2.8.2
index 467396a..67051c5 100644
--- a/winsup/cygwin/release/2.8.2
+++ b/winsup/cygwin/release/2.8.2
@@ -7,9 +7,12 @@ What's new:
 What changed:
 -
 
-
 Bug Fixes
 -
 
 - Fix scandirat
   Addresses: https://cygwin.com/ml/cygwin/2017-07/msg00045.html
+
+- Fix signal.h with strict features enabled
+  Addresses: https://cygwin.com/ml/cygwin/2017-07/msg00051.html
+  Addresses: https://cygwin.com/ml/cygwin/2017-07/msg00088.html


[newlib-cygwin] Cygwin: fix guard on struct siginfo_t

2017-07-10 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=187066dcad5b65657b1a3a6e9ff18b390f24d062

commit 187066dcad5b65657b1a3a6e9ff18b390f24d062
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Jul 7 17:33:59 2017 -0500

Cygwin: fix guard on struct siginfo_t

Add line breaks to make it clearer that the struct packing applies to more
than one struct.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/cygwin/signal.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/include/cygwin/signal.h 
b/winsup/cygwin/include/cygwin/signal.h
index e73874c..af08336 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -175,7 +175,10 @@ typedef struct sigevent
   pthread_attr_t *sigev_notify_attributes; /* notification attributes */
 } sigevent_t;
 
+#if __POSIX_VISIBLE >= 199309
+
 #pragma pack(push,4)
+
 struct _sigcommune
 {
   __uint32_t _si_code;
@@ -190,8 +193,6 @@ struct _sigcommune
   };
 };
 
-#if __POSIX_VISIBLE >= 199309
-
 #define __SI_PAD_SIZE 32
 #ifdef __INSIDE_CYGWIN__
 # ifndef max
@@ -251,6 +252,7 @@ typedef struct
 #endif /*__INSIDE_CYGWIN__*/
   };
 } siginfo_t;
+
 #pragma pack(pop)
 
 #endif /* __POSIX_VISIBLE >= 199309 */


[newlib-cygwin] Cygwin: fix signal.h with _POSIX_C_SOURCE=1

2017-07-05 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8a508f301cb9fb7e11f7cc2e3be7ffd42e64c25f

commit 8a508f301cb9fb7e11f7cc2e3be7ffd42e64c25f
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Jul 4 18:10:02 2017 -0500

Cygwin: fix signal.h with _POSIX_C_SOURCE=1

struct sigaction is POSIX.1-1990 but siginfo_t, which is used by its
sa_sigaction member, is POSIX.1b-1993.  Therefore it needs to be guarded
as well, and as part of a union, the struct size is protected.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/cygwin/signal.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/include/cygwin/signal.h 
b/winsup/cygwin/include/cygwin/signal.h
index 700d45c..e73874c 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -325,7 +325,9 @@ struct sigaction
   __extension__ union
   {
 _sig_func_ptr sa_handler;  /* SIG_DFL, SIG_IGN, or pointer 
to a function */
+#if __POSIX_VISIBLE >= 199309
 void  (*sa_sigaction) ( int, siginfo_t *, void * );
+#endif
   };
   sigset_t sa_mask;
   int sa_flags;


[newlib-cygwin] cygwin: export strverscmp, add versionsort

2017-06-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f698efbce167768d9c859c07dd2bebc75ade7728

commit f698efbce167768d9c859c07dd2bebc75ade7728
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Jun 14 15:26:38 2017 -0500

cygwin: export strverscmp, add versionsort

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/common.din   | 2 ++
 winsup/cygwin/include/cygwin/version.h | 3 ++-
 winsup/cygwin/include/sys/dirent.h | 1 +
 winsup/cygwin/release/2.8.1| 2 ++
 winsup/cygwin/scandir.cc   | 6 ++
 winsup/doc/posix.xml   | 2 ++
 6 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 75fe05c..9331653 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1396,6 +1396,7 @@ strtoull NOSIGFE
 strtoull_l NOSIGFE
 strtoumax = strtoull NOSIGFE
 strupr NOSIGFE
+strverscmp NOSIGFE
 strxfrm NOSIGFE
 strxfrm_l NOSIGFE
 swab NOSIGFE
@@ -1492,6 +1493,7 @@ vasprintf SIGFE
 vdprintf SIGFE
 verr SIGFE
 verrx SIGFE
+versionsort NOSIGFE
 vfiprintf SIGFE
 vfork SIGFE
 vfprintf SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index c0254a8..bde358f 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -476,12 +476,13 @@ details. */
   309: Export getloadavg.
   310: Export reallocarray.
   311: Export __xpg_sigpause.
+  312: Export strverscmp, versionsort.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 311
+#define CYGWIN_VERSION_API_MINOR 312
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/cygwin/include/sys/dirent.h 
b/winsup/cygwin/include/sys/dirent.h
index 771f716..049e87a 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -89,6 +89,7 @@ int alphasort (const struct dirent **__a, const struct dirent 
**__b);
 int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist,
   int (*select) (const struct dirent *),
   int (*compar) (const struct dirent **, const struct dirent **));
+int versionsort (const struct dirent **__a, const struct dirent **__b);
 #endif
 
 #if __BSD_VISIBLE
diff --git a/winsup/cygwin/release/2.8.1 b/winsup/cygwin/release/2.8.1
index 1ebe7d8..d03f296 100644
--- a/winsup/cygwin/release/2.8.1
+++ b/winsup/cygwin/release/2.8.1
@@ -5,6 +5,8 @@ What's new:
 
 - New API: reallocarray
 
+- New API: strverscmp, versionsort.
+
 
 What changed:
 -
diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc
index 1c324c1..d6ac649 100644
--- a/winsup/cygwin/scandir.cc
+++ b/winsup/cygwin/scandir.cc
@@ -20,6 +20,12 @@ alphasort (const struct dirent **a, const struct dirent **b)
 }
 
 extern "C" int
+versionsort (const struct dirent **a, const struct dirent **b)
+{
+  return strverscmp ((*a)->d_name, (*b)->d_name);
+}
+
+extern "C" int
 scandir (const char *dir,
 struct dirent ***namelist,
 int (*select) (const struct dirent *),
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index ced7e38..7e28427 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1367,6 +1367,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 strtoll_l
 strtoul_l
 strtoull_l
+strverscmp
 sysinfo
 tdestroy
 timegm
@@ -1377,6 +1378,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 vasnprintf
 vasprintf
 vasprintf_r
+versionsort
 wcsftime_l
 wcstod_l
 wcstof_l


[newlib-cygwin] cygwin: document XSI sigpause

2017-06-14 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a5cc86ba1306f986b888edf583a3a3ca6c1d98a8

commit a5cc86ba1306f986b888edf583a3a3ca6c1d98a8
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Jun 14 14:30:44 2017 -0500

cygwin: document XSI sigpause

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/release/2.8.1 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/winsup/cygwin/release/2.8.1 b/winsup/cygwin/release/2.8.1
index 90b5a66..1ebe7d8 100644
--- a/winsup/cygwin/release/2.8.1
+++ b/winsup/cygwin/release/2.8.1
@@ -9,6 +9,9 @@ What's new:
 What changed:
 -
 
+- The XSI form of sigpause, which removes the given signal from the process's
+  signal mask, is made available when compiling with _XOPEN_SOURCE or
+  _GNU_SOURCE.
 
 Bug Fixes
 -


[newlib-cygwin] Export XSI sigpause

2017-06-14 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=dde6af6f82d117532cc8a57f34ccbb52ca3160fa

commit dde6af6f82d117532cc8a57f34ccbb52ca3160fa
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Jun 14 10:20:05 2017 -0500

Export XSI sigpause

There are two common sigpause variants, both of which take an int argument.
If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
which removes the given signal from the process's signal mask; otherwise
you get the BSD version, which sets the process's signal mask to the given
value.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/sys/signal.h   | 14 +-
 winsup/cygwin/common.din   |  1 +
 winsup/cygwin/include/cygwin/version.h |  3 ++-
 winsup/cygwin/signal.cc| 12 
 winsup/doc/posix.xml   | 10 --
 5 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index a56f18a..da064cd 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -200,7 +200,19 @@ int _EXFUN(sigwait, (const sigset_t *set, int *sig));
 #endif /* !__CYGWIN__ && !__rtems__ */
 #endif /* __POSIX_VISIBLE */
 
-#if __BSD_VISIBLE
+/* There are two common sigpause variants, both of which take an int argument.
+   If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version,
+   which removes the given signal from the process's signal mask; otherwise
+   you get the BSD version, which sets the process's signal mask to the given
+   value. */
+#if __XSI_VISIBLE && !defined(__INSIDE_CYGWIN__)
+# ifdef __GNUC__
+int _EXFUN(sigpause, (int)) __asm__ (__ASMNAME ("__xpg_sigpause"));
+# else
+int _EXFUN(__xpg_sigpause, (int));
+#  define sigpause __xpg_sigpause
+# endif
+#elif __BSD_VISIBLE
 int _EXFUN(sigpause, (int));
 #endif
 
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 6620700..75fe05c 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -102,6 +102,7 @@ __wrap__ZdlPv NOSIGFE   # void operator 
delete(void *p) throw()
 __wrap__ZdlPvRKSt9nothrow_t NOSIGFE # void operator delete(void *p, const 
std::nothrow_t ) throw()
 __xdrrec_getrec SIGFE
 __xdrrec_setnonblock SIGFE
+__xpg_sigpause SIGFE
 __xpg_strerror_r SIGFE
 _exit SIGFE
 _feinitialise NOSIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index 7baca61..c0254a8 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -475,12 +475,13 @@ details. */
   308: Export dladdr.
   309: Export getloadavg.
   310: Export reallocarray.
+  311: Export __xpg_sigpause.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 310
+#define CYGWIN_VERSION_API_MINOR 311
 
 /* There is also a compatibity version number associated with the shared memory
regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index f371a23..fbd2b24 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -524,6 +524,18 @@ sigpause (int signal_mask)
 }
 
 extern "C" int
+__xpg_sigpause (int sig)
+{
+  int res;
+  sigset_t signal_mask;
+  sigprocmask (0, NULL, _mask);
+  sigdelset (_mask, sig);
+  res = handle_sigsuspend (signal_mask);
+  syscall_printf ("%R = __xpg_sigpause(%y)", res, sig);
+  return res;
+}
+
+extern "C" int
 pause (void)
 {
   int res = handle_sigsuspend (_my_tls.sigmask);
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 5c9f656..ced7e38 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -877,7 +877,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 signal
 signbit(see chapter "Implementation Notes")
 signgam
-sigpause
+sigpause   (see chapter "Implementation Notes")
 sigpending
 sigprocmask
 sigqueue
@@ -925,7 +925,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 strdup
 strerror
 strerror_l
-strerror_r
+strerror_r (see chapter "Implementation Notes")
 strfmon
 strfmon_l
 strftime
@@ -1668,6 +1668,12 @@ depending on whether _BSD_SOURCE or _GNU_SOURCE is 
defined when compiling.basename is available in both POSIX and GNU flavors,
 depending on whether libgen.h is included or not.
 
+sigpause is available in both BSD and SysV/XSI
+flavors, depending on whether _XOPEN_SOURCE is defined when compiling.
+
+strerror_r is available in both POSIX and GNU
+flavors, depending on whether _GNU_SOURCE is defined when compiling.
+
 dladdr always sets the Dl_info members dli_sname and
 dli_saddr to NULL, indicating no symbol matching addr could be found.


[newlib-cygwin] Feature test macros overhaul: Cygwin signal.h

2017-06-14 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6a6c1c52e6bfea85beb06ea60417b90ae3c6857c

commit 6a6c1c52e6bfea85beb06ea60417b90ae3c6857c
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Jun 13 14:58:33 2017 -0500

Feature test macros overhaul: Cygwin signal.h

This should match newlib's .

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/cygwin/signal.h | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/include/cygwin/signal.h 
b/winsup/cygwin/include/cygwin/signal.h
index f304995..700d45c 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -190,6 +190,8 @@ struct _sigcommune
   };
 };
 
+#if __POSIX_VISIBLE >= 199309
+
 #define __SI_PAD_SIZE 32
 #ifdef __INSIDE_CYGWIN__
 # ifndef max
@@ -251,6 +253,8 @@ typedef struct
 } siginfo_t;
 #pragma pack(pop)
 
+#endif /* __POSIX_VISIBLE >= 199309 */
+
 enum
 {
   SI_USER = 0, /* sent by kill, raise, pthread_kill */
@@ -314,6 +318,8 @@ enum
 
 typedef void (*_sig_func_ptr)(int);
 
+#if __POSIX_VISIBLE
+
 struct sigaction
 {
   __extension__ union
@@ -344,11 +350,17 @@ struct sigaction
Do not use.  */
 #define _SA_INTERNAL_MASK 0xf000   /* bits in this range are internal */
 
+#endif /* __POSIX_VISIBLE */
+
+#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
+
 #undef MINSIGSTKSZ
 #defineMINSIGSTKSZ  8192
 #undef SIGSTKSZ
 #defineSIGSTKSZ32768
 
+#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 */
+
 #defineSIGHUP  1   /* hangup */
 #defineSIGINT  2   /* interrupt */
 #defineSIGQUIT 3   /* quit */
@@ -397,20 +409,32 @@ struct sigaction
 
 #define SIG_HOLD ((_sig_func_ptr)2)/* Signal in signal mask */
 
+#if __POSIX_VISIBLE >= 200809
 void psiginfo (const siginfo_t *, const char *);
+#endif
+#if __POSIX_VISIBLE
 int sigwait (const sigset_t *, int *);
+#endif
+#if __POSIX_VISIBLE >= 199309
 int sigwaitinfo (const sigset_t *, siginfo_t *);
+#endif
+#if __XSI_VISIBLE >= 4
 int sighold (int);
 int sigignore (int);
 int sigrelse (int);
 _sig_func_ptr sigset (int, _sig_func_ptr);
+#endif
 
+#if __POSIX_VISIBLE >= 199309
 int sigqueue(pid_t, int, const union sigval);
+#endif
+#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
 int siginterrupt (int, int);
+#endif
 #ifdef __INSIDE_CYGWIN__
 extern const char *sys_sigabbrev[];
 extern const char *sys_siglist[];
-#else
+#elif __BSD_VISIBLE
 extern const char __declspec(dllimport) *sys_sigabbrev[];
 extern const char __declspec(dllimport) *sys_siglist[];
 #endif


[newlib-cygwin] Cygwin: create separate bits/byteswap.h

2017-02-09 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e704ab2470159b7d8b6a02e8482bb5b38215ac9a

commit e704ab2470159b7d8b6a02e8482bb5b38215ac9a
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Feb 8 17:01:34 2017 -0600

Cygwin: create separate bits/byteswap.h

Match glibc behaviour to expose the public bswap_* macros only with an
explicity #include ; #include'ing  should not expose
them.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/bits/byteswap.h | 37 +++
 winsup/cygwin/include/byteswap.h  | 25 +--
 winsup/cygwin/include/endian.h| 26 
 3 files changed, 51 insertions(+), 37 deletions(-)

diff --git a/winsup/cygwin/include/bits/byteswap.h 
b/winsup/cygwin/include/bits/byteswap.h
new file mode 100644
index 000..20ed5bb
--- /dev/null
+++ b/winsup/cygwin/include/bits/byteswap.h
@@ -0,0 +1,37 @@
+/* bits/byteswap.h
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _BITS_BYTESWAP_H
+#define _BITS_BYTESWAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static __inline unsigned short
+__bswap_16 (unsigned short __x)
+{
+  return (__x >> 8) | (__x << 8);
+}
+
+static __inline unsigned int
+__bswap_32 (unsigned int __x)
+{
+  return (__bswap_16 (__x & 0x) << 16) | (__bswap_16 (__x >> 16));
+}
+
+static __inline unsigned long long
+__bswap_64 (unsigned long long __x)
+{
+  return (((unsigned long long) __bswap_32 (__x & 0xull)) << 32) | 
(__bswap_32 (__x >> 32));
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _BITS_BYTESWAP_H */
diff --git a/winsup/cygwin/include/byteswap.h b/winsup/cygwin/include/byteswap.h
index 5e3f221..05bb5ca 100644
--- a/winsup/cygwin/include/byteswap.h
+++ b/winsup/cygwin/include/byteswap.h
@@ -9,33 +9,10 @@ details. */
 #ifndef _BYTESWAP_H
 #define _BYTESWAP_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static __inline unsigned short
-__bswap_16 (unsigned short __x)
-{
-  return (__x >> 8) | (__x << 8);
-}
-
-static __inline unsigned int
-__bswap_32 (unsigned int __x)
-{
-  return (__bswap_16 (__x & 0x) << 16) | (__bswap_16 (__x >> 16));
-}
-
-static __inline unsigned long long
-__bswap_64 (unsigned long long __x)
-{
-  return (((unsigned long long) __bswap_32 (__x & 0xull)) << 32) | 
(__bswap_32 (__x >> 32));
-}
+#include 
 
 #define bswap_16(x) __bswap_16(x)
 #define bswap_32(x) __bswap_32(x)
 #define bswap_64(x) __bswap_64(x)
 
-#ifdef __cplusplus
-}
-#endif
 #endif /* _BYTESWAP_H */
diff --git a/winsup/cygwin/include/endian.h b/winsup/cygwin/include/endian.h
index a17ff99..5a43ad0 100644
--- a/winsup/cygwin/include/endian.h
+++ b/winsup/cygwin/include/endian.h
@@ -35,17 +35,17 @@ details. */
 
 #if __BSD_VISIBLE
 
-#include 
+#include 
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 
-#define htobe16(x) bswap_16(x)
-#define htobe32(x) bswap_32(x)
-#define htobe64(x) bswap_64(x)
+#define htobe16(x) __bswap_16(x)
+#define htobe32(x) __bswap_32(x)
+#define htobe64(x) __bswap_64(x)
 
-#define be16toh(x) bswap_16(x)
-#define be32toh(x) bswap_32(x)
-#define be64toh(x) bswap_64(x)
+#define be16toh(x) __bswap_16(x)
+#define be32toh(x) __bswap_32(x)
+#define be64toh(x) __bswap_64(x)
 
 #define htole16(x) (x)
 #define htole32(x) (x)
@@ -67,13 +67,13 @@ details. */
 #define be32toh(x) (x)
 #define be64toh(x) (x)
 
-#define htole16(x) bswap_16(x)
-#define htole32(x) bswap_32(x)
-#define htole64(x) bswap_64(x)
+#define htole16(x) __bswap_16(x)
+#define htole32(x) __bswap_32(x)
+#define htole64(x) __bswap_64(x)
 
-#define le16toh(x) bswap_16(x)
-#define le32toh(x) bswap_32(x)
-#define le64toh(x) bswap_64(x)
+#define le16toh(x) __bswap_16(x)
+#define le32toh(x) __bswap_32(x)
+#define le64toh(x) __bswap_64(x)
 
 #endif /*__BYTE_ORDER == __BIG_ENDIAN*/


[newlib-cygwin] Add release message for commit 3d3ab82

2016-08-30 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=abd37f0c79aa33f53d829bf68511bb78308646f1

commit abd37f0c79aa33f53d829bf68511bb78308646f1
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Aug 30 10:53:35 2016 -0500

Add release message for commit 3d3ab82

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/release/2.6.0 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/winsup/cygwin/release/2.6.0 b/winsup/cygwin/release/2.6.0
index e13a31e..eb39f8f 100644
--- a/winsup/cygwin/release/2.6.0
+++ b/winsup/cygwin/release/2.6.0
@@ -81,3 +81,6 @@ Bug Fixes
 - Allow kill(pid, ) on zombies to return successfully, rather than
   only kill(pid, 0), to align behaviour with POSIX requirements.
   Addresses: https://cygwin.com/ml/cygwin/2016-08/msg00188.html
+
+- Fix off_t typedef on 64-bit.
+  Addresses: https://sourceware.org/ml/newlib/2016/msg01028.html


[newlib-cygwin] cygwin/math: make isinf functions signed

2016-04-04 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=929be8005ceed50182388ba14dc20317ddeeb7bd

commit 929be8005ceed50182388ba14dc20317ddeeb7bd
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Apr 1 17:38:17 2016 -0500

cygwin/math: make isinf functions signed

glibc returns -1 for negative infinity:

http://man7.org/linux/man-pages/man3/isinfl.3.html
https://sourceware.org/bugzilla/show_bug.cgi?id=15367

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/math/isinf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/math/isinf.c b/winsup/cygwin/math/isinf.c
index e7d3e26..fd9e299 100644
--- a/winsup/cygwin/math/isinf.c
+++ b/winsup/cygwin/math/isinf.c
@@ -1,18 +1,18 @@
 int
 isinf (double x)
 {
-  return __builtin_isinf (x);
+  return __builtin_isinf_sign (x);
 }
 
 int
 isinff (float x)
 {
-  return __builtin_isinf (x);
+  return __builtin_isinf_sign (x);
 }
 
 int
 isinfl (long double x)
 {
-  return __builtin_isinf (x);
+  return __builtin_isinf_sign (x);
 }


[newlib-cygwin] winsup/utils: port getconf to 64-bit

2016-04-04 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8502abb674e23e976ebdb85fb07934dd01172506

commit 8502abb674e23e976ebdb85fb07934dd01172506
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Apr 1 17:44:31 2016 -0500

winsup/utils: port getconf to 64-bit

The available specifications obviously differ on 32-bit and 64-bit, as
already handled in .

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/utils/getconf.c | 35 +++
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c
index 8732be1..993aa29 100644
--- a/winsup/utils/getconf.c
+++ b/winsup/utils/getconf.c
@@ -385,22 +385,33 @@ struct spec_variable {
   int valid;
 };
 
+#if __LP64__
+#define ILP32 0
+#define LP64 1
+#else
+#define ILP32 1
+#define LP64 0
+#endif
+
 static const struct spec_variable spec_table[] = {
-  { "POSIX_V7_ILP32_OFF32",0 },
-  { "POSIX_V7_ILP32_OFFBIG",   1 },
-  { "POSIX_V7_LP64_OFF64", 0 },
-  { "POSIX_V7_LPBIG_OFFBIG",   0 },
-  { "POSIX_V6_ILP32_OFF32",0 },
-  { "POSIX_V6_ILP32_OFFBIG",   1 },
-  { "POSIX_V6_LP64_OFF64", 0 },
-  { "POSIX_V6_LPBIG_OFFBIG",   0 },
-  { "XBS5_ILP32_OFF32",0 },
-  { "XBS5_ILP32_OFFBIG",   1 },
-  { "XBS5_LP64_OFF64", 0 },
-  { "XBS5_LPBIG_OFFBIG",   0 },
+  { "POSIX_V7_ILP32_OFF32",0   },
+  { "POSIX_V7_ILP32_OFFBIG",   ILP32   },
+  { "POSIX_V7_LP64_OFF64", LP64},
+  { "POSIX_V7_LPBIG_OFFBIG",   LP64},
+  { "POSIX_V6_ILP32_OFF32",0   },
+  { "POSIX_V6_ILP32_OFFBIG",   ILP32   },
+  { "POSIX_V6_LP64_OFF64", LP64},
+  { "POSIX_V6_LPBIG_OFFBIG",   LP64},
+  { "XBS5_ILP32_OFF32",0   },
+  { "XBS5_ILP32_OFFBIG",   ILP32   },
+  { "XBS5_LP64_OFF64", LP64},
+  { "XBS5_LPBIG_OFFBIG",   LP64},
   { NULL, 0 },
 };
 
+#undef ILP32
+#undef LP64
+
 static int a_flag = 0; /* list all variables */
 static int v_flag = 0; /* follow given specification */


[newlib-cygwin] cygwin: update sysconf for new features

2016-04-04 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=959d58ea7cb2bc7ed8ab4c804fc1d72a0f5ad01d

commit 959d58ea7cb2bc7ed8ab4c804fc1d72a0f5ad01d
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Apr 1 17:42:27 2016 -0500

cygwin: update sysconf for new features

POSIX spawn and thread barriers have since been added.  Also fix a typo in
_POSIX2_C_DEV (result is the same).

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/sysconf.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index ae35c6e..0d33bcb 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -565,7 +565,7 @@ static struct
   {cons, {c:PTHREAD_DESTRUCTOR_ITERATIONS}},   /*  53, 
_SC_THREAD_DESTRUCTOR_ITERATIONS */
   {cons, {c:_POSIX_ADVISORY_INFO}},/*  54, _SC_ADVISORY_INFO */
   {cons, {c:ATEXIT_MAX}},  /*  55, _SC_ATEXIT_MAX */
-  {cons, {c:-1L}}, /*  56, _SC_BARRIERS */
+  {cons, {c:_POSIX_BARRIERS}}, /*  56, _SC_BARRIERS */
   {cons, {c:BC_BASE_MAX}}, /*  57, _SC_BC_BASE_MAX */
   {cons, {c:BC_DIM_MAX}},  /*  58, _SC_BC_DIM_MAX */
   {cons, {c:BC_SCALE_MAX}},/*  59, _SC_BC_SCALE_MAX */
@@ -584,7 +584,7 @@ static struct
   {cons, {c:_POSIX_REGEXP}},   /*  72, _SC_REGEXP */
   {cons, {c:RE_DUP_MAX}},  /*  73, _SC_RE_DUP_MAX */
   {cons, {c:_POSIX_SHELL}},/*  74, _SC_SHELL */
-  {cons, {c:-1L}}, /*  75, _SC_SPAWN */
+  {cons, {c:_POSIX_SPAWN}},/*  75, _SC_SPAWN */
   {cons, {c:_POSIX_SPIN_LOCKS}},   /*  76, _SC_SPIN_LOCKS */
   {cons, {c:-1L}}, /*  77, _SC_SPORADIC_SERVER */
   {nsup, {c:0}},   /*  78, _SC_SS_REPL_MAX */
@@ -618,7 +618,7 @@ static struct
   {cons, {c:_XOPEN_VERSION}},  /* 106, _SC_XOPEN_VERSION */
   {cons, {c:_POSIX2_CHAR_TERM}},   /* 107, _SC_2_CHAR_TERM */
   {cons, {c:_POSIX2_C_BIND}},  /* 108, _SC_2_C_BIND */
-  {cons, {c:_POSIX2_C_BIND}},  /* 109, _SC_2_C_DEV */
+  {cons, {c:_POSIX2_C_DEV}},   /* 109, _SC_2_C_DEV */
   {cons, {c:-1L}}, /* 110, _SC_2_FORT_DEV */
   {cons, {c:-1L}}, /* 111, _SC_2_FORT_RUN */
   {cons, {c:-1L}}, /* 112, _SC_2_LOCALEDEF */


[newlib-cygwin] Feature test macros overhaul: Cygwin pthread.h

2016-04-04 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b3acb347c43a534bb1978c21abebf1ae2a25b866

commit b3acb347c43a534bb1978c21abebf1ae2a25b866
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Fri Apr 1 17:30:41 2016 -0500

Feature test macros overhaul: Cygwin pthread.h

As a Cygwin-specific header, there is no need to guard functions based on
capability macros.  Instead, guard several blocks based on additions or
removals in later versions of POSIX.1, along with a few which are only
XSI or GNU extensions.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/pthread.h | 29 +
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h
index 84e0a14..83631dd 100644
--- a/winsup/cygwin/include/pthread.h
+++ b/winsup/cygwin/include/pthread.h
@@ -75,9 +75,6 @@ int pthread_attr_getinheritsched (const pthread_attr_t *, int 
*);
 int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *);
 int pthread_attr_getschedpolicy (const pthread_attr_t *, int *);
 int pthread_attr_getscope (const pthread_attr_t *, int *);
-int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *);
-int pthread_attr_getstackaddr (const pthread_attr_t *, void **)
-__attribute__ ((__deprecated__));
 int pthread_attr_init (pthread_attr_t *);
 int pthread_attr_setdetachstate (pthread_attr_t *, int);
 int pthread_attr_setguardsize (pthread_attr_t *, size_t);
@@ -86,16 +83,18 @@ int pthread_attr_setschedparam (pthread_attr_t *, const 
struct sched_param *);
 int pthread_attr_setschedpolicy (pthread_attr_t *, int);
 int pthread_attr_setscope (pthread_attr_t *, int);
 
-#ifdef _POSIX_THREAD_ATTR_STACKADDR
+#if __POSIX_VISIBLE >= 200112
+int pthread_attr_getstack (const pthread_attr_t *, void **, size_t *);
 int pthread_attr_setstack (pthread_attr_t *, void *, size_t);
+#endif
+#if __POSIX_VISIBLE < 200809
+int pthread_attr_getstackaddr (const pthread_attr_t *, void **)
+__attribute__ ((__deprecated__));
 int pthread_attr_setstackaddr (pthread_attr_t *, void *)
 __attribute__ ((__deprecated__));
 #endif
-
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
 int pthread_attr_getstacksize (const pthread_attr_t *, size_t *);
 int pthread_attr_setstacksize (pthread_attr_t *, size_t);
-#endif
 
 int pthread_cancel (pthread_t);
 /* Macros for cleanup_push and pop;
@@ -135,6 +134,7 @@ int pthread_condattr_setclock (pthread_condattr_t *, 
clockid_t);
 int pthread_condattr_setpshared (pthread_condattr_t *, int);
 
 /* Barriers */
+#if __POSIX_VISIBLE >= 200112
 int pthread_barrierattr_init (pthread_barrierattr_t *);
 int pthread_barrierattr_setpshared (pthread_barrierattr_t *, int);
 int pthread_barrierattr_getpshared (const pthread_barrierattr_t *, int *);
@@ -143,6 +143,7 @@ int pthread_barrier_init (pthread_barrier_t *,
   const pthread_barrierattr_t *, unsigned);
 int pthread_barrier_destroy (pthread_barrier_t *);
 int pthread_barrier_wait (pthread_barrier_t *);
+#endif
 
 /* Threads */
 int pthread_create (pthread_t *, const pthread_attr_t *,
@@ -150,7 +151,9 @@ int pthread_create (pthread_t *, const pthread_attr_t *,
 int pthread_detach (pthread_t);
 int pthread_equal (pthread_t, pthread_t);
 void pthread_exit (void *) __attribute__ ((__noreturn__));
+#if __POSIX_VISIBLE >= 200112
 int pthread_getcpuclockid (pthread_t, clockid_t *);
+#endif
 int pthread_getschedparam (pthread_t, int *, struct sched_param *);
 void *pthread_getspecific (pthread_key_t);
 int pthread_join (pthread_t, void **);
@@ -177,13 +180,16 @@ int pthread_mutexattr_setpshared (pthread_mutexattr_t *, 
int);
 int pthread_mutexattr_settype (pthread_mutexattr_t *, int);
 
 /* Spinlocks */
+#if __POSIX_VISIBLE >= 200112
 int pthread_spin_destroy (pthread_spinlock_t *);
 int pthread_spin_init (pthread_spinlock_t *, int);
 int pthread_spin_lock (pthread_spinlock_t *);
 int pthread_spin_trylock (pthread_spinlock_t *);
 int pthread_spin_unlock (pthread_spinlock_t *);
+#endif
 
 /* RW Locks */
+#if __XSI_VISIBLE >= 500 || __POSIX_VISIBLE >= 200112
 int pthread_rwlock_destroy (pthread_rwlock_t *rwlock);
 int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t 
*attr);
 int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock);
@@ -196,12 +202,15 @@ int pthread_rwlockattr_getpshared (const 
pthread_rwlockattr_t *attr,
   int *pshared);
 int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared);
 int pthread_rwlockattr_destroy (pthread_rwlockattr_t *rwlockattr);
+#endif
 
 int pthread_once (pthread_once_t *, void (*)(void));
 
+#if __XSI_VISIBLE >= 500
 /* Concurrency levels - X/Open interface */
 int pthread_getconcurrency (void);
 int pthread_setconcurrency (int);
+#endif
 
 
 pthread_t pthread_self (void);
@@ -214,11 +223,15 @@ void pthread_test

[newlib-cygwin] Feature test macros overhaul: dirent.h

2016-03-20 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d2937299fad043fa91cdf7f56eef914558be4077

commit d2937299fad043fa91cdf7f56eef914558be4077
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 16:17:38 2016 -0500

Feature test macros overhaul: dirent.h

MAXNAMLEN is a BSDism.

Use the proper internal macros instead of !_POSIX_SOURCE.  telldir and
seekdir are XSI, scandir and alphasort are POSIX.1-2008, and scandirat
is GNU.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/dirent.h   |  3 ++-
 winsup/cygwin/include/sys/dirent.h | 13 ++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/dirent.h b/newlib/libc/include/dirent.h
index 6fefc03..6135b9f 100644
--- a/newlib/libc/include/dirent.h
+++ b/newlib/libc/include/dirent.h
@@ -3,9 +3,10 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+#include 
 #include 
 
-#if !defined(MAXNAMLEN) && !defined(_POSIX_SOURCE)
+#if !defined(MAXNAMLEN) && __BSD_VISIBLE
 #define MAXNAMLEN 1024
 #endif
 
diff --git a/winsup/cygwin/include/sys/dirent.h 
b/winsup/cygwin/include/sys/dirent.h
index 46c34ab..dd02617 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -12,6 +12,7 @@
 #ifndef _SYS_DIRENT_H
 #define _SYS_DIRENT_H
 
+#include 
 #include 
 #include 
 
@@ -72,22 +73,28 @@ int closedir (DIR *);
 
 int dirfd (DIR *);
 
-#ifndef _POSIX_SOURCE
+#if __MISC_VISIBLE || __XSI_VISIBLE
 #ifndef __INSIDE_CYGWIN__
 long telldir (DIR *);
 void seekdir (DIR *, long loc);
 #endif
+#endif
 
+#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809
 int scandir (const char *__dir,
 struct dirent ***__namelist,
 int (*select) (const struct dirent *),
 int (*compar) (const struct dirent **, const struct dirent **));
+int alphasort (const struct dirent **__a, const struct dirent **__b);
+#endif
 
+#if __GNU_VISIBLE
 int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist,
   int (*select) (const struct dirent *),
   int (*compar) (const struct dirent **, const struct dirent **));
+#endif
 
-int alphasort (const struct dirent **__a, const struct dirent **__b);
+#if __BSD_VISIBLE
 #ifdef _DIRENT_HAVE_D_TYPE
 /* File types for `d_type'.  */
 enum
@@ -116,5 +123,5 @@ enum
 # define IFTODT(mode)  (((mode) & 017) >> 12)
 # define DTTOIF(dirtype)((dirtype) << 12)
 #endif /* _DIRENT_HAVE_D_TYPE */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
 #endif /*_SYS_DIRENT_H*/


[newlib-cygwin] Feature test macros overhaul: fnmatch.h

2016-03-20 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d94d983d1bed2d0f5ffb03b8b5469d7e59e839de

commit d94d983d1bed2d0f5ffb03b8b5469d7e59e839de
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 16:19:42 2016 -0500

Feature test macros overhaul: fnmatch.h

Use the proper internal macro for GNU extensions.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/fnmatch.h   | 6 +++---
 winsup/cygwin/include/fnmatch.h | 6 +++---
 winsup/cygwin/libc/fnmatch.c| 1 +
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/newlib/libc/include/fnmatch.h b/newlib/libc/include/fnmatch.h
index 06311fc..a94e923 100644
--- a/newlib/libc/include/fnmatch.h
+++ b/newlib/libc/include/fnmatch.h
@@ -33,21 +33,21 @@
 #ifndef_FNMATCH_H_
 #define_FNMATCH_H_
 
+#include 
+
 #defineFNM_NOMATCH 1   /* Match failed. */
 
 #defineFNM_NOESCAPE0x01/* Disable backslash escaping. */
 #defineFNM_PATHNAME0x02/* Slash must be matched by slash. */
 #defineFNM_PERIOD  0x04/* Period must be matched by period. */
 
-#if defined(_GNU_SOURCE) || !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+#if __GNU_VISIBLE
 #defineFNM_LEADING_DIR 0x08/* Ignore / after Imatch. */
 #defineFNM_CASEFOLD0x10/* Case insensitive search. */
 #defineFNM_IGNORECASE  FNM_CASEFOLD
 #defineFNM_FILE_NAME   FNM_PATHNAME
 #endif
 
-#include 
-
 __BEGIN_DECLS
 int fnmatch(const char *, const char *, int);
 __END_DECLS
diff --git a/winsup/cygwin/include/fnmatch.h b/winsup/cygwin/include/fnmatch.h
index e4500ab..556d3b1 100644
--- a/winsup/cygwin/include/fnmatch.h
+++ b/winsup/cygwin/include/fnmatch.h
@@ -39,21 +39,21 @@
 #ifndef _FNMATCH_H_
 #define _FNMATCH_H_
 
+#include 
+
 #define FNM_NOMATCH1/* Match failed. */
 #define FNM_NOSYS2/* Function not supported (unused). */
 
 #define FNM_NOESCAPE0x01/* Disable backslash escaping. */
 #define FNM_PATHNAME0x02/* Slash must be matched by slash. */
 #define FNM_PERIOD0x04/* Period must be matched by period. */
-#ifndef _POSIX_SOURCE
+#if __GNU_VISIBLE
 #define FNM_LEADING_DIR0x08/* Ignore / after Imatch. */
 #define FNM_CASEFOLD0x10/* Case insensitive search. */
 #define FNM_IGNORECASEFNM_CASEFOLD
 #define FNM_FILE_NAMEFNM_PATHNAME
 #endif
 
-#include 
-
 __BEGIN_DECLS
 int  fnmatch __P((const char *, const char *, int));
 __END_DECLS
diff --git a/winsup/cygwin/libc/fnmatch.c b/winsup/cygwin/libc/fnmatch.c
index 8c38678..fc43765 100644
--- a/winsup/cygwin/libc/fnmatch.c
+++ b/winsup/cygwin/libc/fnmatch.c
@@ -38,6 +38,7 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)fnmatch.c  8.2 (Berkeley) 4/16/94";
 #endif /* LIBC_SCCS and not lint */
+#include "winsup.h"
 #include 
 __FBSDID("$FreeBSD: head/lib/libc/gen/fnmatch.c 288309 2015-09-27 12:52:18Z 
jilles $");


[newlib-cygwin] Feature test macros overhaul: limits.h

2016-03-20 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=86a724b8c04cb3a2b2b70025dfc2d8ff75e15c7b

commit 86a724b8c04cb3a2b2b70025dfc2d8ff75e15c7b
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 16:25:18 2016 -0500

Feature test macros overhaul: limits.h

Simplify the C99 conditional, and use the internal macro for GNU extensions.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/limits.h   | 6 +++---
 winsup/cygwin/include/limits.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/limits.h b/newlib/libc/include/limits.h
index 190f1f7..dd09c1c 100644
--- a/newlib/libc/include/limits.h
+++ b/newlib/libc/include/limits.h
@@ -2,6 +2,7 @@
 # define _LIBC_LIMITS_H_   1
 
 #include 
+#include 
 
 # ifdef _MB_LEN_MAX
 #  define MB_LEN_MAX   _MB_LEN_MAX
@@ -96,8 +97,7 @@
 #define __LONG_LONG_MAX__ 9223372036854775807LL
 #   endif
 
-#   if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||   \
-  (defined(__cplusplus) && __cplusplus >= 201103L)
+#   if __ISO_C_VISIBLE >= 1999
 /* Minimum and maximum values a `signed long long int' can hold.  */
 #undef LLONG_MIN
 #define LLONG_MIN (-LLONG_MAX-1)
@@ -109,7 +109,7 @@
 #define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
 #   endif
 
-#  if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined 
(__STRICT_ANSI__)
+#  if __GNU_VISIBLE
 /* Minimum and maximum values a `signed long long int' can hold.  */
 #undef LONG_LONG_MIN
 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h
index e093d28..c17cd0a 100644
--- a/winsup/cygwin/include/limits.h
+++ b/winsup/cygwin/include/limits.h
@@ -110,7 +110,7 @@ details. */
 #define __LONG_LONG_MAX__ 9223372036854775807LL
 #endif
 
-#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined 
(__STRICT_ANSI__)
+#if __GNU_VISIBLE
 #undef LONG_LONG_MIN
 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
 #undef LONG_LONG_MAX


[newlib-cygwin] Feature test macros overhaul: time.h

2016-03-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=43e5ee83fed23ecaf9826202c9ee6172fb7293d6

commit 43e5ee83fed23ecaf9826202c9ee6172fb7293d6
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 17:23:09 2016 -0500

Feature test macros overhaul: time.h

Throughout, replace __STRICT_ANSI__ with the proper internal macros.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/time.h  | 15 +--
 winsup/cygwin/include/cygwin/time.h |  7 ---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index b9d1f20..698ad61 100644
--- a/newlib/libc/include/time.h
+++ b/newlib/libc/include/time.h
@@ -8,6 +8,7 @@
 #define _TIME_H_
 
 #include "_ansi.h"
+#include 
 #include 
 
 #define __need_size_t
@@ -76,11 +77,14 @@ _END_STD_C
 extern "C" {
 #endif
 
-#ifndef __STRICT_ANSI__
+#if __XSI_VISIBLE
 char  *_EXFUN(strptime, (const char *__restrict,
 const char *__restrict,
 struct tm *__restrict));
+#endif
+#if __POSIX_VISIBLE
 _VOID  _EXFUN(tzset,   (_VOID));
+#endif
 _VOID  _EXFUN(_tzset_r,(struct _reent *));
 
 typedef struct __tzrule_struct
@@ -106,6 +110,7 @@ __tzinfo_type *_EXFUN (__gettzinfo, (_VOID));
 /* getdate functions */
 
 #ifdef HAVE_GETDATE
+#if __XSI_VISIBLE >= 4
 #ifndef _REENT_ONLY
 #define getdate_err (*__getdate_err())
 int *_EXFUN(__getdate_err,(_VOID));
@@ -121,21 +126,27 @@ struct tm *   _EXFUN(getdate, (const char *));
  7  there is no line in the template that matches the input,
  8  invalid input specification  */
 #endif /* !_REENT_ONLY */
+#endif /* __XSI_VISIBLE >= 4 */
 
+#if __GNU_VISIBLE
 /* getdate_r returns the error code as above */
 int_EXFUN(getdate_r, (const char *, struct tm *));
+#endif /* __GNU_VISIBLE */
 #endif /* HAVE_GETDATE */
 
 /* defines for the opengroup specifications Derived from Issue 1 of the SVID.  
*/
+#if __SVID_VISIBLE || __XSI_VISIBLE
 extern __IMPORT long _timezone;
 extern __IMPORT int _daylight;
+#endif
+#if __POSIX_VISIBLE
 extern __IMPORT char *_tzname[2];
 
 /* POSIX defines the external tzname being defined in time.h */
 #ifndef tzname
 #define tzname _tzname
 #endif
-#endif /* !__STRICT_ANSI__ */
+#endif /* __POSIX_VISIBLE */
 
 #ifdef __cplusplus
 }
diff --git a/winsup/cygwin/include/cygwin/time.h 
b/winsup/cygwin/include/cygwin/time.h
index 6a82ae6..1f8a989 100644
--- a/winsup/cygwin/include/cygwin/time.h
+++ b/winsup/cygwin/include/cygwin/time.h
@@ -24,17 +24,18 @@ time_t __cdecl timegm (struct tm *);
 
 #define TIMER_RELTIME  0 /* For compatibility with HP/UX, Solaris, others? */
 
-#ifndef __STRICT_ANSI__
-
+#if __SVID_VISIBLE
 extern int stime (const time_t *);
+#endif
 
+#if __SVID_VISIBLE || __XSI_VISIBLE
 extern int daylight __asm__ (_SYMSTR (_daylight));
 
 #ifndef __timezonefunc__
 extern long timezone __asm__ (_SYMSTR (_timezone));
 #endif
 
-#endif /*__STRICT_ANSI__*/
+#endif /* __SVID_VISIBLE || __XSI_VISIBLE */
 
 #ifdef __cplusplus
 }


[newlib-cygwin] Feature test macros overhaul: stdlib.h

2016-03-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=84ba25226ca8f0bdc60d3c9a5af287ea5ea94301

commit 84ba25226ca8f0bdc60d3c9a5af287ea5ea94301
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 16:55:26 2016 -0500

Feature test macros overhaul: stdlib.h

Throughout, simplify the C99/C11 conditionals, and replace
__STRICT_ANSI__ with the proper internal POSIX macros.  The _*_r
reentrant functions need not be guarded (and most haven't been) because
such names in the global scope are reserved to the implementation.

atoff is unique to newlib.

dtoa is not actually exported (_dtoa_r is used internally), is
nonstandard, and the declaration conflicts with the code included in
MySQL, NSPR, and SpiderMonkey.

mktemp was removed in POSIX.1-2001.

The qsort_r declarations are reordered so that the GNU version retains
precedence.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 newlib/libc/include/stdlib.h  | 98 +++
 newlib/libc/search/qsort_r.c  |  1 +
 newlib/libc/stdlib/efgcvt.c   |  2 +
 winsup/cygwin/include/cygwin/stdlib.h | 24 ++---
 winsup/cygwin/libc/strfmon.c  |  2 +-
 5 files changed, 73 insertions(+), 54 deletions(-)

diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index fd6315b..b0856fa 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -40,9 +40,7 @@ typedef struct
   long rem; /* remainder */
 } ldiv_t;
 
-#if !defined(__STRICT_ANSI__) || \
-  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
-  (defined(__cplusplus) && __cplusplus >= 201103L)
+#if __ISO_C_VISIBLE >= 1999
 typedef struct
 {
   long long int quot; /* quotient */
@@ -68,7 +66,7 @@ _VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((__noreturn__)));
 int_EXFUN(abs,(int));
 int_EXFUN(atexit,(_VOID (*__func)(_VOID)));
 double _EXFUN(atof,(const char *__nptr));
-#ifndef __STRICT_ANSI__
+#if __MISC_VISIBLE
 float  _EXFUN(atoff,(const char *__nptr));
 #endif
 int_EXFUN(atoi,(const char *__nptr));
@@ -88,7 +86,7 @@ char *  _EXFUN(getenv,(const char *__string));
 char * _EXFUN(_getenv_r,(struct _reent *, const char *__string));
 char * _EXFUN(_findenv,(_CONST char *, int *));
 char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *));
-#ifndef __STRICT_ANSI__
+#if __POSIX_VISIBLE >= 200809
 extern char *suboptarg;/* getsubopt(3) external 
variable */
 int_EXFUN(getsubopt,(char **, char * const *, char **));
 #endif
@@ -105,41 +103,51 @@ size_t_EXFUN(mbstowcs,(wchar_t *__restrict, const 
char *__restrict, size_t));
 size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *__restrict, const char 
*__restrict, size_t, _mbstate_t *));
 size_t _EXFUN(wcstombs,(char *__restrict, const wchar_t *__restrict, size_t));
 size_t _EXFUN(_wcstombs_r,(struct _reent *, char *__restrict, const wchar_t 
*__restrict, size_t, _mbstate_t *));
-#ifndef __STRICT_ANSI__
 #ifndef _REENT_ONLY
+#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
 char * _EXFUN(mkdtemp,(char *));
+#endif
+#if __GNU_VISIBLE
 int_EXFUN(mkostemp,(char *, int));
 int_EXFUN(mkostemps,(char *, int, int));
+#endif
+#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4
 int_EXFUN(mkstemp,(char *));
+#endif
+#if __MISC_VISIBLE
 int_EXFUN(mkstemps,(char *, int));
+#endif
+#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112)
 char * _EXFUN(mktemp,(char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' 
is dangerous; use `mkstemp' instead";
 #endif
+#endif /* !_REENT_ONLY */
 char * _EXFUN(_mkdtemp_r, (struct _reent *, char *));
 int_EXFUN(_mkostemp_r, (struct _reent *, char *, int));
 int_EXFUN(_mkostemps_r, (struct _reent *, char *, int, int));
 int_EXFUN(_mkstemp_r, (struct _reent *, char *));
 int_EXFUN(_mkstemps_r, (struct _reent *, char *, int));
 char * _EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE 
((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead";
-#endif
 _VOID  _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, __compar_fn_t 
_compar));
 int_EXFUN(rand,(_VOID));
 _PTR   _EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size));
-#ifndef __STRICT_ANSI__
+#if __BSD_VISIBLE
 _PTR   _EXFUN(reallocf,(_PTR __r, size_t __size));
+#endif
+#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
 char * _EXFUN(realpath, (const char *__restrict path, char *__restrict 
resolved_path));
+#endif
+#if __BSD_VISIBLE
 int_EXFUN(rpmatch, (const char *response));
 #endif
 _VOID  _EXFUN(srand,(unsigned __seed));
 double _EXFUN(strtod,(const char *__restrict __n, char **__restrict 
__end_PTR));
 double _EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char 
**__restrict __end_PTR));
-#if !defined(__STRICT_ANSI__) || \
-  (defined(__STDC_V

[newlib-cygwin] Cygwin: define byteswap.h inlines as macros

2016-03-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=00d2fe19591e3e8ad58157de90adbfc29d5cc5dc

commit 00d2fe19591e3e8ad58157de90adbfc29d5cc5dc
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 22:11:20 2016 -0500

Cygwin: define byteswap.h inlines as macros

The bswap_* "functions" are macros in glibc, so they may be tested for
by the preprocessor (e.g. #ifdef bswap_16).

    Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/byteswap.h | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/include/byteswap.h b/winsup/cygwin/include/byteswap.h
index cd5a726..9f73c5a 100644
--- a/winsup/cygwin/include/byteswap.h
+++ b/winsup/cygwin/include/byteswap.h
@@ -16,23 +16,27 @@ extern "C" {
 #endif
 
 static __inline unsigned short
-bswap_16 (unsigned short __x)
+__bswap_16 (unsigned short __x)
 {
   return (__x >> 8) | (__x << 8);
 }
 
 static __inline unsigned int
-bswap_32 (unsigned int __x)
+__bswap_32 (unsigned int __x)
 {
-  return (bswap_16 (__x & 0x) << 16) | (bswap_16 (__x >> 16));
+  return (__bswap_16 (__x & 0x) << 16) | (__bswap_16 (__x >> 16));
 }
 
 static __inline unsigned long long
-bswap_64 (unsigned long long __x)
+__bswap_64 (unsigned long long __x)
 {
-  return (((unsigned long long) bswap_32 (__x & 0xull)) << 32) | 
(bswap_32 (__x >> 32));
+  return (((unsigned long long) __bswap_32 (__x & 0xull)) << 32) | 
(__bswap_32 (__x >> 32));
 }
 
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
 #ifdef __cplusplus
 }
 #endif


[newlib-cygwin] Feature test macros overhaul: Cygwin headers

2016-03-19 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3237fb31b3178f7e42d6c1c0aca9ae622c8be6d1

commit 3237fb31b3178f7e42d6c1c0aca9ae622c8be6d1
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Mon Mar 14 21:24:29 2016 -0500

Feature test macros overhaul: Cygwin headers

Use proper internal macros for BSD and GNU.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/endian.h | 5 +++--
 winsup/cygwin/include/fenv.h   | 6 --
 winsup/cygwin/include/glob.h   | 4 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/include/endian.h b/winsup/cygwin/include/endian.h
index d59d2c8..960e61c 100644
--- a/winsup/cygwin/include/endian.h
+++ b/winsup/cygwin/include/endian.h
@@ -12,6 +12,7 @@ details. */
 #define _ENDIAN_H_
 
 #include 
+#include 
 #include 
 
 /*#ifdef  __USE_BSD*/
@@ -27,7 +28,7 @@ details. */
 # define __LONG_LONG_PAIR(HI, LO) HI, LO
 #endif
 
-#if /*defined __USE_BSD ||*/ ! defined _POSIX_SOURCE
+#if __BSD_VISIBLE
 
 #include 
 
@@ -71,7 +72,7 @@ details. */
 
 #endif /*__BYTE_ORDER == __BIG_ENDIAN*/
 
-#endif /*__USE_BSD || !_POSIX_SOURCE*/
+#endif /*__BSD_VISIBLE*/
 
 #endif /*_ENDIAN_H_*/
 
diff --git a/winsup/cygwin/include/fenv.h b/winsup/cygwin/include/fenv.h
index b49033f..4976913 100644
--- a/winsup/cygwin/include/fenv.h
+++ b/winsup/cygwin/include/fenv.h
@@ -11,6 +11,8 @@ details. */
 #ifndef _FENV_H_
 #define _FENV_H_
 
+#include 
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -133,14 +135,14 @@ extern const fenv_t *_fe_dfl_env;
type "pointer to const-qualified fenv_t",may also be specified by
the implementation.  */
 
-#ifdef _GNU_SOURCE
+#if __GNU_VISIBLE
 /*  If possible, the GNU C Library defines a macro FE_NOMASK_ENV which
represents an environment where every exception raised causes a trap
to occur. You can test for this macro using #ifdef. It is only defined
if _GNU_SOURCE is defined.  */
 extern const fenv_t *_fe_nomask_env;
 #define FE_NOMASK_ENV (_fe_nomask_env)
-#endif /* _GNU_SOURCE */
+#endif /* __GNU_VISIBLE */
 
 
 /*  The following shall be declared as functions and may also be
diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h
index 5f1b420..0376cc3 100644
--- a/winsup/cygwin/include/glob.h
+++ b/winsup/cygwin/include/glob.h
@@ -80,7 +80,7 @@ typedef struct {
 #defineGLOB_NOMATCH(-3)/* No match and GLOB_NOCHECK was not 
set. */
 #defineGLOB_NOSYS  (-4)/* Obsolete: source comptability only. 
*/
 
-#ifndef _POSIX_SOURCE
+#if __GNU_VISIBLE
 #defineGLOB_ALTDIRFUNC 0x0040  /* Use alternately specified directory 
funcs. */
 #defineGLOB_BRACE  0x0080  /* Expand braces ala csh. */
 #defineGLOB_MAGCHAR0x0100  /* Pattern had globbing characters. */
@@ -92,7 +92,7 @@ typedef struct {
 /* source compatibility, these are the old names */
 #define GLOB_MAXPATH   GLOB_LIMIT
 #defineGLOB_ABEND  GLOB_ABORTED
-#endif /* __BSD_VISIBLE */
+#endif /* __GNU_VISIBLE */
 
 __BEGIN_DECLS


[newlib-cygwin] cygwin: Export clog10, clog10f

2016-02-22 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8b1ede3ce11d53292036aadfcfb6043df0235f9c

commit 8b1ede3ce11d53292036aadfcfb6043df0235f9c
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Thu Feb 18 10:51:01 2016 -0600

cygwin: Export clog10, clog10f

winsup/cygwin/
* common.din: Add clog10, clog10f.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

winsup/doc/
* new-features.xml (ov-new2.5): Mention clog10, clog10f.
* posix.xml (std-gnu): Add clog10, clog10f.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/common.din   | 2 ++
 winsup/cygwin/include/cygwin/version.h | 3 ++-
 winsup/doc/new-features.xml| 4 
 winsup/doc/posix.xml   | 2 ++
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 9584d09..c39d265 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -232,6 +232,8 @@ clock_nanosleep SIGFE
 clock_setres SIGFE
 clock_settime SIGFE
 clog NOSIGFE
+clog10 NOSIGFE
+clog10f NOSIGFE
 clogf NOSIGFE
 close SIGFE
 closedir SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index 067a5f1..be85ce1 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -475,13 +475,14 @@ details. */
   291: Export aligned_alloc, at_quick_exit, quick_exit.
   292: Export rpmatch.
   293: Convert utmpname/utmpxname to int.
+  294: Export clog10, clog10f.
  */
 
  /* Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 293
+#define CYGWIN_VERSION_API_MINOR 294
 
  /* There is also a compatibity version number associated with the
shared memory regions.  It is incremented when incompatible
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index d78dcce..8f7a6ab 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -24,6 +24,10 @@ SYSTEM like a trivial ACL.
 Bump POSIX option macros to POSIX.1-2008.
 
 
+
+New APIs: clog10, clog10f.
+
+
 
 
 
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 51a1df7..f065714 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1151,6 +1151,8 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 asprintf_r
 basename   (see chapter "Implementation Notes")
 canonicalize_file_name
+clog10
+clog10f
 dremf
 dup3
 envz_add


[newlib-cygwin] cygwin: accept SIGIOT as alias of SIGABRT

2016-02-18 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7503575f1d098e43901836c51426f508e589f867

commit 7503575f1d098e43901836c51426f508e589f867
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Wed Feb 17 23:13:32 2016 -0600

cygwin: accept SIGIOT as alias of SIGABRT

winsup/cygwin/
* include/cygwin/signal.h (SIGIOT): Define SIGIOT in terms of SIGABRT.
* strsig.cc (struct sigdesc): Ditto.

winsup/doc/
* utils.xml (kill): Document SIGIOT.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/include/cygwin/signal.h | 1 +
 winsup/cygwin/strsig.cc   | 3 ++-
 winsup/doc/utils.xml  | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/include/cygwin/signal.h 
b/winsup/cygwin/include/cygwin/signal.h
index 04ddb69..e876dec 100644
--- a/winsup/cygwin/include/cygwin/signal.h
+++ b/winsup/cygwin/include/cygwin/signal.h
@@ -358,6 +358,7 @@ struct sigaction
 #defineSIGILL  4   /* illegal instruction (not reset when caught) 
*/
 #defineSIGTRAP 5   /* trace trap (not reset when caught) */
 #defineSIGABRT 6   /* used by abort */
+#defineSIGIOT  SIGABRT /* synonym for SIGABRT on most systems */
 #defineSIGEMT  7   /* EMT instruction */
 #defineSIGFPE  8   /* floating point exception */
 #defineSIGKILL 9   /* kill (cannot be caught or ignored) */
diff --git a/winsup/cygwin/strsig.cc b/winsup/cygwin/strsig.cc
index 987e135..bb53e1b 100644
--- a/winsup/cygwin/strsig.cc
+++ b/winsup/cygwin/strsig.cc
@@ -26,7 +26,8 @@ struct sigdesc
   _s(SIGQUIT, "Quit"), /*  3 */ \
   _s(SIGILL, "Illegal instruction"),   /*  4 */ \
   _s(SIGTRAP, "Trace/breakpoint trap"),/*  5 */ \
-  _s(SIGABRT, "Aborted"),  /*  6 */ \
+  _s2(SIGABRT, "Aborted",  /*  6 */ \
+  SIGIOT, "Aborted"),   \
   _s(SIGEMT, "EMT instruction"),   /*  7 */ \
   _s(SIGFPE, "Floating point exception"),  /*  8 */ \
   _s(SIGKILL, "Killed"),   /*  9 */ \
diff --git a/winsup/doc/utils.xml b/winsup/doc/utils.xml
index a00384e..501d248 100644
--- a/winsup/doc/utils.xml
+++ b/winsup/doc/utils.xml
@@ -741,6 +741,7 @@ SIGQUIT  3quit
 SIGILL   4illegal instruction (not reset when caught)
 SIGTRAP  5trace trap (not reset when caught)
 SIGABRT  6used by abort
+SIGIOT   6another name for SIGABRT
 SIGEMT   7EMT instruction
 SIGFPE   8floating point exception
 SIGKILL  9kill (cannot be caught or ignored)


[newlib-cygwin] cygwin: export rpmatch(3)

2015-11-18 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ed8beb536181cfa7bf6e74cbe0dd078d1b8df07c

commit ed8beb536181cfa7bf6e74cbe0dd078d1b8df07c
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Tue Nov 17 12:23:33 2015 -0600

cygwin: export rpmatch(3)

winsup/cygwin/
* common.din (rpmatch): Export.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.

winsup/doc/
* new-features.xml (ov-new2.4): New section. Document rpmatch.
* posix.xml (std-bsd): Add rpmatch.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/cygwin/ChangeLog|  5 +
 winsup/cygwin/common.din   |  1 +
 winsup/cygwin/include/cygwin/version.h |  3 ++-
 winsup/doc/ChangeLog   |  5 +
 winsup/doc/new-features.xml| 12 
 winsup/doc/posix.xml   |  1 +
 6 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index bdaab40..1bab25c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-17  Yaakov Selkowitz  <yselk...@redhat.com>
+
+   * common.din (rpmatch): Export.
+   * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
+
 2015-11-12  Corinna Vinschen  <cori...@vinschen.de>
 
* flock.cc (lockf_t::create_lock_obj): Correctly recreate lock object
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 5d22e97..0b0e196 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1017,6 +1017,7 @@ rindex NOSIGFE
 rmdir SIGFE
 round NOSIGFE
 roundf NOSIGFE
+rpmatch SIGFE
 rresvport = cygwin_rresvport SIGFE
 rresvport_af = cygwin_rresvport_af SIGFE
 ruserok SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h 
b/winsup/cygwin/include/cygwin/version.h
index af5afd5..2edd7d7 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -473,13 +473,14 @@ details. */
   289: Export sigsetjmp, siglongjmp.
   290: Add sysconf cache handling.
   291: Export aligned_alloc, at_quick_exit, quick_exit.
+  292: Export rpmatch.
  */
 
  /* Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 291
+#define CYGWIN_VERSION_API_MINOR 292
 
  /* There is also a compatibity version number associated with the
shared memory regions.  It is incremented when incompatible
diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index 14dd387..df8c641 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-17  Yaakov Selkowitz  <yselk...@redhat.com>
+
+   * new-features.xml (ov-new2.4): New section. Document rpmatch.
+   * posix.xml (std-bsd): Add rpmatch.
+
 2015-11-02  Corinna Vinschen  <cori...@vinschen.de>
 
* new-features.xml (ov-new2.3): Document Parallels Desktop FS support.
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 88eb25c..e054a8e 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -4,6 +4,18 @@
 
 What's new and what changed in Cygwin
 
+What's new and what changed in 2.4
+
+
+
+
+New API: rpmatch.
+
+
+
+
+
+
 What's new and what changed in 2.3
 
 
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index dc6c148..7b6efba 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1086,6 +1086,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).
 res_send
 revoke
 rexec
+rpmatch
 rresvport
 rresvport_af
 ruserok


[newlib-cygwin] winsup/utils: add CPU cache variables to getconf(1)

2015-10-22 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=505812d04283d9276bb462683bbfaf52b241ac05

commit 505812d04283d9276bb462683bbfaf52b241ac05
Author: Yaakov Selkowitz <yselk...@redhat.com>
Date:   Thu Oct 22 12:33:37 2015 -0500

winsup/utils: add CPU cache variables to getconf(1)

* getconf.c (conf_table): Add LEVEL*_CACHE_* variables.

Signed-off-by: Yaakov Selkowitz <yselk...@redhat.com>

Diff:
---
 winsup/utils/ChangeLog |  4 
 winsup/utils/getconf.c | 15 +++
 2 files changed, 19 insertions(+)

diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 66bfcb0..ac6eb98 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-22  Yaakov Selkowitz  <yselk...@redhat.com>
+
+   * getconf.c (conf_table): Add LEVEL*_CACHE_* variables.
+
 2015-08-30  Corinna Vinschen  <cori...@vinschen.de>
 
* cygcheck.cc (dump_sysinfo): Fix missing commas in products array.
diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c
index 7e0b5f5..8732be1 100644
--- a/winsup/utils/getconf.c
+++ b/winsup/utils/getconf.c
@@ -357,6 +357,21 @@ static const struct conf_variable conf_table[] =
   { "POSIX2_UPE",  SYSCONF,_SC_2_UPE   
},
   { "POSIX2_VERSION",  SYSCONF,_SC_2_VERSION   
},
   /* implementation-specific values */
+  { "LEVEL1_ICACHE_SIZE",  SYSCONF,_SC_LEVEL1_ICACHE_SIZE  
},
+  { "LEVEL1_ICACHE_ASSOC", SYSCONF,_SC_LEVEL1_ICACHE_ASSOC 
},
+  { "LEVEL1_ICACHE_LINESIZE",  SYSCONF,
_SC_LEVEL1_ICACHE_LINESIZE  },
+  { "LEVEL1_DCACHE_SIZE",  SYSCONF,_SC_LEVEL1_DCACHE_SIZE  
},
+  { "LEVEL1_DCACHE_ASSOC", SYSCONF,_SC_LEVEL1_DCACHE_ASSOC 
},
+  { "LEVEL1_DCACHE_LINESIZE",  SYSCONF,
_SC_LEVEL1_DCACHE_LINESIZE  },
+  { "LEVEL2_CACHE_SIZE",   SYSCONF,_SC_LEVEL2_CACHE_SIZE   
},
+  { "LEVEL2_CACHE_ASSOC",  SYSCONF,_SC_LEVEL2_CACHE_ASSOC  
},
+  { "LEVEL2_CACHE_LINESIZE",   SYSCONF,
_SC_LEVEL2_CACHE_LINESIZE   },
+  { "LEVEL3_CACHE_SIZE",   SYSCONF,_SC_LEVEL3_CACHE_SIZE   
},
+  { "LEVEL3_CACHE_ASSOC",  SYSCONF,_SC_LEVEL3_CACHE_ASSOC  
},
+  { "LEVEL3_CACHE_LINESIZE",   SYSCONF,
_SC_LEVEL3_CACHE_LINESIZE   },
+  { "LEVEL4_CACHE_SIZE",   SYSCONF,_SC_LEVEL4_CACHE_SIZE   
},
+  { "LEVEL4_CACHE_ASSOC",  SYSCONF,_SC_LEVEL4_CACHE_ASSOC  
},
+  { "LEVEL4_CACHE_LINESIZE",   SYSCONF,
_SC_LEVEL4_CACHE_LINESIZE   },
   { "_NPROCESSORS_CONF",   SYSCONF,_SC_NPROCESSORS_CONF
},
   { "_NPROCESSORS_ONLN",   SYSCONF,_SC_NPROCESSORS_ONLN
},
   { "_AVPHYS_PAGES",   SYSCONF,_SC_AVPHYS_PAGES
},


[newlib-cygwin] winsup/cygwin: rework basename redefinition handling in path.cc

2015-07-06 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c9b37162799ebbfadd5d4ffba11aa9a44c4d9853

commit c9b37162799ebbfadd5d4ffba11aa9a44c4d9853
Author: Yaakov Selkowitz yselk...@redhat.com
Date:   Mon Jul 6 15:17:17 2015 -0500

winsup/cygwin: rework basename redefinition handling in path.cc

This fixes the compile after commit 
79e419de6261c4e04785908828096cb4d56b8680.

* path.cc: Rework basename redefinition handling.  Explain why.

Diff:
---
 winsup/cygwin/ChangeLog |  4 
 winsup/cygwin/path.cc   | 10 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 58b75e2..13d6fe7 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-06  Yaakov Selkowitz  yselk...@redhat.com
+
+   * path.cc: Rework basename redefinition handling.  Explain why.
+
 2015-07-05  Corinna Vinschen  cori...@vinschen.de
 
* dcrt0.cc (CYGWIN_GUARD): Remove.
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 446d746..89dbdab 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -48,7 +48,12 @@
  c: means c:\.
   */
 
-#define _BASENAME_DEFINED
+/* This file includes both the XPG and GNU basename functions, with the
+   former exported as basename for ABI compatibility but the latter
+   declared as such for source compatibility with glibc.  This tells
+   string.h not to declare the GNU variant in order to prevent a conflicting
+   declaration error with the XPG variant implemented herein. */
+#define basename basename
 #include winsup.h
 #include miscfuncs.h
 #include ctype.h
@@ -70,6 +75,7 @@
 #include ntdll.h
 #include wchar.h
 #include wctype.h
+#undef basename
 
 suffix_info stat_suffixes[] =
 {
@@ -4739,8 +4745,6 @@ out:
   return buf;
 }
 
-#undef basename
-
 /* No need to be reentrant or thread-safe according to SUSv3.
/ and \\ are treated equally.  Leading drive specifiers are
kept intact as far as it makes sense.  Everything else is


[newlib-cygwin/cygwin-2.0] Fix more typos in ntsec.xml

2015-04-29 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=37ab32da30a8bed7339fb1e9968bae53390a4622

commit 37ab32da30a8bed7339fb1e9968bae53390a4622
Author: Yaakov Selkowitz yselk...@redhat.com
Date:   Wed Apr 29 11:20:21 2015 -0500

Fix more typos in ntsec.xml

Signed-off-by: Yaakov Selkowitz yselk...@redhat.com

Diff:
---
 winsup/doc/ntsec.xml | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/winsup/doc/ntsec.xml b/winsup/doc/ntsec.xml
index b731cd0..d982867 100644
--- a/winsup/doc/ntsec.xml
+++ b/winsup/doc/ntsec.xml
@@ -863,7 +863,7 @@ the old information.
 para
 So, what settings can we perform with filename/etc/nsswitch.conf/filename?
 Let's start with an example filename/etc/nsswitch.conf/filename file
-file set up to all default values:
+set up to all default values:
 /para
 
 screen
@@ -1749,7 +1749,7 @@ The literalunix/literal schema utilizes the
 literalposixAccount/literal attribute extension.  This is one of two
 schema extensions which are connected to AD accounts, available by default
 starting with Windows Server 2003 R2.  They are usually
-literalnot set/literal, unless used by the Active Directory
+emphasis role='bold'not set/emphasis, unless used by the Active Directory
 literalServer for NIS/literal feature (deprecated since Server 2012 R2).
 
 Two schemata are interesting for Cygwin, literalposixAccount/literal,
@@ -2031,7 +2031,7 @@ by child processes.
 
 para
 A fully set up Samba file server with domain integration is running winbindd to
-map Window SIDs to artificially created UNIX uids and gids, and this mapping is
+map Windows SIDs to artificially created UNIX uids and gids, and this mapping 
is
 transparent within the domain, so Cygwin doesn't have to do anything special.
 /para
 
@@ -2134,7 +2134,7 @@ met.  Later ACEs are not taken into 
account./para/listitem
 
 listitemparaAll access denied ACEs emphasis
 role='bold'should/emphasis precede any access allowed ACE.  ACLs
-following this rule are called canonical/para/listitem
+following this rule are called canonical./para/listitem
 /itemizedlist
 
 paraNote that the last rule is a preference or a definition of


[newlib-cygwin] cygwin: fix __x86_64__ conditional in stdint.h

2015-03-10 Thread Yaakov Selkowitz
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2a6db5083cae9c7f54a72b693bc9e7984d513483

commit 2a6db5083cae9c7f54a72b693bc9e7984d513483
Author: Yaakov Selkowitz yselk...@redhat.com
Date:   Tue Mar 10 10:44:47 2015 -0500

cygwin: fix __x86_64__ conditional in stdint.h

Signed-off-by: Yaakov Selkowitz yselk...@redhat.com

Diff:
---
 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
@@ -1,3 +1,7 @@
+2015-03-10  Yaakov Selkowitz  yselkow...@cygwin.com
+
+   * include/stdint.h: Fix __x86_64__ conditional.
+
 2015-03-05  Corinna Vinschen  cori...@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
@@ -114,7 +114,7 @@ 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
 #else