[U-Boot] [PATCH v2 7/8] sandbox: Add flags for open() call

Mike Frysinger vapier at gentoo.org
Sun Jan 15 05:44:01 CET 2012


On Saturday 14 January 2012 23:36:40 Simon Glass wrote:
> On Sat, Jan 14, 2012 at 8:19 PM, Mike Frysinger wrote:
> > On Tuesday 10 January 2012 19:45:51 Simon Glass wrote:
> >> +enum {
> >> +     OS_O_RDONLY,
> >> +     OS_O_WRONLY,
> >> +     OS_O_RDWR,
> >> +     OS_O_CREAT      = 0100,
> >> +};
> > 
> > the flags are bit based, so an enum won't work i don't think
> 
> Mostly, but in /usr/include/bits/fcntl.h:
> 
> #define O_RDONLY	     00
> #define O_WRONLY	     01
> #define O_RDWR		     02
> #define O_CREAT		   0100	/* not fcntl */

what i mean is that people don't do bitwise operations with enums.  so to open 
a few for writing and create it, you have to do:
	open(..., O_CREAT|O_WRONLY)

which is just weird with enums
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120114/249ed228/attachment.pgp>


More information about the U-Boot mailing list