32768 in open() flags
Opened this issue · 3 comments
Sorry for the question but probably you might know the answer. I'm trying to figure out open()
flags for different nodejs open modes on linux and have got this:
'r' # Open file for reading. An exception occurs if the file does not exist.
#32768
# 0b1000000000000000
'r+' # Open file for reading and writing. An exception occurs if the file does not exist.
#32770
# 0b1000000000000010
'rs' # Open file for reading in synchronous mode. Instructs the operating system to bypass the local file system cache.
# This is primarily useful for opening files on NFS mounts as it allows you to skip the potentially stale local cache. It has a very real impact on I/O performance so don't use this flag unless you need it.
# Note that this doesn't turn fs.open() into a synchronous blocking call. If that's what you want then you should be using fs.openSync()
#36864
# 0b1001000000000000
'rs+' # Open file for reading and writing, telling the OS to open it synchronously. See notes for 'rs' about using this with caution.
#36866
# 0b1001000000000010
'w' # Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
#32769
# 0b1000000000000001
'wx' # Like 'w' but fails if path exists.
'w+' # Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).
#32770
# 0b1000000000000010
'wx+' # Like 'w+' but fails if path exists.
'a' # Open file for appending. The file is created if it does not exist.
#33793
# 0b1000010000000001
'ax' # Like 'a' but fails if path exists.
'a+' # Open file for reading and appending. The file is created if it does not exist.
#33794
# 0b1000010000000010
'ax+' # Like 'a+' but fails if path exists.
Every flags
value I've got contains 0b1000000000000000 bitmask which is 32768 in decimal or 0100000 octal. But there is no such value in require('constants')
which I believe should be used instead of hardcoded values. S_IFREG
is equal to 32768 but I doubt it is suitable for open flags. Could you tell me please what is this flag for and what it means? Thank you.
Under some unclear circumstances an open_flag 0b1000000000000000000 (262144)
emegred also.
I've made a Travis CI test to make the matter of discussion more tangible
https://github.com/aa6/nodejs_fuse_tests/blob/master/spec/fuse-bindings_open_flags.spec.coffee
It is strange that open()
function is never called for x
modes.