Skip to content

Commit

Permalink
src: register external references in os bindings
Browse files Browse the repository at this point in the history
PR-URL: #40239
Refs: #38905
Refs: #37476
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
joyeecheung authored and BethGriggs committed Nov 23, 2021
1 parent 7bb3d43 commit 7a8a6de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ namespace node {
using v8::Context;
using v8::Local;
using v8::Object;
using v8::TryCatch;
using v8::Value;

namespace crypto {
Expand Down
1 change: 1 addition & 0 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ExternalReferenceRegistry {
V(heap_utils) \
V(messaging) \
V(native_module) \
V(os) \
V(performance) \
V(process_methods) \
V(process_object) \
Expand Down
17 changes: 17 additions & 0 deletions src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "env-inl.h"
#include "node_external_reference.h"
#include "string_bytes.h"

#ifdef __MINGW32__
Expand Down Expand Up @@ -398,7 +399,23 @@ void Initialize(Local<Object> target,
Boolean::New(env->isolate(), IsBigEndian())).Check();
}

void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(GetHostname);
registry->Register(GetLoadAvg);
registry->Register(GetUptime);
registry->Register(GetTotalMemory);
registry->Register(GetFreeMemory);
registry->Register(GetCPUInfo);
registry->Register(GetInterfaceAddresses);
registry->Register(GetHomeDirectory);
registry->Register(GetUserInfo);
registry->Register(SetPriority);
registry->Register(GetPriority);
registry->Register(GetOSInformation);
}

} // namespace os
} // namespace node

NODE_MODULE_CONTEXT_AWARE_INTERNAL(os, node::os::Initialize)
NODE_MODULE_EXTERNAL_REFERENCE(os, node::os::RegisterExternalReferences)

0 comments on commit 7a8a6de

Please sign in to comment.