[PATCH] Cygwin: fix CPU_SET macro visibility

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Cygwin: fix CPU_SET macro visibility

Mark Geisert
The CPU_SET macros defined in Cygwin's include/sys/cpuset.h must not
be visible in an application's namespace unless _GNU_SOURCE has been
#defined.  Internally this means wrapping them in #if __GNU_VISIBLE.

---
 winsup/cygwin/include/sys/cpuset.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/winsup/cygwin/include/sys/cpuset.h b/winsup/cygwin/include/sys/cpuset.h
index 2056f6af7..1adf48d54 100644
--- a/winsup/cygwin/include/sys/cpuset.h
+++ b/winsup/cygwin/include/sys/cpuset.h
@@ -26,6 +26,7 @@ typedef struct
   __cpu_mask __bits[__CPU_GROUPMAX];
 } cpu_set_t;
 
+#if __GNU_VISIBLE
 int __sched_getaffinity_sys (pid_t, size_t, cpu_set_t *);
 
 /* These macros alloc or free dynamically-sized cpu sets of size 'num' cpus.
@@ -88,6 +89,8 @@ int __sched_getaffinity_sys (pid_t, size_t, cpu_set_t *);
 #define CPU_XOR(dst, src1, src2)  CPU_XOR_S(sizeof (cpu_set_t), dst, src1, src2)
 #define CPU_EQUAL(src1, src2)     CPU_EQUAL_S(sizeof (cpu_set_t), src1, src2)
 
+#endif /* __GNU_VISIBLE */
+
 #ifdef __cplusplus
 }
 #endif
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Cygwin: fix CPU_SET macro visibility

Ken Brown-6
On 9/14/2019 12:58 AM, Mark Geisert wrote:

> The CPU_SET macros defined in Cygwin's include/sys/cpuset.h must not
> be visible in an application's namespace unless _GNU_SOURCE has been
> #defined.  Internally this means wrapping them in #if __GNU_VISIBLE.
>
> ---
>   winsup/cygwin/include/sys/cpuset.h | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/winsup/cygwin/include/sys/cpuset.h b/winsup/cygwin/include/sys/cpuset.h
> index 2056f6af7..1adf48d54 100644
> --- a/winsup/cygwin/include/sys/cpuset.h
> +++ b/winsup/cygwin/include/sys/cpuset.h
> @@ -26,6 +26,7 @@ typedef struct
>     __cpu_mask __bits[__CPU_GROUPMAX];
>   } cpu_set_t;
>  
> +#if __GNU_VISIBLE
>   int __sched_getaffinity_sys (pid_t, size_t, cpu_set_t *);
>  
>   /* These macros alloc or free dynamically-sized cpu sets of size 'num' cpus.
> @@ -88,6 +89,8 @@ int __sched_getaffinity_sys (pid_t, size_t, cpu_set_t *);
>   #define CPU_XOR(dst, src1, src2)  CPU_XOR_S(sizeof (cpu_set_t), dst, src1, src2)
>   #define CPU_EQUAL(src1, src2)     CPU_EQUAL_S(sizeof (cpu_set_t), src1, src2)
>  
> +#endif /* __GNU_VISIBLE */
> +
>   #ifdef __cplusplus
>   }
>   #endif

Pushed.  Thanks.

Ken