This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


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

Open Mode translation


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.





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