From 86fa667f9731c790d6575f31efa156c02cb7984b Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Thu, 19 May 2016 20:29:45 +0200 Subject: Add code:module_status/1 and modified_modules/0 These functions use the MD5 beam/native checksum to determine whether the code for a module has changed on disk and is a candidate for loading. --- lib/kernel/doc/src/code.xml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml index 3143cdc825..f881fd76fd 100644 --- a/lib/kernel/doc/src/code.xml +++ b/lib/kernel/doc/src/code.xml @@ -898,6 +898,48 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]), identical names and writes a report to stdout.

+ + + Return the status of the module in relation to object file on disk. + +

Returns:

+ + not_loaded +

If Module is not currently loaded.

+ loaded +

If Module is loaded and the object file + exists and contains the same code.

+ removed +

If Module is loaded but no + corresponding object file can be found in the code path.

+ modified +

If Module is loaded but the object file + contains code with a different MD5 checksum.

+
+

Preloaded modules are always reported as loaded, without + inspecting the contents on disk. Cover compiled modules will always + be reported as modified if an object file exists, or as + removed otherwise. Modules whose load path is an empty string + (which is the convention for auto-generated code) will only be + reported as loaded or not_loaded.

+

For modules that have native code loaded (see + is_module_native/1), + the MD5 sum of the native code in the object file is used for the + comparison, if it exists; the Beam code in the file is ignored. + Reversely, for modules that do not currently have native code + loaded, any native code in the file will be ignored.

+

See also modified_modules/0.

+
+
+ + + Return a list of all modules modified on disk. + +

Returns the list of all currently loaded modules for which + module_status/1 + returns modified. See also all_loaded/0.

+
+
Test if a module has native code. -- cgit v1.2.3