This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Open Mode translation
- To: newlib <newlib at sources dot redhat dot com>
- Subject: Open Mode translation
- From: Prasad Venkata Boddupalli <bprasad at CS dot Arizona dot EDU>
- Date: Tue, 5 Jun 2001 00:32:56 -0700 (MST)
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.