aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/erl_init.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-05-02 10:16:04 +0200
committerMicael Karlberg <[email protected]>2019-05-02 10:16:04 +0200
commit5c3b8ece50b2dfa66351198375acf4a5f08833ac (patch)
tree2d1d42872f10a68656793638c460c3f76859a8c5 /erts/preloaded/src/erl_init.erl
parent202ac7dcd4060b463a08d6bca09529c95d5855f4 (diff)
parentb49f68d5d8a256a7a0847d939b2da8a4be6c728a (diff)
downloadotp-5c3b8ece50b2dfa66351198375acf4a5f08833ac.tar.gz
otp-5c3b8ece50b2dfa66351198375acf4a5f08833ac.tar.bz2
otp-5c3b8ece50b2dfa66351198375acf4a5f08833ac.zip
Merge branch 'bmk/erts/esock/20190430/configure_esock_include/OTP-15658'
Diffstat (limited to 'erts/preloaded/src/erl_init.erl')
-rw-r--r--erts/preloaded/src/erl_init.erl26
1 files changed, 23 insertions, 3 deletions
diff --git a/erts/preloaded/src/erl_init.erl b/erts/preloaded/src/erl_init.erl
index 6edead362c..d209c4033b 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,7 @@ 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, net]), % socket:on_load(), net:on_load(),
%% Proceed to the specified boot module
run(Mod, boot, BootArgs).
@@ -48,3 +47,24 @@ run(M, F, A) ->
true ->
M:F(A)
end.
+
+conditional_load(CondMod, Mods2Load) ->
+ conditional_load(CondMod, erlang:loaded(), Mods2Load).
+
+conditional_load(_CondMod, [], _Mods2LOad) ->
+ ok;
+conditional_load(CondMod, [CondMod|_], Mods2Load) ->
+ on_load(Mods2Load);
+conditional_load(CondMod, [_|T], Mods2Load) ->
+ conditional_load(CondMod, T, Mods2Load).
+
+on_load([]) ->
+ ok;
+on_load([Mod|Mods]) ->
+ Mod:on_load(),
+ on_load(Mods).
+
+
+
+
+