From 9e34d5b91fda4c1021090fa00a8921cc2c8d2cb8 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 7 Mar 2019 17:27:44 +0100 Subject: [socket] Preliminary - make socket configurable Preliminary work to make socket configurable (enable and disable). OTP-15658 --- erts/preloaded/src/erl_init.erl | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'erts/preloaded/src') diff --git a/erts/preloaded/src/erl_init.erl b/erts/preloaded/src/erl_init.erl index 6edead362c..a650367c25 100644 --- a/erts/preloaded/src/erl_init.erl +++ b/erts/preloaded/src/erl_init.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. +%% Copyright Ericsson AB 2000-2019. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -35,8 +35,8 @@ start(Mod, BootArgs) -> erl_tracer:on_load(), prim_buffer:on_load(), prim_file:on_load(), - socket:on_load(), - net:on_load(), + conditional_load(socket), % socket:on_load(), + net:on_load(), % This needs to be loaded since it contains 'other' funcs... %% Proceed to the specified boot module run(Mod, boot, BootArgs). @@ -48,3 +48,17 @@ run(M, F, A) -> true -> M:F(A) end. + +conditional_load(Mod) -> + conditional_load(Mod, erlang:loaded()). + +conditional_load(_Mod, []) -> + ok; +conditional_load(Mod, [Mod|_]) -> + Mod:on_load(); +conditional_load(Mod, [_|T]) -> + conditional_load(Mod, T). + + + + -- cgit v1.2.3