cygwin-devel vs libbsd-devel: arc4random_stir() macro in stdlib.h breaks bsd/stdlib.h

Christian Franke Christian.Franke@t-online.de
Fri Mar 14 12:48:08 GMT 2025


Corinna Vinschen via Cygwin wrote:
> On Mar 13 08:59, Christian Franke via Cygwin wrote:
>> Problem introduced in a8891c93:
>>
>> $ cygcheck -f /usr/include/stdlib.h
>> cygwin-devel-3.6.0-0.430.ga942476236b5
>>
>> $ cygcheck -f /usr/include/bsd/stdlib.h
>> libbsd-devel-0.12.2-2
>>
>> $ gcc -c -xc - <<<'#include <bsd/stdlib.h>'
>> In file included from <stdin>:1:
>> /usr/include/bsd/stdlib.h:62:26: error: macro "arc4random_stir" passed 1
>> arguments, but takes just 0
>>     62 | void arc4random_stir(void);
>>        |                          ^
>> In file included from /usr/include/stdlib.h:26,
>>                   from /usr/include/bsd/stdlib.h:32:
>> /usr/include/cygwin/stdlib.h:26: note: macro "arc4random_stir" defined here
>>     26 | #define arc4random_stir()
> Should work again with cygwin-3.6.0-0.431.gad29c33229e5
>

This fixes the problem, thanks.

There are possibly still inconsistencies:

$ gcc -E -xc - <<<'#include <stdlib.h>' | grep arc4random_stir
void arc4random_stir(void);

$ gcc -E -xc - <<<'#include <bsd/stdlib.h>' | grep arc4random_stir
void arc4random_stir(void); // from cygwin/stdlib.h
void arc4random_stir(void); // from bsd/stdlib.h

$ gcc -E -xc - <<<'#include <stdlib.h>' | grep arc4random_addrandom

$ gcc -E -xc - <<<'#include <bsd/stdlib.h>' | grep arc4random_addrandom
void arc4random_addrandom(unsigned char *dat, int datlen);

$ gcc -E -xc - <<<'#include <bsd/stdlib.h>' | grep arc4random_buf
void arc4random_buf (void *, size_t); // from stdlib.h
void arc4random_buf(void *_buf, size_t n); // from bsd/stdlib.h

$ nm /usr/lib/libcygwin.a | grep ' arc4random'
0000000000000000 T arc4random
0000000000000000 T arc4random_addrandom
0000000000000000 T arc4random_buf
0000000000000000 T arc4random_stir
0000000000000000 T arc4random_uniform

$ nm /usr/lib/libbsd.dll.a | grep ' arc4random' || echo not found
not found

I guess:
- arc4random_addrandom() should be removed from libcygwin.a or added to 
cygwin/stdlib.h.
- all arc4random*() should be hidden for __CYGWIN__ in bsd/stdlib.h.

-- 
Regards,
Christian



More information about the Cygwin mailing list