0

Hey guys,


I hate asking this but unfortunetly, Google does not know how to interpret "|" and probably assumes its an OR command or something :P . The line goes as follows (source found http://pysnippet.blogspot.com/2009/11/fuse-filesystem-in-userspace-part-1.html here):

st.st_mode = stat.S_IFDIR | 0755

I know it's doing something about the mode being 0755 but I have never seen | be used like that before.

Can someone explain whats going on?


Thanks!

Edited by BLUEC0RE: clarification

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by BLUEC0RE
1

The single vertical bar is for the bitwise OR operator. What the code is doing is taking the S_IFDIR flag (which indicates if a given file handle is actually for a directory), and overlaying the bitfield for the desired file permissions, which results in the overall file mode value. See here and here for more details.

Edited by Schol-R-LEA: n/a

Votes + Comments
Very informative post
0

The single vertical bar is for the bitwise OR operator. What the code is doing is taking the S_IFDIR flag (which indicates if a given file handle is actually for a directory), and overlaying the bitfield for the desired file permissions, which results in the overall file mode value. See here and here for more details.

That helped me out, thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.