public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/4] Various fixes for 2.5.0
@ 2016-04-01 22:53 Yaakov Selkowitz
  2016-04-01 23:40 ` [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h Yaakov Selkowitz
  2016-04-04 14:35 ` [PATCH 0/4] Various fixes for 2.5.0 Corinna Vinschen
  0 siblings, 2 replies; 6+ messages in thread
From: Yaakov Selkowitz @ 2016-04-01 22:53 UTC (permalink / raw)
  To: cygwin-patches

An assortment of unrelated patches discovered in the process of rebuilding
GCC with 2.5.0-0.10.

Yaakov Selkowitz (4):
  Feature test macros overhaul: Cygwin pthread.h
  cygwin/math: make isinf functions signed
  cygwin: update sysconf for new features
  winsup/utils: port getconf to 64-bit

 winsup/cygwin/include/pthread.h | 29 +++++++++++++++++++++--------
 winsup/cygwin/math/isinf.c      |  6 +++---
 winsup/cygwin/sysconf.cc        |  6 +++---
 winsup/utils/getconf.c          | 35 +++++++++++++++++++++++------------
 4 files changed, 50 insertions(+), 26 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h
  2016-04-01 22:53 [PATCH 0/4] Various fixes for 2.5.0 Yaakov Selkowitz
@ 2016-04-01 23:40 ` Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 2/4] cygwin/math: make isinf functions signed Yaakov Selkowitz
                     ` (2 more replies)
  2016-04-04 14:35 ` [PATCH 0/4] Various fixes for 2.5.0 Corinna Vinschen
  1 sibling, 3 replies; 6+ messages in thread
From: Yaakov Selkowitz @ 2016-04-01 23:40 UTC (permalink / raw)
  To: cygwin-patches

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 <yselkowi@redhat.com>
---
 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_testcancel (void);
 
 /* Non posix calls */
 
+#if __GNU_VISIBLE
 int pthread_getattr_np (pthread_t, pthread_attr_t *);
 int pthread_sigqueue (pthread_t *, int, const union sigval);
+int pthread_yield (void);
+#endif
+#if __MISC_VISIBLE /* HP-UX, others? */
 int pthread_suspend (pthread_t);
 int pthread_continue (pthread_t);
-int pthread_yield (void);
+#endif
 
 #ifdef __cplusplus
 }
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] winsup/utils: port getconf to 64-bit
  2016-04-01 23:40 ` [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 2/4] cygwin/math: make isinf functions signed Yaakov Selkowitz
@ 2016-04-01 23:40   ` Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 3/4] cygwin: update sysconf for new features Yaakov Selkowitz
  2 siblings, 0 replies; 6+ messages in thread
From: Yaakov Selkowitz @ 2016-04-01 23:40 UTC (permalink / raw)
  To: cygwin-patches

The available specifications obviously differ on 32-bit and 64-bit, as
already handled in <sys/features.h>.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
 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 */
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] cygwin/math: make isinf functions signed
  2016-04-01 23:40 ` [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h Yaakov Selkowitz
@ 2016-04-01 23:40   ` Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 4/4] winsup/utils: port getconf to 64-bit Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 3/4] cygwin: update sysconf for new features Yaakov Selkowitz
  2 siblings, 0 replies; 6+ messages in thread
From: Yaakov Selkowitz @ 2016-04-01 23:40 UTC (permalink / raw)
  To: cygwin-patches

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 <yselkowi@redhat.com>
---
 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);
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] cygwin: update sysconf for new features
  2016-04-01 23:40 ` [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 2/4] cygwin/math: make isinf functions signed Yaakov Selkowitz
  2016-04-01 23:40   ` [PATCH 4/4] winsup/utils: port getconf to 64-bit Yaakov Selkowitz
@ 2016-04-01 23:40   ` Yaakov Selkowitz
  2 siblings, 0 replies; 6+ messages in thread
From: Yaakov Selkowitz @ 2016-04-01 23:40 UTC (permalink / raw)
  To: cygwin-patches

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 <yselkowi@redhat.com>
---
 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 */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Various fixes for 2.5.0
  2016-04-01 22:53 [PATCH 0/4] Various fixes for 2.5.0 Yaakov Selkowitz
  2016-04-01 23:40 ` [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h Yaakov Selkowitz
@ 2016-04-04 14:35 ` Corinna Vinschen
  1 sibling, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2016-04-04 14:35 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

On Apr  1 17:52, Yaakov Selkowitz wrote:
> An assortment of unrelated patches discovered in the process of rebuilding
> GCC with 2.5.0-0.10.

Ok.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-04 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01 22:53 [PATCH 0/4] Various fixes for 2.5.0 Yaakov Selkowitz
2016-04-01 23:40 ` [PATCH 1/4] Feature test macros overhaul: Cygwin pthread.h Yaakov Selkowitz
2016-04-01 23:40   ` [PATCH 2/4] cygwin/math: make isinf functions signed Yaakov Selkowitz
2016-04-01 23:40   ` [PATCH 4/4] winsup/utils: port getconf to 64-bit Yaakov Selkowitz
2016-04-01 23:40   ` [PATCH 3/4] cygwin: update sysconf for new features Yaakov Selkowitz
2016-04-04 14:35 ` [PATCH 0/4] Various fixes for 2.5.0 Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).