Now that I'm at the stage where I'm implementing drivers (and hence, their read/write implementations), I need to start thinking about the mode bits so user programs have the predicted results (for instance, not being able to write to a readonly device).
The problem is, I usually get 0x1B6 as the mode bits, and as far as I can see, this is no combination of the mode constants. Any ideas?
Newlib: Mode bits?
check linux/sys/stat.h in newlib. It has all the constants defined, as per the open-group base specification (POSIX).
JamesM
addendum: There are no posix-defined constants for these. You are free to make them up (that's why they're defined in sys/stat.h not stat.h). Linux in fact seems to change quite a few of the file constants between implementations (c.f. Linux x86 / Linux MIPSel)http://www.opengroup.org/onlinepubs/009695399/ wrote: File mode bits:
S_IRWXU
Read, write, execute/search by owner.
S_IRUSR
Read permission, owner.
S_IWUSR
Write permission, owner.
S_IXUSR
Execute/search permission, owner.
S_IRWXG
Read, write, execute/search by group.
S_IRGRP
Read permission, group.
S_IWGRP
Write permission, group.
S_IXGRP
Execute/search permission, group.
S_IRWXO
Read, write, execute/search by others.
S_IROTH
Read permission, others.
S_IWOTH
Write permission, others.
S_IXOTH
Execute/search permission, others.
JamesM