_DARWIN_UNLIMITED_SELECT is defined too late for select()

Scott Kevill scott at GameRanger.com
Mon Jun 25 19:56:56 CEST 2018


Yes, I know OSX is horribly broken, however...

ev.c defines _DARWIN_UNLIMITED_SELECT after including <sys/time.h>, but on the 10.10 OSX SDK (haven't tried any other versions), <sys/time.h> has this line:


#include <sys/_select.h>    /* select() prototype */


And <sys/_select.h> has this (with cruft removed for more clarity):


int  select(int, fd_set * __restrict, fd_set * __restrict,
        fd_set * __restrict, struct timeval * __restrict)
#if defined(_DARWIN_C_SOURCE) || defined(_DARWIN_UNLIMITED_SELECT)
        __DARWIN_EXTSN_C(select)
#else
#  if defined(__LP64__) && !__DARWIN_NON_CANCELABLE
        __DARWIN_1050(select)
#  else
        __DARWIN_ALIAS_C(select)
#  endif
#endif
        ;


libev unmodified:

$ nm -u .libs/libev.a | grep _select
_select$1050

libev with _DARWIN_UNLIMITED_SELECT defined before <sys/time.h>:

$ nm -u .libs/libev.a | grep _select
_select$DARWIN_EXTSN

And I've confirmed this does fix the >1024 EINVAL from select(). Same result is achieved adding the definition to libev's configure course:

./configure CFLAGS=-D_DARWIN_UNLIMITED_SELECT

Cheers,
Scott.
-- 
Scott Kevill
GameRanger Pty Ltd
https://www.GameRanger.com
- play your friends online -




More information about the libev mailing list