Open Mode translation

Prasad Venkata Boddupalli bprasad@CS.Arizona.EDU
Tue Jun 5 00:32:00 GMT 2001


Hi,
    In the gdb arm emulator, the open mode value obtained from the binary
(compiled using newlib) is translated to another number using,

static int translate_open_mode[] =
{
  O_RDONLY,                          /* "r"   */
  O_RDONLY+O_BINARY,                 /* "rb"  */
  O_RDWR,                            /* "r+"  */
  O_RDWR  +O_BINARY,                 /* "r+b" */
  O_WRONLY         +O_CREAT+O_TRUNC, /* "w"   */
  O_WRONLY+O_BINARY+O_CREAT+O_TRUNC, /* "wb"  */
  O_RDWR           +O_CREAT+O_TRUNC, /* "w+"  */
  O_RDWR  +O_BINARY+O_CREAT+O_TRUNC, /* "w+b" */
  O_WRONLY         +O_APPEND+O_CREAT,/* "a"   */
  O_WRONLY+O_BINARY+O_APPEND+O_CREAT,/* "ab"  */
  O_RDWR           +O_APPEND+O_CREAT,/* "a+"  */
  O_RDWR  +O_BINARY+O_APPEND+O_CREAT /* "a+b" */
};

Can someone please write as what exactly is going on ? Why this mapping ?

thanks,
Prasad.






More information about the Newlib mailing list