Eric Norum eric.norum at
Mon Feb 11 15:05:42 UTC 2002

Pattara Kiatisevi wrote:
> Thank you for fast response. At first, I did use the O_WRONLY flag but I
> couldn't find the definition of O_WRONLY anywhere in the RTEMS source
> (hmm, maybe I missed it somehow) so I happened to see
> #define LIBIO_FLAGS_WRITE         0x0004  /* writing */
> in the libio.h so I tried directly the value of "4" :-p
> So it works now (with O_WRONLY) but I have to define it manually in my
> application code (#define O_WRONLY 1). A better way is possible?
> Regards,
> Pattara

I don't want to deter your initial enthusiasm for using RTEMS, but
before posting to the mailing list you could perhaps try looking for
yourself.  This sort of thing can easily be found with a quick use of
find /opt/rtems/ -name '*.h' -print | xargs grep O_WRONLY
/opt/rtems/m68k-rtems/include/sys/fcntl.h:#define	O_ACCMODE
/opt/rtems/m68k-rtems/include/sys/fcntl.h:#define	O_WRONLY	1    /* +1 ==
/opt/rtems/m68k-rtems/include/sys/fcntl.h:#define _O_WRONLY	O_WRONLY

So, like on any POSIX-compatible system 

#include <fcntl.h> 

is all you need to get the required declarations (since fcntl.h includes
sys/fcntl.h), which are part of the newlib sources.

Eric Norum                                 eric.norum at
Department of Electrical Engineering       Phone: (306) 966-5394
University of Saskatchewan                 FAX:   (306) 966-5407
Saskatoon, Canada.

More information about the users mailing list