This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: poll.h and polling stuff???


tsmith@megaroms.co.uk wrote:
> 
> [i'm still very new to ecos]
> 
> to add poll() i think i need to
> a) alter the cdl for the fileio package to compile poll.cxx
> b) write poll.cxx in the same directory as select.cxx

It may be easier just to add poll() to select.cxx. From what I remember
when poll() is available, select() is normally implemented in terms of
poll(). So the current select() would be modified to be poll(), and you
would add a new select() that wraps it. Probably :-).
 
> How do i get a poll.h file to appear in my ecos build? fileio.h doesn't look like the place to add stuff.

The isoinfra package is intended to manage "top level" header files. The
net stack is an exception because that's imported code. Instead what would
happen is that isoinfra would have a poll.h that probably includes a header
fragment from the actual implementation in fileio.... or possibly just
provides a sensible default if there's an implementation. For example
isoinfra's poll.h could include:

#if CYGINT_ISO_POLL
# ifdef CYGBLD_ISO_POLL_HEADER
#  include  CYGBLD_ISO_POLL_HEADER
# else

struct pollfd {
  int fd;
  short events;
  short revents;
};

typedef unsigned int nfds_t;

#define POLLIN       0x01 
#define POLLRDNORM   0x02
#define POLLRDBAND   0x04
#define POLLPRI      0x08
#define POLLOUT      0x10
#define POLLWRNORM   POLLOUT
#define POLLWRBAND   0x20
#define POLLERR      0x40
#define POLLHUP      0x80
#define POLLNVAL     0x100

#ifdef __cplusplus
extern "C" {
#endif

extern int
poll( struct pollfd /* fds */ [], nfds_t /* nfds */, int /* timeout */ );

#ifdef __cplusplus
} /* extern "C" */
#endif 

# endif
#endif

You can probably just cut and paste the above.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]