aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorRichard Carlsson <[email protected]>2018-05-23 11:35:31 +0200
committerRichard Carlsson <[email protected]>2018-05-23 13:31:18 +0200
commit6ee6d1903c4255cbea809129c8262d5863a94093 (patch)
tree253e38d96db5de4fabadb335044c9e07b84b5a0f /erts/preloaded/src
parent4534387fd15937fd3a7d646e9fa56ba2b62390da (diff)
downloadotp-6ee6d1903c4255cbea809129c8262d5863a94093.tar.gz
otp-6ee6d1903c4255cbea809129c8262d5863a94093.tar.bz2
otp-6ee6d1903c4255cbea809129c8262d5863a94093.zip
Add erl_init module
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/Makefile1
-rw-r--r--erts/preloaded/src/erl_init.erl39
2 files changed, 40 insertions, 0 deletions
diff --git a/erts/preloaded/src/Makefile b/erts/preloaded/src/Makefile
index 4333f6643a..17b9fa796b 100644
--- a/erts/preloaded/src/Makefile
+++ b/erts/preloaded/src/Makefile
@@ -42,6 +42,7 @@ PRE_LOADED_ERL_MODULES = \
zlib \
prim_zip \
otp_ring0 \
+ erl_init \
erts_code_purger \
erlang \
erts_internal \
diff --git a/erts/preloaded/src/erl_init.erl b/erts/preloaded/src/erl_init.erl
new file mode 100644
index 0000000000..186a04a8e8
--- /dev/null
+++ b/erts/preloaded/src/erl_init.erl
@@ -0,0 +1,39 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2016. 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.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(erl_init).
+
+%% Initial process of an Erlang system.
+
+-export([start/2]).
+
+%% This gets the boot arguments as expected by init:boot/1
+
+-spec start(_, term()) -> term().
+start(_Env, Argv) ->
+ run(init, boot, Argv).
+
+run(M, F, A) ->
+ case erlang:function_exported(M, F, 1) of
+ false ->
+ erlang:display({fatal,error,module,M,"does not export",F,"/1"}),
+ halt(1);
+ true ->
+ M:F(A)
+ end.