From cf4c83c8c920470f2225f0162129a009b09d2d09 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 30 Apr 2016 14:13:00 -0700 Subject: [PATCH] process: add O_NOATIME constant Add O_NOATIME flag on Linux for use with `fs.open()`. PR-URL: https://github.com/nodejs/node/pull/6492 Fixes: https://github.com/nodejs/node/issues/2182 --- src/node_constants.cc | 4 ++++ test/parallel/test-process-constants-noatime.js | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/parallel/test-process-constants-noatime.js diff --git a/src/node_constants.cc b/src/node_constants.cc index 87443c95be1b6d..928502f6affca9 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -1036,6 +1036,10 @@ void DefineSystemConstants(Local target) { NODE_DEFINE_CONSTANT(target, O_EXCL); #endif +#ifdef O_NOATIME + NODE_DEFINE_CONSTANT(target, O_NOATIME); +#endif + #ifdef O_NOFOLLOW NODE_DEFINE_CONSTANT(target, O_NOFOLLOW); #endif diff --git a/test/parallel/test-process-constants-noatime.js b/test/parallel/test-process-constants-noatime.js new file mode 100644 index 00000000000000..cf6b98f794157b --- /dev/null +++ b/test/parallel/test-process-constants-noatime.js @@ -0,0 +1,11 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const isLinux = process.platform === 'linux'; + +const O_NOATIME = process.binding('constants').O_NOATIME; +const expected = isLinux ? 0x40000 : undefined; + +assert.strictEqual(O_NOATIME, expected);