[Patch, libgfortran] Pass mode in "open" for O_CREAT and on VxWorks

Tobias Burnus burnus@net-b.de
Tue May 15 09:03:00 GMT 2012


Dear all,

the motivation for the following is rbmj's patch for libstdc++ on VxWorks,
cf. http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00073.html

Note that gfortan is used on VxWorks as the following email proves:
http://gcc.gnu.org/ml/fortran/2012-02/msg00115.html
(VxWorks is a real-time embedded operating system:
  https://en.wikipedia.org/wiki/VxWorks)


Seemingly, VxWorks differs from POSIX. POSIX [1] has
   int open(const char *path, int oflag, ... );
and requires only with O_CREAT as third argument at mode_t. By contrast,
VxWorks has the following prototype [2]
   int open (const char * name, int flags, int mode)
where "mode" is not optional and the function is not variadic.


This patch does now always passes a mode on VxWorks; I assume that the mode
is ignored if there is no O_CREAT. That part of the code gets only 
accessed if there is no "access" function; looking at [2], that seems to 
be the case for VxWorks.


Additionally, in the fall-back implementation of "mkstemp", "open" with
O_CREAT is used but no mode has been passed. I added 0600 unconditionally.


The patch was build on x86-64-linux, but I only expect an effect on VxWorks
and on systems without mkstemp.
OK for the trunk? (Is there a need for backporting?)

Tobias

[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/open.html
[2] 
http://www-kryo.desy.de/documents/vxWorks/V5.5/vxworks/ref/ioLib.html#open
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vxWorks.diff
Type: text/x-patch
Size: 1371 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120515/d39c704f/attachment.bin>


More information about the Gcc-patches mailing list