[ECOS] #ifdef _POSIX_SOURCE, select.h, fileno, fdopen

Rutger Hofman rutger@cs.vu.nl
Thu Dec 25 09:58:00 GMT 2008

Good evening list,

eCos sys/select.h has an all-developing #if !defined(_POSIX_SOURCE); if 
it is defined, there are no (proto)types for fd_set and friends or select().

If I read the Linux man page, the select types (fd_set) and prototypes 
are defined from Posix in sys/select.h, and from sys/time.h, 
sys/types.h, unistd.h according to earlier standards. So it would seem 
incompatible (at least) that eCos only provides these (proto)types 

On the other hand, Linux stdio.h has conditional prototypes for fileno() 
and fdopen() in stdio.h that depend on a defined _POSIX_SOURCE. eCos has 
no conditions on providing these.

I need to compile my application for both Linux and eCos. Now, if I 
define _POSIX_SOURCE, I have fileno and fdopen under Linux, but no 
select and fd_set under eCos. If I don't define _POSIX_SOURCE, I have 
select and fd_set under eCos but no fileno and fdopen under Linux.

Shouldn't eCos define fd_set and select() (also) if _POSIX_SOURCE? And 
maybe, shouldn't eCos make providing fileno/fdopen depend on #ifdef 


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list