From 69b8d1ab13473f851f8957e2bb6f5486f64612ad Mon Sep 17 00:00:00 2001 From: Guilherme Andrade Date: Sat, 23 Jul 2016 19:10:10 +0100 Subject: zlib: support extraction of inflation dictionary --- erts/doc/src/zlib.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'erts/doc') diff --git a/erts/doc/src/zlib.xml b/erts/doc/src/zlib.xml index 138414a880..1a7c2d2b6f 100644 --- a/erts/doc/src/zlib.xml +++ b/erts/doc/src/zlib.xml @@ -575,6 +575,17 @@ unpack(Z, Compressed, Dict) -> + + + Return the decompression dictionary. + +

Returns the decompression dictionary currently in use + by the stream. This function must be called between + inflateInit/1,2 + and inflateEnd.

+
+
+ Open a stream and return a stream reference. -- cgit v1.2.3 From 58d8a3ac4d491c8cd962ac0839a56cd1a0e339f9 Mon Sep 17 00:00:00 2001 From: Dmytro Lytovchenko Date: Mon, 13 Jun 2016 12:05:55 +0200 Subject: Option to erlang:garbage_collect to request minor (generational) GC Note: Minor GC option is a hint, and GC may still decide to run fullsweep. Test case for major and minor gc on self Test case for major and minor gs on some other process + async gc test check docs fix --- erts/doc/src/erlang.xml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 2b7a3b85e5..90f2de594b 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -1604,6 +1604,12 @@ true the form {garbage_collect, RequestId, GCResult}. + + {type, 'major' | 'minor'} + Triggers garbage collection of requested type. Default value is + 'major', which would trigger a fullsweep GC. + The option 'minor' is considered a hint and may lead to + either minor or major GC run.

If Pid equals self(), and no async option has been passed, the garbage -- cgit v1.2.3 From 2d67526de71b6b22a9b08779bcebcfde8f13afef Mon Sep 17 00:00:00 2001 From: Guilherme Andrade Date: Sat, 20 Aug 2016 23:27:56 +0100 Subject: Specify min zlib ver on inflateGetDictionary doc --- erts/doc/src/zlib.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'erts/doc') diff --git a/erts/doc/src/zlib.xml b/erts/doc/src/zlib.xml index 1a7c2d2b6f..e1924fffee 100644 --- a/erts/doc/src/zlib.xml +++ b/erts/doc/src/zlib.xml @@ -583,6 +583,7 @@ unpack(Z, Compressed, Dict) -> by the stream. This function must be called between inflateInit/1,2 and inflateEnd.

+

Only supported if ERTS was compiled with zlib >= 1.2.8.

-- cgit v1.2.3 From 986d32a62b20c32338dac4dfd27c141c8f9be0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 20 Jun 2016 13:25:04 +0200 Subject: Implement the new ceil/1 and floor/1 guard BIFs Implement as ceil/1 and floor/1 as new guard BIFs (essentially part of Erlang language). They are guard BIFs because trunc/1 is a guard BIF. It would be strange to have trunc/1 as a part of the language, but not ceil/1 and floor/1. --- erts/doc/src/erlang.xml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index d0a3a77e43..18a7a5b777 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -717,6 +717,19 @@ Z = erlang:adler32_combine(X,Y,iolist_size(Data2)). + + + Returns the smallest integer not less than the argument + +

Returns the smallest integer not less than + Number. + For example:

+
+> ceil(5.5).
+6
+

Allowed in guard tests.

+
+
Check if a module has old code. @@ -1464,6 +1477,20 @@ true + + + Returns the largest integer not greater than the argument + +

Returns the largest integer not greater than + Number. + For example:

+
+> floor(-10.5).
+-11
+

Allowed in guard tests.

+
+
+ Information about a fun. -- cgit v1.2.3 From 4f8071d81aa0690caa3adc734d73a1cb004ad808 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 19 Sep 2016 14:34:57 +0200 Subject: erts: Remove deprecated nif 'reload' feature and instead let erlang:load_nif/2 return {error, {reload, _}} before even trying to load the library if a NIF library has already been successfully loaded for the calling module instance. --- erts/doc/src/erl_nif.xml | 46 +++++++++++++--------------------------------- erts/doc/src/erlang.xml | 6 +++++- 2 files changed, 18 insertions(+), 34 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index b5dc9037c4..5d55cc9121 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -296,8 +296,8 @@ return term; synchronization. This includes terms in process-independent environments that are shared between threads. Resource objects also require synchronization if you treat them as mutable.

-

The library initialization callbacks load, reload, and - upgrade are all thread-safe even for shared state data.

+

The library initialization callbacks load and + upgrade are thread-safe even for shared state data.

Version Management @@ -498,7 +498,7 @@ return term; Initialization ERL_NIF_INIT(MODULE, - ErlNifFunc funcs[], load, reload, upgrade, unload) + ErlNifFunc funcs[], load, NULL, upgrade, unload)

This is the magic macro to initialize a NIF library. It is to be evaluated in global file scope.

@@ -507,11 +507,14 @@ return term; the macro.

funcs is a static array of function descriptors for all the implemented NIFs in this library.

-

load, reload, upgrade and unload - are pointers to functions. One of load, reload, or +

load, upgrade and unload + are pointers to functions. One of load or upgrade is called to initialize the library. unload is called to release the library. All are described individually below.

+

The fourth argument NULL is ignored. It + was earlier used for the deprectated reload callback + which is no longer supported since OTP 20.

If compiling a NIF for static inclusion through --enable-static-nifs, you must define STATIC_ERLANG_NIF before the ERL_NIF_INIT declaration.

@@ -539,7 +542,7 @@ return term; and there is old code of this module with a loaded NIF library.

Works as load, except that *old_priv_data already contains the value set by the last call to load or - reload for the old module code. *priv_data is + upgrade for the old module code. *priv_data is initialized to NULL when upgrade is called. It is allowed to write to both *priv_data and *old_priv_data.

@@ -551,27 +554,7 @@ return term;

unload is called when the module code that the NIF library belongs to is purged as old. New code of the same - module may or may not exist. Notice that unload is not - called for a replaced library as a consequence of reload.

-
- int (*reload)(ErlNifEnv* env, void** - priv_data, ERL_NIF_TERM load_info) - - -

The reload mechanism is deprecated. It was only intended - as a development feature. Do not use it as an upgrade method for - live production systems. It can be removed in future releases. - Ensure to pass reload as NULL to - ERL_NIF_INIT - to disable it when not used.

-
-

reload is called when the NIF library is loaded and a - previously loaded library already exists for this module code.

-

Works as load, except that - *priv_data already contains the value set by the - previous call to load or reload.

-

The library fails to load if reload returns - anything other than 0 or if reload is NULL.

+ module may or may not exist.

@@ -2249,9 +2232,8 @@ enif_map_iterator_destroy(env, &iter); returns NULL and sets *tried to flags. It is allowed to set tried to NULL.

Notice that enif_open_resource_type is only allowed to be - called in the three callbacks - load, - reload, and + called in the two callbacks + load and upgrade.

@@ -2305,10 +2287,8 @@ enif_map_iterator_destroy(env, &iter); Get the private data of a NIF library.

Returns the pointer to the private data that was set by - load, - reload, or + load or upgrade.

-

Was previously named enif_get_data.

diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index f42c39db5f..d22d40ba8a 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -2598,9 +2598,13 @@ os_prompt% The library did not fulfill the requirements as a NIF library of the calling module. - load | reload | upgrade + load | upgrade The corresponding library callback was unsuccessful. + reload + A NIF library is already loaded for this module instance. + The previously deprecated reload feature was removed in OTP 20. + old_code The call to load_nif/2 was made from the old code of a module that has been upgraded; this is not -- cgit v1.2.3 From 48314b2f6bedee39cb20c38599b9b1c2611e9b51 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 19 Sep 2016 14:37:24 +0200 Subject: erts: Remove old doc note for erlang:load_nif --- erts/doc/src/erlang.xml | 7 ------- 1 file changed, 7 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index d22d40ba8a..f318f28b6d 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -2562,13 +2562,6 @@ os_prompt% Load NIF library. - -

Before Erlang/OTP R14B, NIFs were an - experimental feature. Versions before Erlang/OTP R14B can - have different and possibly incompatible NIF semantics and - interfaces. For example, in Erlang/OTP R13B03 the return value on - failure was {error,Reason,Text}.

-

Loads and links a dynamic library containing native implemented functions (NIFs) for a module. Path is a file path to the shareable object/dynamic library file minus -- cgit v1.2.3 From 3489b9b689073f428a23f7fc7a67774b7dda07be Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 18 Sep 2016 12:33:08 +0200 Subject: Use more correct delimiters for erl_nif.h include Anywhere but the beam sources we shouldn't #include "erl_nif.h", because what "erl_nif.h" does is: (1) fail to find it outside of -I dirs, (2) then treat it as if it was written like . Using skips (1). More information can be found in 6.10.2 of the C standard. Because the examples use "erl_nif.h", NIF projects in the Erlang ecosystem copy this verbatim and make the same mistake. --- erts/doc/src/erl_nif.xml | 2 +- erts/doc/src/erl_tracer.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index b5dc9037c4..b149d72637 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -80,7 +80,7 @@ /* niftest.c */ -#include "erl_nif.h" +#include <erl_nif.h> static ERL_NIF_TERM hello(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { diff --git a/erts/doc/src/erl_tracer.xml b/erts/doc/src/erl_tracer.xml index 83eef374ca..43613c31b1 100644 --- a/erts/doc/src/erl_tracer.xml +++ b/erts/doc/src/erl_tracer.xml @@ -684,7 +684,7 @@ trace(_, _, _, _, _) ->

erl_msg_tracer.c:

-#include "erl_nif.h"
+#include <erl_nif.h>
 
 /* NIF interface declarations */
 static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info);
-- 
cgit v1.2.3


From 6c7160b1105f7f258898e7ba406289bef33fd756 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson 
Date: Wed, 21 Sep 2016 17:46:11 +0200
Subject: erts: Clearify run_erl docs

ERL-258
---
 erts/doc/src/run_erl.xml | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'erts/doc')

diff --git a/erts/doc/src/run_erl.xml b/erts/doc/src/run_erl.xml
index ad7b2c5b85..a9b6a7e2c6 100644
--- a/erts/doc/src/run_erl.xml
+++ b/erts/doc/src/run_erl.xml
@@ -49,7 +49,7 @@
   
     
       run_erl [-daemon] pipe_dir/ log_dir "exec command
-        [command_arguments]"
+        arg1 arg2 ..."
       Start the Erlang emulator without attached terminal.
       
         

Arguments:

@@ -92,11 +92,10 @@ - "exec command [command_arguments]" + "exec command arg1 arg2 ..." -

In the third argument, is the - executable to execute where everything written to stdin - and stdout is logged to .

+

A space-separated string specifying the program to be executed. + The second field is typically a command name such as erl.

@@ -105,7 +104,7 @@
Notes concerning the Log Files -

While running, run_erl (as stated earlier) sends all output, +

While running, run_erl sends all output, uninterpreted, to a log file. The file is named , where N is an integer. When the log is "full" (default log size is 100 KB), run_erl starts to log -- cgit v1.2.3 From c875f46fe83381d5917b3a7a8453e2ae58d233a8 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Mon, 26 Sep 2016 22:46:06 +0200 Subject: erts: Add examples to binary_to_term and term_to_binary --- erts/doc/src/erlang.xml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 950a5fe189..b0d25389fd 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -516,7 +516,14 @@ Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).

Returns an Erlang term that is the result of decoding binary object Binary, which must be encoded - according to the Erlang external term format.

+ according to the + Erlang external term format.

+
+> Bin = term_to_binary(hello).
+<<131,100,0,5,104,101,108,108,111>>
+> hello = binary_to_term(Bin).
+hello
+

When decoding binaries from untrusted sources, consider using binary_to_term/2 to prevent Denial @@ -555,6 +562,14 @@ Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).

Failure: badarg if safe is specified and unsafe data is decoded.

+
+> binary_to_term(<<131,100,0,5,104,101,108,108,111>>, [safe]).
+** exception error: bad argument
+> hello.
+hello
+> binary_to_term(<<131,100,0,5,104,101,108,108,111>>, [safe]).
+hello
+

See also term_to_binary/1, @@ -8599,12 +8614,19 @@ ok

Returns a binary data object that is the result of encoding - Term according to the Erlang external - term format.

+ Term according to the + Erlang external + term format.

This can be used for various purposes, for example, writing a term to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.

+
+> Bin = term_to_binary(hello).
+<<131,100,0,5,104,101,108,108,111>>
+> hello = binary_to_term(Bin).
+hello
+

See also binary_to_term/1.

-- cgit v1.2.3 From 714570912d678c10f4aa4b6a6692d958e0fc7fe7 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 28 Sep 2016 16:40:19 +0200 Subject: Document the order of directories added with code:add_pathsa/1 code:add_pathsa/1 reverts the list of directories when adding it at the beginning of the code path. The command line option '-pa' behaves in the same way. This is now documented. --- erts/doc/src/erl.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index f62d3fb170..eb1d24cf12 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -393,9 +393,11 @@

Adds the specified directories to the beginning of the code - path, similar to ; see - code(3). - As an alternative to -pa, if several directories are + path, similar to + . Note that the + order of the given directories will be reversed in the + resulting path.

+

As an alternative to -pa, if several directories are to be prepended to the code path and the directories have a common parent directory, that parent directory can be specified in environment variable ERL_LIBS; see -- cgit v1.2.3 From 2dfca60a24c2c6728a4b8431f37aeee05212a4ac Mon Sep 17 00:00:00 2001 From: Gabriele Santomaggio Date: Thu, 13 Oct 2016 21:17:10 +0200 Subject: Add system_info(atom_limit) Add system_info(atom_limit) to provide a way to retrieve the maximum number of atoms allowed. Add tests and documentation for it too. Also split system_info_SUITE:start_node/2 to start_node_ets/2 and start_node_atm/2 to avoid code duplication. --- erts/doc/src/erlang.xml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index b0d25389fd..43a3481351 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -7185,13 +7185,14 @@ ok erlang:system_info({allocator, Alloc}).

+ - + Information about the CPU topology of the system. @@ -7291,12 +7292,12 @@ ok - - + + Information about the default process heap settings. @@ -7373,7 +7374,7 @@ ok - + @@ -7388,14 +7389,14 @@ ok - + - + @@ -7425,6 +7426,7 @@ ok + Information about the system.

Returns various information about the current system @@ -7436,6 +7438,16 @@ ok

See above.

+ atom_limit + + +

Returns the maximum number of atoms allowed. + This limit can be increased at startup by passing + command-line flag + +t to + erl(1). +

+
build_type

Returns an atom describing the build type of the runtime -- cgit v1.2.3 From 37384d3e68b3558e7cd48646a8acf4b74e6bc1c3 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 12 Oct 2016 15:33:21 +0200 Subject: erts: Fix some system_info docs inconsistencies --- erts/doc/src/erlang.xml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 43a3481351..c76a30947c 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -7185,7 +7185,6 @@ ok erlang:system_info({allocator, Alloc}).

-
@@ -7340,12 +7339,6 @@ ok see process_flag(max_heap_size, MaxHeapSize).

- min_heap_size - -

Returns {min_heap_size, MinHeapSize}, - where MinHeapSize is the current - system-wide minimum heap size for spawned processes.

-
message_queue_data @@ -7358,6 +7351,12 @@ ok process_flag(message_queue_data, MQD).

+ min_heap_size + +

Returns {min_heap_size, MinHeapSize}, + where MinHeapSize is the current + system-wide minimum heap size for spawned processes.

+
min_bin_vheap_size

Returns {min_bin_vheap_size, @@ -7432,12 +7431,6 @@ ok

Returns various information about the current system (emulator) as specified by Item:

- allocated_areas, allocator, - alloc_util_allocators, allocator_sizes - -

See - above.

-
atom_limit @@ -7445,7 +7438,7 @@ ok This limit can be increased at startup by passing command-line flag +t to - erl(1). + erl(1).

build_type -- cgit v1.2.3 From 95dd51d198c05ee8e93afd4984a0b306bc1fcdc3 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 25 Oct 2016 15:58:24 +0200 Subject: erts: Correct docs for driver_select --- erts/doc/src/erl_driver.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index 836a58a676..5191742bc9 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -1916,9 +1916,9 @@ r = driver_async(myPort, &myKey, myData, myFunc); ]]> returned. Another thread can still be using the event object internally. To safely close an event object, call driver_select with ERL_DRV_USE and on==0, which - clears all events. Then call - - stop_select when it is safe to close the event + clears all events and then either calls + stop_select + or schedules it to be called when it is safe to close the event object. ERL_DRV_USE is to be set together with the first event for an event object. It is harmless to set ERL_DRV_USE even if it already has been done. Clearing all events but keeping -- cgit v1.2.3