[ANNOUNCEMENT] cygwin 3.1.0-0.4 (TEST)

Mark Geisert mark@maxrnd.com
Fri Sep 13 22:14:00 GMT 2019


Michael Haubenwallner wrote:
> On 9/5/19 3:16 PM, Ken Brown wrote:
>> The following packages have been uploaded to the Cygwin distribution
>> as test releases:
>>
>> * cygwin-3.1.0-0.4
>> * cygwin-devel-3.1.0-0.4
>> * cygwin-doc-3.1.0-0.4
> 
>> - New APIs: sched_getaffinity, sched_setaffinity, pthread_getaffinity_np,
>>    pthread_setaffinity_np, plus CPU_SET macros.
> 
> There's some problem with <sched.h>, seen with boost-1.71.0/bootstrap.sh,
> even after tweaking their sysinfo.cpp like this to include <sched.h>:
> 
> -#if defined(OS_LINUX)
> +#if defined(OS_LINUX) || defined(OS_CYGWIN)
> 
> This boils down to a test case like this that succeeds to *compile* on Linux,
> although requires _GNU_SOURCE to be defined earlier to perform anything useful:
> 
> $ cat > test.cc <<'EOF'
> #ifdef LIKE_BOOST
> # include <pthread.h>
> # define _GNU_SOURCE
> #endif
> #include <sched.h>
> int main()
> {
> #if defined(CPU_COUNT_S)
>    ::cpu_set_t cpu_set;
>    if (::sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set) == 0)
>      {
>        return CPU_COUNT_S(sizeof(cpu_set_t), &cpu_set);
>      }
> #endif
>    return 0;
> }
> EOF
> 
> Both these commands fail to compile on Cygwin with identical error:
> $ g++ test.c -DLIKE_BOOST
> $ g++ test.c
> test.c: In function ‘main’:
> test.c:10:7: warning: implicit declaration of function ‘sched_getaffinity’; did you mean ‘sched_getparam’? [-Wimplicit-function-declaration]
>     if (sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set) == 0)
>         ^~~~~~~~~~~~~~~~~
>         sched_getparam
> 
> Actually it is boost's fault to include <pthread.h> before defining _GNU_SOURCE,
> but it feels like Cygwin should *not* define CPU_COUNT_S without _GNU_SOURCE.
> 
> Thoughts?
> /haubi/
> 
> PS: This does work as expected:
> $ g++ test.c -D_GNU_SOURCE

Thanks for the problem report.  Blame me for this one.  I believe your last 
suggestion is the correct fix but I want to double-check something additional. 
Shortly I'll submit a patch to correct this one way or another.

..mark

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list