I was looking at the permission bits used in various functions like stat() and chmod(), and I wanted a description of what the macros defined actually are. For instance S_IRUSR says it's represented by 00400 (GNU/Linux). My question is, could someone describe what the 00400 actually is? Is it a number, what? I understand how to OR the macros, I just don't get what the macro actually is.

I actually understand what the permissions are, that's not the issue, I just want to know what the number represented by the macro is and how it works. Is it a bitfield or something, I'm just trying to understand that conceptually. I understand octal permission modes, that's not the question, what does the number represent in the macro.
–
hcaulfield57Nov 23 '12 at 21:06

1

@Holden - "00400" is a number. An octal (base 8) number (you can tell by the leading "0"). Representing filesystem permissions.
–
paulsm4Nov 23 '12 at 21:08

3

Hmpf. Everything is bits. in octal representation, the bits forming a word are grouped in groups of 3 bits, and these 3 bits can then be represented by numbers 0..7 (octal means that 8 dec is 10 in octal, like 10 dec is 10 in dec :-). So if you or 4 oct with 2 oct, that means you or 100 bin with 010 bin, which yields 110 bin, which translates into 6 oct. Want more confusion?
–
pbhdNov 23 '12 at 21:20