mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
5f22375922
* add constants for dlopen flags, which are needed for dlopen's flag passing. * introduce an optional parameter for process.dlopen(), allowing to pass dlopen flags (using values from os.constants.dlopen). If no flags are passed, the default behavior is to load the library with RTLD_LAZY (perform lazy binding) and RTLD_LOCAL (symbols are available only locally). PR-URL: https://github.com/nodejs/node/pull/12794 Refs: https://github.com/nodejs/node/pull/4105 Refs: https://github.com/libuv/libuv/pull/1331 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
32 lines
945 B
JavaScript
32 lines
945 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const constants = process.binding('constants');
|
|
const assert = require('assert');
|
|
|
|
assert.deepStrictEqual(
|
|
Object.keys(constants).sort(), ['crypto', 'fs', 'os', 'zlib']
|
|
);
|
|
|
|
assert.deepStrictEqual(
|
|
Object.keys(constants.os).sort(), ['UV_UDP_REUSEADDR', 'dlopen', 'errno',
|
|
'signals']
|
|
);
|
|
|
|
// Make sure all the constants objects don't inherit from Object.prototype
|
|
const inheritedProperties = Object.getOwnPropertyNames(Object.prototype);
|
|
function test(obj) {
|
|
assert(obj);
|
|
assert.strictEqual(Object.prototype.toString.call(obj), '[object Object]');
|
|
assert.strictEqual(Object.getPrototypeOf(obj), null);
|
|
|
|
inheritedProperties.forEach((property) => {
|
|
assert.strictEqual(property in obj, false);
|
|
});
|
|
}
|
|
|
|
[
|
|
constants, constants.crypto, constants.fs, constants.os, constants.zlib,
|
|
constants.os.dlopen, constants.os.errno, constants.os.signals
|
|
].forEach(test);
|