erl_prim_loader(3)
π erl_prim_loader β the low-level Erlang loader π
okay bestie, welcome to erl_prim_loader, aka the lowkey Erlang loader from the erts manual. This is the module that loads all Erlang modules into the system β yes, all of them. The start script also gets fetched with this same low-level loader. She does it all, no cap. π
β¨ DESCRIPTION β¨
erl_prim_loader knows about the environment and how to fetch modules. That's literally her whole thing.
The command-line flag -loader Loader is how you pick which method erl_prim_loader uses. The Erlang runtime system supports two Loader methods: efile and inet. Two options, two vibes. πΈ
π Command-Line Flags π
The erl_prim_loader module interprets these command-line flags, bestie β write them down, they matter:
-loader Loaderβ says the name of the loader thaterl_prim_loaderuses.Loadercan be eitherefile(uses the local file system) orinet(loads using theboot_serveron another Erlang node). And if you just... omit the-loaderflag entirely? It defaults toefile. periodt.-loader_debugβ makes theefileloader spill some debug information while it's handling files, like the reason for failures. it's giving detective energy π-hosts Hostsβ says which other Erlang nodes theinetloader is allowed to use. This flag is mandatory if the-loader inetflag is present. On each host there has to be an Erlang node running theerl_boot_server, and that server handles the load requests.Hostsis a list of IP addresses β and heads up, hostnames are not acceptable. it's IPs only, sorry bestie π-setcookie Cookieβ sets the cookie of the Erlang runtime system. This flag is mandatory if the-loader inetflag is present.
π See Also
init, erl_boot_server
π FUNCTIONS π
π get_file(Filename) -> {ok, Bin, FullName} | error
when
Filename :: atom() | string(),
Bin :: binary(),
FullName :: string().
β οΈ Using this function is deprecated in favor of read_file/1. she's iconic but she's retired, ok?
Fetches a file using the low-level loader. Filename is either an absolute filename or just the name of the file, for example, "lists.beam". If an internal path is set to the loader, that path gets used to find the file. FullName is the complete name of the fetched file, and Bin is the contents of the file as a binary.
Filename can also be a file inside an archive, for example, $OTPROOT/lib/mnesia-4.4.7.ez/mnesia-4.4.7/ebin/mnesia.beam. For the tea on archive files, go see code.
π get_path() -> {ok, Path}
when Path :: [Dir :: string()].
β οΈ Using this function is deprecated in favor of code:get_path/0.
Gets the path set in the loader. The path is set by the init process according to the information found in the start script.
π¦ list_dir(Dir) -> {ok, Filenames} | error
when
Dir :: string(),
Filenames :: [Filename :: string()].
Lists all the files in a directory.
Returns {ok, Filenames} if successful, otherwise error. Filenames is a list of the names of all the files in the directory β and ngl, the names are not sorted. no alphabetical order, no vibes, just whatever.
Dir can also be a directory inside an archive, for example, $OTPROOT/lib/mnesia-4.4.7.ez/mnesia-4.4.7/ebin. For information about archive files, see code.
π read_file(Filename) -> {ok, Bin} | error
when Filename :: string(), Bin :: binary().
Reads a file using the low-level loader. slay.
Returns {ok, Bin} if successful, otherwise error. Bin is the contents of the file as a binary.
Filename can also be a file inside an archive, for example, $OTPROOT/lib/mnesia-4.4.7.ez/mnesia-4.4.7/ebin/mnesia.beam. For information about archive files, see code.
π read_file_info(Filename) -> {ok, FileInfo} | error
when
Filename :: string(),
FileInfo :: file:file_info().
Retrieves information about a file. nosy but make it legal π
Returns {ok, FileInfo} if successful, otherwise error. FileInfo is a record file_info, defined in the Kernel include file file.hrl. Include the following directive in the module from which the function is called:
-include_lib("kernel/include/file.hrl").
For more information about the record, see file:read_file_info/2.
Filename can also be a file inside an archive, for example, $OTPROOT/lib/mnesia-4.4.7.ez/mnesia-4.4.7/ebin/mnesia. For information about archive files, see code.
π§ read_link_info(Filename) -> {ok, FileInfo} | error
when
Filename :: string(),
FileInfo :: file:file_info().
Works exactly like read_file_info/1, except that if Filename is a symbolic link, the information about the link is returned in the file_info record, and the type field of the record is set to symlink.
If Filename is not a symbolic link, this function returns exactly the same result as read_file_info/1. And on platforms that don't support symbolic links at all? This function is always equivalent to read_file_info/1. same energy, no notes.
β set_path(Path) -> ok
when Path :: [Dir :: string()].
Sets the path of the loader β this happens if init interprets a path command in the start script.
and that's the whole page bestie, you ate that reading session fr fr π«Άπ
β¨ this has been erl_prim_loader from the Erlang module definitions, brought to you by Ericsson AB, from erts version 17.0.6 β¨ ππ
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms