From 57c3246511434f42214e113b8902af10ab9cca49 Mon Sep 17 00:00:00 2001 From: xsipewe Date: Tue, 21 Jun 2016 15:50:34 +0200 Subject: erts: Editorial changes --- erts/doc/src/erlang.xml | 7265 ++++++++++++++++++++++++----------------------- 1 file changed, 3735 insertions(+), 3530 deletions(-) (limited to 'erts/doc/src/erlang.xml') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index cab18ac8b8..3356447168 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -32,18 +32,21 @@ erlang The Erlang BIFs. -

By convention, most Built-In Functions (BIFs) are seen as being +

By convention, most Built-In Functions (BIFs) are included in this module. Some of the BIFs are viewed more or less as part of the Erlang programming language and are auto-imported. Thus, it is not necessary to specify the module name. For example, the calls atom_to_list(Erlang) and erlang:atom_to_list(Erlang) are identical.

+

Auto-imported BIFs are listed without module prefix. BIFs listed with module prefix are not auto-imported.

+

BIFs can fail for various reasons. All BIFs fail with reason badarg if they are called with arguments of an incorrect type. The other reasons are described in the description of each individual BIF.

+

Some BIFs can be used in guard tests and are marked with "Allowed in guard tests".

@@ -53,107 +56,104 @@ ext_binary()

A binary data object, structured according to - the Erlang external term format.

+ the Erlang external term format.

- -

See erlang:process_flag(message_queue_data, MQD).

+ +

See + process_flag(message_queue_data, MQD).

- -

See erlang:timestamp/0.

+ +

See + erlang:timestamp/0.

-

- Supported time unit representations:

+ + +

Supported time unit representations:

- PartsPerSecond :: integer() >= 1 - + PartsPerSecond :: integer() >= 1 +

Time unit expressed in parts per second. That is, - the time unit equals 1/PartsPerSecond second.

- - seconds - + the time unit equals 1/PartsPerSecond second.

+
+ seconds +

Symbolic representation of the time unit - represented by the integer 1.

- - milli_seconds - + represented by the integer 1.

+
+ milli_seconds +

Symbolic representation of the time unit - represented by the integer 1000.

- - micro_seconds - + represented by the integer 1000.

+
+ micro_seconds +

Symbolic representation of the time unit - represented by the integer 1000000.

- - nano_seconds - + represented by the integer 1000000.

+
+ nano_seconds +

Symbolic representation of the time unit - represented by the integer 1000000000.

- - native - + represented by the integer 1000000000.

+
+ native +

Symbolic representation of the native time unit - used by the Erlang runtime system.

- -

The native time unit is determined at - runtime system start, and remains the same until - the runtime system terminates. If a runtime system - is stopped and then started again (even on the same - machine), the native time unit of the new - runtime system instance can differ from the - native time unit of the old runtime system - instance.

- -

One can get an approximation of the native - time unit by calling erlang:convert_time_unit(1, - seconds, native). The result equals the number - of whole native time units per second. In case - the number of native time units per second does - not add up to a whole number, the result is rounded downwards.

- - -

The value of the native time unit gives - you more or less no information at all about the - quality of time values. It sets a limit for - the - resolution - as well as for the - precision - of time values, - but it gives absolutely no information at all about the - accuracy - of time values. The resolution of the native time - unit and the resolution of time values can differ - significantly.

-
-
- - perf_counter - + used by the Erlang runtime system.

+

The native time unit is determined at + runtime system start, and remains the same until + the runtime system terminates. If a runtime system + is stopped and then started again (even on the same + machine), the native time unit of the new + runtime system instance can differ from the + native time unit of the old runtime system + instance.

+

One can get an approximation of the native + time unit by calling + + erlang:convert_time_unit(1, seconds, native). + The result equals the number + of whole native time units per second. If + the number of native time units per second does not + add up to a whole number, the result is rounded downwards.

+ +

The value of the native time unit gives + you more or less no information about the + quality of time values. It sets a limit for the + + resolution and for the + + precision of time values, + but it gives no information about the + + accuracy of time values. The resolution of + the native time unit and the resolution of time + values can differ significantly.

+
+
+ perf_counter +

Symbolic representation of the performance counter - time unit used by the Erlang runtime system.

- -

The perf_counter time unit behaves much in the same way - as the native time unit. That is it might differ inbetween - run-time restarts. You get values of this type by calling - os:perf_counter() -

+ time unit used by the Erlang runtime system.

+

The perf_counter time unit behaves much in the same way + as the native time unit. That is, it can differ between + runtime restarts. To get values of this type, call + + os:perf_counter().

- -
- -

The time_unit/0 type may be extended. Use - erlang:convert_time_unit/3 - in order to convert time values between time units.

- + +

The time_unit/0 type can be extended. + To convert time values between time units, use + + erlang:convert_time_unit/3.

@@ -182,61 +182,60 @@ - Computes adler32 checksum. + Compute adler32 checksum.

Computes and returns the adler32 checksum for - Data.

+ Data.

- Computes adler32 checksum. + Compute adler32 checksum.

Continues computing the adler32 checksum by combining - the previous checksum, OldAdler, with - the checksum of Data.

+ the previous checksum, OldAdler, with + the checksum of Data.

The following code:

- X = erlang:adler32(Data1), - Y = erlang:adler32(X,Data2). -

assigns the same value to Y as this:

+X = erlang:adler32(Data1), +Y = erlang:adler32(X,Data2). +

assigns the same value to Y as this:

- Y = erlang:adler32([Data1,Data2]). +Y = erlang:adler32([Data1,Data2]).
- Combines two adler32 checksums. + Combine two adler32 checksums.

Combines two previously computed adler32 checksums. - This computation requires the size of the data object for - the second checksum to be known.

+ This computation requires the size of the data object for + the second checksum to be known.

The following code:

- Y = erlang:adler32(Data1), - Z = erlang:adler32(Y,Data2). +Y = erlang:adler32(Data1), +Z = erlang:adler32(Y,Data2).

assigns the same value to Z as this:

- X = erlang:adler32(Data1), - Y = erlang:adler32(Data2), - Z = erlang:adler32_combine(X,Y,iolist_size(Data2)). +X = erlang:adler32(Data1), +Y = erlang:adler32(Data2), +Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).
- Appends an extra element to a tuple. + Append an extra element to a tuple.

Returns a new tuple that has one element more than Tuple1, and contains the elements in - Tuple1 + Tuple1 followed by Term as the last element. - Semantically equivalent to + Semantically equivalent to list_to_tuple(tuple_to_list(Tuple1) ++ - [Term]), but much faster.

-

Example:

+ [Term]), but much faster. Example:

 > erlang:append_element({one, two}, three).
 {one,two,three}
@@ -245,32 +244,31 @@ - Applies a function to an argument list. + Apply a function to an argument list.

Calls a fun, passing the elements in Args - as arguments.

+ as arguments.

If the number of elements in the arguments are known at compile time, the call is better written as Fun(Arg1, Arg2, ... ArgN).

-

Earlier, Fun could also be given as +

Earlier, Fun could also be speciifed as {Module, Function}, equivalent to - apply(Module, Function, Args). This use is - deprecated and will stop working in a future release.

+ apply(Module, Function, Args). This use is + deprecated and will stop working in a future release.

- Applies a function to an argument list. + Apply a function to an argument list.

Returns the result of applying Function in Module to Args. - The applied function must + The applied function must be exported from Module. The arity of the function is - the length of Args.

-

Example:

+ the length of Args. Example:

 > apply(lists, reverse, [[a, b, c]]).
 [c,b,a]
@@ -278,39 +276,43 @@
 "Erlang"

If the number of arguments are known at compile time, the call is better written as - Module:Function(Arg1, Arg2, ..., ArgN).

-

Failure: error_handler:undefined_function/3 is called + Module:Function(Arg1, Arg2, ..., + ArgN).

+

Failure: + error_handler:undefined_function/3 is called if the applied function is not exported. The error handler can be redefined (see - process_flag/2). + process_flag/2). If error_handler is undefined, or if the user has redefined the default error_handler so the replacement - module is undefined, an error with the reason undef + module is undefined, an error with reason undef is generated.

- Returns the binary representation of an atom. + Return the binary representation of an atom.

Returns a binary corresponding to the text representation of Atom. If Encoding - is latin1, there is one byte for each character + is latin1, one byte exists for each character in the text representation. If Encoding is utf8 or unicode, the characters are encoded using UTF-8 (that is, characters from 128 through 255 are encoded in two bytes).

-

atom_to_binary(Atom, latin1) never - fails because the text representation of an atom can only - contain characters from 0 through 255. In a future release, - the text representation - of atoms can be allowed to contain any Unicode character and - atom_to_binary(Atom, latin1) will then fail if the - text representation for Atom contains a Unicode - character greater than 255.

+ +

atom_to_binary(Atom, latin1) never + fails, as the text representation of an atom can only + contain characters from 0 through 255. In a future release, + the text representation + of atoms can be allowed to contain any Unicode character and + atom_to_binary(Atom, latin1) then fails if the + text representation for Atom contains a Unicode + character > 255.

+

Example:

 > atom_to_binary('Erlang', latin1).
@@ -332,12 +334,12 @@
 
     
       
-      Extracts a part of a binary.
+      Extract a part of a binary.
       
       

Extracts the part of the binary described by PosLen.

Negative length can be used to extract bytes at the end - of a binary, for example:

+ of a binary, for example:

1> Bin = <<1,2,3,4,5,6,7,8,9,10>>. 2> binary_part(Bin,{byte_size(Bin), -5}). @@ -349,43 +351,44 @@ 1> Bin = <<1,2,3>> 2> binary_part(Bin,{0,2}). <<1,2>> -

For details about the PosLen semantics, see the - binary - manual page in STDLIB.

+

For details about the PosLen semantics, see + stdlib:binary.

Allowed in guard tests.

- Extracts a part of a binary. + Extract a part of a binary.

The same as binary_part(Subject, - {Start, Length}).

+ {Start, Length}).

Allowed in guard tests.

- Converts from text representation to an atom. + Convert from text representation to an atom.

Returns the atom whose text representation is - Binary. - If Encoding is latin1, no - translation of bytes in the binary is done. - If Encoding - is utf8 or unicode, the binary must contain - valid UTF-8 sequences. Only Unicode characters up - to 255 are allowed.

-

binary_to_atom(Binary, utf8) fails if - the binary contains Unicode characters greater than 255. - In a future release, such Unicode characters can be allowed - and binary_to_atom(Binary, utf8) does then not fail. - For more information on Unicode support in atoms, see the - note on UTF-8 - encoded atoms - in Section "External Term Format" in the User's Guide.

+ Binary. + If Encoding is latin1, no + translation of bytes in the binary is done. + If Encoding + is utf8 or unicode, the binary must contain + valid UTF-8 sequences. Only Unicode characters up + to 255 are allowed.

+ +

binary_to_atom(Binary, utf8) fails if + the binary contains Unicode characters > 255. + In a future release, such Unicode characters can be allowed and + binary_to_atom(Binary, utf8) does then not fail. + For more information about Unicode support in atoms, see the + note on UTF-8 + encoded atoms + in section "External Term Format" in the User's Guide.

+

Examples:

 > binary_to_atom(<<"Erlang">>, latin1).
@@ -399,10 +402,10 @@
 
     
       
-      Converts from text representation to an atom.
+      Convert from text representation to an atom.
       
         

As - binary_to_atom/2, + binary_to_atom/2, but the atom must exist.

Failure: badarg if the atom does not exist.

@@ -410,7 +413,7 @@ - Converts from text representation to a float. + Convert from text representation to a float.

Returns the float whose text representation is Binary, for example:

@@ -424,7 +427,7 @@ - Converts from text representation to an integer. + Convert from text representation to an integer.

Returns an integer whose text representation is Binary, for example:

@@ -438,10 +441,11 @@ - Converts from text representation to an integer. + Convert from text representation to an integer.

Returns an integer whose text representation in base - Base is Binary, for example:

+ Base is Binary, for + example:

 > binary_to_integer(<<"3FF">>, 16).
 1023
@@ -452,7 +456,7 @@ - Converts a binary to a list. + Convert a binary to a list.

Returns a list of integers corresponding to the bytes of Binary.

@@ -461,75 +465,83 @@ - Converts part of a binary to a list. - 1..byte_size(Binary) + Convert part of a binary to a list. + 1..byte_size(Binary) +

As binary_to_list/1, but returns a list of integers corresponding to the bytes from position Start to position Stop in Binary. - The positions in the + The positions in the binary are numbered starting from 1.

-

The one-based indexing for binaries used by - this function is deprecated. New code is to use - binary:bin_to_list/3 - in STDLIB instead. All functions in module - binary consistently use zero-based indexing.

+ +

The one-based indexing for binaries used by + this function is deprecated. New code is to use + + binary:bin_to_list/3 + in STDLIB instead. All functions in module + binary consistently use zero-based indexing.

+
- Decodes an Erlang external term format binary. + Decode an Erlang external term format binary.

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

-

When decoding binaries from untrusted sources, - consider using binary_to_term/2 to prevent Denial - of Service attacks.

+ +

When decoding binaries from untrusted sources, + consider using binary_to_term/2 to prevent Denial + of Service attacks.

+

See also - term_to_binary/1 - and - binary_to_term/2.

+ term_to_binary/1 + and + binary_to_term/2.

- Decodes an Erlang external term format binary. + Decode an Erlang external term format binary.

As binary_to_term/1, but takes options that affect decoding - of the binary.

+ of the binary.

+

Option:

safe

Use this option when receiving binaries from an untrusted - source.

+ source.

When enabled, it prevents decoding data that can be used to - attack the Erlang system. In the event of receiving unsafe - data, decoding fails with a badarg error.

+ attack the Erlang system. In the event of receiving unsafe + data, decoding fails with a badarg error.

This prevents creation of new atoms directly, - creation of new atoms indirectly (as they are embedded in - certain structures, such as process identifiers, - refs, and funs), and - creation of new external function references. - None of those resources are garbage collected, so unchecked - creation of them can exhaust available memory.

+ creation of new atoms indirectly (as they are embedded in + certain structures, such as process identifiers, + refs, and funs), and + creation of new external function references. + None of those resources are garbage collected, so unchecked + creation of them can exhaust available memory.

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

+ data is decoded.

See also - term_to_binary/1, - binary_to_term/1, - and - list_to_existing_atom/1.

+ term_to_binary/1, + + binary_to_term/1, and + + list_to_existing_atom/1.

- Returns the size of a bitstring. + Return the size of a bitstring.

Returns an integer that is the size in bits of Bitstring, for example:

@@ -544,7 +556,7 @@ - Converts a bitstring to a list. + Convert a bitstring to a list.

Returns a list of integers corresponding to the bytes of Bitstring. If the number of bits in the binary @@ -555,14 +567,14 @@ - Increments the reduction counter. + Increment the reduction counter.

This implementation-dependent function increments the reduction counter for the calling process. In the Beam emulator, the reduction counter is normally incremented by one for each function and BIF call. A context switch is forced when the counter reaches the maximum number of - reductions for a process (2000 reductions in OTP R12B).

+ reductions for a process (2000 reductions in Erlang/OTP R12B).

This BIF can be removed in a future version of the Beam machine without prior warning. It is unlikely to be @@ -573,13 +585,12 @@ - Returns the size of a bitstring (or binary). + Return the size of a bitstring (or binary).

Returns an integer that is the number of bytes needed to contain Bitstring. That is, if the number of bits in Bitstring is not divisible by 8, the resulting - number of bytes is rounded up.

-

Examples:

+ number of bytes is rounded up. Examples:

 > byte_size(<<433:16,3:3>>).
 3
@@ -591,134 +602,126 @@
 
     
       
-      Cancels a timer.
+      Cancel a timer.
       
         

Cancels a timer. The same as calling - erlang:cancel_timer(TimerRef, - []).

+ + erlang:cancel_timer(TimerRef, []).

- Cancels a timer. - -

- Cancels a timer that has been created by - erlang:start_timer(), - or erlang:send_after(). - TimerRef identifies the timer, and - was returned by the BIF that created the timer. -

-

Available Options:

+ Cancel a timer. + +

Cancels a timer that has been created by + + erlang:start_timer or + erlang:send_after. + TimerRef identifies the timer, and + was returned by the BIF that created the timer.

+

Options:

{async, Async} -

- Asynchronous request for cancellation. Async - defaults to false which will cause the - cancellation to be performed synchronously. When - Async is set to true, the cancel - operation is performed asynchronously. That is, - erlang:cancel_timer() will send an asynchronous - request for cancellation to the timer service that - manages the timer, and then return ok. -

-
+

Asynchronous request for cancellation. Async + defaults to false, which causes the + cancellation to be performed synchronously. When + Async is set to true, the cancel + operation is performed asynchronously. That is, + cancel_timer() sends an asynchronous + request for cancellation to the timer service that + manages the timer, and then returns ok.

+ {info, Info} -

- Request information about the Result - of the cancellation. Info defaults to true - which means the Result is - given. When Info is set to false, no - information about the result of the cancellation - is given. When the operation is performed

- - synchronously - -

- If Info is true, the Result is - returned by erlang:cancel_timer(); otherwise, - ok is returned. -

-
- asynchronously - -

- If Info is true, a message on the form - {cancel_timer, TimerRef, - Result} is sent to the - caller of erlang:cancel_timer() when the - cancellation operation has been performed; otherwise, - no message is sent. -

-
-
-
-
-

- More Options may be added in the future. -

-

If Result is an integer, it represents - the time in milli-seconds left until the canceled timer would - have expired.

-

- If Result is false, a - timer corresponding to TimerRef could not - be found. This can be either because the timer had expired, - already had been canceled, or because TimerRef - never corresponded to a timer. Even if the timer had expired, - it does not tell you whether or not the timeout message has - arrived at its destination yet. -

- -

- The timer service that manages the timer may be co-located - with another scheduler than the scheduler that the calling - process is executing on. If this is the case, communication - with the timer service takes much longer time than if it - is located locally. If the calling process is in critical - path, and can do other things while waiting for the result - of this operation, or is not interested in the result of - the operation, you want to use option {async, true}. - If using option {async, false}, the calling - process blocks until the operation has been performed. -

-
-

See also +

Requests information about the Result + of the cancellation. Info defaults to true, + which means the Result is + given. When Info is set to false, no + information about the result of the cancellation + is given.

+ + +

When the operation is performed synchronously: + if Info is true, the Result is + returned by erlang:cancel_timer(). otherwise + ok is returned.

+
+ +

When the operation is performed asynchronously: + if Info is true, a message on the form + {cancel_timer, TimerRef, + Result} is sent to the + caller of erlang:cancel_timer() when the + cancellation operation has been performed, otherwise + no message is sent.

+
+
+ + +

More Options may be added in the future.

+

If Result is an integer, it represents + the time in milliseconds left until the canceled timer would + have expired.

+

If Result is false, a + timer corresponding to TimerRef could not + be found. This can be either because the timer had expired, + already had been canceled, or because TimerRef + never corresponded to a timer. Even if the timer had expired, + it does not tell you if the time-out message has + arrived at its destination yet.

+ +

The timer service that manages the timer can be co-located + with another scheduler than the scheduler that the calling + process is executing on. If so, communication + with the timer service takes much longer time than if it + is located locally. If the calling process is in critical + path, and can do other things while waiting for the result + of this operation, or is not interested in the result of + the operation, you want to use option {async, true}. + If using option {async, false}, the calling + process blocks until the operation has been performed.

+
+

See also erlang:send_after/4, - erlang:start_timer/4, - and - erlang:read_timer/2.

+ + erlang:start_timer/4, and + + erlang:read_timer/2.

+ - Checks if a module has old code. + Check if a module has old code.

Returns true if Module has old code, - otherwise false.

-

See also code(3).

+ otherwise false.

+

See also + kernel:code(3).

- Checks if a process executes old code for a module. + Check if a process executes old code for a module.

The same as - erlang:check_process_code(Pid, Module, []).

+ + check_process_code(Pid, Module, []) + .

- Checks if a process executes old code for a module. + Check if a process executes old code for a module. -

Checks if the node local process identified by Pid - executes old code for Module.

-

The available Options are as follows:

+

Checks if the node local process identified by + Pid + executes old code for Module.

+

Options:

{allow_gc, boolean()} @@ -726,30 +729,30 @@ the operation. If {allow_gc, false} is passed, and a garbage collection is needed to determine the result of the operation, the operation is aborted (see - information on CheckResult in the following). + information on CheckResult below). The default is to allow garbage collection, that is, {allow_gc, true}.

-
+ {async, RequestId}

The function check_process_code/3 returns the value async immediately after the request has been sent. When the request has been processed, the process that called this function is passed a - message on the form - {check_process_code, RequestId, CheckResult}.

-
+ message on the form {check_process_code, RequestId, + CheckResult}.

+

If Pid equals self(), and - no async option has been passed, the operation - is performed at once. Otherwise a request for - the operation is sent to the process identified by - Pid, and is handled when - appropriate. If no async option has been passed, - the caller blocks until CheckResult - is available and can be returned.

+ no async option has been passed, the operation + is performed at once. Otherwise a request for + the operation is sent to the process identified by + Pid, and is handled when + appropriate. If no async option has been passed, + the caller blocks until CheckResult + is available and can be returned.

CheckResult informs about the result of - the request as follows:

+ the request as follows:

true @@ -759,54 +762,59 @@ code for this module, or the process has references to old code for this module, or the process contains funs that references old code for this module.

-
+ false

The process identified by Pid does not execute old code for Module.

-
+ aborted

The operation was aborted, as the process needed to be garbage collected to determine the operation result, and the operation was requested - by passing option {allow_gc, false}.

+ by passing option {allow_gc, false}.

+
-

See also code(3).

+

See also + kernel:code(3).

Failures:

badarg - If Pid is not a node local process identifier. - + If Pid is not a node local process + identifier. + badarg If Module is not an atom. - + badarg If OptionList is an invalid list of options. - +
- Converts time unit of a time value. + Convert time unit of a time value. -

Converts the Time value of time unit - FromUnit to the corresponding - ConvertedTime value of time unit - ToUnit. The result is rounded - using the floor function.

- -

You may lose accuracy and precision when converting - between time units. In order to minimize such loss, collect all - data at native time unit and do the conversion on the end - result.

+

Converts the Time value of time unit + FromUnit to the corresponding + ConvertedTime value of time unit + ToUnit. The result is rounded + using the floor function.

+ +

You can lose accuracy and precision when converting + between time units. To minimize such loss, collect all + data at native time unit and do the conversion on the end + result.

+
+ - Computes crc32 (IEEE 802.3) checksum. + Compute crc32 (IEEE 802.3) checksum.

Computes and returns the crc32 (IEEE 802.3 style) checksum for Data.

@@ -815,37 +823,37 @@ - Computes crc32 (IEEE 802.3) checksum. + Compute crc32 (IEEE 802.3) checksum.

Continues computing the crc32 checksum by combining - the previous checksum, OldCrc, with the checksum of - Data.

+ the previous checksum, OldCrc, with the checksum + of Data.

The following code:

- X = erlang:crc32(Data1), - Y = erlang:crc32(X,Data2). +X = erlang:crc32(Data1), +Y = erlang:crc32(X,Data2).

assigns the same value to Y as this:

- Y = erlang:crc32([Data1,Data2]). +Y = erlang:crc32([Data1,Data2]).
- Combines two crc32 (IEEE 802.3) checksums. + Combine two crc32 (IEEE 802.3) checksums.

Combines two previously computed crc32 checksums. - This computation requires the size of the data object for - the second checksum to be known.

+ This computation requires the size of the data object for + the second checksum to be known.

The following code:

- Y = erlang:crc32(Data1), - Z = erlang:crc32(Y,Data2). +Y = erlang:crc32(Data1), +Z = erlang:crc32(Y,Data2).

assigns the same value to Z as this:

- X = erlang:crc32(Data1), - Y = erlang:crc32(Data2), - Z = erlang:crc32_combine(X,Y,iolist_size(Data2)). +X = erlang:crc32(Data1), +Y = erlang:crc32(Data2), +Z = erlang:crc32_combine(X,Y,iolist_size(Data2)).
@@ -855,8 +863,7 @@

Returns the current date as {Year, Month, Day}.

The time zone and Daylight Saving Time correction depend on - the underlying OS.

-

Example:

+ the underlying OS. Example:

 > date().
 {1995,2,19}
@@ -865,28 +872,29 @@ - Extracts a protocol packet from a binary. + Extract a protocol packet from a binary.

Decodes the binary Bin according to the packet - protocol specified by Type. Similar to the packet - handling done by sockets with option {packet,Type}.

+ protocol specified by Type. Similar to the packet + handling done by sockets with option + {packet,Type}.

If an entire packet is contained in Bin, it is - returned together with the remainder of the binary as - {ok,Packet,Rest}.

+ returned together with the remainder of the binary as + {ok,Packet,Rest}.

If Bin does not contain the entire packet, - {more,Length} is returned. - Length is either the - expected total size of the packet, or undefined - if the expected packet size is unknown. decode_packet - can then be called again with more data added.

+ {more,Length} is returned. + Length is either the + expected total size of the packet, or undefined + if the expected packet size is unknown. decode_packet + can then be called again with more data added.

If the packet does not conform to the protocol format, - {error,Reason} is returned.

-

The following Types are valid:

+ {error,Reason} is returned.

+

Types:

raw | 0

No packet handling is done. The entire binary is - returned unless it is empty.

+ returned unless it is empty.

1 | 2 | 4 @@ -898,10 +906,10 @@ line -

A packet is a line terminated by a delimiter byte, - default is the latin1 newline character. The delimiter - byte is included in the returned packet unless the line - was truncated according to option line_length.

+

A packet is a line-terminated by a delimiter byte, + default is the latin-1 newline character. The delimiter + byte is included in the returned packet unless the line + was truncated according to option line_length.

asn1 | cdr | sunrm | fcgi | tpkt @@ -918,53 +926,51 @@ http | httph | http_bin | httph_bin

The Hypertext Transfer Protocol. The packets - are returned with the format according to - HttpPacket described earlier. - A packet is either a - request, a response, a header, or an end of header - mark. Invalid lines are returned as - HttpError.

+ are returned with the format according to + HttpPacket described earlier. + A packet is either a + request, a response, a header, or an end of header + mark. Invalid lines are returned as + HttpError.

Recognized request methods and header fields are returned - as atoms. Others are returned as strings. Strings of - unrecognized header fields are formatted with only - capital letters first and after hyphen characters, for - example, "Sec-Websocket-Key".

+ as atoms. Others are returned as strings. Strings of + unrecognized header fields are formatted with only + capital letters first and after hyphen characters, for + example, "Sec-Websocket-Key".

The protocol type http is only to be used for - the first line when an HttpRequest or an - HttpResponse is expected. - The following calls are to use httph to get - HttpHeaders until - http_eoh is returned, which marks the end of the - headers and the beginning of any following message body.

+ the first line when an HttpRequest or an + HttpResponse is expected. + The following calls are to use httph to get + HttpHeaders until + http_eoh is returned, which marks the end of the + headers and the beginning of any following message body.

The variants http_bin and httph_bin return - strings (HttpString) as binaries instead of lists.

+ strings (HttpString) as binaries instead of lists.

-

The following options are available:

- - {packet_size, integer() >= 0} - -

Sets the maximum allowed size of the packet body. - If the packet header indicates that the length of the - packet is longer than the maximum allowed length, the - packet is considered invalid. Default is 0, which means - no size limit.

-
- {line_length, integer() >= 0} - +

Options:

+ + {packet_size, integer() >= 0} +

Sets the maximum allowed size of the packet body. + If the packet header indicates that the length of the + packet is longer than the maximum allowed length, the + packet is considered invalid. Defaults to 0, which means + no size limit.

+
+ {line_length, integer() >= 0} +

For packet type line, lines longer than the indicated length are truncated.

-

Option line_length also applies to http* - packet types as an alias for option packet_size - if packet_size itself is not set. This use is - only intended for backward compatibility.

-
- {line_delimiter, 0 =< byte() =< 255} - -

For packet type line, sets the delimiting byte. - Default is the latin1 character $\n.

-
-
+

Option line_length also applies to http* + packet types as an alias for option packet_size + if packet_size itself is not set. This use is + only intended for backward compatibility.

+
+ {line_delimiter, 0 =< byte() =< 255} +

For packet type line, sets the delimiting byte. + Default is the latin-1 character $\n.

+
+

Examples:

 > erlang:decode_packet(1,<<3,"abcd">>,[]).
@@ -976,7 +982,7 @@
 
     
       
-      Deletes element at index in a tuple.
+      Delete element at index in a tuple.
       1..tuple_size(Tuple1)
       
         

Returns a new tuple with element at Index @@ -989,16 +995,16 @@ - Makes the current code for a module old. + Make the current code for a module old. -

Makes the current code for Module become old code, - and deletes all references for this module from the export table. +

Makes the current code for Module become old + code and deletes all references for this module from the export table. Returns undefined if the module does not exist, otherwise true.

This BIF is intended for the code server (see - code(3)) and is not - to be used elsewhere.

+ kernel:code(3)) + and is not to be used elsewhere.

Failure: badarg if there already is an old version of Module.

@@ -1007,54 +1013,56 @@ - Stops monitoring. + Stop monitoring.

If MonitorRef is a reference that the calling process obtained by calling - monitor/2, + monitor/2, this monitoring is turned off. If the monitoring is already turned off, nothing happens.

Once demonitor(MonitorRef) has returned, it is guaranteed that no {'DOWN', MonitorRef, _, _, _} message, because of the monitor, will be placed in the caller message queue - in the future. A {'DOWN', + in the future. However, a {'DOWN', MonitorRef, _, _, _} message can have been placed in the caller message queue before - the call, though. It is therefore usually advisable + the call. It is therefore usually advisable to remove such a 'DOWN' message from the message queue after monitoring has been stopped. - demonitor(MonitorRef, [flush]) - can be used instead of - demonitor(MonitorRef) if this cleanup is wanted.

+ + demonitor(MonitorRef, [flush]) + can be used instead of demonitor(MonitorRef) + if this cleanup is wanted.

-

Prior to OTP release R11B (ERTS version 5.5) demonitor/1 - behaved completely asynchronously, i.e., the monitor was active +

Before Erlang/OTP R11B (ERTS 5.5) demonitor/1 + behaved completely asynchronously, that is, the monitor was active until the "demonitor signal" reached the monitored entity. This had one undesirable effect. You could never know when you were guaranteed not to receive a DOWN message - due to the monitor.

-

Current behavior can be viewed as two combined operations: + because of the monitor.

+

The current behavior can be viewed as two combined operations: asynchronously send a "demonitor signal" to the monitored entity - and ignore any future results of the monitor.

+ and ignore any future results of the monitor.

Failure: It is an error if MonitorRef refers to a monitoring started by another process. Not all such cases are cheap to check. If checking is cheap, the call fails with - badarg for example, if MonitorRef is a + badarg, for example if MonitorRef is a remote reference.

- Stops monitoring. + Stop monitoring.

The returned value is true unless info is part of OptionList.

demonitor(MonitorRef, []) is equivalent to - demonitor(MonitorRef).

-

The available Options are as follows:

+ + demonitor(MonitorRef).

+

Options:

flush @@ -1065,28 +1073,28 @@

Calling demonitor(MonitorRef, [flush]) is equivalent to the following, but more efficient:

- demonitor(MonitorRef), - receive - {_, MonitorRef, _, _, _} -> - true - after 0 -> - true - end +demonitor(MonitorRef), +receive + {_, MonitorRef, _, _, _} -> + true +after 0 -> + true +end
info

The returned value is one of the following:

true - The monitor was found and removed. In this case, +

The monitor was found and removed. In this case, no 'DOWN' message corresponding to this - monitor has been delivered and will not be delivered. + monitor has been delivered and will not be delivered.

false - The monitor was not found and could not be removed. +

The monitor was not found and could not be removed. This probably because someone already has placed a 'DOWN' message corresponding to this monitor - in the caller message queue. + in the caller message queue.

If option info is combined with option flush, @@ -1101,21 +1109,21 @@ badarg If OptionList is not a list. - + badarg If Option is an invalid option. - + badarg The same failure as for - demonitor/1. - + demonitor/1. + - Forces the disconnection of a node. + Force the disconnection of a node.

Forces the disconnection of a node. This appears to the node Node as if the local node has crashed. @@ -1129,7 +1137,7 @@ - Prints a term on standard output. + Print a term on standard output.

Prints a text representation of Term on the standard output.

@@ -1141,7 +1149,7 @@ - Returns the Nth element of a tuple. + Return the Nth element of a tuple. 1..tuple_size(Tuple)

Returns the Nth element (numbering from 1) of @@ -1155,7 +1163,7 @@ b

- Returns and deletes the process dictionary. + Return and delete the process dictionary.

Returns the process dictionary and deletes it, for example:

@@ -1169,13 +1177,13 @@ b
- Returns and deletes a value from the process dictionary. + Return and delete a value from the process dictionary. +

Returns the value Val associated with Key and deletes it from the process dictionary. Returns undefined if no value is associated with - Key.

-

Example:

+ Key. Example:

 > put(key1, {merry, lambs, are, playing}),
 X = erase(key1),
@@ -1186,16 +1194,15 @@ b
- Stops execution with a given reason. + Stop execution with a specified reason.

Stops the execution of the calling process with the reason Reason, where Reason is any term. The exit reason is {Reason, Where}, where Where is a list of the functions most recently called (the current - function first). Since evaluating this function causes - the process to terminate, it has no return value.

-

Example:

+ function first). As evaluating this function causes + the process to terminate, it has no return value. Example:

 > catch error(foobar).
 {'EXIT',{foobar,[{erl_eval,do_apply,5},
@@ -1208,7 +1215,7 @@ b
- Stops execution with a given reason. + Stop execution with a specified reason.

Stops the execution of the calling process with the reason Reason, where Reason @@ -1218,21 +1225,20 @@ b

function first). Args is expected to be the list of arguments for the current function; in Beam it is used to provide the arguments for the current function in - the term Where. Since evaluating this function causes + the term Where. As evaluating this function causes the process to terminate, it has no return value.

- Stops execution with a given reason. + Stop execution with a specified reason.

Stops the execution of the calling process with exit reason Reason, where Reason - is any term. Since + is any term. As evaluating this function causes the process to terminate, it - has no return value.

-

Example:

+ has no return value. Example:

 > exit(foobar).
 ** exception exit: foobar
@@ -1243,44 +1249,44 @@ b
- Sends an exit signal to a process or a port. + Send an exit signal to a process or a port.

Sends an exit signal with exit reason Reason to the process or port identified by Pid.

The following behavior applies if Reason is any term, except normal or kill:

- - - If Pid is not trapping exits, - Pid - itself exits with exit reason Reason. - - If Pid is trapping exits, the exit - signal is transformed into a message - {'EXIT', From, Reason} - and delivered to the message queue of Pid. - - From is the process identifier of the process - that sent the exit signal. See also - process_flag/2. - - -

If Reason is the atom normal, + +

If Pid is not trapping exits, Pid - does not exit. If it is trapping exits, the exit signal is - transformed into a message {'EXIT', From, normal} - and delivered to its message queue.

-

If Reason is the atom kill, - that is, if exit(Pid, kill) is called, - an untrappable exit signal is sent to Pid, - which unconditionally exits with exit reason killed. -

+ itself exits with exit reason Reason.

+ +

If Pid is trapping exits, the exit + signal is transformed into a message + {'EXIT', From, Reason} + and delivered to the message queue of Pid.

+
+

From is the process identifier of the process + that sent the exit signal. See also + + process_flag/2.

+
+ +

If Reason is the atom normal, + Pid + does not exit. If it is trapping exits, the exit signal is + transformed into a message {'EXIT', From, normal} + and delivered to its message queue.

+

If Reason is the atom kill, + that is, if exit(Pid, kill) is called, + an untrappable exit signal is sent to Pid, + which unconditionally exits with exit reason killed.

- Calculates the maximum size for a term encoded in the Erlang external term format. + Calculate the maximum size for a term encoded in the Erlang + external term format.

Calculates, without doing the encoding, the maximum byte size for a term encoded in the Erlang external term format. The following @@ -1291,13 +1297,15 @@ b

> true = Size1 =< Size2. true

This is equivalent to a call to:

-erlang:external_size(Term, []) + +erlang:external_size(Term, [])
- Calculates the maximum size for a term encoded in the Erlang external term format. + Calculate the maximum size for a term encoded in the Erlang + external term format.

Calculates, without doing the encoding, the maximum byte size for a term encoded in the Erlang external term format. The following @@ -1309,13 +1317,14 @@ true true

Option {minor_version, Version} specifies how floats are encoded. For a detailed description, see - term_to_binary/2.

+ + term_to_binary/2.

- Converts a number to a float. + Convert a number to a float.

Returns a float by converting Number to a float, for example:

@@ -1326,7 +1335,8 @@ true

If used on the top level in a guard, it tests whether the argument is a floating point number; for clarity, use - is_float/1 instead.

+ is_float/1 + instead.

When float/1 is used in an expression in a guard, such as 'float(A) == 4.0', it converts a number as described earlier.

@@ -1345,13 +1355,14 @@ true - Text representation of a float formatted using given options. + Text representation of a float formatted using specified + options.

Returns a binary corresponding to the text representation of Float using fixed decimal point formatting. Options behaves in the same - way as float_to_list/2.

-

Examples:

+ way as + float_to_list/2. Examples:

 > float_to_binary(7.12, [{decimals, 4}]).
 <<"7.1200">>
@@ -1371,27 +1382,29 @@ true
- Text representation of a float formatted using given options. + Text representation of a float formatted using specified + options.

Returns a string corresponding to the text representation - of Float using fixed decimal point formatting. The - options are as follows:

+ of Float using fixed decimal point formatting.

+

Available options:

- If option decimals is specified, the returned value +

If option decimals is specified, the returned value contains at most Decimals number of digits past the - decimal point. If the number does not fit in the internal - static buffer of 256 bytes, the function throws badarg. + decimal point. If the number does not fit in the internal + static buffer of 256 bytes, the function throws badarg.

- If option compact is provided, the trailing zeros +

If option compact is specified, the trailing zeros at the end of the list are truncated. This option is only - meaningful together with option decimals. + meaningful together with option decimals.

- If option scientific is provided, the float is +

If option scientific is specified, the float is formatted using scientific notation with Decimals - digits of precision. + digits of precision.

- If Options is [], the function behaves as - float_to_list/1. +

If Options is [], the function behaves as + + float_to_list/1.

Examples:

@@ -1418,16 +1431,16 @@ true

Two types of funs have slightly different semantics:

- A fun created by fun M:F/A is called an +

A fun created by fun M:F/A is called an external fun. Calling it will always call the function F with arity A in the latest code for module M. Notice that module M does not even - need to be loaded when the fun fun M:F/A is created. + need to be loaded when the fun fun M:F/A is created.

- All other funs are called local. When a local fun +

All other funs are called local. When a local fun is called, the same version of the code that created the fun is called (even if a newer version of the module has been - loaded). + loaded).

The following elements are always present in the list @@ -1491,14 +1504,14 @@ true {new_uniq, Uniq}

Uniq (a binary) is a unique value for this fun. It - is calculated from the compiled code for the entire module.

+ is calculated from the compiled code for the entire module.

{uniq, Uniq}

Uniq (an integer) is a unique value for this fun. - As from OTP R15, this integer is calculated from the - compiled code for the entire module. Before OTP R15, this - integer was based on only the body of the fun.

+ As from Erlang/OTP R15, this integer is calculated from the + compiled code for the entire module. Before Erlang/OTP R15, this + integer was based on only the body of the fun.

@@ -1520,7 +1533,7 @@ true uniq, and pid. For an external fun, the value of any of these items is always the atom undefined.

See - erlang:fun_info/1.

+ erlang:fun_info/1.

@@ -1535,20 +1548,24 @@ true - Checks if a function is exported and loaded. + Check if a function is exported and loaded. -

Returns true if the module Module is loaded - and contains an exported function Function/Arity, - or if there is a BIF (a built-in function implemented in C) - with the given name, otherwise returns false.

-

This function used to return false for built-in - functions before the 18.0 release.

+

Returns true if the module Module is + loaded and contains an exported function + Function/Arity, + or if there is a BIF (a built-in function implemented in C) + with the specified name, otherwise returns false.

+ +

This function used to return false for BIFs + before Erlang/OTP 18.0.

+
- Forces an immediate garbage collection of the calling process. + Force an immediate garbage collection of the calling process. +

Forces an immediate garbage collection of the executing process. The function is not to be used unless @@ -1563,73 +1580,76 @@ true - Garbage collects a process. + Garbage collect a process.

The same as - garbage_collect(Pid, []).

+ + garbage_collect(Pid, []).

- Garbage collects a process. + Garbage collect a process.

Garbage collects the node local process identified by - Pid.

-

The available Options are as follows:

+ Pid.

+

Option:

{async, RequestId} The function garbage_collect/2 returns - the value async immediately after the request - has been sent. When the request has been processed, the - process that called this function is passed a message on + the value async immediately after the request + has been sent. When the request has been processed, the + process that called this function is passed a message on the form {garbage_collect, RequestId, GCResult}. -

If Pid equals self(), and - no async option has been passed, the garbage - collection is performed at once, that is, the same as calling - garbage_collect/0. - Otherwise a request for garbage collection - is sent to the process identified by Pid, - and will be handled when appropriate. If no async - option has been passed, the caller blocks until - GCResult is available and can be returned.

-

GCResult informs about the result of - the garbage collection request as follows:

+

If Pid equals self(), and + no async option has been passed, the garbage + collection is performed at once, that is, the same as calling + + garbage_collect/0. + Otherwise a request for garbage collection + is sent to the process identified by Pid, + and will be handled when appropriate. If no async + option has been passed, the caller blocks until + GCResult is available and can be returned.

+

GCResult informs about the result of + the garbage collection request as follows:

true - The process identified by Pid has - been garbage collected. - + The process identified by Pid has + been garbage collected. + false - No garbage collection was performed, as - the process identified by Pid - terminated before the request could be satisfied. - + No garbage collection was performed, as + the process identified by Pid + terminated before the request could be satisfied. +

Notice that the same caveats apply as for - garbage_collect/0.

+ + garbage_collect/0.

Failures:

badarg - If Pid is not a node local process identifier. - + If Pid is not a node local process identifier. + badarg - If OptionList is an invalid list of options. - + If OptionList is an invalid list of options. +
- Returns the process dictionary. + Return the process dictionary.

Returns the process dictionary as a list of {Key, Val} tuples, for example:

@@ -1644,12 +1664,11 @@ true - Returns a value from the process dictionary. + Return a value from the process dictionary. -

Returns the value Val associated with Key in - the process dictionary, or undefined if Key - does not exist.

-

Example:

+

Returns the value Val associated with + Key in the process dictionary, or undefined + if Key does not exist. Example:

 > put(key1, merry),
 put(key2, lambs),
@@ -1661,7 +1680,7 @@ true
- Gets the magic cookie of the local node. + Get the magic cookie of the local node.

Returns the magic cookie of the local node if the node is alive, otherwise the atom nocookie.

@@ -1670,9 +1689,11 @@ true - Return a list of all keys from the process dictionary + Return a list of all keys from the process dictionary. + -

Returns a list of keys all keys present in the process dictionary.

+

Returns a list of all keys present in the process dictionary, + for example:

 > put(dog, {animal,1}),
 put(cow, {animal,2}),
@@ -1681,9 +1702,10 @@ true
[dog,cow,lamb]
+ - Returns a list of keys from the process dictionary. + Return a list of keys from the process dictionary.

Returns a list of keys that are associated with the value Val in the process dictionary, for example:

@@ -1701,48 +1723,49 @@ true - Gets the call stack back-trace of the last exception. + Get the call stack back-trace of the last exception.

Gets the call stack back-trace (stacktrace) of the last exception in the calling process as a list of - {Module,Function,Arity,Location} tuples. - Field Arity in the first tuple can be the + {Module,Function,Arity,Location} + tuples. Field Arity in the first tuple can be the argument list of that function call instead of an arity integer, depending on the exception.

If there has not been any exceptions in a process, the stacktrace is []. After a code change for the process, the stacktrace can also be reset to [].

-

The stacktrace is the same data as the catch operator +

The stacktrace is the same data as operator catch returns, for example:

-

{'EXIT',{badarg,Stacktrace}} = catch abs(x)

-

Location is a (possibly empty) list +

+{'EXIT',{badarg,Stacktrace}} = catch abs(x)
+

Location is a (possibly empty) list of two-tuples that - can indicate the location in the source code of the function. - The first element is an atom describing the type of - information in the second element. The following - items can occur:

- - file - The second element of the tuple is a string (list of - characters) representing the file name of the source file - of the function. - - line - The second element of the tuple is the line number - (an integer greater than zero) in the source file - where the exception occurred or the function was called. - - + can indicate the location in the source code of the function. + The first element is an atom describing the type of + information in the second element. The following + items can occur:

+ + file + The second element of the tuple is a string (list of + characters) representing the filename of the source file + of the function. + + line + The second element of the tuple is the line number + (an integer > 0) in the source file + where the exception occurred or the function was called. + +

See also - erlang:error/1 and - erlang:error/2.

+ error/1 and + error/2.

- Gets the group leader for the calling process. + Get the group leader for the calling process.

Returns the process identifier of the group leader for the process evaluating the function.

@@ -1750,14 +1773,14 @@ true groups have a group leader. All I/O from the group is channeled to the group leader. When a new process is spawned, it gets the same group leader as the spawning - process. Initially, at system start-up, init is both + process. Initially, at system startup, init is both its own group leader and the group leader of all processes.

- Sets the group leader for a process. + Set the group leader for a process.

Sets the group leader of Pid to GroupLeader. @@ -1765,72 +1788,72 @@ true certain shell is to have another group leader than init.

See also - group_leader/0.

+ group_leader/0.

- Halts the Erlang runtime system and indicates normal exit to the calling environment. + Halt the Erlang runtime system and indicate normal exit to + the calling environment. -

The same as - halt(0, []).

-

Example:

+

The same as + halt(0, []). Example:

 > halt().
-os_prompt% 
+os_prompt%
- Halts the Erlang runtime system. + Halt the Erlang runtime system. -

The same as - halt(Status, []).

-

Example:

+

The same as + halt(Status, []). Example:

 > halt(17).
 os_prompt% echo $?
 17
-os_prompt% 
+os_prompt%
- Halts the Erlang runtime system. + Halt the Erlang runtime system.

Status must be a non-negative integer, a string, - or the atom abort. - Halts the Erlang runtime system. Has no return value. - Depending on Status, the following occurs:

- - integer() - The runtime system exits with integer value - Status - as status code to the calling environment (OS). - - string() - An Erlang crash dump is produced with Status - as slogan. Then the runtime system exits with status code 1. - Note that only code points in the range 0-255 may be used - and the string will be truncated if longer than 200 characters. - - abort - - The runtime system aborts producing a core dump, if that is - enabled in the OS. - - -

On many platforms, the OS supports only status - codes 0-255. A too large status code will be truncated by clearing - the high bits.

-

For integer Status, the Erlang runtime system + or the atom abort. + Halts the Erlang runtime system. Has no return value. + Depending on Status, the following occurs:

+ + integer() + The runtime system exits with integer value + Status + as status code to the calling environment (OS). + + string() + An Erlang crash dump is produced with Status + as slogan. Then the runtime system exits with status code 1. + Note that only code points in the range 0-255 may be used + and the string will be truncated if longer than 200 characters. + + abort + The runtime system aborts producing a core dump, if that is + enabled in the OS. + + + +

On many platforms, the OS supports only status + codes 0-255. A too large status code is truncated by clearing + the high bits.

+
+

For integer Status, the Erlang runtime system closes all ports and allows async threads to finish their operations before exiting. To exit without such flushing, use - Option as {flush,false}.

-

For statuses string() and abort, option + Option as {flush,false}.

+

For statuses string() and abort, option flush is ignored and flushing is not done.

@@ -1842,13 +1865,15 @@ os_prompt%

Returns a hash value for Term within the range 1..Range. The maximum range is 1..2^27-1.

-

This BIF is deprecated, as the hash value can differ on - different architectures. The hash values for integer - terms higher than 2^27 and large binaries are +

This BIF is deprecated, as the hash value can differ on + different architectures. The hash values for integer + terms > 2^27 and large binaries are poor. The BIF is retained for backward compatibility reasons (it can have been used to hash records into a file), but all new code is to use one of the BIFs - erlang:phash/2 or erlang:phash2/1,2 instead.

+ erlang:phash/2 or + erlang:phash2/1,2 + instead.

@@ -1870,7 +1895,7 @@ os_prompt% - Hibernates a process until a message is sent to it. + Hibernate a process until a message is sent to it.

Puts the calling process into a wait state where its memory allocation has been reduced as much as possible. This is @@ -1878,15 +1903,15 @@ os_prompt% soon.

The process is awaken when a message is sent to it, and control resumes in Module:Function with - the arguments given by Args with the call + the arguments specified by Args with the call stack emptied, meaning that the process terminates when that function returns. Thus erlang:hibernate/3 never returns to its caller.

If the process has any message in its message queue, the process is awakened immediately in the same way as described earlier.

-

In more technical terms, what erlang:hibernate/3 does - is the following. It discards the call stack for the process, +

In more technical terms, erlang:hibernate/3 + discards the call stack for the process, and then garbage collects the process. After this, all live data is in one continuous heap. The heap is then shrunken to the exact same size as the live data @@ -1898,11 +1923,12 @@ os_prompt% size is changed to a size not smaller than the minimum heap size.

Notice that emptying the call stack means that any surrounding - catch is removed and must be reinserted after + catch is removed and must be re-inserted after hibernation. One effect of this is that processes started using proc_lib (also indirectly, such as gen_server processes), are to use - proc_lib:hibernate/3 + + proc_lib:hibernate/3 in STDLIB instead, to ensure that the exception handler continues to work when the process wakes up.

@@ -1910,15 +1936,16 @@ os_prompt% - Inserts an element at index in a tuple. - 1..tuple_size(Tuple1) + 1 + Insert an element at index in a tuple. + 1..tuple_size(Tuple1) + + 1

Returns a new tuple with element Term - inserted at position - Index in tuple Tuple1. - All elements from position Index and upwards are - pushed one step higher in the new tuple Tuple2.

-

Example:

+ inserted at position + Index in tuple Tuple1. + All elements from position Index and upwards are + pushed one step higher in the new tuple Tuple2. + Example:

 > erlang:insert_element(2, {one, two, three}, new).
 {one,new,two,three}
@@ -1942,8 +1969,8 @@ os_prompt% Text representation of an integer.

Returns a binary corresponding to the text - representation of Integer in base - Base, for example:

+ representation of Integer in base + Base, for example:

 > integer_to_binary(1023, 16).
 <<"3FF">>
@@ -1979,7 +2006,7 @@ os_prompt% Size of an iolist. -

Returns an integer that is the size in bytes +

Returns an integer, that is the size in bytes, of the binary that would be the result of iolist_to_binary(Item), for example:

@@ -1990,7 +2017,7 @@ os_prompt% 
- Converts an iolist to a binary. + Convert an iolist to a binary.

Returns a binary that is made from the integers and binaries in IoListOrBinary, for example:

@@ -2008,7 +2035,7 @@ os_prompt% - Checks whether the local node is alive. + Check whether the local node is alive.

Returns true if the local node is alive (that is, if the node can be part of a distributed system), otherwise @@ -2018,7 +2045,7 @@ os_prompt% - Checks whether a term is an atom. + Check whether a term is an atom.

Returns true if Term is an atom, otherwise false.

@@ -2028,18 +2055,18 @@ os_prompt% - Checks whether a term is a binary. + Check whether a term is a binary.

Returns true if Term is a binary, otherwise false.

-

A binary always contains a complete number of bytes.

+

A binary always contains a complete number of bytes.

Allowed in guard tests.

- Checks whether a term is a bitstring. + Check whether a term is a bitstring.

Returns true if Term is a bitstring (including a binary), otherwise false.

@@ -2049,7 +2076,7 @@ os_prompt% - Checks whether a term is a boolean. + Check whether a term is a boolean.

Returns true if Term is the atom true or the atom false (that is, a boolean). @@ -2060,18 +2087,18 @@ os_prompt% - Checks if a function is a BIF implemented in C. + Check if a function is a BIF implemented in C.

This BIF is useful for builders of cross-reference tools.

Returns true if Module:Function/Arity - is a BIF implemented in C, otherwise false.

+ is a BIF implemented in C, otherwise false.

- Checks whether a term is a float. + Check whether a term is a float.

Returns true if Term is a floating point number, otherwise false.

@@ -2081,7 +2108,7 @@ os_prompt% - Checks whether a term is a fun. + Check whether a term is a fun.

Returns true if Term is a fun, otherwise false.

@@ -2091,7 +2118,8 @@ os_prompt% - Checks whether a term is a fun with a given arity. + Check whether a term is a fun with a specified given arity. +

Returns true if Term is a fun that can be applied with Arity number of arguments, otherwise @@ -2102,7 +2130,7 @@ os_prompt% - Checks whether a term is an integer. + Check whether a term is an integer.

Returns true if Term is an integer, otherwise false.

@@ -2112,7 +2140,7 @@ os_prompt% - Checks whether a term is a list. + Check whether a term is a list.

Returns true if Term is a list with zero or more elements, otherwise false.

@@ -2122,7 +2150,7 @@ os_prompt% - Checks whether a term is a map. + Check whether a term is a map.

Returns true if Term is a map, otherwise false.

@@ -2132,7 +2160,7 @@ os_prompt% - Checks whether a term is a number. + Check whether a term is a number.

Returns true if Term is an integer or a floating point number. Otherwise returns false.

@@ -2142,7 +2170,7 @@ os_prompt% - Checks whether a term is a process identifier. + Check whether a term is a process identifier.

Returns true if Term is a process identifier, otherwise false.

@@ -2152,7 +2180,7 @@ os_prompt% - Checks whether a term is a port. + Check whether a term is a port.

Returns true if Term is a port identifier, otherwise false.

@@ -2162,26 +2190,26 @@ os_prompt% - Checks whether a process is alive. + Check whether a process is alive. -

Pid must refer to a process at the local node.

+

Pid must refer to a process at the local + node.

Returns true if the process exists and is alive, that is, is not exiting and has not exited. Otherwise returns - false. -

+ false.

- Checks whether a term appears to be a record. + Check whether a term appears to be a record.

Returns true if Term is a tuple and its first element is RecordTag. Otherwise returns false.

Normally the compiler treats calls to is_record/2 - specially. It emits code to verify that Term + especially. It emits code to verify that Term is a tuple, that its first element is RecordTag, and that the size is correct. However, if RecordTag is @@ -2195,7 +2223,7 @@ os_prompt% - Checks whether a term appears to be a record. + Check whether a term appears to be a record.

RecordTag must be an atom.

Returns true if @@ -2214,7 +2242,7 @@ os_prompt% - Checks whether a term is a reference. + Check whether a term is a reference.

Returns true if Term is a reference, otherwise false.

@@ -2224,7 +2252,7 @@ os_prompt% - Checks whether a term is a tuple. + Check whether a term is a tuple.

Returns true if Term is a tuple, otherwise false.

@@ -2246,7 +2274,7 @@ os_prompt% - Creates a link to another process (or port). + Create a link to another process (or port).

Creates a link between the calling process and another process (or port) PidOrPort, if there is @@ -2256,34 +2284,34 @@ os_prompt%

If PidOrPort does not exist, the behavior of the BIF depends on if the calling process is trapping exits or not (see - process_flag/2):

+ + process_flag/2):

- If the calling process is not trapping exits, and - checking PidOrPort is cheap - (that is, if PidOrPort - is local), link/1 fails with reason noproc. - Otherwise, if the calling process is trapping exits, - and/or PidOrPort is remote, link/1 - returns true, but an exit signal with reason noproc - is sent to the calling process. +

If the calling process is not trapping exits, and + checking PidOrPort is cheap + (that is, if PidOrPort + is local), link/1 fails with reason noproc.

+

Otherwise, if the calling process is trapping exits, + and/or PidOrPort is remote, link/1 + returns true, but an exit signal with reason noproc + is sent to the calling process.

- Converts from text representation to an atom. + Convert from text representation to an atom.

Returns the atom whose text representation is String.

-

String can only contain ISO-latin-1 - characters (that is, - numbers less than 256) as the implementation does not - allow unicode characters equal to or above 256 in atoms. - For more information on Unicode support in atoms, see - note on UTF-8 +

String can only contain ISO-latin-1 + characters (that is, numbers < 256) as the implementation does not + allow Unicode characters equal to or above 256 in atoms. + For more information on Unicode support in atoms, see + note on UTF-8 encoded atoms - in Section "External Term Format" in the User's Guide.

+ in section "External Term Format" in the User's Guide.

Example:

 > list_to_atom("Erlang").
@@ -2293,7 +2321,7 @@ os_prompt% 
- Converts a list to a binary. + Convert a list to a binary.

Returns a binary that is made from the integers and binaries in IoList, for example:

@@ -2311,13 +2339,13 @@ os_prompt% - Converts a list to a bitstring. + Convert a list to a bitstring.

Returns a bitstring that is made from the integers and bitstrings in BitstringList. (The last tail in - BitstringList is allowed to be a bitstring.)

-

Example:

+ BitstringList is allowed to be a bitstring.) + Example:

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
@@ -2332,7 +2360,7 @@ os_prompt% 
- Converts from text representation to an atom. + Convert from text representation to an atom.

Returns the atom whose text representation is String, @@ -2344,7 +2372,7 @@ os_prompt% - Converts from text representation to a float. + Convert from text representation to a float.

Returns the float whose text representation is String, for example:

@@ -2358,7 +2386,7 @@ os_prompt% - Converts from text representation to an integer. + Convert from text representation to an integer.

Returns an integer whose text representation is String, for example:

@@ -2372,7 +2400,7 @@ os_prompt% - Converts from text representation to an integer. + Convert from text representation to an integer.

Returns an integer whose text representation in base Base is String, @@ -2387,7 +2415,7 @@ os_prompt% - Converts from text representation to a pid. + Convert from text representation to a pid.

Returns a process identifier whose text representation is a String, for example:

@@ -2398,14 +2426,14 @@ os_prompt% representation of a process identifier.

This BIF is intended for debugging and is not to be used - in application programs.

+ in application programs.

- Converts a list to a tuple. + Convert a list to a tuple.

Returns a tuple corresponding to List, for example

@@ -2418,7 +2446,7 @@ os_prompt% - Loads object code for a module. + Load object code for a module.

If Binary contains the object code for module Module, this BIF loads that object code. If @@ -2429,23 +2457,21 @@ os_prompt% that code.

Returns either {module, Module}, or {error, Reason} if loading fails. - Reason is any of the following:

+ Reason is one of the following:

badfile - -

The object code in Binary has an - incorrect format or the object code contains code - for another module than Module.

+ The object code in Binary has an + incorrect format or the object code contains code + for another module than Module. not_purged - -

Binary contains a module that cannot be - loaded because old code for this module already exists.

+ Binary contains a module that cannot be + loaded because old code for this module already exists.

This BIF is intended for the code server (see - code(3)) + kernel:code(3)) and is not to be used elsewhere.

@@ -2453,33 +2479,33 @@ os_prompt% - Loads NIF library. + Load NIF library. -

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

+

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 - the OS-dependent file extension (.so for Unix and - .dll for Windows. For information on how to - implement a NIF library, see - erl_nif.

+ implemented functions (NIFs) for a module. Path + is a file path to the shareable object/dynamic library file minus + the OS-dependent file extension (.so for Unix and + .dll for Windows). For information on how to + implement a NIF library, see + erl_nif.

LoadInfo can be any term. It is passed on to - the library as part of the initialization. A good practice is - to include a module version number to support future code - upgrade scenarios.

+ the library as part of the initialization. A good practice is + to include a module version number to support future code + upgrade scenarios.

The call to load_nif/2 must be made - directly from the Erlang code of the module that the - NIF library belongs to. It returns either ok, or - {error,{Reason,Text}} if loading fails. - Reason is one of the following atoms - while Text is a human readable string that - can give more information about the failure:

+ directly from the Erlang code of the module that the + NIF library belongs to. It returns either ok, or + {error,{Reason,Text}} if loading fails. + Reason is one of the following atoms + while Text is a human readable string that + can give more information about the failure:

load_failed The OS failed to load the NIF library. @@ -2502,11 +2528,12 @@ os_prompt% - Lists all loaded modules. + List all loaded modules.

Returns a list of all loaded Erlang modules (current and old code), including preloaded modules.

-

See also code(3).

+

See also + kernel:code(3).

@@ -2527,13 +2554,13 @@ os_prompt% - Converts from local to Universal Time Coordinated (UTC) date and time. + Convert from local to Universal Time Coordinated (UTC) date + and time.

Converts local date and time to Universal Time Coordinated (UTC), if supported by the underlying OS. Otherwise no conversion is done and Localtime - is returned.

-

Example:

+ is returned. Example:

 > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}).
 {{1996,11,6},{13,45,17}}
@@ -2544,15 +2571,16 @@ os_prompt% - Converts from local to Universal Time Coordinated (UTC) date and time. + Convert from local to Universal Time Coordinated (UTC) date + and time.

Converts local date and time to Universal Time Coordinated (UTC) as erlang:localtime_to_universaltime/1, but the caller decides if Daylight Saving Time is active.

-

If IsDst == true, Localtime is - during Daylight Saving Time, if IsDst == false it is - not. If IsDst == undefined, the underlying OS can - guess, which is the same as calling +

If IsDst == true, Localtime + is during Daylight Saving Time, if IsDst == false + it is not. If IsDst == undefined, the underlying + OS can guess, which is the same as calling erlang:localtime_to_universaltime(Localtime).

Examples:

@@ -2569,24 +2597,27 @@ os_prompt% 
- Returns a unique reference. + Return a unique reference. -

Returns a unique - reference. The reference is unique among - connected nodes.

-

Known issue: When a node is restarted multiple - times with the same node name, references created - on a newer node can be mistaken for a reference - created on an older node with the same node name.

+

Returns a + + unique reference. The reference is unique among + connected nodes.

+ +

Known issue: When a node is restarted multiple + times with the same node name, references created + on a newer node can be mistaken for a reference + created on an older node with the same node name.

+
- Creates a new tuple of a given arity. + Create a new tuple of a specified arity. -

Creates a new tuple of the given Arity, where all - elements are InitialValue, for example:

+

Creates a new tuple of the specified Arity, where + all elements are InitialValue, for example:

 > erlang:make_tuple(4, []).
 {[],[],[],[]}
@@ -2595,17 +2626,16 @@ os_prompt% - Creates a new tuple with given arity and contents. + Create a new tuple with specifed arity and contents.

Creates a tuple of size Arity, where each element has value DefaultValue, and then fills in - values from InitList. + values from InitList. Each list element in InitList - must be a two-tuple, where the first element is a position in the - newly created tuple and the second element is any term. If a - position occurs more than once in the list, the term corresponding - to the last occurrence is used.

-

Example:

+ must be a two-tuple, where the first element is a position in the + newly created tuple and the second element is any term. If a + position occurs more than once in the list, the term corresponding + to the last occurrence is used. Example:

 > erlang:make_tuple(5, [], [{2,ignored},{5,zz},{2,aa}]).
 {{[],aa,[],[],zz}
@@ -2614,7 +2644,7 @@ os_prompt% - Returns the size of a map. + Return the size of a map.

Returns an integer, which is the number of key-value pairs in Map, for example:

@@ -2627,74 +2657,75 @@ os_prompt% - Test that a match specification works - -

- This function is a utility to test a match_spec used in calls to - ets:select/2 and - erlang:trace_pattern/3. - The function both tests MatchSpec for "syntactic" correctness and - runs the match_spec against the object. If the match_spec contains - errors, the tuple {error, Errors} is returned where Errors is a list - of natural language descriptions of what was wrong with the match_spec. -

-

- If the Type is table the object to match - against should be a tuple. The function then returns - {ok,Result,[],Warnings} where Result is what would have been the - result in a real ets:select/2 call or false if the match_spec does - not match the object tuple. -

- -

- If Type is trace the object to match - against should be a list. The function returns - {ok, Result, Flags, Warnings} where Result is true if a trace - message should be emitted, false if a trace message should not - be emitted or the message term to be appended to the trace message. - Flags is a list containing all the trace flags that will be enabled, - at the moment this is only return_trace. -

- -

- This is a useful debugging and test tool, especially when writing complicated - match specifications. -

-

- See also - ets:test_ms/2. -

+ Test that a match specification works. + +

Tests a match specification used in calls to + ets:select/2 + and + erlang:trace_pattern/3. + The function tests both a match specification for "syntactic" + correctness and runs the match specification against the object. If + the match specification contains errors, the tuple {error, + Errors} is returned, where Errors is a list of natural + language descriptions of what was wrong with the match + specification.

+

If Type is table, the object to match + against is to be a tuple. The function then returns + {ok,Result,[],Warnings}, where Result is what would + have been the result in a real ets:select/2 call, or + false if the match specification does not match the object + tuple.

+

If Type is trace, the object to match + against is to be a list. The function returns + {ok, Result, Flags, Warnings}, where Result is one of + the following:

+ + true if a trace message is to be emitted + false if a trace message is not to be emitted + The message term to be appended to the trace message + +

Flags is a list containing all the trace flags to be enabled, + currently this is only return_trace.

+

This is a useful debugging and test tool, especially when writing + complicated match specifications.

+

See also + ets:test_ms/2 + in STDLIB.

- Returns the largest of two terms. + Return the largest of two terms.

Returns the largest of Term1 and Term2. - If the terms are equal, Term1 is returned.

+ If the terms are equal, Term1 is returned.

- Computes an MD5 message digest. + Compute an MD5 message digest.

Computes an MD5 message digest from Data, where the length of the digest is 128 bits (16 bytes). Data is a binary or a list of small integers and binaries.

-

For more information about MD5, see RFC 1321 - The - MD5 Message-Digest Algorithm.

-

The MD5 Message-Digest Algorithm is not considered - safe for code-signing or software-integrity purposes.

+

For more information about MD5, see + + RFC 1321 - The MD5 Message-Digest Algorithm.

+ +

The MD5 Message-Digest Algorithm is not considered + safe for code-signing or software-integrity purposes.

+
- Finishes the update of an MD5 context and returns the computed MD5 message digest. + Finish the update of an MD5 context and return the computed + MD5 message digest.

Finishes the update of an MD5 Context and returns the computed MD5 message digest.

@@ -2703,18 +2734,19 @@ os_prompt% - Creates an MD5 context. + Create an MD5 context. -

Creates an MD5 context, to be used in subsequent calls to +

Creates an MD5 context, to be used in the following calls to md5_update/2.

- Updates an MD5 context with data and returns a new context. + Update an MD5 context with data and return a new context. + -

Updates an MD5 Context with +

Update an MD5 Context with Data and returns a NewContext.

@@ -2730,7 +2762,7 @@ os_prompt% element is a tuple {Type, Size}. The first element Type is an atom describing memory type. The second element Size is the memory size in bytes.

-

The memory types are as follows:

+

Memory types:

total @@ -2782,7 +2814,7 @@ os_prompt% ets -

The total amount of memory currently allocated for ets +

The total amount of memory currently allocated for ets tables. This memory is part of the memory presented as system memory.

@@ -2790,9 +2822,9 @@ os_prompt%

Only on 64-bit halfword emulator. The total amount of memory allocated in low memory areas - that are restricted to less than 4 GB, although - the system can have more memory.

-

Can be removed in a future release of the halfword + that are restricted to < 4 GB, although + the system can have more memory.

+

Can be removed in a future release of the halfword emulator.

maximum @@ -2802,8 +2834,9 @@ os_prompt% when the emulator is run with instrumentation.

For information on how to run the emulator with instrumentation, see - instrument(3) - and/or erl(1).

+ + tools:instrument(3) + and/or erl(1).

@@ -2820,20 +2853,20 @@ os_prompt%

As the total value is the sum of processes and system, the error in system propagates to the total value.

-

The different amounts of memory that are summed are - not gathered atomically, which introduces - an error in the result.

+

The different amounts of memory that are summed are + not gathered atomically, which introduces + an error in the result.

The different values have the following relation to each other. Values beginning with an uppercase letter is not part of the result.

- total = processes + system - processes = processes_used + ProcessesNotUsed - system = atom + binary + code + ets + OtherSystem - atom = atom_used + AtomNotUsed - RealTotal = processes + RealSystem - RealSystem = system + MissedSystem +total = processes + system +processes = processes_used + ProcessesNotUsed +system = atom + binary + code + ets + OtherSystem +atom = atom_used + AtomNotUsed +RealTotal = processes + RealSystem +RealSystem = system + MissedSystem

More tuples in the returned list can be added in a future release.

@@ -2843,20 +2876,20 @@ os_prompt% the emulator stacks are not supposed to be included. That is, the total value is not supposed to be equal to the total size of all pages mapped to the emulator.

-

Furthermore, because of fragmentation and prereservation of +

Also, because of fragmentation and prereservation of memory areas, the size of the memory segments containing the dynamically allocated memory blocks can be much larger than the total size of the dynamically allocated memory blocks.

- -

As from ERTS 5.6.4, erlang:memory/0 requires that - all erts_alloc(3) - allocators are enabled (default behavior).

-
+ +

As from ERTS 5.6.4, erlang:memory/0 requires that + all erts_alloc(3) + allocators are enabled (default behavior).

+

Failure: notsup if an - erts_alloc(3) - allocator has been disabled.

+ erts_alloc(3) + allocator has been disabled.

@@ -2866,61 +2899,61 @@ os_prompt% Information about dynamically allocated memory. -

Returns the memory size in bytes allocated for memory of - type Type. The argument can also be given as a list +

Returns the memory size in bytes allocated for memory of type + Type. The argument can also be specifed as a list of memory_type() atoms, in which case a corresponding list of {memory_type(), Size :: integer >= 0} tuples is returned.

- -

As from ERTS version 5.6.4, + +

As from ERTS 5.6.4, erlang:memory/1 requires that - all erts_alloc(3) - allocators are enabled (default behavior).

-
+ all erts_alloc(3) + allocators are enabled (default behavior).

+

Failures:

badarg - If Type is not one of the memory types + If Type is not one of the memory types listed in the description of - erlang:memory/0. - + erlang:memory/0. + badarg - If maximum is passed as Type and + If maximum is passed as Type and the emulator is not run in instrumented mode. - + notsup - If an erts_alloc(3) - allocator has been disabled. - - + If an erts_alloc(3) + allocator has been disabled. + +

See also - erlang:memory/0.

+ erlang:memory/0.

- Returns the smallest of two terms. + Return the smallest of two terms.

Returns the smallest of Term1 and Term2. - If the terms are equal, Term1 is returned.

+ If the terms are equal, Term1 is returned.

- Checks if a module is loaded. + Check if a module is loaded.

Returns true if the module Module is loaded, otherwise false. It does not attempt to load the module.

This BIF is intended for the code server (see - code(3)) and is not to be - used elsewhere.

+ kernel:code(3)) + and is not to be used elsewhere.

@@ -2929,7 +2962,7 @@ os_prompt% - Starts monitoring. + Start monitoring. @@ -2937,35 +2970,39 @@ os_prompt%

Sends a monitor request of type Type to the entity identified by Item. If the monitored entity - does not exist or when it dies, the caller of monitor/2 will - be notified by a message on the following format:

- {Tag, MonitorRef, Type, Object, Info} -

The monitor request is an asynchronous signal. That is, it - takes time before the signal reaches its destination.

+ does not exist or it changes monitored state, the caller of + monitor/2 is notified by a message on the following format:

+ +{Tag, MonitorRef, Type, Object, Info} + +

The monitor request is an asynchronous signal. That is, it + takes time before the signal reaches its destination.

+

Type can be one of the following atoms: process, port or time_offset.

-

A monitor is triggered only once, after that it is removed from - both monitoring process and the monitored entity. - Monitors are fired when the monitored process or port terminates, - does not exist at the moment of creation, or if the connection to - it is lost. In the case with connection, we lose knowledge about - the fact if it still exists or not. The monitoring is also turned off - when demonitor/1 - is called.

- -

When monitoring by name please note, that the RegisteredName - is resolved to pid() or port() only once - at the moment of monitor instantiation, later changes to the name - registration will not affect the existing monitor.

- -

When a monitor is triggered, a 'DOWN' message that has the - following pattern {'DOWN', MonitorRef, Type, Object, Info} - is sent to the monitoring process.

- -

In monitor message MonitorRef and Type are the same as - described earlier, and:

+

A process or port monitor is triggered only once, + after that it is removed from both monitoring process and + the monitored entity. Monitors are fired when the monitored process + or port terminates, does not exist at the moment of creation, + or if the connection to it is lost. If the connection to it is lost, + we do not know if it still exixts. The monitoring is also turned off + when demonitor/1 is + called.

+ +

A process or port monitor by name + resolves the RegisteredName to pid() or port() + only once at the moment of monitor instantiation, later changes to + the name registration will not affect the existing monitor.

+ +

When a process or port monitor is triggered, + a 'DOWN' message is sent that has the following pattern:

+ +{'DOWN', MonitorRef, Type, Object, Info} + +

In the monitor message MonitorRef and Type are the + same as described earlier, and:

Object @@ -2992,14 +3029,14 @@ os_prompt% implemented), the call fails with badarg.

The format of the 'DOWN' message changed in ERTS - version 5.2 (OTP R9B) for monitoring + 5.2 (Erlang/OTP R9B) for monitoring by registered name. Element Object of the 'DOWN' message could in earlier versions sometimes be the process identifier of the monitored process and sometimes be the registered name. Now element Object is always a tuple consisting of the registered name and - the node name. Processes on new nodes (ERTS version 5.2 - or higher) always get 'DOWN' messages on + the node name. Processes on new nodes (ERTS 5.2 + or higher versions) always get 'DOWN' messages on the new format even if they are monitoring processes on old nodes. Processes on old nodes always get 'DOWN' messages on the old format.

@@ -3008,11 +3045,11 @@ os_prompt% Monitoring a process -

Creates monitor between the current process and another - process identified by Item, which can be a - pid() (local or remote), an atom RegisteredName or - a tuple {RegisteredName, Node} for a registered process, - located elsewhere.

+

Creates monitor between the current process and another + process identified by Item, which can be a + pid() (local or remote), an atom RegisteredName or + a tuple {RegisteredName, Node} for a registered process, + located elsewhere.

Monitoring a port @@ -3026,62 +3063,64 @@ os_prompt%
Monitoring a - time_offset + time_offset -

Monitor changes in - time offset - between - Erlang - monotonic time and - Erlang - system time. There is only one valid - Item in combination with the - time_offset Type, namely the atom - clock_service. Note that the atom clock_service is - not the registered name of a process. In this specific - case it serves as an identifier of the runtime system internal - clock service at current runtime system instance.

+

Monitors changes in + time offset + between + Erlang + monotonic time and + Erlang + system time. One valid Item + exists in combination with the + time_offset Type, namely the atom + clock_service. Notice that the atom clock_service is + not the registered name of a process. In this + case it serves as an identifier of the runtime system internal + clock service at current runtime system instance.

The monitor is triggered when the time offset is changed. - This either if the time offset value is changed, or if the - offset is changed from preliminary to final during - finalization - of the time offset when the - single - time warp mode is used. When a change from preliminary - to final time offset is made, the monitor will be triggered once - regardless of whether the time offset value was actually changed - or not.

+ This either if the time offset value is changed, or if the + offset is changed from preliminary to final during + finalization + of the time offset when the + single + time warp mode is used. When a change from preliminary + to final time offset is made, the monitor is triggered once + regardless of whether the time offset value was changed + or not.

If the runtime system is in - multi - time warp mode, the time offset will be changed when - the runtime system detects that the - OS system - time has changed. The runtime system will, however, - not detect this immediately when it happens. A task checking - the time offset is scheduled to execute at least once a minute, - so under normal operation this should be detected within a - minute, but during heavy load it might take longer time.

- -

The monitor will not be automatically removed - after it has been triggered. That is, repeated changes of - the time offset will trigger the monitor repeatedly.

- -

When the monitor is triggered a 'CHANGE' message will - be sent to the monitoring process. A 'CHANGE' message has - the following pattern:

- {'CHANGE', MonitorRef, Type, Item, NewTimeOffset} -

where MonitorRef, Type, and - Item are the same as described above, and - NewTimeOffset is the new time offset.

+ multi + time warp mode, the time offset is changed when + the runtime system detects that the + OS system + time has changed. The runtime system does, however, + not detect this immediately when it occurs. A task checking + the time offset is scheduled to execute at least once a minute, + so under normal operation this is to be detected within a + minute, but during heavy load it can take longer time.

+ +

The monitor is not automatically removed + after it has been triggered. That is, repeated changes of + the time offset trigger the monitor repeatedly.

+ +

When the monitor is triggered a 'CHANGE' message is + sent to the monitoring process. A 'CHANGE' message has + the following pattern:

+ +{'CHANGE', MonitorRef, Type, Item, NewTimeOffset} +

where MonitorRef, Type, and + Item are the same as described above, and + NewTimeOffset is the new time offset.

When the 'CHANGE' message has been received you are - guaranteed not to retrieve the old time offset when calling - erlang:time_offset(). - Note that you can observe the change of the time offset - when calling erlang:time_offset() before you - get the 'CHANGE' message.

+ guaranteed not to retrieve the old time offset when calling + + erlang:time_offset(). + Notice that you can observe the change of the time offset + when calling erlang:time_offset() before you + get the 'CHANGE' message.

@@ -3092,20 +3131,19 @@ os_prompt%

The monitor functionality is expected to be extended. That is, other Types and Items are expected to be supported in a future release.

-

If or when monitor/2 is extended, other - possible values for Tag, Object and - Info in the monitor message will be introduced.

+ possible values for Tag, Object, and + Info in the monitor message will be introduced.

- Monitors the status of a node. + Monitor the status of a node. -

Monitors the status of the node Node. +

Monitor the status of the node Node. If Flag is true, monitoring is turned on. If Flag is false, monitoring is turned off.

@@ -3127,12 +3165,12 @@ os_prompt% - Monitors the status of a node. + Monitor the status of a node.

Behaves as - monitor_node/2 + monitor_node/2 except that it allows an - extra option to be given, namely allow_passive_connect. + extra option to be specified, namely allow_passive_connect. This option allows the BIF to wait the normal network connection time-out for the monitored node to connect itself, even if it cannot be actively connected from this node @@ -3155,70 +3193,77 @@ os_prompt% Current Erlang monotonic time. -

Returns the current - Erlang - monotonic time in native - time unit. This - is a monotonically increasing time since some unspecified point in - time.

- -

This is a - monotonically increasing time, but not a - strictly monotonically increasing - time. That is, consecutive calls to - erlang:monotonic_time/0 can produce the same result.

- -

Different runtime system instances will use different - unspecified points in time as base for their Erlang monotonic clocks. - That is, it is pointless comparing monotonic times from - different runtime system instances. Different runtime system instances - may also place this unspecified point in time different relative - runtime system start. It may be placed in the future (time at start - is a negative value), the past (time at start is a - positive value), or the runtime system start (time at start is - zero). The monotonic time at runtime system start can be - retrieved by calling - erlang:system_info(start_time).

+

Returns the current + Erlang + monotonic time in native + time unit. This + is a monotonically increasing time since some unspecified point in + time.

+ +

This is a + + monotonically increasing time, but not a + + strictly monotonically increasing + time. That is, consecutive calls to + erlang:monotonic_time/0 can produce the same result.

+

Different runtime system instances will use different unspecified + points in time as base for their Erlang monotonic clocks. + That is, it is pointless comparing monotonic times from + different runtime system instances. Different runtime system + instances can also place this unspecified point in time different + relative runtime system start. It can be placed in the future (time + at start is a negative value), the past (time at start is a + positive value), or the runtime system start (time at start is + zero). The monotonic time at runtime system start can be + retrieved by calling + + erlang:system_info(start_time).

+
+ - Current Erlang monotonic time + Current Erlang monotonic time. -

Returns the current - Erlang - monotonic time converted - into the Unit passed as argument.

- -

Same as calling - erlang:convert_time_unit(erlang:monotonic_time(), - native, Unit) - however optimized for commonly used Units.

+

Returns the current + Erlang + monotonic time converted + into the Unit passed as argument.

+

Same as calling + + erlang:convert_time_unit( + erlang:monotonic_time(), + native, Unit), + however optimized for commonly used Units.

+ - Stops execution with a given reason. + Stop execution with a specifed reason.

Works exactly like - erlang:error/1, but - Dialyzer thinks that this BIF will return an arbitrary - term. When used in a stub function for a NIF to generate an - exception when the NIF library is not loaded, Dialyzer - does not generate false warnings.

+ error/1, but + Dialyzer thinks that this BIF will return an arbitrary + term. When used in a stub function for a NIF to generate an + exception when the NIF library is not loaded, Dialyzer + does not generate false warnings.

- Stops execution with a given reason. + Stop execution with a specified reason.

Works exactly like - erlang:error/2, but - Dialyzer thinks that this BIF will return an arbitrary - term. When used in a stub function for a NIF to generate an - exception when the NIF library is not loaded, Dialyzer - does not generate false warnings.

+ error/2, but + Dialyzer thinks that this BIF will return an arbitrary + term. When used in a stub function for a NIF to generate an + exception when the NIF library is not loaded, Dialyzer + does not generate false warnings.

@@ -3258,10 +3303,10 @@ os_prompt% All nodes of a certain type in the system. -

Returns a list of nodes according to the argument given. - The returned result when the argument is a list, is the list +

Returns a list of nodes according to the argument specified. + The returned result, when the argument is a list, is the list of nodes satisfying the disjunction(s) of the list elements.

-

NodeType can be any of the following:

+

NodeTypes:

visible @@ -3282,13 +3327,15 @@ os_prompt% known

Nodes that are known to this node. That is, connected - nodes and nodes referred to by process identifiers, port - identifiers and references located on this node. - The set of known nodes is garbage collected. Notice that - this garbage collection can be delayed. For more - information, see - delayed_node_table_gc. -

+ nodes and nodes referred to by process identifiers, port + identifiers, and references located on this node. + The set of known nodes is garbage collected. Notice that + this garbage collection can be delayed. For more + information, see + + delayed_node_table_gc in + + erlang:system_info/1.

Some equalities: [node()] = nodes(this), @@ -3302,20 +3349,22 @@ os_prompt% Elapsed time since 00:00 GMT. -

This function is deprecated! Do not use it! - See the users guide chapter - Time and Time Correction - for more information. Specifically the - Dos and Dont's - section for information on what to use instead of erlang:now/0. -

-

Returns the tuple {MegaSecs, Secs, MicroSecs} which is + +

This function is deprecated. Do not use it.

+

For more information, see section + Time and Time Correction + in the User's Guide. Specifically, section + + Dos and Dont's describes what to use instead of + erlang:now/0.

+ +

Returns the tuple {MegaSecs, Secs, MicroSecs}, which is the elapsed time since 00:00 GMT, January 1, 1970 (zero hour), - on the assumption that the underlying OS supports this. + if provided by the underlying OS. Otherwise some other point in time is chosen. It is also - guaranteed that subsequent calls to this BIF return + guaranteed that the following calls to this BIF return continuously increasing values. Hence, the return value from - now() can be used to generate unique time-stamps. + erlang:now/0 can be used to generate unique time stamps. If it is called in a tight loop on a fast machine, the time of the node can become skewed.

Can only be used to check the local time of day if @@ -3326,28 +3375,31 @@ os_prompt% - Opens a port. + Open a port.

Returns a port identifier as the result of opening a new Erlang port. A port can be seen as an external Erlang process.

-

The name of the executable as well as the arguments - given in cd, env, args, and arg0 are - subject to Unicode file name translation if the system is running - in Unicode file name mode. To avoid - translation or to force, for example UTF-8, supply the executable - and/or arguments as a binary in the correct - encoding. For details, see the module - file, the function - file:native_name_encoding/0, and the - STDLIB - User's Guide.

-

The characters in the name (if given as a list) can - only be higher than 255 if the Erlang Virtual Machine is started - in Unicode file name translation mode. Otherwise the name - of the executable is limited to the ISO-latin-1 - character set.

-

PortName can be any of the following:

+

The name of the executable as well as the arguments + specifed in cd, env, args, and arg0 are + subject to Unicode filename translation if the system is running + in Unicode filename mode. To avoid + translation or to force, for example UTF-8, supply the executable + and/or arguments as a binary in the correct + encoding. For details, see the module + kernel:file, the + function + file:native_name_encoding/0 in Kernel, and + the STDLIB + User's Guide.

+ +

The characters in the name (if specified as a list) can + only be > 255 if the Erlang virtual machine is started + in Unicode filename translation mode. Otherwise the name + of the executable is limited to the ISO Latin-1 + character set.

+
+

PortNames:

{spawn, Command} @@ -3366,55 +3418,57 @@ os_prompt% vfork, setting environment variable ERL_NO_VFORK to any value causes fork to be used instead.

-

For external programs, PATH is searched - (or an equivalent method is used to find programs, - depending on OS). This is done by invoking - the shell on certain platforms. The first space-separated - token of the command is considered as the - name of the executable (or driver). This (among other - things) makes this option unsuitable for running - programs having spaces in file names or directory names. - If spaces in executable file names are desired, use - {spawn_executable, Command} instead.

+

For external programs, PATH is searched + (or an equivalent method is used to find programs, + depending on the OS). This is done by invoking + the shell on certain platforms. The first space-separated + token of the command is considered as the + name of the executable (or driver). This (among other + things) makes this option unsuitable for running + programs with spaces in filenames or directory names. + If spaces in executable filenames are desired, use + {spawn_executable, Command} instead.

{spawn_driver, Command} -

Works like {spawn, Command}, but demands the - first (space-separated) token of the command to be the name of a - loaded driver. If no driver with that name is loaded, a - badarg error is raised.

+

Works like {spawn, Command}, but demands + the first (space-separated) token of the command to be the name + of a loaded driver. If no driver with that name is loaded, a + badarg error is raised.

{spawn_executable, FileName} -

Works like {spawn, FileName}, but only runs - external executables. FileName in its whole - is used as the name of the executable, including any spaces. - If arguments are to be passed, the PortSettings - args and arg0 can be used.

-

The shell is usually not invoked to start the - program, it is executed directly. PATH (or +

Works like {spawn, FileName}, but only runs + external executables. FileName in its whole + is used as the name of the executable, including any spaces. + If arguments are to be passed, the + PortSettings + args and arg0 can be used.

+

The shell is usually not invoked to start the + program, it is executed directly. PATH (or equivalent) is not searched. To find a program - in PATH to execute, use - os:find_executable/1.

-

Only if a shell script or .bat file is - executed, the appropriate command interpreter is - invoked implicitly, but there is still no - command argument expansion or implicit PATH search.

-

If FileName cannot be run, an error - exception is raised, with the POSIX error code as the reason. - The error reason can differ between OSs. - Typically the error enoent is raised when an - attempt is made to run a program that is not found and - eacces is raised when the given file is not - executable.

+ in PATH to execute, use + + os:find_executable/1.

+

Only if a shell script or .bat file is + executed, the appropriate command interpreter is + invoked implicitly, but there is still no + command-argument expansion or implicit PATH search.

+

If FileName cannot be run, an error + exception is raised, with the POSIX error code as the reason. + The error reason can differ between OSs. + Typically the error enoent is raised when an + attempt is made to run a program that is not found and + eacces is raised when the specified file is not + executable.

{fd, In, Out}

Allows an Erlang process to access any currently opened file descriptors used by Erlang. The file descriptor - In can be used for standard input, and the file - descriptor Out for standard output. It is only - used for various servers in the Erlang OS (shell + In can be used for standard input, and the + file descriptor Out for standard output. + It is only used for various servers in the Erlang OS (shell and user). Hence, its use is limited.

@@ -3423,7 +3477,8 @@ os_prompt% {packet, N} -

Messages are preceded by their length, sent in N +

Messages are preceded by their length, sent in + N bytes, with the most significant byte first. The valid values for N are 1, 2, and 4.

@@ -3436,16 +3491,16 @@ os_prompt% {line, L}

Messages are delivered on a per line basis. Each line - (delimited by the OS-dependent new line sequence) is + (delimited by the OS-dependent newline sequence) is delivered in a single message. The message data format is {Flag, Line}, where Flag is eol or noeol, and Line is the - data delivered (without the new line sequence).

+ data delivered (without the newline sequence).

L specifies the maximum line length in bytes. Lines longer than this are delivered in more than one message, with Flag set to noeol for all but the last message. If end of file is encountered - anywhere else than immediately following a new line + anywhere else than immediately following a newline sequence, the last line is also delivered with Flag set to noeol. Otherwise lines are delivered with Flag set to eol.

@@ -3455,14 +3510,14 @@ os_prompt% {cd, Dir}

Only valid for {spawn, Command} and - {spawn_executable, FileName}. + {spawn_executable, FileName}. The external program starts using Dir as its working directory. Dir must be a string.

{env, Env} -

Only valid for {spawn, Command} and - {spawn_executable, FileName}. +

Only valid for {spawn, Command}, and + {spawn_executable, FileName}. The environment of the started process is extended using the environment specifications in Env.

Env is to be a list of tuples @@ -3473,56 +3528,58 @@ os_prompt% port process. Both Name and Val must be strings. The one exception is Val being the atom - false (in analogy with os:getenv/1), which - removes the environment variable.

-
- {args, [ string() | binary() ]} - -

Only valid for {spawn_executable, FileName} - and specifies arguments to the executable. Each argument - is given as a separate string and (on Unix) eventually - ends up as one element each in the argument vector. On - other platforms, a similar behavior is mimicked.

-

The arguments are not expanded by the shell before - being supplied to the executable. Most notably this - means that file wild card expansion does not happen. - To expand wild cards for the arguments, use - filelib:wildcard/1. - Notice that even if - the program is a Unix shell script, meaning that the - shell ultimately is invoked, wild card expansion - does not happen, and the script is provided with the - untouched arguments. On Windows, wild card expansion - is always up to the program itself, therefore this is - not an issue issue.

-

The executable name (also known as argv[0]) - is not to be given in this list. The proper executable name - is automatically used as argv[0], where applicable.

-

If you explicitly want to set the - program name in the argument vector, option arg0 - can be used.

-
- {arg0, string() | binary()} - -

Only valid for {spawn_executable, FileName} - and explicitly specifies the program name argument when - running an executable. This can in some circumstances, - on some OSs, be desirable. How the program - responds to this is highly system-dependent and no specific - effect is guaranteed.

-
+ false (in analogy with + os:getenv/1, + which removes the environment variable.

+
+ {args, [ string() | binary() ]} + +

Only valid for {spawn_executable, FileName} + and specifies arguments to the executable. Each argument + is specified as a separate string and (on Unix) eventually + ends up as one element each in the argument vector. On + other platforms, a similar behavior is mimicked.

+

The arguments are not expanded by the shell before + they are supplied to the executable. Most notably this + means that file wildcard expansion does not occur. + To expand wildcards for the arguments, use + + filelib:wildcard/1 in STDLIB. + Notice that even if + the program is a Unix shell script, meaning that the + shell ultimately is invoked, wildcard expansion + does not occur, and the script is provided with the + untouched arguments. On Windows, wildcard expansion + is always up to the program itself, therefore this is + not an issue.

+

The executable name (also known as argv[0]) + is not to be specified in this list. The proper executable name + is automatically used as argv[0], where applicable.

+

If you explicitly want to set the + program name in the argument vector, option arg0 + can be used.

+
+ {arg0, string() | binary()} + +

Only valid for {spawn_executable, FileName} + and explicitly specifies the program name argument when + running an executable. This can in some circumstances, + on some OSs, be desirable. How the program + responds to this is highly system-dependent and no specific + effect is guaranteed.

+
exit_status

Only valid for {spawn, Command}, where Command refers to an external program, and - for {spawn_executable, FileName}.

+ for {spawn_executable, FileName}.

When the external process connected to the port exits, a message of the form {Port,{exit_status,Status}} is sent to the connected process, where Status is the exit status of the external process. If the program aborts on Unix, the same convention is used as the shells do (that is, 128+signal).

-

If option eof is also given, the messages eof +

If option eof is specified also, the messages eof and exit_status appear in an unspecified order.

If the port program closes its stdout without exiting, option exit_status does not work.

@@ -3530,7 +3587,7 @@ os_prompt% use_stdio

Only valid for {spawn, Command} and - {spawn_executable, FileName}. It + {spawn_executable, FileName}. It allows the standard input and output (file descriptors 0 and 1) of the spawned (Unix) process for communication with Erlang.

@@ -3550,14 +3607,14 @@ os_prompt% overlapped_io

Affects ports to external programs on Windows only. The - standard input and standard output handles of the port program - are, if this option is supplied, opened with flag - FILE_FLAG_OVERLAPPED, so that the port program can - (and must) do - overlapped I/O on its standard handles. This is not normally - the case for simple port programs, but an option of value for the - experienced Windows programmer. On all other platforms, this - option is silently discarded.

+ standard input and standard output handles of the port program + are, if this option is supplied, opened with flag + FILE_FLAG_OVERLAPPED, so that the port program can + (and must) do + overlapped I/O on its standard handles. This is not normally + the case for simple port programs, but an option of value for the + experienced Windows programmer. On all other platforms, this + option is silently discarded.

in @@ -3582,27 +3639,28 @@ os_prompt% hide

When running on Windows, suppresses creation of a new - console window when spawning the port program. - (This option has no effect on other platforms.)

+ console window when spawning the port program. + (This option has no effect on other platforms.)

{parallelism, Boolean} - +

Sets scheduler hint for port parallelism. If set to - true, the Virtual Machine schedules port tasks; - when doing so, it improves parallelism in the system. If set - to false, the Virtual Machine tries to - perform port tasks immediately, improving latency at the - expense of parallelism. The default can be set at system startup - by passing command-line argument - +spp to erl(1).

+ true, the virtual machine schedules port tasks; + when doing so, it improves parallelism in the system. If set + to false, the virtual machine tries to + perform port tasks immediately, improving latency at the + expense of parallelism. The default can be set at system startup + by passing command-line argument + +spp to + erl(1).

Default is stream for all port types and use_stdio for spawned ports.

-

Failure: If the port cannot be opened, the exit reason is - badarg, system_limit, or the POSIX error code that - most closely describes the error, or einval if no POSIX +

Failure: if the port cannot be opened, the exit reason is + badarg, system_limit, or the POSIX error code that + most closely describes the error, or einval if no POSIX code is appropriate:

badarg @@ -3628,11 +3686,11 @@ os_prompt% Full file table (for the entire OS). eacces - Command given in {spawn_executable, Command} + Command specified in {spawn_executable, Command} does not point out an executable file. enoent - FileName given in + FileName specified in {spawn_executable, FileName} does not point out an existing file. @@ -3642,13 +3700,12 @@ os_prompt% errors arising when sending messages to it are reported to the owning process using signals of the form {'EXIT', Port, PosixCode}. For the possible values of - PosixCode, see the - file(3) - manual page in Kernel.

-

The maximum number of ports that can be open at the same + PosixCode, see + kernel:file(3).

+

The maximum number of ports that can be open at the same time can be configured by passing command-line flag - +Q to - erl(1).

+ +Q to + erl(1).

@@ -3663,7 +3720,7 @@ os_prompt% The function returns a hash value for Term within the range 1..Range. The maximum value for - Range is 2^32.

+ Range is 2^32.

This BIF can be used instead of the old deprecated BIF erlang:hash/2, as it calculates better hashes for all data types, but consider using phash2/1,2 instead.

@@ -3681,9 +3738,9 @@ os_prompt% the same Erlang term regardless of machine architecture and ERTS version (the BIF was introduced in ERTS 5.2). The function returns a hash value for - Term within the range - 0..Range-1. The maximum value for - Range is 2^32. When without argument + Term within the range + 0..Range-1. The maximum value for + Range is 2^32. When without argument Range, a value in the range 0..2^27-1 is returned.

This BIF is always to be used for hashing terms. It @@ -3703,14 +3760,14 @@ os_prompt% representation of Pid.

This BIF is intended for debugging and is not to be used - in application programs.

+ in application programs.

- Performs a synchronous call to a port with term data. + Perform a synchronous call to a port with term data.

Performs a synchronous call to a port. The meaning of Operation and Data @@ -3728,87 +3785,84 @@ os_prompt% badarg - If Port is not an identifier of an open port, - or the registered name of an open port. If the calling - process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. - + If Port is not an identifier of an open port, + or the registered name of an open port. If the calling + process was previously linked to the closed port, + identified by Port, the exit signal + from the port is guaranteed to be delivered before this + badarg exception occurs. + badarg - - If Operation does not fit in a 32-bit integer. - + + If Operation does not fit in a 32-bit integer. + badarg - - If the port driver does not support synchronous control - operations. - + + If the port driver does not support synchronous control operations. + badarg - - If the port driver so decides for any reason (probably - something wrong with Operation - or Data). - - + + If the port driver so decides for any reason (probably + something wrong with Operation + or Data). + + - Closes an open port. - -

Closes an open port. Roughly the same as - Port ! {self(), close} except for the error behavior - (see the following), being synchronous, and that the port does - not reply with {Port, closed}. Any process can - close a port with port_close/1, not only the port owner - (the connected process). If the calling process is linked to + Close an open port. + +

Closes an open port. Roughly the same as Port ! + {self(), close} except for the error behavior + (see below), being synchronous, and that the port does + not reply with {Port, closed}. Any process can + close a port with port_close/1, not only the port owner + (the connected process). If the calling process is linked to the port identified by Port, the exit - signal from the port is guaranteed to be delivered before - port_close/1 returns.

+ signal from the port is guaranteed to be delivered before + port_close/1 returns.

For comparison: Port ! {self(), close} - only fails with badarg if Port does - not refer to a port or a process. If Port - is a closed port, nothing happens. If Port + only fails with badarg if Port does + not refer to a port or a process. If Port + is a closed port, nothing happens. If Port is an open port and the calling process is the port owner, - the port replies with {Port, closed} when all buffers - have been flushed and the port really closes. If the calling - process is not the port owner, the port owner fails - with badsig.

+ the port replies with {Port, closed} when all buffers + have been flushed and the port really closes. If the calling + process is not the port owner, the port owner fails + with badsig.

Notice that any process can close a port using Port ! {PortOwner, close} as if it itself was the port owner, but the reply always goes to the port owner.

-

As from OTP R16, Port ! {PortOwner, close} is truly - asynchronous. Notice that this operation has always been - documented as an asynchronous operation, while the underlying - implementation has been synchronous. port_close/1 is - however still fully synchronous. This because of its error - behavior.

-

Failure: badarg if Port is not an identifier - of an open port, or the registered name of an open port. - If the calling process was previously linked to the closed - port, identified by Port, the exit - signal from the port is guaranteed to be delivered before - this badarg exception occurs.

+

As from Erlang/OTP R16, + Port ! {PortOwner, close} is truly + asynchronous. Notice that this operation has always been + documented as an asynchronous operation, while the underlying + implementation has been synchronous. port_close/1 is + however still fully synchronous because of its error behavior.

+

Failure: badarg if Port is not an + identifier of an open port, or the registered name of an open port. + If the calling process was previously linked to the closed + port, identified by Port, the exit + signal from the port is guaranteed to be delivered before + this badarg exception occurs.

- Sends data to a port. + Send data to a port.

Sends data to a port. Same as - Port ! {PortOwner, {command, Data}} except - for the error - behavior and being synchronous (see the following). Any process - can send data to a port with port_command/2, not only the - port owner (the connected process).

-

For comparison: Port ! {PortOwner, {command, Data}} - only fails with badarg if Port - does not refer to a port or a process. If - Port is a closed port, the data message - disappears + Port ! {PortOwner, {command, Data}} except for + the error behavior and being synchronous (see below). Any process + can send data to a port with port_command/2, not only the + port owner (the connected process).

+

For comparison: Port ! {PortOwner, {command, + Data}} only fails with badarg if Port + does not refer to a port or a process. If Port is + a closed port, the data message disappears without a sound. If Port is open and the calling process is not the port owner, the port owner fails with badsig. The port owner fails with badsig @@ -3816,57 +3870,58 @@ os_prompt%

Notice that any process can send to a port using Port ! {PortOwner, {command, Data}} as if it itself was the port owner.

-

If the port is busy, the calling process is suspended - until the port is not busy any more.

-

As from OTP-R16, Port ! {PortOwner, {command, Data}} - is truly asynchronous. Notice that this operation has always been - documented as an asynchronous operation, while the underlying - implementation has been synchronous. port_command/2 is - however still fully synchronous. This because of its error - behavior.

+

If the port is busy, the calling process is suspended + until the port is not busy any more.

+

As from Erlang/OTP R16, + Port ! {PortOwner, {command, Data}} + is truly asynchronous. Notice that this operation has always been + documented as an asynchronous operation, while the underlying + implementation has been synchronous. port_command/2 is + however still fully synchronous because of its error behavior.

Failures:

badarg - If Port is not an identifier of an open - port, or the registered name of an open port. If the - calling process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. - +

If Port is not an identifier of an open + port, or the registered name of an open port. If the + calling process was previously linked to the closed port, + identified by Port, the exit signal + from the port is guaranteed to be delivered before this + badarg exception occurs.

+ badarg - If Data is an invalid I/O list. - -
+

If Data is an invalid I/O list.

+ +
- Sends data to a port. + Send data to a port.

Sends data to a port. port_command(Port, Data, []) - equals port_command(Port, Data).

-

If the port command is aborted, false is returned, - otherwise true.

-

If the port is busy, the calling process is suspended - until the port is not busy any more.

-

The following Options are valid:

+ equals port_command(Port, Data).

+

If the port command is aborted, false is returned, + otherwise true.

+

If the port is busy, the calling process is suspended + until the port is not busy anymore.

+

Options:

force The calling process is not suspended if the port is - busy, instead the port command is forced through. The - call fails with a notsup exception if the - driver of the port does not support this. For more - information, see driver flag - . + busy, instead the port command is forced through. The + call fails with a notsup exception if the + driver of the port does not support this. For more + information, see driver flag + + ![CDATA[ERL_DRV_FLAG_SOFT_BUSY]]. nosuspend The calling process is not suspended if the port is - busy, instead the port command is aborted and - false is returned. + busy, instead the port command is aborted and + false is returned. @@ -3876,34 +3931,34 @@ os_prompt% badarg - If Port is not an identifier of an open - port, or the registered name of an open port. If the - calling process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. - + If Port is not an identifier of an open + port, or the registered name of an open port. If the + calling process was previously linked to the closed port, + identified by Port, the exit signal + from the port is guaranteed to be delivered before this + badarg exception occurs. + badarg - If Data is an invalid I/O list. - + If Data is an invalid I/O list. + badarg - If OptionList is an invalid option list. - + If OptionList is an invalid option list. + notsup - If option force has been passed, but the - driver of the port does not allow forcing through - a busy port. - - + If option force has been passed, but the + driver of the port does not allow forcing through + a busy port. + +
- Sets the owner of a port. + Set the owner of a port.

Sets the port owner (the connected port) to Pid. Roughly the same as @@ -3911,14 +3966,14 @@ os_prompt% except for the following:

-

The error behavior differs, see the following.

+

The error behavior differs, see below.

The port does not reply with {Port,connected}.

-

port_connect/1 is synchronous, see the following.

+

port_connect/1 is synchronous, see below.

The new port owner gets linked to the port.

@@ -3930,7 +3985,7 @@ os_prompt% port_connect/2.

For comparison: Port ! {self(), {connect, Pid}} - only fails with badarg if Port + only fails with badarg if Port does not refer to a port or a process. If Port is a closed port, nothing happens. If Port @@ -3940,40 +3995,39 @@ os_prompt% the port, while the new is not. If Port is an open port and the calling process is not the port owner, the port owner fails with badsig. The port - owner fails with badsig also if Pid is not an - existing local process identifier.

+ owner fails with badsig also if Pid is not + an existing local process identifier.

Notice that any process can set the port owner using Port ! {PortOwner, {connect, Pid}} as if it itself was the port owner, but the reply always goes to the port owner.

-

As from OTP-R16, - Port ! {PortOwner, {connect, Pid}} is - truly asynchronous. Notice that this operation has always been - documented as an asynchronous operation, while the underlying - implementation has been synchronous. port_connect/2 is - however still fully synchronous. This because of its error - behavior.

+

As from Erlang/OTP R16, + Port ! {PortOwner, {connect, Pid}} + is truly asynchronous. Notice that this operation has always been + documented as an asynchronous operation, while the underlying + implementation has been synchronous. port_connect/2 is + however still fully synchronous because of its error behavior.

Failures:

badarg - If Port is not an identifier of an open port, or - the registered name of an open port. If the calling - process was previously linked to the closed port, - identified by Port, the exit signal - from the port is guaranteed to be delivered before this - badarg exception occurs. - + If Port is not an identifier of an open port, + or the registered name of an open port. If the calling + process was previously linked to the closed port, + identified by Port, the exit signal + from the port is guaranteed to be delivered before this + badarg exception occurs. +
badarg - If process identified by Pid is not an existing - local process. - + If the process identified by Pid is not an existing + local process. +
- Performs a synchronous control operation on a port. + Perform a synchronous control operation on a port.

Performs a synchronous control operation on a port. The meaning of Operation and @@ -3987,25 +4041,24 @@ os_prompt% badarg - If Port is not an open port or the registered - name of an open port. - + If Port is not an open port or the registered + name of an open port. + badarg - If Operation cannot fit in a 32-bit integer. - + If Operation cannot fit in a 32-bit integer. + badarg - If the port driver does not support synchronous control - operations. - + If the port driver does not support synchronous control operations. + badarg - If the port driver so decides for any reason (probably + If the port driver so decides for any reason (probably something wrong with Operation or Data). - - + + @@ -4017,11 +4070,11 @@ os_prompt% Port, or undefined if the port is not open. The order of the tuples is undefined, and all the tuples are not mandatory. - If the port is closed and the calling process - was previously linked to the port, the exit signal from the - port is guaranteed to be delivered before port_info/1 - returns undefined.

-

The result contains information about the following + If the port is closed and the calling process + was previously linked to the port, the exit signal from the + port is guaranteed to be delivered before port_info/1 + returns undefined.

+

The result contains information about the following Items:

registered_name (if the port has a registered @@ -4034,9 +4087,9 @@ os_prompt% output

For more information about the different Items, see - port_info/2.

+ port_info/2.

Failure: badarg if Port is not a local port - identifier, or an atom.

+ identifier, or an atom.

@@ -4044,15 +4097,15 @@ os_prompt% Information about the connected process of a port. -

Pid is the process identifier of the process - connected to the port.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Pid is the process identifier of the process + connected to the port.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4060,15 +4113,15 @@ os_prompt% Information about the internal index of a port. -

Index is the internal index of the port. This - index can be used to separate ports.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Index is the internal index of the port. This + index can be used to separate ports.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4076,15 +4129,15 @@ os_prompt% Information about the input of a port. -

Bytes is the total number of bytes - read from the port.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Bytes is the total number of bytes + read from the port.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4092,15 +4145,15 @@ os_prompt% Information about the links of a port. -

Pids is a list of the process identifiers - of the processes that the port is linked to.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Pids is a list of the process identifiers + of the processes that the port is linked to.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4108,7 +4161,7 @@ os_prompt% Information about the locking of a port. -

Locking is one of the following:

+

Locking is one of the following:

false (emulator without SMP support) port_level (port-specific locking) @@ -4116,13 +4169,13 @@ os_prompt%

Notice that these results are highly implementation-specific and can change in a future release.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4130,17 +4183,17 @@ os_prompt% Information about the memory size of a port. -

Bytes is the total number of - bytes allocated for this port by the runtime system. The - port itself can have allocated memory that is not - included in Bytes.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Bytes is the total number of + bytes allocated for this port by the runtime system. The + port itself can have allocated memory that is not + included in Bytes.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4148,15 +4201,15 @@ os_prompt% Information about the monitors of a port. -

Monitors represent processes that this port - monitors.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Monitors represent processes monitored by + this port.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4180,15 +4233,15 @@ os_prompt% Information about the name of a port. -

Name is the command name set by - open_port/2.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Name is the command name set by + open_port/2.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4196,18 +4249,18 @@ os_prompt% Information about the OS pid of a port. -

OsPid is the process identifier (or equivalent) - of an OS process created with - open_port({spawn | spawn_executable, - Command}, Options). If the port is not the result of spawning - an OS process, the value is undefined.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

OsPid is the process identifier (or equivalent) + of an OS process created with + open_port({spawn | spawn_executable, + Command}, Options). If the port is not the result of + spawning an OS process, the value is undefined.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4215,18 +4268,18 @@ os_prompt% Information about the output of a port. -

Bytes is the total number of bytes written - to the port from Erlang processes using - port_command/2, - port_command/3, - or Port ! {Owner, {command, Data}.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Bytes is the total number of bytes written + to the port from Erlang processes using + port_command/2, + port_command/3, + or Port ! {Owner, {command, Data}.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4234,10 +4287,10 @@ os_prompt% Information about the parallelism hint of a port. -

Boolean corresponds to the port parallelism - hint being used by this port. For more information, see option - parallelism - of open_port/2.

+

Boolean corresponds to the port parallelism + hint used by this port. For more information, see option + parallelism + of open_port/2.

@@ -4245,16 +4298,16 @@ os_prompt% Information about the queue size of a port. -

Bytes is the total number - of bytes queued by the port using the ERTS driver queue - implementation.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

Bytes is the total number + of bytes queued by the port using the ERTS driver queue + implementation.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4262,15 +4315,16 @@ os_prompt% Information about the registered name of a port. -

RegisteredName is the registered name of - the port. If the port has no registered name, [] is returned.

-

If the port identified by Port is not open, - undefined is returned. If the port is closed and the - calling process was previously linked to the port, the exit - signal from the port is guaranteed to be delivered before - port_info/2 returns undefined.

+

RegisteredName is the registered name of + the port. If the port has no registered name, [] is + returned.

+

If the port identified by Port is not open, + undefined is returned. If the port is closed and the + calling process was previously linked to the port, the exit + signal from the port is guaranteed to be delivered before + port_info/2 returns undefined.

Failure: badarg if Port is not a local - port identifier, or an atom.

+ port identifier, or an atom.

@@ -4282,24 +4336,24 @@ os_prompt% representation of the port identifier Port.

This BIF is intended for debugging. It is not to be used - in application programs.

+ in application programs.

- Lists all existing ports. + List all existing ports. -

Returns a list of port identifiers corresponding to all the - ports existing on the local node.

-

Notice that an exiting port exists, but is not open.

+

Returns a list of port identifiers corresponding to all the + ports existing on the local node.

+

Notice that an exiting port exists, but is not open.

- Lists all pre-loaded modules. + List all preloaded modules.

Returns a list of Erlang modules that are preloaded in the system. As all loading of code is done through the file @@ -4310,12 +4364,13 @@ os_prompt% - Writes information about a local process on standard error. + Write information about a local process on standard error. +

Writes information about the local process Pid on standard error. The only allowed value for the atom - Type is backtrace, which shows the contents of - the call stack, including information about the call chain, with + Type is backtrace, which shows the contents + of the call stack, including information about the call chain, with the current function printed first. The format of the output is not further defined.

@@ -4323,7 +4378,7 @@ os_prompt% - Sets process flag trap_exit for the calling process. + Set process flag trap_exit for the calling process.

When trap_exit is set to true, exit signals arriving to a process are converted to {'EXIT', From, Reason} @@ -4334,13 +4389,14 @@ os_prompt% linked processes. Application processes are normally not to trap exits.

Returns the old value of the flag.

-

See also exit/2.

+

See also exit/2.

- Sets process flag error_handler for the calling process. + Set process flag error_handler for the calling process. +

Used by a process to redefine the error handler for undefined function calls and undefined registered @@ -4348,13 +4404,14 @@ os_prompt% as code auto-loading depends on the correct operation of the error handling module.

Returns the old value of the flag.

+
- - Sets process flag min_heap_size for the calling process. + Set process flag min_heap_size for the calling process. +

Changes the minimum heap size for the calling process.

Returns the old value of the flag.

@@ -4363,90 +4420,79 @@ os_prompt% - Sets process flag min_bin_vheap_size for the calling process. + Set process flag min_bin_vheap_size for the calling process. +

Changes the minimum binary virtual heap size for the calling process.

Returns the old value of the flag.

+ - Sets process flag max_heap_size for the calling process. + Set process flag max_heap_size for the calling process. + -

- This flag sets the maximum heap size for the calling process. +

This flag sets the maximum heap size for the calling process. If MaxHeapSize is an integer, the system default values for kill and error_logger are used.

size -

- The maximum size in words of the process. If set to zero, the - heap size limit is disabled. Badarg will be thrown if the value is - smaller than - min_heap_size. - The size check is only done when a garbage collection is triggered. -

-

- size is the entire heap of the process when garbage collection - is triggered, this includes all generational heaps, the process stack, +

The maximum size in words of the process. If set to zero, the + heap size limit is disabled. badarg is be thrown if the + value is smaller than + min_heap_size. The size check is only done when + a garbage collection is triggered.

+

size is the entire heap of the process when garbage collection + is triggered. This includes all generational heaps, the process stack, any - messages that are considered to be part of the heap and any - extra memory that the garbage collector needs during collection. -

-

- size is the same as can be retrieved using + messages that are considered to be part of the heap, and any + extra memory that the garbage collector needs during collection.

+

size is the same as can be retrieved using erlang:process_info(Pid, total_heap_size), - or by adding heap_block_size, old_heap_block_size - and mbuf_size from - erlang:process_info(Pid, garbage_collection_info). -

+ or by adding heap_block_size, old_heap_block_size + and mbuf_size from + erlang:process_info(Pid, garbage_collection_info).

kill -

- When set to true the runtime system will send an +

When set to true, the runtime system sends an untrappable exit signal with reason kill to the process if the maximum heap size is reached. The garbage collection - that triggered the kill will not be completed, instead the - process will exit as soon as is possible. When set to false - no exit signal will be sent to the process, instead it will - continue executing. -

-

- If kill is not defined in the map + that triggered the kill is not completed, instead the + process exits as soon as possible. When set to false, + no exit signal is sent to the process, instead it continues + executing.

+

If kill is not defined in the map, the system default will be used. The default system default - is true. It can be changed by either the erl - +hmaxk option, - or - erlang:system_flag(max_heap_size, MaxHeapSize). -

+ is true. It can be changed by either option + +hmaxk in erl(1), + or + erlang:system_flag(max_heap_size, MaxHeapSize).

error_logger -

- When set to true the runtime system will send a - message to the current error_logger +

When set to true, the runtime system sends a + message to the current + error_logger containing details about the process when the maximum - heap size is reached. One error_logger report will - be sent each time the limit is reached. -

-

- If error_logger is not defined in the map the system - default will be used. The default system default is true. - It can be changed by either the erl +hmaxel - option, or - erlang:system_flag(max_heap_size, MaxHeapSize). -

+ heap size is reached. One error_logger report is sent + each time the limit is reached.

+

If error_logger is not defined in the map, the system + default is used. The default system default is true. + It can be changed by either the option + +hmaxel int erl(1), + or + erlang:system_flag(max_heap_size, MaxHeapSize).

-

- The heap size of a process is quite hard to predict, especially the +

The heap size of a process is quite hard to predict, especially the amount of memory that is used during the garbage collection. When contemplating using this option, it is recommended to first run it in production with kill set to false and inspect @@ -4456,62 +4502,57 @@ os_prompt%

+ - Set process flag message_queue_data for the calling process + Set process flag message_queue_data for the calling process. + -

This flag determines how messages in the message queue - are stored. When the flag is:

+

This flag determines how messages in the message queue + are stored, as follows:

off_heap - -

- All messages in the message queue will be stored - outside of the process heap. This implies that no - messages in the message queue will be part of a garbage - collection of the process. -

+ +

All messages in the message queue will be stored + outside of the process heap. This implies that no + messages in the message queue will be part of a garbage + collection of the process.

+
on_heap - -

- All messages in the message queue will eventually be - placed on heap. They may however temporarily be stored - off heap. This is how messages always have been stored - up until ERTS version 8.0. -

+ +

All messages in the message queue will eventually be + placed on heap. They can however temporarily be stored + off heap. This is how messages always have been stored + up until ERTS 8.0.

+
-

- The default message_queue_data process flag is determined - by the +hmqd - erl command line argument. -

-

- If the process potentially may get a hugh amount of messages, - you are recommended to set the flag to off_heap. This - since a garbage collection with lots of messages placed on - the heap may become extremly expensive and the process may - consume large amounts of memory. Performance of the - actual message passing is however generally better when not - using the off_heap flag. -

-

- When changing this flag messages will be moved. This work - has been initiated but not completed when this function - call returns. -

+

The default message_queue_data process flag is determined + by command-line argument + +hmqd in erl(1).

+

If the process potentially can get many messages, + you are advised to set the flag to off_heap. This + because a garbage collection with many messages placed on + the heap can become extremly expensive and the process can + consume large amounts of memory. Performance of the + actual message passing is however generally better when not + using flag off_heap.

+

When changing this flag messages will be moved. This work + has been initiated but not completed when this function + call returns.

Returns the old value of the flag.

+ - Sets process flag priority for the calling process. + Set process flag priority for the calling process.

Sets the process priority. Level is an atom. - There are four priority levels: low, + Four priority levels exist: low, normal, high, and max. Default is normal.

@@ -4525,23 +4566,23 @@ os_prompt% low are interleaved. Processes on priority low are selected for execution less frequently than processes on priority normal.

-

When there are runnable processes on priority high, +

When runnable processes on priority high exist, no processes on priority low or normal are - selected for execution. Notice however, that this does + selected for execution. Notice however that this does not mean that no processes on priority low - or normal can run when there are processes - running on priority high. On the runtime + or normal can run when processes + are running on priority high. On the runtime system with SMP support, more processes can be running - in parallel than processes on priority high, that is, + in parallel than processes on priority high. That is, a low and a high priority process can execute at the same time.

-

When there are runnable processes on priority max, +

When runnable processes on priority max exist, no processes on priority low, normal, or high are selected for execution. As with priority high, processes on lower priorities can execute in parallel with processes on priority max.

-

Scheduling is preemptive. Regardless of priority, a process - is preempted when it has consumed more than a certain number +

Scheduling is pre-emptive. Regardless of priority, a process + is pre-empted when it has consumed more than a certain number of reductions since the last time it was selected for execution.

@@ -4557,7 +4598,7 @@ os_prompt% take this into account and handle such scenarios by yourself.

Making calls from a high priority process into code - that you have no control over can cause the high + that you has no control over can cause the high priority process to wait for a process with lower priority. That is, effectively decreasing the priority of the high priority process during the call. Even if this @@ -4571,8 +4612,8 @@ os_prompt% especially priority high. A process on priority high is only to perform work for short periods. Busy looping for - long periods in a high priority process does - most likely cause problems, as important OTP servers + long periods in a high priority process causes + most likely problems, as important OTP servers run on priority normal.

Returns the old value of the flag.

@@ -4580,10 +4621,10 @@ os_prompt% - Sets process flag save_calls for the calling process. + Set process flag save_calls for the calling process.

N must be an integer in the interval 0..10000. - If N is greater than 0, call saving is made + If N > 0, call saving is made active for the process. This means that information about the N most recent global function calls, BIF calls, sends, and @@ -4594,12 +4635,12 @@ os_prompt% explicitly mentioned. Only a fixed amount of information is saved, as follows:

- A tuple {Module, Function, Arity} for - function calls - The atoms send, 'receive', and +

A tuple {Module, Function, Arity} for + function calls

+

The atoms send, 'receive', and timeout for sends and receives ('receive' when a message is received and timeout when a - receive times out) + receive times out)

If N = 0, call saving is disabled for the process, which is the @@ -4611,7 +4652,7 @@ os_prompt% - Sets process flag sensitive for the calling process. + Set process flag sensitive for the calling process.

Sets or clears flag sensitive for the current process. When a process has been marked as sensitive by calling @@ -4621,13 +4662,13 @@ os_prompt%

Features that are disabled include (but are not limited to) the following:

- Tracing: Trace flags can still be set for the process, +

Tracing. Trace flags can still be set for the process, but no trace messages of any kind are generated. (If flag sensitive is turned off, trace messages are again - generated if any trace flags are set.) - Sequential tracing: The sequential trace token is + generated if any trace flags are set.)

+

Sequential tracing. The sequential trace token is propagated as usual, but no sequential trace messages are - generated. + generated.

process_info/1,2 cannot be used to read out the message queue or the process dictionary (both are returned @@ -4637,19 +4678,19 @@ os_prompt% are omitted.

If {save_calls,N} has been set for the process, no function calls are saved to the call saving list. - (The call saving list is not cleared. Furthermore, send, receive, - and timeout events are still added to the list.)

+ (The call saving list is not cleared. Also, send, receive, + and time-out events are still added to the list.)

Returns the old value of the flag.

- Sets process flags for a process. + Set process flags for a process.

Sets certain flags for the process Pid, in the same manner as - process_flag/2. + process_flag/2. Returns the old value of the flag. The valid values for Flag are only a subset of those allowed in process_flag/2, namely save_calls.

@@ -4664,46 +4705,46 @@ os_prompt% - - + +

Returns a list containing InfoTuples with - miscellaneous information about the process identified by - Pid, or undefined if the process is not alive.

-

The order of the InfoTuples is undefined and - all InfoTuples are not mandatory. + miscellaneous information about the process identified by + Pid, or undefined if the process is not alive.

+

The order of the InfoTuples is undefined and + all InfoTuples are not mandatory. The InfoTuples - part of the result can be changed without prior notice.

-

The InfoTuples with the following items - are part of the result:

+ part of the result can be changed without prior notice.

+

The InfoTuples with the following items + are part of the result:

current_function initial_call status - message_queue_len + message_queue_len messages links - dictionary + dictionary trap_exit error_handler - priority + priority group_leader total_heap_size - heap_size + heap_size stack_size reductions - garbage_collection + garbage_collection

If the process identified by Pid has a registered name, - also an InfoTuple with item registered_name - appears.

-

For information about specific InfoTuples, see - process_info/2.

+ also an InfoTuple with item registered_name + is included.

+

For information about specific InfoTuples, see + process_info/2.

This BIF is intended for debugging only. For - all other purposes, use - process_info/2.

+ all other purposes, use + process_info/2.

Failure: badarg if Pid is not a local process.

@@ -4718,38 +4759,39 @@ os_prompt% - - + +

Returns information about the process identified by - Pid, as specified by - Item or ItemList. - Returns undefined if the process is not alive.

-

If the process is alive and a single Item - is given, the returned value is the corresponding - InfoTuple, unless Item =:= registered_name - and the process has no registered name. In this case, - [] is returned. This strange behavior is because of - historical reasons, and is kept for backward compatibility.

-

If ItemList is given, the result is - InfoTupleList. - The InfoTuples in - InfoTupleList appear with the corresponding - Items in the same order as the - Items appeared - in ItemList. Valid Items can - appear multiple times in ItemList.

-

If registered_name is part of ItemList - and the process has no name registered a - {registered_name, []}, InfoTuple - will appear in the resulting - InfoTupleList. This - behavior is different when a single - Item =:= registered_name is given, and when - process_info/1 is used.

-
-

The following InfoTuples with corresponding - Items are valid:

+ Pid, as specified by + Item or ItemList. + Returns undefined if the process is not alive.

+

If the process is alive and a single Item + is specified, the returned value is the corresponding + InfoTuple, unless Item =:= registered_name + and the process has no registered name. In this case, + [] is returned. This strange behavior is because of + historical reasons, and is kept for backward compatibility.

+

If ItemList is specified, the result is + InfoTupleList. + The InfoTuples in + InfoTupleList are included with the corresponding + Items in the same order as the + Items were included + in ItemList. Valid Items can + be included multiple times in ItemList.

+ +

If registered_name is part of ItemList + and the process has no name registered, a + {registered_name, []}, InfoTuple + will be included in the resulting + InfoTupleList. This + behavior is different when a single + Item =:= registered_name is specified, and when + process_info/1 is used.

+
+

Valid InfoTuples with corresponding + Items:

{backtrace, Bin} @@ -4762,15 +4804,15 @@ os_prompt% {binary, BinInfo}

BinInfo is a list containing miscellaneous - information about binaries currently being referred to by this + information about binaries currently referred to by this process. This InfoTuple can be changed or removed without prior notice.

{catchlevel, CatchLevel}

CatchLevel is the number of currently active - catches in this process. This InfoTuple can be - changed or removed without prior notice.

+ catches in this process. This InfoTuple can be + changed or removed without prior notice.

{current_function, {Module, Function, Arity}} @@ -4786,14 +4828,15 @@ os_prompt%

Module, Function, Arity is the current function call of the process. - Location is a list of two-tuples describing the - location in the source code.

+ Location is a list of two-tuples describing + the location in the source code.

{current_stacktrace, Stack}

Returns the current call stack back-trace (stacktrace) of the process. The stack has the same format as returned by - erlang:get_stacktrace/0.

+ + erlang:get_stacktrace/0.

{dictionary, Dictionary} @@ -4807,9 +4850,9 @@ os_prompt% {garbage_collection, GCInfo}

GCInfo is a list containing miscellaneous - information about garbage collection for this process. - The content of GCInfo can be changed without - prior notice.

+ information about garbage collection for this process. + The content of GCInfo can be changed without + prior notice.

@@ -4817,24 +4860,22 @@ os_prompt%

GCInfo is a list containing miscellaneous - detailed information about garbage collection for this process. - The content of GCInfo can be changed without - prior notice. - See gc_minor_start in - erlang:trace/3 for details about - what each item means. -

+ detailed information about garbage collection for this process. + The content of GCInfo can be changed without + prior notice. For details about the meaning of each item, see + gc_minor_start + in erlang:trace/3.

{group_leader, GroupLeader} -

GroupLeader is group leader for the I/O of - the process.

+

GroupLeader is the group leader for the I/O + of the process.

{heap_size, Size} -

Size is the size in words of the youngest heap - generation of the process. This generation includes - the process stack. This information is highly +

Size is the size in words of the youngest + heap generation of the process. This generation includes + the process stack. This information is highly implementation-dependent, and can change if the implementation changes.

@@ -4848,29 +4889,29 @@ os_prompt%
{links, PidsAndPorts} -

PidsAndPorts is a list of process identifiers - and port identifiers, with processes or ports to which the process - has a link.

+

PidsAndPorts is a list of process identifiers + and port identifiers, with processes or ports to which the process + has a link.

{last_calls, false|Calls}

The value is false if call saving is not active - for the process (see - process_flag/3). + for the process (see + process_flag/3). If call saving is active, a list is returned, in which the last element is the most recent called.

{memory, Size} -

Size is the size in bytes of the process. This - includes call stack, heap, and internal structures.

+

Size is the size in bytes of the process. + This includes call stack, heap, and internal structures.

{message_queue_len, MessageQueueLen}

MessageQueueLen is the number of messages - currently in the message queue of the process. This is - the length of the list MessageQueue returned as - the information item messages (see the following).

+ currently in the message queue of the process. This is the + length of the list MessageQueue returned as + the information item messages (see below).

{messages, MessageQueue} @@ -4913,36 +4954,37 @@ os_prompt% {message_queue_data, MQD} -

Returns the current state of the message_queue_data - process flag. MQD is either off_heap, - or on_heap. For more information, see the - documentation of - process_flag(message_queue_data, - MQD).

+

Returns the current state of process flag + message_queue_data. MQD is either + off_heap or on_heap. For more + information, see the documentation of + + process_flag(message_queue_data, MQD).

{priority, Level}

Level is the current priority level for - the process. For more information on priorities, see - process_flag(priority, - Level).

+ the process. For more information on priorities, see + + process_flag(priority, Level).

{reductions, Number} -

Number is the number of reductions executed by - the process.

+

Number is the number of reductions executed + by the process.

{registered_name, Atom} -

Atom is the registered name of the process. If - the process has no registered name, this tuple is not +

Atom is the registered process name. + If the process has no registered name, this tuple is not present in the list.

- {sequential_trace_token, [] | SequentialTraceToken} + {sequential_trace_token, [] | + SequentialTraceToken}

SequentialTraceToken is the sequential trace - token for the process. This InfoTuple can be - changed or removed without prior notice.

+ token for the process. This InfoTuple can be + changed or removed without prior notice.

{stack_size, Size} @@ -4951,9 +4993,9 @@ os_prompt% {status, Status} -

Status is the status of the process and is one - of the following:

- +

Status is the status of the process and is + one of the following:

+ exiting garbage_collecting waiting (for a message) @@ -4961,46 +5003,44 @@ os_prompt% runnable (ready to run, but another process is running) suspended (suspended on a "busy" port - or by the BIF erlang:suspend_process/[1,2]) + or by the BIF erlang:suspend_process/1,2)
{suspending, SuspendeeList}

SuspendeeList is a list of - {Suspendee, ActiveSuspendCount, - OutstandingSuspendCount} tuples. - Suspendee is the process identifier of a - process that has been, or is to be, - suspended by the process identified by Pid - through one of the following BIFs:

+ {Suspendee, ActiveSuspendCount, + OutstandingSuspendCount} tuples. + Suspendee is the process identifier of a + process that has been, or is to be, + suspended by the process identified by Pid + through the BIF + erlang:suspend_process/2 or + + erlang:suspend_process/1.

+

ActiveSuspendCount is the number of + times Suspendee has been suspended by + Pid. + OutstandingSuspendCount is the number of not + yet completed suspend requests sent by Pid, + that is:

- erlang:suspend_process/2 - - - erlang:suspend_process/1 - - -

ActiveSuspendCount is the number of - times Suspendee has been suspended by - Pid. - OutstandingSuspendCount is the number of not yet - completed suspend requests sent by Pid, that is:

- - If ActiveSuspendCount =/= 0, - Suspendee is - currently in the suspended state. +

If ActiveSuspendCount =/= 0, + Suspendee is + currently in the suspended state.

- If OutstandingSuspendCount =/= 0, option - asynchronous of erlang:suspend_process/2 - has been used and the suspendee has not yet been - suspended by Pid. + +

If OutstandingSuspendCount =/= 0, + option asynchronous of erlang:suspend_process/2 + has been used and the suspendee has not yet been + suspended by Pid.

-

Notice that ActiveSuspendCount and - OutstandingSuspendCount are not the - total suspend count on Suspendee, - only the parts contributed by Pid.

+

Notice that ActiveSuspendCount and + OutstandingSuspendCount are not the + total suspend count on Suspendee, + only the parts contributed by Pid.

@@ -5008,21 +5048,21 @@ os_prompt%

Size is the total size, in words, of all heap - fragments of the process. This includes the process stack and - any unreceived messages that are considered to be part of the - heap.

+ fragments of the process. This includes the process stack and + any unreceived messages that are considered to be part of the + heap.

{trace, InternalTraceFlags}

InternalTraceFlags is an integer - representing the internal trace flag for this process. - This InfoTuple - can be changed or removed without prior notice.

+ representing the internal trace flag for this process. + This InfoTuple + can be changed or removed without prior notice.

{trap_exit, Boolean}

Boolean is true if the process - is trapping exits, otherwise false.

+ is trapping exits, otherwise false.

Notice that not all implementations support all @@ -5030,9 +5070,9 @@ os_prompt%

Failures:

badarg - If Pid is not a local process. + If Pid is not a local process. badarg - If Item is an invalid item. + If Item is an invalid item.
@@ -5042,11 +5082,11 @@ os_prompt% All processes.

Returns a list of process identifiers corresponding to - all the processes currently existing on the local node.

-

Notice that an exiting process exists, but is not alive. - That is, is_process_alive/1 returns false - for an exiting process, but its process identifier is part - of the result returned from processes/0.

+ all the processes currently existing on the local node.

+

Notice that an exiting process exists, but is not alive. + That is, is_process_alive/1 returns false + for an exiting process, but its process identifier is part + of the result returned from processes/0.

Example:

 > processes().
@@ -5056,22 +5096,23 @@ os_prompt% 
- Removes old code for a module. + Remove old code for a module.

Removes old code for Module. Before this BIF is used, - erlang:check_process_code/2 is to be called to check + + check_process_code/2is to be called to check that no processes execute old code in the module.

This BIF is intended for the code server (see - code(3)) + kernel:code(3)) and is not to be used elsewhere.

-

As from ERTS 8.0 (OTP 19), any lingering processes - that still execute the old code will be killed by this function. - In earlier versions, such incorrect use could cause much - more fatal failures, like emulator crash.

+

As from ERTS 8.0 (Erlang/OTP 19), any lingering processes + that still execute the old code is killed by this function. + In earlier versions, such incorrect use could cause much + more fatal failures, like emulator crash.

Failure: badarg if there is no old code for Module.

@@ -5080,14 +5121,13 @@ os_prompt% - Adds a new value to the process dictionary. + Add a new value to the process dictionary.

Adds a new Key to the process dictionary, associated with the value Val, and returns undefined. If Key exists, the old value is deleted and replaced by Val, and - the function returns the old value.

-

Example:

+ the function returns the old value. Example:

 > X = put(name, walrus), Y = put(name, carpenter),
 Z = get(name),
@@ -5103,17 +5143,18 @@ os_prompt% 
- Stops execution with an exception of given class, reason, and call stack backtrace. + Stop execution with an exception of specified class, reason, + and call stack backtrace.

Stops the execution of the calling process with an - exception of given class, reason, and call stack backtrace + exception of the specified class, reason, and call stack backtrace (stacktrace).

Class is error, exit, or throw. So, if it were not for the stacktrace, erlang:raise(Class, Reason, - Stacktrace) is - equivalent to erlang:Class(Reason).

+ Stacktrace) is equivalent to + erlang:Class(Reason).

Reason is any term. Stacktrace is a list as returned from get_stacktrace(), that is, a list of @@ -5123,12 +5164,12 @@ os_prompt% argument list. The stacktrace can also contain {Fun, Args, Location} tuples, where Fun is a local fun and Args is an argument list.

-

Element Location at the end is optional. - Omitting it is equivalent to specifying an empty list.

+

Element Location at the end is optional. + Omitting it is equivalent to specifying an empty list.

The stacktrace is used as the exception stacktrace for the calling process; it is truncated to the current maximum stacktrace depth.

-

Since evaluating this function causes the process to +

As evaluating this function causes the process to terminate, it has no return value unless the arguments are invalid, in which case the function returns the error reason badarg. If you want to be @@ -5141,77 +5182,67 @@ os_prompt% - Reads the state of a timer. + Read the state of a timer. -

Read the state of a timer. The same as calling - erlang:read_timer(TimerRef, - []).

+

Reads the state of a timer. The same as calling + erlang:read_timer(TimerRef, + []).

+ - Reads the state of a timer. - -

- Read the state of a timer that has been created by either - erlang:start_timer(), - or erlang:send_after(). - TimerRef identifies the timer, and - was returned by the BIF that created the timer. -

-

Available Options:

+ Read the state of a timer. + +

Reads the state of a timer that has been created by either + erlang:start_timer + or erlang:send_after. + TimerRef identifies the timer, and + was returned by the BIF that created the timer.

+

Options:

- {async, Async} - -

- Asynchronous request for state information. Async - defaults to false which will cause the operation - to be performed synchronously. In this case, the Result - is returned by erlang:read_timer(). When - Async is true, erlang:read_timer() - sends an asynchronous request for the state information - to the timer service that manages the timer, and then returns - ok. A message on the format {read_timer, - TimerRef, Result} is - sent to the caller of erlang:read_timer() when the - operation has been processed. -

-
+ {async, Async} + +

Asynchronous request for state information. Async + defaults to false, which causes the operation + to be performed synchronously. In this case, the Result + is returned by erlang:read_timer. When + Async is true, erlang:read_timer + sends an asynchronous request for the state information + to the timer service that manages the timer, and then returns + ok. A message on the format {read_timer, + TimerRef, Result} is + sent to the caller of erlang:read_timer when the + operation has been processed.

+
-

- More Options may be added in the future. -

-

- If Result is an integer, it represents the - time in milli-seconds left until the timer expires.

-

- If Result is false, a - timer corresponding to TimerRef could not - be found. This can be because the timer had expired, - it had been canceled, or because TimerRef - never has corresponded to a timer. Even if the timer has expired, - it does not tell you whether or not the timeout message has - arrived at its destination yet. -

- -

- The timer service that manages the timer may be co-located - with another scheduler than the scheduler that the calling - process is executing on. If this is the case, communication - with the timer service takes much longer time than if it - is located locally. If the calling process is in critical - path, and can do other things while waiting for the result - of this operation, you want to use option {async, true}. - If using option {async, false}, the calling - process will be blocked until the operation has been - performed. -

-
+

More Options can be added in the future.

+

If Result is an integer, it represents the + time in milliseconds left until the timer expires.

+

If Result is false, a + timer corresponding to TimerRef could not + be found. This because the timer had expired, + or been canceled, or because TimerRef + never has corresponded to a timer. Even if the timer has expired, + it does not tell you whether or not the time-out message has + arrived at its destination yet.

+ +

The timer service that manages the timer can be co-located + with another scheduler than the scheduler that the calling + process is executing on. If so, communication + with the timer service takes much longer time than if it + is located locally. If the calling process is in a critical + path, and can do other things while waiting for the result + of this operation, you want to use option {async, true}. + If using option {async, false}, the calling + process is blocked until the operation has been performed.

+

See also erlang:send_after/4, - erlang:start_timer/4, - and - erlang:cancel_timer/2.

+ + erlang:start_timer/4, and + + erlang:cancel_timer/2.

@@ -5223,21 +5254,20 @@ os_prompt% representation of Ref.

This BIF is intended for debugging and is not to be used - in application programs.

+ in application programs.

- Registers a name for a pid (or port). + Register a name for a pid (or port).

Associates the name RegName with a process identifier (pid) or a port identifier. RegName, which must be an atom, can be used instead of the pid or port identifier in send operator - (RegName ! Message).

-

Example:

+ (RegName ! Message). Example:

 > register(db, Pid).
 true
@@ -5263,7 +5293,7 @@ true All registered names.

Returns a list of names that have been registered using - register/2, for + register/2, for example:

 > registered().
@@ -5273,20 +5303,21 @@ true
- Resumes a suspended process. + Resume a suspended process.

Decreases the suspend count on the process identified by - Suspendee. Suspendee - is previously to have been suspended through - erlang:suspend_process/2 - or - erlang:suspend_process/1 - by the process calling - erlang:resume_process(Suspendee). When the - suspend count on Suspendee reaches zero, - Suspendee is resumed, that is, its state - is changed from suspended into the state it had before it was - suspended.

+ Suspendee. Suspendee + is previously to have been suspended through + + erlang:suspend_process/2 or + + erlang:suspend_process/1 + by the process calling + erlang:resume_process(Suspendee). When the + suspend count on Suspendee reaches zero, + Suspendee is resumed, that is, its state + is changed from suspended into the state it had before it was + suspended.

This BIF is intended for debugging only.

@@ -5294,29 +5325,29 @@ true badarg - If Suspendee is not a process identifier. - + If Suspendee is not a process identifier. + badarg - If the process calling erlang:resume_process/1 had - not previously increased the suspend count on the process - identified by Suspendee. - + If the process calling erlang:resume_process/1 had + not previously increased the suspend count on the process + identified by Suspendee. + badarg - If the process identified by Suspendee - is not alive. - + If the process identified by Suspendee + is not alive. +
- Returns an integer by rounding a number. + Return an integer by rounding a number.

Returns an integer by rounding Number, - for example:

+ for example:

 round(5.5).
 6
@@ -5326,7 +5357,7 @@ true - Returns pid of the calling process. + Return pid of the calling process.

Returns the process identifier of the calling process, for example:

@@ -5339,7 +5370,7 @@ true - Sends a message. + Send a message.

Sends a message and returns Msg. This @@ -5353,27 +5384,27 @@ true - Sends a message conditionally. + Send a message conditionally.

Either sends a message and returns ok, or does not send - the message but returns something else (see the following). + the message but returns something else (see below). Otherwise the same as - erlang:send/2. + erlang:send/2. For more detailed explanation and warnings, see - erlang:send_nosuspend/2,3.

-

The options are as follows:

+ + erlang:send_nosuspend/2,3.

+

Options:

nosuspend - -

If the sender would have to be suspended to do the send, - nosuspend is returned instead.

+ If the sender would have to be suspended to do the send, + nosuspend is returned instead. noconnect -

If the destination node would have to be auto-connected - to do the send, noconnect is returned - instead.

+ If the destination node would have to be auto-connected + to do the send, noconnect is returned + instead.
@@ -5385,35 +5416,36 @@ true - Starts a timer. + Start a timer.

Starts a timer. The same as calling - erlang:send_after(Time, - Dest, Msg, []).

+ + erlang:send_after(Time, Dest, + Msg, []).

+ - Start a timer + Start a timer. -

- Starts a timer. When the timer expires, the message +

Starts a timer. When the timer expires, the message Msg is sent to the process - identified by Dest. Apart from - the format of the timeout message, - erlang:send_after/4 works exactly as - erlang:start_timer/4.

+ identified by Dest. Apart from + the format of the time-out message, this function works exactly as + + erlang:start_timer/4.

- Tries to send a message without ever blocking. + Try to send a message without ever blocking.

The same as - erlang:send(Dest, - Msg, [nosuspend]), + erlang:send(Dest, + Msg, [nosuspend]), but returns true if the message was sent and false if the message was not sent because the sender would have had to be suspended.

@@ -5439,12 +5471,12 @@ true contradictory to the Erlang programming model. The message is not sent if this function returns false.

In many systems, transient states of - overloaded queues are normal. The fact that this function + overloaded queues are normal. Although this function returns false does not mean that the other node is guaranteed to be non-responsive, it could be a temporary overload. Also, a return value of true does only mean that the message can be sent on the (TCP) channel - without blocking, the message is not guaranteed to + without blocking; the message is not guaranteed to arrive at the remote node. For a disconnected non-responsive node, the return value is true (mimics the behavior of operator !). The expected @@ -5458,15 +5490,16 @@ true - Tries to send a message without ever blocking. + Try to send a message without ever blocking.

The same as - erlang:send(Dest, - Msg, [nosuspend | Options]), + erlang:send(Dest, + Msg, [nosuspend | Options]), but with a Boolean return value.

This function behaves like - erlang:send_nosuspend/2, + + erlang:send_nosuspend/2, but takes a third parameter, a list of options. The only option is noconnect, which makes the function return false if @@ -5490,14 +5523,15 @@ true - Sets the magic cookie of a node. + Set the magic cookie of a node.

Sets the magic cookie of Node to the atom Cookie. If Node is the local node, the function also sets the cookie of all other unknown nodes to - Cookie (see Section - Distributed Erlang + Cookie (see section + + Distributed Erlang in the Erlang Reference Manual in System Documentation).

Failure: function_clause if the local node is not alive.

@@ -5506,12 +5540,12 @@ true - Sets the Nth element of a tuple. + Set the Nth element of a tuple. 1..tuple_size(Tuple1

Returns a tuple that is a copy of argument Tuple1 - with the element given by integer argument + with the element specified by integer argument Index (the first element is the element with index 1) replaced by argument Value, for example:

@@ -5526,52 +5560,52 @@ true Size of a tuple or binary.

Returns the number of elements in a tuple or the number of - bytes in a binary or bitstring, for example:

+ bytes in a binary or bitstring, for example:

 > size({morni, mulle, bwange}).
 3
 > size(<<11, 22, 33>>).
-3
-
-

For bitstrings the number of whole bytes is returned. That is, if the number of bits +3 +

For bitstrings, the number of whole bytes is returned. + That is, if the number of bits in the bitstring is not divisible by 8, the resulting number of bytes is rounded down.

Allowed in guard tests.

See also tuple_size/1, - byte_size/1 - and + byte_size/1, and bit_size/1.

- Creates a new process with a fun as entry point. + Create a new process with a fun as entry point.

Returns the process identifier of a new process started by the application of Fun to the empty list []. Otherwise - works like spawn/3.

+ works like spawn/3.

- Creates a new process with a fun as entry point on a given node. + Create a new process with a fun as entry point on a specified + node.

Returns the process identifier of a new process started by the application of Fun to the empty list [] on Node. If Node does not exist, a useless pid is returned. Otherwise works like - spawn/3.

+ spawn/3.

- Creates a new process with a function as entry point. + Create a new process with a function as entry point.

Returns the process identifier of a new process started by the application of Module:Function @@ -5583,7 +5617,7 @@ true does not exist (where Arity is the length of Args). The error handler can be redefined (see - process_flag/2). + process_flag/2). If error_handler is undefined, or the user has redefined the default error_handler and its replacement is undefined, a failure with reason undef occurs.

@@ -5596,7 +5630,8 @@ true - Creates a new process with a function as entry point on a given node. + Create a new process with a function as entry point on a + specified node.

Returns the process identifier (pid) of a new process started by the application @@ -5604,26 +5639,28 @@ true to Args on Node. If Node does not exist, a useless pid is returned. Otherwise works like - spawn/3.

+ spawn/3.

- Creates and links to a new process with a fun as entry point. + Create and link to a new process with a fun as entry point. +

Returns the process identifier of a new process started by the application of Fun to the empty list []. A link is created between the calling process and the new process, atomically. Otherwise works like - spawn/3.

+ spawn/3.

- Creates and links to a new process with a fun as entry point on a specified node. + Create and link to a new process with a fun as entry point on + a specified node.

Returns the process identifier (pid) of a new process started by the application of Fun to the empty @@ -5632,26 +5669,29 @@ true atomically. If Node does not exist, a useless pid is returned and an exit signal with reason noconnection is sent to the calling - process. Otherwise works like spawn/3.

+ process. Otherwise works like + spawn/3.

- Creates and links to a new process with a function as entry point. + Create and link to a new process with a function as entry point. +

Returns the process identifier of a new process started by the application of Module:Function to Args. A link is created between the calling process and the new process, atomically. Otherwise works like - spawn/3.

+ spawn/3.

- Creates and links to a new process with a function as entry point on a given node. + Create and link to a new process with a function as entry point + on a specified node.

Returns the process identifier (pid) of a new process started by the application @@ -5661,109 +5701,113 @@ true process, atomically. If Node does not exist, a useless pid is returned and an exit signal with reason noconnection is sent to the calling - process. Otherwise works like spawn/3.

+ process. Otherwise works like + spawn/3.

- Creates and monitors a new process with a fun as entry point. + Create and monitor a new process with a fun as entry point. +

Returns the process identifier of a new process, started by the application of Fun to the empty list [], and a reference for a monitor created to the new process. Otherwise works like - spawn/3.

+ spawn/3.

- Creates and monitors a new process with a function as entry point. + Create and monitor a new process with a function as entry point. +

A new process is started by the application of Module:Function to Args. The process is monitored at the same time. Returns the process identifier and a reference for the monitor. Otherwise works like - spawn/3.

+ spawn/3.

- Creates a new process with a fun as entry point. + Create a new process with a fun as entry point. - - - + + +

Returns the process identifier (pid) of a new process started by the application of Fun to the empty list []. Otherwise works like - spawn_opt/4.

-

If option monitor is given, the newly created + spawn_opt/4.

+

If option monitor is specified, the newly created process is monitored, and both the pid and reference for - the monitor is returned.

+ the monitor are returned.

- Creates a new process with a fun as entry point on a given node. + Create a new process with a fun as entry point on a specified + node. - - - + + +

Returns the process identifier (pid) of a new process started by the application of Fun to the empty list [] on Node. If Node does not exist, a useless pid is returned. Otherwise works like - spawn_opt/4.

+ spawn_opt/4.

- Creates a new process with a function as entry point. + Create a new process with a function as entry point. - - - + + +

Works as - spawn/3, except that an - extra option list is given when creating the process.

-

If option monitor is given, the newly created + spawn/3, except that an + extra option list is specified when creating the process.

+

If option monitor is specified, the newly created process is monitored, and both the pid and reference for - the monitor is returned.

-

The options are as follows:

+ the monitor are returned.

+

Options:

link

Sets a link to the parent process (like - spawn_link/3 does).

+ spawn_link/3 + does).

monitor

Monitors the new process (like - monitor/2 does).

+ monitor/2 does).

{priority, Level

Sets the priority of the new process. Equivalent to - executing - process_flag(priority, - Level) + executing + process_flag(priority, Level) in the start function of the new process, except that the priority is set before the process is selected for execution for the first time. For more information on priorities, see - process_flag(priority, - Level).

+ + process_flag(priority, Level).

{fullsweep_after, Number} @@ -5786,21 +5830,22 @@ true

A few cases when it can be useful to change fullsweep_after:

- If binaries that are no longer used are to be +

If binaries that are no longer used are to be thrown away as soon as possible. (Set - Number to zero.) + Number to zero.)

- A process that mostly have short-lived data is +

A process that mostly have short-lived data is fullsweeped seldom or never, that is, the old heap contains mostly garbage. To ensure a fullsweep occasionally, set Number to a - suitable value, such as 10 or 20. + suitable value, such as 10 or 20.

In embedded systems with a limited amount of RAM and no virtual memory, you might want to preserve memory by setting Number to zero. (The value can be set globally, see - erlang:system_flag/2.) + + erlang:system_flag/2.)
@@ -5825,7 +5870,7 @@ true option unless you know that there is problem with execution times or memory consumption, and ensure that the option improves matters.

-

Gives a minimum binary virtual heap size, in words. +

Gives a minimum binary virtual heap size, in words. Setting this value higher than the system default can speed up some processes because less garbage collection is done. @@ -5837,24 +5882,25 @@ true {max_heap_size, Size}

Sets the max_heap_size process flag. The default - max_heap_size is determined by the - +hmax erl - command line argument. For more information, see the - documentation of - process_flag(max_heap_size, - Size).

+ max_heap_size is determined by command-line argument + +hmax + in erl/1. For more information, see the + documentation of + process_flag(max_heap_size, Size). +

{message_queue_data, MQD}

Sets the state of the message_queue_data process - flag. MQD should be either off_heap, - or on_heap. The default - message_queue_data process flag is determined by the - +hmqd erl - command line argument. For more information, see the - documentation of - process_flag(message_queue_data, - MQD).

+ flag. MQD is to be either off_heap + or on_heap. The default + message_queue_data process flag is determined by + command-line argument + +hmqd in erl/1. + For more information, see the documentation of + + process_flag(message_queue_data, + MQD).

@@ -5862,11 +5908,12 @@ true - Creates a new process with a function as entry point on a given node. + Create a new process with a function as entry point on a + specified node. - - - + + +

Returns the process identifier (pid) of a new process started by the application @@ -5874,23 +5921,24 @@ true Args on Node. If Node does not exist, a useless pid is returned. Otherwise works like - spawn_opt/4.

-

Option monitor is not supported by - spawn_opt/5.

+ spawn_opt/4.

+ +

Option monitor is not supported by + spawn_opt/5.

+
- Splits a binary into two. + Split a binary into two. 0..byte_size(Bin)

Returns a tuple containing the binaries that are the result of splitting Bin into two parts at position Pos. This is not a destructive operation. After the operation, - there are three binaries altogether.

-

Example:

+ there are three binaries altogether. Example:

 > B = list_to_binary("0123456789").
 <<"0123456789">>
@@ -5907,79 +5955,68 @@ true
- Starts a timer. + Start a timer.

Starts a timer. The same as calling - erlang:start_timer(Time, - Dest, Msg, []).

+ + erlang:start_timer(Time, + Dest, Msg, []).

- Starts a timer. + Start a timer. -

- Starts a timer. When the timer expires, the message +

Starts a timer. When the timer expires, the message {timeout, TimerRef, Msg} - is sent to the process identified by - Dest. -

-

Available Options:

+ is sent to the process identified by Dest.

+

Options:

{abs, false} -

- This is the default. It means the - Time value is interpreted - as a time in milli-seconds relative current - Erlang - monotonic time. -

-
+

This is the default. It means the + Time value is interpreted + as a time in milliseconds relative current + Erlang + monotonic time.

+ {abs, true} -

- Absolute Time value. The - Time value is interpreted as an - absolute Erlang monotonic time in milli-seconds. -

-
+

Absolute Time value. The + Time value is interpreted as an + absolute Erlang monotonic time in milliseconds.

+
-

- More Options may be added in the future. -

-

- The absolute point in time, the timer is set to expire on, - has to be in the interval - [erlang:system_info(start_time), - erlang:system_info(end_time)]. - Further, if a relative time is specified, the Time value - is not allowed to be negative. -

-

- If Dest is a pid(), it must - be a pid() of a process created on the current - runtime system instance. This process may or may not - have terminated. If Dest is an - atom(), it is interpreted as the name of a - locally registered process. The process referred to by the - name is looked up at the time of timer expiration. No error - is given if the name does not refer to a process. -

-

- If Dest is a pid(), the timer is - automatically canceled if the process referred to by the - pid() is not alive, or if the process exits. This - feature was introduced in ERTS version 5.4.11. Notice that - timers are not automatically canceled when - Dest is an atom(). -

+

More Options can be added in the future.

+

The absolute point in time, the timer is set to expire on, + must be in the interval + [ + erlang:system_info(start_time), + + erlang:system_info(end_time)]. + If a relative time is specified, the Time + value is not allowed to be negative.

+

If Dest is a pid(), it must + be a pid() of a process created on the current + runtime system instance. This process has either terminated + or not. If Dest is an + atom(), it is interpreted as the name of a + locally registered process. The process referred to by the + name is looked up at the time of timer expiration. No error + is returned if the name does not refer to a process.

+

If Dest is a pid(), the timer is + automatically canceled if the process referred to by the + pid() is not alive, or if the process exits. This + feature was introduced in ERTS 5.4.11. Notice that + timers are not automatically canceled when + Dest is an atom().

See also erlang:send_after/4, - erlang:cancel_timer/2, - and - erlang:read_timer/2.

+ + erlang:cancel_timer/2, and + + erlang:read_timer/2.

Failure: badarg if the arguments do not satisfy the requirements specified here.

@@ -5988,22 +6025,25 @@ true Information about active processes and ports. - -

- Returns a list where each element represents the amount - of active processes and ports on each run queue and its - associated scheduler. That is, the number of processes and - ports that are ready to run, or are currently running. The - element location in the list corresponds to the scheduler - and its run queue. The first element corresponds to scheduler - number 1 and so on. The information is not gathered - atomically. That is, the result is not necessarily a - consistent snapshot of the state, but instead quite - efficiently gathered. See also, - statistics(total_active_tasks), - statistics(run_queue_lengths), and - statistics(total_run_queue_lengths). -

+ + +

Returns a list where each element represents the amount + of active processes and ports on each run queue and its + associated scheduler. That is, the number of processes and + ports that are ready to run, or are currently running. The + element location in the list corresponds to the scheduler + and its run queue. The first element corresponds to scheduler + number 1 and so on. The information is not gathered + atomically. That is, the result is not necessarily a + consistent snapshot of the state, but instead quite + efficiently gathered.

+

See also + + statistics(total_active_tasks), + + statistics(run_queue_lengths), and + + statistics(total_run_queue_lengths).

@@ -6022,11 +6062,13 @@ true

Returns the number of exact reductions.

-

statistics(exact_reductions) is - a more expensive operation than - statistics(reductions), - especially on an Erlang machine with SMP support.

-
+ +

statistics(exact_reductions) is + a more expensive operation than + + statistics(reductions), + especially on an Erlang machine with SMP support.

+
@@ -6035,7 +6077,7 @@ true Information about garbage collection.

Returns information about garbage collection, for example:

-
+        
 > statistics(garbage_collection).
 {85,23961,0}

This information can be invalid for some implementations.

@@ -6047,9 +6089,9 @@ true
Information about I/O.

Returns Input, - which is the total number of bytes - received through ports, and Output, - which is the total number of bytes output to ports.

+ which is the total number of bytes + received through ports, and Output, + which is the total number of bytes output to ports.

@@ -6058,23 +6100,21 @@ true Information about microstate accounting. -

- Microstate accounting can be used to measure how much time the Erlang +

Microstate accounting can be used to measure how much time the Erlang runtime system spends doing various tasks. It is designed to be as - lightweight as possible, but there will be some overhead when this + lightweight as possible, but some overhead exists when this is enabled. Microstate accounting is meant to be a profiling tool - to help figure out performance bottlenecks. - To start/stop/reset microstate_accounting you use - the system_flag - - microstate_accounting. -

-

- erlang:statistics(microstate_accounting) returns a list of maps - representing some of the OS threads within ERTS. Each map contains - type and id fields that can be used to identify what + to help finding performance bottlenecks. + To start/stop/reset microstate accounting, use + system flag + microstate_accounting.

+

statistics(microstate_accounting) returns a list of maps + representing some of the OS threads within ERTS. Each map + contains type and id fields that can be used to + identify what thread it is, and also a counters field that contains data about how much time has been spent in the various states.

+

Example:

 > erlang:statistics(microstate_accounting).
 [#{counters => #{aux => 1899182914,
@@ -6085,12 +6125,11 @@ true
port => 221631, sleep => 5150294100}, id => 1, - type => scheduler}|...] - + type => scheduler}|...]

The time unit is the same as returned by - - os:perf_counter/0. - So to convert it to milliseconds you could do something like this:

+ + os:perf_counter/0 in Kernel. + So, to convert it to milliseconds, you can do something like this:

 lists:map(
   fun(#{ counters := Cnt } = M) ->
@@ -6098,39 +6137,36 @@ lists:map(
                                    erlang:convert_time_unit(PerfCount, perf_counter, 1000)
                            end, Cnt),
          M#{ counters := MsCnt }
-  end, erlang:statistics(microstate_accounting)).
-        
-

- It is important to note that these values are not guaranteed to be + end, erlang:statistics(microstate_accounting)). +

Notice that these values are not guaranteed to be the exact time spent in each state. This is because of various - optimisation done in order to keep the overhead as small as possible. -

- -

Currently the following MSAcc_Thread_Type are available:

+ optimisation done to keep the overhead as small as possible.

+

MSAcc_Thread_Types:

scheduler The main execution threads that do most of the work. - asyncAsync threads are used by various - linked-in drivers (mainly the file drivers) do offload non-cpu - intensive work. - auxTakes care of any work that is not - specifically assigned to a scheduler. + async + Async threads are used by various linked-in drivers (mainly the + file drivers) do offload non-CPU intensive work. + aux + Takes care of any work that is not + specifically assigned to a scheduler. -

Currently the following MSAcc_Thread_States are available. - All states are exclusive, meaning that a thread cannot be in two states - at once. So if you add the numbers of all counters in a thread - you will get the total run-time for that thread.

+

The following MSAcc_Thread_States are available. + All states are exclusive, meaning that a thread cannot be in two + states at once. So, if you add the numbers of all counters in a + thread, you get the total runtime for that thread.

aux Time spent handling auxiliary jobs. check_io Time spent checking for new I/O events. emulator - Time spent executing erlang processes. + Time spent executing Erlang processes. gc Time spent doing garbage collection. When extra states are - enabled this is the time spent doing non-fullsweep garbage - collections. + enabled this is the time spent doing non-fullsweep garbage + collections. other Time spent doing unaccounted things. port @@ -6138,61 +6174,60 @@ lists:map( sleep Time spent sleeping. -

It is possible to add more fine grained MSAcc_Thread_States - through configure. - (e.g. ./configure --with-microstate-accounting=extra). - Enabling these states will cause a performance degradation when - microstate accounting is turned off and increase the overhead when - it is turned on.

+

More fine-grained MSAcc_Thread_States can + be added through configure (such as + ./configure --with-microstate-accounting=extra). + Enabling these states causes performance degradation when + microstate accounting is turned off and increases the overhead when + it is turned on.

alloc Time spent managing memory. Without extra states this time is - spread out over all other states. + spread out over all other states. bif - Time spent in bifs. Without extra states this time is part of - the emulator state. + Time spent in BIFs. Without extra states this time is part of + the emulator state. busy_wait Time spent busy waiting. This is also the state where a - scheduler no longer reports that it is active when using - - erlang:statistics(scheduler_wall_time). - So if you add all other states but this and sleep and then divide that - by all time in the thread you should get something very similar to the - scheduler_wall_time fraction. Without extra states this time is part - of the other state. + scheduler no longer reports that it is active when using + + statistics(scheduler_wall_time). So, if you add + all other states but this and sleep, and then divide that by all + time in the thread, you should get something very similar to the + scheduler_wall_time fraction. Without extra states this + time is part of the other state. ets - Time spent executing ETS bifs. Without extra states this time is - part of the emulator state. + Time spent executing ets BIFs. Without extra states + this time is part of the emulator state. gc_full Time spent doing fullsweep garbage collection. Without extra - states this time is part of the gc state. + states this time is part of the gc state. nif - Time spent in nifs. Without extra states this time is part of - the emulator state. + Time spent in NIFs. Without extra states this time is part of + the emulator state. send Time spent sending messages (processes only). Without extra - states this time is part of the emulator state. + states this time is part of the emulator state. timers Time spent managing timers. Without extra states this time is - part of the other state. + part of the other state. -

There is a utility module called - msacc in - runtime_tools that can be used to more easily analyse these - statistics.

- -

- Returns undefined if the system flag +

The utility module + msacc in the + runtime_tools spplication can be used to more easily analyse + these statistics.

+

Returns undefined if system flag - microstate_accounting - is turned off. -

-

The list of thread information is unsorted and may appear in - different order between calls.

-

The threads and states are subject to change without any - prior notice.

+ microstate_accounting is turned off.

+

The list of thread information is unsorted and can appear in + different order between calls.

+ +

The threads and states are subject to change without any + prior notice.

+
+ Information about reductions. @@ -6202,11 +6237,12 @@ lists:map(
 > statistics(reductions).
 {2046,11}
-

As from ERTS 5.5 (OTP R11B), +

As from ERTS 5.5 (Erlang/OTP R11B), this value does not include reductions performed in current time slices of currently scheduled processes. If an exact value is wanted, use - statistics(exact_reductions).

+ + statistics(exact_reductions).

@@ -6215,15 +6251,14 @@ lists:map( Information about the run-queues. -

- Returns the total length of the run-queues. That is, the number +

Returns the total length of the run-queues. That is, the number of processes and ports that are ready to run on all available - run-queues. The information is gathered atomically. That - is, the result is a consistent snapshot of the state, but - this operation is much more expensive compared to - statistics(total_run_queue_lengths). - This especially when a large amount of schedulers is used. -

+ run-queues. The information is gathered atomically. That + is, the result is a consistent snapshot of the state, but + this operation is much more expensive compared to + + statistics(total_run_queue_lengths), + especially when a large amount of schedulers is used.

@@ -6231,19 +6266,21 @@ lists:map( Information about the run-queue lengths. -

- Returns a list where each element represents the amount - of processes and ports ready to run for each run queue. The - element location in the list corresponds to the run queue - of a scheduler. The first element corresponds to the run - queue of scheduler number 1 and so on. The information is - not gathered atomically. That is, the result is - not necessarily a consistent snapshot of the state, but - instead quite efficiently gathered. See also, - statistics(total_run_queue_lengths), - statistics(active_tasks), and - statistics(total_active_tasks). -

+

Returns a list where each element represents the amount + of processes and ports ready to run for each run queue. The + element location in the list corresponds to the run queue + of a scheduler. The first element corresponds to the run + queue of scheduler number 1 and so on. The information is + not gathered atomically. That is, the result is + not necessarily a consistent snapshot of the state, but + instead quite efficiently gathered.

+

See also + + statistics(total_run_queue_lengths), + + statistics(active_tasks), and + + statistics(total_active_tasks).

@@ -6253,8 +6290,8 @@ lists:map(

Returns information about runtime, in milliseconds.

This is the sum of the runtime for all threads - in the Erlang runtime system and can therefore be greater - than the wall clock time.

+ in the Erlang runtime system and can therefore be greater + than the wall clock time.

Example:

 > statistics(runtime).
@@ -6266,7 +6303,7 @@ lists:map(
       
       Information about each schedulers work time.
       
-      
+        
         

Returns a list of tuples with {SchedulerId, ActiveTime, TotalTime}, where @@ -6274,7 +6311,8 @@ lists:map( ActiveTime is the duration the scheduler has been busy, and TotalTime is the total time duration since - scheduler_wall_time + + scheduler_wall_time activation. The time unit is undefined and can be subject to change between releases, OSs, and system restarts. scheduler_wall_time is only to be used to @@ -6286,28 +6324,28 @@ lists:map( that is:

Executing process code - Executing linked-in-driver or NIF code - Executing built-in-functions, or any other runtime - handling + Executing linked-in driver or NIF code + Executing BIFs, or any other runtime handling Garbage collecting Handling any other memory management -

Notice that a scheduler can also be busy even if the - OS has scheduled out the scheduler thread.

+

Notice that a scheduler can also be busy even if the + OS has scheduled out the scheduler thread.

Returns undefined if system flag - scheduler_wall_time - is turned off.

+ + scheduler_wall_time is turned off.

The list of scheduler information is unsorted and can appear in different order between calls.

-

Using scheduler_wall_time to calculate scheduler-utilization:

-
+        

Using scheduler_wall_time to calculate + scheduler-utilization:

+
 > erlang:system_flag(scheduler_wall_time, true).
 false
 > Ts0 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
 ok

Some time later the user takes another snapshot and calculates scheduler-utilization per scheduler, for example:

-
+        
 > Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
 ok
 > lists:map(fun({{I, A0, T0}, {I, A1, T1}}) ->
@@ -6320,8 +6358,9 @@ ok
  {6,0.9739235846420741},
  {7,0.973237033077876},
  {8,0.9741297293248656}]
-

Using the same snapshots to calculate a total scheduler-utilization:

-
+        

Using the same snapshots to calculate a total + scheduler-utilization:

+
 > {A, T} = lists:foldl(fun({{_, A0, T0}, {_, A1, T1}}, {Ai,Ti}) ->
 	{Ai + (A1 - A0), Ti + (T1 - T0)} end, {0, 0}, lists:zip(Ts0,Ts1)), A/T.
 0.9769136803764825
@@ -6337,17 +6376,19 @@ ok Information about active processes and ports. -

- Returns the total amount of active processes and ports in - the system. That is, the number of processes and ports that - are ready to run, or are currently running. The information - is not gathered atomically. That is, the result - is not necessarily a consistent snapshot of the state, but - instead quite efficiently gathered. See also, - statistics(active_tasks), - statistics(run_queue_lengths), and - statistics(total_run_queue_lengths). -

+

Returns the total amount of active processes and ports in + the system. That is, the number of processes and ports that + are ready to run, or are currently running. The information + is not gathered atomically. That is, the result + is not necessarily a consistent snapshot of the state, but + instead quite efficiently gathered.

+

See also + + statistics(active_tasks), + + statistics(run_queue_lengths), and + + statistics(total_run_queue_lengths).

@@ -6355,18 +6396,19 @@ ok Information about the run-queue lengths. -

- Returns the total length of the run-queues. That is, the number +

Returns the total length of the run queues. That is, the number of processes and ports that are ready to run on all available - run-queues. The information is not gathered atomically. - That is, the result is not necessarily a consistent snapshot of - the state, but much more efficiently gathered compared to - statistics(run_queue). - See also, - statistics(run_queue_lengths), - statistics(total_active_tasks), and - statistics(active_tasks). -

+ run queues. The information is not gathered atomically. + That is, the result is not necessarily a consistent snapshot of + the state, but much more efficiently gathered compared to + + statistics(run_queue).

+

See also + statistics(run_queue_lengths), + + statistics(total_active_tasks), and + + statistics(active_tasks).

@@ -6383,12 +6425,13 @@ ok - Suspends a process. + Suspend a process.

Suspends the process identified by - Suspendee. The same as calling - erlang:suspend_process(Suspendee, - []).

+ Suspendee. The same as calling + + erlang:suspend_process(Suspendee, + []).

This BIF is intended for debugging only.

@@ -6397,63 +6440,64 @@ ok - Suspends a process. + Suspend a process.

Increases the suspend count on the process identified by - Suspendee and puts it in the suspended - state if it is not - already in that state. A suspended process will not be - scheduled for execution until the process has been resumed.

-

A process can be suspended by multiple processes and can - be suspended multiple times by a single process. A suspended - process does not leave the suspended state until its suspend - count reaches zero. The suspend count of - Suspendee is decreased when - erlang:resume_process(Suspendee) - is called by the same process that called - erlang:suspend_process(Suspendee). - All increased suspend - counts on other processes acquired by a process are automatically - decreased when the process terminates.

-

The options (Opts) are as follows:

+ Suspendee and puts it in the suspended + state if it is not + already in that state. A suspended process is not + scheduled for execution until the process has been resumed.

+

A process can be suspended by multiple processes and can + be suspended multiple times by a single process. A suspended + process does not leave the suspended state until its suspend + count reaches zero. The suspend count of + Suspendee is decreased when + + erlang:resume_process(Suspendee) + is called by the same process that called + erlang:suspend_process(Suspendee). + All increased suspend + counts on other processes acquired by a process are automatically + decreased when the process terminates.

+

Options (Opts):

asynchronous - A suspend request is sent to the process identified by - Suspendee. Suspendee - eventually suspends - unless it is resumed before it could suspend. The caller - of erlang:suspend_process/2 returns immediately, - regardless of whether Suspendee has - suspended yet or not. The point in time when - Suspendee suspends cannot be deduced - from other events in the system. It is only guaranteed that - Suspendee eventually suspends - (unless it - is resumed). If option asynchronous has not - been passed, the caller of erlang:suspend_process/2 is - blocked until Suspendee has suspended. - +

A suspend request is sent to the process identified by + Suspendee. Suspendee + eventually suspends + unless it is resumed before it could suspend. The caller + of erlang:suspend_process/2 returns immediately, + regardless of whether Suspendee has + suspended yet or not. The point in time when + Suspendee suspends cannot be deduced + from other events in the system. It is only guaranteed that + Suspendee eventually suspends + (unless it + is resumed). If option asynchronous has not + been passed, the caller of erlang:suspend_process/2 is + blocked until Suspendee has suspended.

+ unless_suspending - The process identified by Suspendee is - suspended unless the calling process already is suspending - Suspendee. - If unless_suspending is combined - with option asynchronous, a suspend request is - sent unless the calling process already is suspending - Suspendee or if a suspend request - already has been sent and is in transit. If the calling - process already is suspending Suspendee, - or if combined with option asynchronous - and a send request already is in transit, - false is returned and the suspend count on - Suspendee remains unchanged. - +

The process identified by Suspendee is + suspended unless the calling process already is suspending + Suspendee. + If unless_suspending is combined + with option asynchronous, a suspend request is + sent unless the calling process already is suspending + Suspendee or if a suspend request + already has been sent and is in transit. If the calling + process already is suspending Suspendee, + or if combined with option asynchronous + and a send request already is in transit, + false is returned and the suspend count on + Suspendee remains unchanged.

+
-

If the suspend count on the process identified by - Suspendee is increased, true - is returned, otherwise false.

+

If the suspend count on the process identified by + Suspendee is increased, true + is returned, otherwise false.

This BIF is intended for debugging only.

@@ -6461,44 +6505,44 @@ ok badarg - If Suspendee is not a process identifier. - + If Suspendee is not a process identifier. + badarg - If the process identified by Suspendee - is the same process - as the process calling erlang:suspend_process/2. - + If the process identified by Suspendee + is the same process + as the process calling erlang:suspend_process/2. + badarg - If the process identified by Suspendee - is not alive. - + If the process identified by Suspendee + is not alive. + badarg - If the process identified by Suspendee - resides on another node. - + If the process identified by Suspendee + resides on another node. + badarg - If OptList is not a proper list of valid - Opts. - + If OptList is not a proper list of valid + Opts. + system_limit - If the process identified by Suspendee - has been suspended - more times by the calling process than can be represented by the - currently used internal data structures. The system limit is - higher than 2,000,000,000 suspends and will never be lower. - + If the process identified by Suspendee + has been suspended + more times by the calling process than can be represented by the + currently used internal data structures. The system limit is + > 2,000,000,000 suspends and will never be lower. +
- Sets system flag backtrace_depth. + Set system flag backtrace_depth.

Sets the maximum depth of call stack back-traces in the exit reason element of 'EXIT' tuples.

@@ -6508,7 +6552,7 @@ ok - Sets system flag cpu_topology. + Set system flag cpu_topology. @@ -6517,52 +6561,52 @@ ok

- This argument is deprecated and scheduled for - removal in ERTS 5.10/OTP R16. Instead of using this - argument, use command-line argument - +sct in - erl(1).

+ This argument is deprecated. + Instead of using this argument, use command-line argument + +sct in + erl(1).

When this argument is removed, a final CPU topology - to use is determined at emulator boot time.

+ to use is determined at emulator boot time.

Sets the user-defined CpuTopology. - The user-defined - CPU topology overrides any automatically detected - CPU topology. By passing undefined as - CpuTopology, - the system reverts to the CPU topology automatically - detected. The returned value equals the value returned - from erlang:system_info(cpu_topology) before the - change was made.

+ The user-defined + CPU topology overrides any automatically detected + CPU topology. By passing undefined as + CpuTopology, + the system reverts to the CPU topology automatically + detected. The returned value equals the value returned + from erlang:system_info(cpu_topology) before the + change was made.

Returns the old value of the flag.

The CPU topology is used when binding schedulers to logical - processors. If schedulers are already bound when the CPU - topology is changed, the schedulers are sent a request - to rebind according to the new CPU topology.

+ processors. If schedulers are already bound when the CPU + topology is changed, the schedulers are sent a request + to rebind according to the new CPU topology.

The user-defined CPU topology can also be set by passing - command-line argument - +sct to - erl(1).

+ command-line argument + +sct to + erl(1).

For information on type CpuTopology - and more, see - erlang:system_info(cpu_topology) - as well as the command-line flags - +sct and - +sbt in - erl(1).

+ and more, see + + erlang:system_info(cpu_topology) + as well as command-line flags + +sct and + +sbt in + erl(1).

- Sets system_flag_dirty_cpu_schedulers_online. + Set system_flag_dirty_cpu_schedulers_online.

- Sets the number of dirty CPU schedulers online. Range is - , where N - is the smallest of the return values of - erlang:system_info(dirty_cpu_schedulers) and - erlang:system_info(schedulers_online).

+ Sets the number of dirty CPU schedulers online. Range is + , where N + is the smallest of the return values of + erlang:system_info(dirty_cpu_schedulers) and + erlang:system_info(schedulers_online).

Returns the old value of the flag.

The number of dirty CPU schedulers online can change if the number of schedulers online changes. For example, if 12 @@ -6573,20 +6617,22 @@ ok down to 3. Similarly, the number of dirty CPU schedulers online increases proportionally to increases in the number of schedulers online.

-

The dirty schedulers functionality is experimental. - Enable support for dirty schedulers when building OTP to - try out the functionality.

+ +

The dirty schedulers functionality is experimental. + Enable support for dirty schedulers when building OTP to + try out the functionality.

For more information, see - erlang:system_info(dirty_cpu_schedulers) - and - erlang:system_info(dirty_cpu_schedulers_online).

+ + erlang:system_info(dirty_cpu_schedulers) and + + erlang:system_info(dirty_cpu_schedulers_online).

- Sets system flag fullsweep_after. + Set system flag fullsweep_after.

Sets system flag fullsweep_after. Number is a non-negative integer indicating @@ -6605,43 +6651,45 @@ ok - Set system flag microstate_accounting -

- Turns on/off microstate accounting measurements. By passing reset it is possible to reset - all counters to 0.

-

For more information see, - erlang:statistics(microstate_accounting). -

+ Set system flag microstate_accounting. + +

+ Turns on/off microstate accounting measurements. By passing reset, + all counters can be reset to 0.

+

For more information see + + statistics(microstate_accounting).

+ - Sets system flag min_heap_size. + Set system flag min_heap_size.

Sets the default minimum heap size for processes. The size - is given in words. The new min_heap_size effects + is specified in words. The new min_heap_size effects only processes spawned after the change of min_heap_size has been made. min_heap_size can be set for individual processes by using - spawn_opt/N or - process_flag/2.

+ spawn_opt/4 or + process_flag/2.

Returns the old value of the flag.

- Sets system flag min_bin_vheap_size. + Set system flag min_bin_vheap_size.

Sets the default minimum binary virtual heap size for - processes. The size is given in words. + processes. The size is specified in words. The new min_bin_vhheap_size effects only processes spawned after the change of min_bin_vhheap_size has been made. min_bin_vheap_size can be set for individual processes by using - spawn_opt/N or - process_flag/2.

+ spawn_opt/4 or + process_flag/2.

Returns the old value of the flag.

@@ -6649,241 +6697,251 @@ ok - Sets system flag max_heap_size + Set system flag max_heap_size.

Sets the default maximum heap size settings for processes. - The size is given in words. The new max_heap_size + The size is specified in words. The new max_heap_size effects only processes spawned efter the change has been made. max_heap_size can be set for individual processes using - spawn_opt/N or - process_flag/2.

+ spawn_opt/4 or + + process_flag/2.

Returns the old value of the flag.

- Sets system flag multi_scheduling. + Set system flag multi_scheduling.

If multi-scheduling is enabled, more than one scheduler thread is used by the emulator. Multi-scheduling can be blocked in two different ways. Either all schedulers but - one is blocked, or all normal schedulers but - one is blocked. When only normal schedulers are blocked - dirty schedulers are free to continue to schedule - processes.

+ one is blocked, or all normal schedulers but + one is blocked. When only normal schedulers are blocked, + dirty schedulers are free to continue to schedule + processes.

If BlockState =:= block, multi-scheduling is blocked. That is, one and only one scheduler thread will - execute. If BlockState =:= unblock and no one + execute. If BlockState =:= unblock and no one else blocks multi-scheduling, and this process has blocked only once, multi-scheduling is unblocked.

If BlockState =:= block_normal, normal - multi-scheduling is blocked. That is, only one normal scheduler - thread will execute, but multiple dirty schedulers may execute. - If BlockState =:= unblock_normal and no one + multi-scheduling is blocked. That is, only one normal scheduler + thread will execute, but multiple dirty schedulers can execute. + If BlockState =:= unblock_normal and no one else blocks normal multi-scheduling, and this process has blocked only once, normal multi-scheduling is unblocked.

-

One process can block multi-scheduling as well as normal - multi-scheduling multiple times. If a process has blocked - multiple times, it must unblock exactly as many times as it - has blocked before it has released its multi-scheduling - block. If a process that has blocked multi-scheduling or normal - multi scheduling exits, it automatically releases its blocking - of multi-scheduling and normal multi-scheduling.

+

One process can block multi-scheduling and normal + multi-scheduling multiple times. If a process has blocked + multiple times, it must unblock exactly as many times as it + has blocked before it has released its multi-scheduling + block. If a process that has blocked multi-scheduling or normal + multi-scheduling exits, it automatically releases its blocking + of multi-scheduling and normal multi-scheduling.

The return values are disabled, blocked, blocked_normal, or enabled. The returned value - describes the state just after the call to + describes the state just after the call to erlang:system_flag(multi_scheduling, BlockState) has been made. For information about the return values, see - erlang:system_info(multi_scheduling).

+ + erlang:system_info(multi_scheduling).

Blocking of multi-scheduling and normal multi-scheduling - is normally not needed. If you feel that you need to use these - features, consider it a few more times again. Blocking - multi-scheduling is only to be used as a last resort, as it is - most likely a very inefficient way to solve the problem.

+ is normally not needed. If you feel that you need to use these + features, consider it a few more times again. Blocking + multi-scheduling is only to be used as a last resort, as it is + most likely a very inefficient way to solve the problem.

See also - erlang:system_info(multi_scheduling), - erlang:system_info(normal_multi_scheduling_blockers), - erlang:system_info(multi_scheduling_blockers), and - erlang:system_info(schedulers).

+ + erlang:system_info(multi_scheduling), + + erlang:system_info(normal_multi_scheduling_blockers), + + erlang:system_info(multi_scheduling_blockers), and + + erlang:system_info(schedulers).

- Sets system flag scheduler_bind_type. + Set system flag scheduler_bind_type.

- This argument is deprecated and scheduled for - removal in ERTS 5.10/OTP R16. Instead of using this - argument, use command-line argument - +sbt in erl(1). - When this argument is removed, a final scheduler bind - type to use is determined at emulator boot time.

+ This argument is deprecated. + Instead of using this argument, use command-line argument + +sbt in + erl(1). When this argument is removed, a final scheduler bind + type to use is determined at emulator boot time.

Controls if and how schedulers are bound to logical - processors.

+ processors.

When erlang:system_flag(scheduler_bind_type, How) - is called, an asynchronous signal is sent to all schedulers - online, causing them to try to bind or unbind as requested.

+ is called, an asynchronous signal is sent to all schedulers + online, causing them to try to bind or unbind as requested.

If a scheduler fails to bind, this is often silently - ignored, as it is not always possible to verify valid - logical processor identifiers. If an error is reported, - it is reported to error_logger. To verify that the - schedulers have bound as requested, call - erlang:system_info(scheduler_bindings).

+ ignored, as it is not always possible to verify valid + logical processor identifiers. If an error is reported, + it is reported to error_logger. To verify that the + schedulers have bound as requested, call + + erlang:system_info(scheduler_bindings).

Schedulers can be bound on newer Linux, - Solaris, FreeBSD, and Windows systems, but more systems will be - supported in future releases.

+ Solaris, FreeBSD, and Windows systems, but more systems will be + supported in future releases.

In order for the runtime system to be able to bind schedulers, - the CPU topology must be known. If the runtime system fails - to detect the CPU topology automatically, it can be defined. - For more information on how to define the CPU topology, see - command-line flag +sct - in erl(1).

+ the CPU topology must be known. If the runtime system fails + to detect the CPU topology automatically, it can be defined. + For more information on how to define the CPU topology, see + command-line flag + +sct in erl(1).

The runtime system does by default not bind schedulers - to logical processors.

+ to logical processors.

If the Erlang runtime system is the only OS - process binding threads to logical processors, this - improves the performance of the runtime system. However, - if other OS processes (for example, another Erlang - runtime system) also bind threads to logical processors, - there can be a performance penalty instead. Sometimes this - performance penalty can be severe. If so, it is recommended - to not bind the schedulers.

+ process binding threads to logical processors, this + improves the performance of the runtime system. However, + if other OS processes (for example, another Erlang + runtime system) also bind threads to logical processors, + there can be a performance penalty instead. Sometimes this + performance penalty can be severe. If so, it is recommended + to not bind the schedulers.

Schedulers can be bound in different ways. Argument - How determines how schedulers are - bound and can be any of the following:

+ How determines how schedulers are + bound and can be any of the following:

unbound - -

Same as command-line argument - +sbt u in erl(1). -

+ Same as command-line argument + +sbt u in + erl(1). + no_spread - -

Same as command-line argument - +sbt ns in erl(1). -

+ Same as command-line argument + +sbt ns + in erl(1). + thread_spread - -

Same as command-line argument - +sbt ts in erl(1). -

+ Same as command-line argument + +sbt ts + in erl(1). + processor_spread - -

Same as command-line argument - +sbt ps in erl(1). -

+ Same as command-line argument + +sbt ps + in erl(1). + spread - -

Same as command-line argument - +sbt s in erl(1). -

+ Same as command-line argument + +sbt s + in erl(1). + no_node_thread_spread - -

Same as command-line argument - +sbt nnts in erl(1). -

+ Same as command-line argument + +sbt nnts + in erl(1). + no_node_processor_spread - -

Same as command-line argument - +sbt nnps in erl(1). -

+ Same as command-line argument + +sbt nnps + in erl(1). + thread_no_node_processor_spread - -

Same as command-line argument - +sbt tnnps in erl(1). -

+ Same as command-line argument + +sbt tnnps + in erl(1). + default_bind - -

Same as command-line argument - +sbt db in erl(1). -

+ Same as command-line argument + +sbt db + in erl(1). +

The returned value equals How before flag scheduler_bind_type was changed.

Failures:

notsup - -

If binding of schedulers is not supported.

+ If binding of schedulers is not supported. badarg - -

If How is not one of the documented - alternatives.

+ If How is not one of the documented + alternatives. badarg - -

If CPU topology information is unavailable.

+ If CPU topology information is unavailable.
-

The scheduler bind type can also be set by passing - command-line argument - +sbt to erl(1).

+

The scheduler bind type can also be set by passing command-line + argument + +sbt to erl(1).

For more information, see - erlang:system_info(scheduler_bind_type), - erlang:system_info(scheduler_bindings), - as well as command-line flags - +sbt - and +sct - in erl(1).

+ + erlang:system_info(scheduler_bind_type), + + erlang:system_info(scheduler_bindings), + as well as command-line flags + +sbt + and +sct + in erl(1).

- Sets system flag scheduler_wall_time. -

- Turns on or off scheduler wall time measurements.

-

For more information, see - erlang:statistics(scheduler_wall_time).

+ Set system flag scheduler_wall_time. + +

+ Turns on or off scheduler wall time measurements.

+

For more information, see + + statistics(scheduler_wall_time).

- Sets system flag schedulers_online. + Set system flag schedulers_online.

- Sets the number of schedulers online. Range is - .

+ Sets the number of schedulers online. Range is + .

Returns the old value of the flag.

If the emulator was built with support for - dirty schedulers, - changing the number of schedulers online can also change the - number of dirty CPU schedulers online. For example, if 12 - schedulers and 6 dirty CPU schedulers are online, and - system_flag/2 is used to set the number of schedulers - online to 6, then the number of dirty CPU schedulers online - is automatically decreased by half as well, down to 3. - Similarly, the number of dirty CPU schedulers online increases - proportionally to increases in the number of schedulers online.

+ + dirty schedulers, + changing the number of schedulers online can also change the + number of dirty CPU schedulers online. For example, if 12 + schedulers and 6 dirty CPU schedulers are online, and + system_flag/2 is used to set the number of schedulers + online to 6, then the number of dirty CPU schedulers online + is automatically decreased by half as well, down to 3. + Similarly, the number of dirty CPU schedulers online increases + proportionally to increases in the number of schedulers online.

For more information, see - erlang:system_info(schedulers) - and - erlang:system_info(schedulers_online).

+ + erlang:system_info(schedulers) and + + erlang:system_info(schedulers_online).

- Sets system flag trace_control_word. + Set system flag trace_control_word.

Sets the value of the node trace control word to TCW, which is to be an unsigned integer. - For more information, see the function - set_tcw - in Section "Match Specifications in Erlang" in the + For more information, see function + set_tcw + in section "Match Specifications in Erlang" in the User's Guide.

Returns the old value of the flag.

@@ -6891,32 +6949,30 @@ ok - Finalize the Time Offset + Finalize the time offset.

- Finalizes the time offset - when single - time warp mode is used. If another time warp mode - is used, the time offset state is left unchanged.

-

Returns the old state identifier. That is:

- - -

If preliminary is returned, finalization was - performed and the time offset is now final.

- - -

If final is returned, the time offset was - already in the final state. This either because another - erlang:system_flag(time_offset, finalize) call, or - because no - time warp mode is used.

- - -

If volatile is returned, the time offset - cannot be finalized because - multi - time warp mode is used.

-
+ Finalizes the time offset + when single + time warp mode is used. If another time warp mode + is used, the time offset state is left unchanged.

+

Returns the old state identifier, that is:

+ +

If preliminary is returned, finalization was + performed and the time offset is now final.

+
+

If final is returned, the time offset was + already in the final state. This either because another + erlang:system_flag(time_offset, finalize) call or + because no + time warp mode is used.

+
+

If volatile is returned, the time offset + cannot be finalized because + multi-time + warp mode is used.

+
+
@@ -6933,7 +6989,7 @@ ok - +

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

@@ -6952,17 +7008,18 @@ ok

erlang:system_info(allocated_areas) is intended for debugging, and the content is highly implementation-dependent. The content of the results - therefore changes when needed without prior notice.

+ therefore changes when needed without prior notice.

Notice that the sum of these values is not the total amount of memory allocated by the emulator. Some values are part of other values, and some memory areas are not part of the result. For information about the total amount of memory allocated by the emulator, see - erlang:memory/0,1.

+ + erlang:memory/0,1.

allocator - +

Returns {Allocator, Version, Features, Settings, where:

@@ -6992,27 +7049,30 @@ ok

See also "System Flags Effecting erts_alloc" in - erts_alloc(3).

+ + erts_alloc(3).

alloc_util_allocators - -

Returns a list of the names of all allocators using - the ERTS internal alloc_util framework - as atoms. For more information, see Section - "The - alloc_util framework" in erts_alloc(3).

+ +

Returns a list of the names of all allocators using + the ERTS internal alloc_util framework + as atoms. For more information, see section + The + alloc_util framework + in erts_alloc(3).

{allocator, Alloc} - +

Returns information about the specified allocator. - As from ERTS 5.6.1, the return value is a list - of {instance, InstanceNo, InstanceInfo} tuples, - where InstanceInfo contains information about - a specific instance of the allocator. If Alloc is not a - recognized allocator, undefined is returned. - If Alloc is disabled, + As from ERTS 5.6.1, the return value is a list + of {instance, InstanceNo, InstanceInfo} tuples, + where InstanceInfo contains information about + a specific instance of the allocator. + If Alloc is not a + recognized allocator, undefined is returned. + If Alloc is disabled, false is returned.

Notice that the information returned is highly implementation-dependent and can be changed or removed @@ -7021,15 +7081,14 @@ ok as it can be of interest for others it has been briefly documented.

The recognized allocators are listed in - erts_alloc(3). - Information about super carriers can be obtained from - ERTS 8.0 with {allocator, erts_mmap} or from - ERTS 5.10.4, the returned list when calling with - {allocator, mseg_alloc} also includes an - {erts_mmap, _} tuple as one element in the list.

- + erts_alloc(3). + Information about super carriers can be obtained from + ERTS 8.0 with {allocator, erts_mmap} or from + ERTS 5.10.4; the returned list when calling with + {allocator, mseg_alloc} also includes an + {erts_mmap, _} tuple as one element in the list.

After reading the erts_alloc(3) documentation, - the returned information + the returned information more or less speaks for itself, but it can be worth explaining some things. Call counts are presented by two values, the first value is giga calls, and the second @@ -7045,19 +7104,20 @@ ok The third is the maximum value since the emulator was started. -

If only one value is present, it is the current value. +

If only one value is present, it is the current value. fix_alloc memory block types are presented by two values. The first value is the memory pool size and the second value is the used memory size.

{allocator_sizes, Alloc} - -

Returns various size information for the specified - allocator. The information returned is a subset of the - information returned by - erlang:system_info({allocator, Alloc}). -

+ +

Returns various size information for the specified + allocator. The information returned is a subset of the + information returned by + + erlang:system_info({allocator, + Alloc}).

@@ -7091,69 +7151,74 @@ ok The info_list() can be extended in a future release. - - + +

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

cpu_topology -

Returns the CpuTopology currently used by - the emulator. The CPU topology is used when binding schedulers - to logical processors. The CPU topology used is the - user-defined CPU topology, - if such exists, otherwise the - automatically detected CPU topology, - if such exists. If no CPU topology - exists, undefined is returned.

-

node refers to Non-Uniform Memory Access (NUMA) - nodes. thread refers to hardware threads - (for example, Intel hyper-threads).

+

Returns the CpuTopology currently used by + the emulator. The CPU topology is used when binding schedulers + to logical processors. The CPU topology used is the + + user-defined CPU topology, + if such exists, otherwise the + + automatically detected CPU topology, + if such exists. If no CPU topology + exists, undefined is returned.

+

node refers to Non-Uniform Memory Access (NUMA) + nodes. thread refers to hardware threads + (for example, Intel hyper-threads).

A level in term CpuTopology can be - omitted if only one entry exists and - InfoList is empty.

-

thread can only be a sub level to core. - core can be a sub level to processor - or node. processor can be on the - top level or a sub level to node. node - can be on the top level or a sub level to - processor. That is, NUMA nodes can be processor - internal or processor external. A CPU topology can - consist of a mix of processor internal and external - NUMA nodes, as long as each logical CPU belongs to - one NUMA node. Cache hierarchy is not part of - the CpuTopology type, but will be in a - future release. Other things can also make it into the CPU - topology in a future release. In other words, expect the - CpuTopology type to change.

+ omitted if only one entry exists and + InfoList is empty.

+

thread can only be a sublevel to core. + core can be a sublevel to processor + or node. processor can be on the + top level or a sublevel to node. node + can be on the top level or a sublevel to + processor. That is, NUMA nodes can be processor + internal or processor external. A CPU topology can + consist of a mix of processor internal and external + NUMA nodes, as long as each logical CPU belongs to + one NUMA node. Cache hierarchy is not part of + the CpuTopology type, but will be in a + future release. Other things can also make it into the CPU + topology in a future release. So, expect the + CpuTopology type to change.

{cpu_topology, defined} - +

Returns the user-defined CpuTopology. - For more information, see command-line flag - +sct in - erl(1) and argument - cpu_topology.

+ For more information, see command-line flag + +sct in + erl(1) and argument + + cpu_topology.

{cpu_topology, detected} - +

Returns the automatically detected - CpuTopologyy. The - emulator detects the CPU topology on some newer - Linux, Solaris, FreeBSD, and Windows systems. - On Windows system with more than 32 logical processors, - the CPU topology is not detected.

+ CpuTopologyy. The + emulator detects the CPU topology on some newer + Linux, Solaris, FreeBSD, and Windows systems. + On Windows system with more than 32 logical processors, + the CPU topology is not detected.

For more information, see argument - cpu_topology.

+ + cpu_topology.

{cpu_topology, used}

Returns CpuTopology used by the emulator. For more information, see argument - cpu_topology.

+ + cpu_topology.

@@ -7170,13 +7235,14 @@ ok +

Returns information about the default process heap settings:

fullsweep_after

Returns {fullsweep_after, integer() >= 0}, which is the fullsweep_after garbage collection setting used by default. For more information, see - garbage_collection described in the following.

+ garbage_collection described below.

garbage_collection @@ -7185,50 +7251,52 @@ ok spawn or spawn_link uses these garbage collection settings. The default settings can be changed by using - system_flag/2. - spawn_opt/4 + + erlang:system_flag/2. + spawn_opt/4 can spawn a process that does not use the default settings.

max_heap_size -

Returns {max_heap_size, MaxHeapSize}, +

Returns {max_heap_size, MaxHeapSize}, where MaxHeapSize is the current - system-wide max heap size settings for spawned processes. - This setting can be set using the erl command line - flags +hmax, + system-wide maximum heap size settings for spawned processes. + This setting can be set using the command-line flags + +hmax, +hmaxk and - +hmaxel. It can - also be changed at run-time using + +hmaxel in + erl/1. It can also be changed at runtime using - erlang:system_flag(max_heap_size, MaxHeapSize). - For more details about the max_heap_size process flag + erlang:system_flag(max_heap_size, MaxHeapSize). + For more details about the max_heap_size process flag, see - process_flag(max_heap_size, MaxHeapSize). -

+ process_flag(max_heap_size, MaxHeapSize).

- min_heap_size + min_heap_size -

Returns {min_heap_size, MinHeapSize}, +

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

- message_queue_data + + message_queue_data

Returns the default value of the message_queue_data - process flag which is either off_heap, or on_heap. - This default is set by the erl command line argument - +hmqd. For more information on the - message_queue_data process flag, see documentation of - process_flag(message_queue_data, - MQD).

+ process flag, which is either off_heap or on_heap. + This default is set by command-line argument + +hmqd in + erl/1. For more information on the + message_queue_data process flag, see documentation of + + process_flag(message_queue_data, MQD).

- min_bin_vheap_size + min_bin_vheap_size -

Returns {min_bin_vheap_size, +

Returns {min_bin_vheap_size, MinBinVHeapSize}, where MinBinVHeapSize is the current system-wide - minimum binary virtual heap size for spawned processes.

+ minimum binary virtual heap size for spawned processes.

@@ -7299,24 +7367,25 @@ ok allocated_areas, allocator, alloc_util_allocators, allocator_sizes -

See above.

+

See + above.

build_type

Returns an atom describing the build type of the runtime - system. This is normally the atom opt for optimized. - Other possible return values are debug, purify, - quantify, purecov, gcov, valgrind, - gprof, and lcnt. Possible return values - can be added or removed at any time without prior notice.

+ system. This is normally the atom opt for optimized. + Other possible return values are debug, purify, + quantify, purecov, gcov, valgrind, + gprof, and lcnt. Possible return values + can be added or removed at any time without prior notice.

c_compiler_used

Returns a two-tuple describing the C compiler used when - compiling the runtime system. The first element is an - atom describing the name of the compiler, or undefined - if unknown. The second element is a term describing the - version of the compiler, or undefined if unknown.

+ compiling the runtime system. The first element is an + atom describing the name of the compiler, or undefined + if unknown. The second element is a term describing the + version of the compiler, or undefined if unknown.

check_io @@ -7333,12 +7402,13 @@ ok Erlang/OTP release that the current emulator has been set to be backward compatible with. The compatibility mode can be configured at startup by using command-line flag - +R in + +R in erl(1).

cpu_topology -

See above.

+

See above.

creation @@ -7354,22 +7424,22 @@ ok debug_compiled -

Returns true if the emulator has been debug - compiled, otherwise false.

+

Returns true if the emulator has been + debug-compiled, otherwise false.

delayed_node_table_gc

Returns the amount of time in seconds garbage collection - of an entry in a node table is delayed. This limit can be set - on startup by passing the command line flag - +zdntgc - to erl. For more information see the documentation of the - command line flag.

+ of an entry in a node table is delayed. This limit can be set + on startup by passing command-line flag + +zdntgc + to erl/1. For more information, see the documentation of + the command-line flag.

dirty_cpu_schedulers - +

Returns the number of dirty CPU scheduler threads used by the emulator. Dirty CPU schedulers execute CPU-bound native functions, such as NIFs, linked-in driver code, @@ -7381,23 +7451,31 @@ ok can be changed at any time. The number of dirty CPU schedulers can be set at startup by passing command-line flag - +SDcpu or - +SDPcpu in + +SDcpu or + +SDPcpu in erl(1).

-

Notice that the dirty schedulers functionality is +

Notice that the dirty schedulers functionality is experimental. Enable support for dirty schedulers when building OTP to try out the functionality.

See also - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline), - erlang:system_info(dirty_cpu_schedulers_online), - erlang:system_info(dirty_io_schedulers), - erlang:system_info(schedulers), - erlang:system_info(schedulers_online), and - erlang:system_flag(schedulers_online, SchedulersOnline).

+ + erlang:system_flag(dirty_cpu_schedulers_online, + DirtyCPUSchedulersOnline), + + erlang:system_info(dirty_cpu_schedulers_online), + + erlang:system_info(dirty_io_schedulers), + + erlang:system_info(schedulers), + + erlang:system_info(schedulers_online), and + + erlang:system_flag(schedulers_online, + SchedulersOnline).

dirty_cpu_schedulers_online - +

Returns the number of dirty CPU schedulers online. The return value satisfies , @@ -7406,51 +7484,60 @@ ok erlang:system_info(schedulers_online).

The number of dirty CPU schedulers online can be set at startup by passing command-line flag - +SDcpu in + +SDcpu in erl(1).

Notice that the dirty schedulers functionality is experimental. Enable support for dirty schedulers when building OTP to try out the functionality.

For more information, see - erlang:system_info(dirty_cpu_schedulers), - erlang:system_info(dirty_io_schedulers), - erlang:system_info(schedulers_online), and - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline).

+ + erlang:system_info(dirty_cpu_schedulers), + + erlang:system_info(dirty_io_schedulers), + + erlang:system_info(schedulers_online), and + + erlang:system_flag(dirty_cpu_schedulers_online, + DirtyCPUSchedulersOnline).

dirty_io_schedulers - +

Returns the number of dirty I/O schedulers as an integer. Dirty I/O schedulers execute I/O-bound native functions, such as NIFs and linked-in driver code, which cannot be managed cleanly by the normal emulator schedulers.

This value can be set at startup by passing command-line - argument +SDio + argument +SDio in erl(1).

-

Notice that the dirty schedulers functionality is +

Notice that the dirty schedulers functionality is experimental. Enable support for dirty schedulers when building OTP to try out the functionality.

For more information, see - erlang:system_info(dirty_cpu_schedulers), - erlang:system_info(dirty_cpu_schedulers_online), and - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline).

+ + erlang:system_info(dirty_cpu_schedulers), + + erlang:system_info(dirty_cpu_schedulers_online), + and + erlang:system_flag(dirty_cpu_schedulers_online, + DirtyCPUSchedulersOnline).

dist

Returns a binary containing a string of distribution information formatted as in Erlang crash dumps. For more - information, see Section - "How to interpret the Erlang crash dumps" + information, see section + How to interpret the Erlang crash dumps in the User's Guide.

dist_buf_busy_limit - +

Returns the value of the distribution buffer busy limit - in bytes. This limit can be set at startup by passing - command-line flag - +zdbbl - to erl.

+ in bytes. This limit can be set at startup by passing + command-line flag + +zdbbl + to erl.

dist_ctrl @@ -7468,62 +7555,63 @@ ok

Returns a string containing the Erlang driver version used by the runtime system. It has the form - "<major ver>.<minor ver>".

+ + "<major ver>.<minor ver>".

dynamic_trace

Returns an atom describing the dynamic trace framework - compiled into the virtual machine. It can be - dtrace, systemtap, or none. For a - commercial or standard build, it is always none. - The other return values indicate a custom configuration - (for example, ./configure --with-dynamic-trace=dtrace). - For more information about dynamic tracing, see the - dyntrace - manual page and the - README.dtrace/README.systemtap files in the - Erlang source code top directory.

+ compiled into the virtual machine. It can be + dtrace, systemtap, or none. For a + commercial or standard build, it is always none. + The other return values indicate a custom configuration + (for example, ./configure --with-dynamic-trace=dtrace). + For more information about dynamic tracing, see + + runtime_tools:dyntrace manual page and the + README.dtrace/README.systemtap files in the + Erlang source code top directory.

dynamic_trace_probes

Returns a boolean() indicating if dynamic trace - probes (dtrace or systemtap) are built into - the emulator. This can only be true if the Virtual - Machine was built for dynamic tracing (that is, - system_info(dynamic_trace) returns - dtrace or systemtap).

+ probes (dtrace or systemtap) are built into + the emulator. This can only be true if the virtual + machine was built for dynamic tracing (that is, + system_info(dynamic_trace) returns + dtrace or systemtap).

- end_time - + end_time +

The last Erlang monotonic - time in native - time unit that - can be represented internally in the current Erlang runtime system - instance. The time between the - start time and - the end time is at least a quarter of a millennium.

+ time in native + time unit that + can be represented internally in the current Erlang runtime system + instance. The time between the + start time and + the end time is at least a quarter of a millennium.

+
elib_malloc

This option will be removed in a future release. - The return value will always be false, as the - elib_malloc allocator has been removed.

+ The return value will always be false, as the + elib_malloc allocator has been removed.

- eager_check_io + + eager_check_io -

- Returns the value of the erl command line flag - +secio - which is either true or false. See the - documentation of the command line flag for information about - the different values. -

+

Returns the value of command-line flag + +secio in + erl/1, which is either true or false. + For information about the different values, see the + documentation of the command-line flag.

ets_limit -

Returns the maximum number of ETS tables allowed. This +

Returns the maximum number of ets tables allowed. This limit can be increased at startup by passing command-line flag - +e to + +e to erl(1) or by setting environment variable ERL_MAX_ETS_TABLES before starting the Erlang runtime system.

@@ -7541,10 +7629,10 @@ ok private -

Each process has a heap reserved for its use and no - references between heaps of different processes are - allowed. Messages passed between processes are copied - between heaps.

+ Each process has a heap reserved for its use and no + references between heaps of different processes are + allowed. Messages passed between processes are copied + between heaps.
@@ -7552,8 +7640,9 @@ ok

Returns a binary containing a string of miscellaneous system information formatted as in Erlang crash dumps. - For more information, see Section - "How to interpret the Erlang crash dumps" + For more information, see section + + How to interpret the Erlang crash dumps in the User's Guide.

kernel_poll @@ -7565,38 +7654,39 @@ ok

Returns a binary containing a string of loaded module information formatted as in Erlang crash dumps. For more - information, see Section - "How to interpret the Erlang crash dumps" - in the User's Guide.

+ information, see section + How to interpret the Erlang + crash dumps in the User's Guide.

- logical_processors + logical_processors - +

Returns the detected number of logical processors configured - in the system. The return value is either an integer, or - the atom unknown if the emulator cannot - detect the configured logical processors.

+ in the system. The return value is either an integer, or + the atom unknown if the emulator cannot + detect the configured logical processors.

- logical_processors_available + logical_processors_available - +

Returns the detected number of logical processors available - to the Erlang runtime system. The return value is either an - integer, or the atom unknown if the emulator - cannot detect the available logical processors. The number - of available logical processors is less than or equal to - the number of - logical processors online.

+ to the Erlang runtime system. The return value is either an + integer, or the atom unknown if the emulator + cannot detect the available logical processors. The number + of available logical processors is less than or equal to + the number of + logical processors online.

- logical_processors_online + logical_processors_online - +

Returns the detected number of logical processors online on - the system. The return value is either an integer, - or the atom unknown if the emulator cannot - detect logical processors online. The number of logical - processors online is less than or equal to the number of - logical processors configured.

+ the system. The return value is either an integer, + or the atom unknown if the emulator cannot + detect logical processors online. The number of logical + processors online is less than or equal to the number of + logical processors + configured.

machine @@ -7605,17 +7695,16 @@ ok modified_timing_level

Returns the modified timing-level (an integer) if - modified timing is enabled, otherwise, undefined. + modified timing is enabled, otherwise undefined. For more information about modified timing, see command-line flag - +T + +T in erl(1)

multi_scheduling - -

Returns disabled, blocked, blocked_normal, - or enabled:

+ +

Returns one of the following:

disabled @@ -7634,9 +7723,9 @@ ok

The emulator has more than one scheduler thread, but all normal scheduler threads except one are - blocked. Note that dirty schedulers are not - blocked, and may schedule Erlang processes and - execute native code.

+ blocked. Notice that dirty schedulers are not + blocked, and can schedule Erlang processes and + execute native code.

enabled @@ -7647,201 +7736,204 @@ ok

See also - erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling_blockers), - erlang:system_info(normal_multi_scheduling_blockers), - and - erlang:system_info(schedulers).

+ + erlang:system_flag(multi_scheduling, BlockState), + + erlang:system_info(multi_scheduling_blockers), + + erlang:system_info(normal_multi_scheduling_blockers), + and + erlang:system_info(schedulers).

multi_scheduling_blockers - +

Returns a list of Pids when multi-scheduling is blocked, otherwise the empty list is returned. The Pids in the list - represent all the processes currently + represent all the processes currently blocking multi-scheduling. A Pid occurs only once in the list, even if the corresponding process has blocked multiple times.

See also - erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling), - erlang:system_info(normal_multi_scheduling_blockers), - - and - erlang:system_info(schedulers).

+ + erlang:system_flag(multi_scheduling, BlockState), + + erlang:system_info(multi_scheduling), + + erlang:system_info(normal_multi_scheduling_blockers), + and + erlang:system_info(schedulers).

nif_version -

Returns a string containing the version of the Erlang NIF interface - used by the runtime system. It is on the form - "<major ver>.<minor ver>".

+

Returns a string containing the version of the Erlang NIF + interface used by the runtime system. It is on the form + "<major ver>.<minor ver>".

normal_multi_scheduling_blockers - +

Returns a list of Pids when - normal multi-scheduling is blocked (i.e. all normal schedulers - but one is blocked), otherwise the empty list is returned. - The Pids in the list represent all the - processes currently blocking normal multi-scheduling. - A Pid occurs only once in the list, even if - the corresponding process has blocked multiple times.

+ normal multi-scheduling is blocked (that is, all normal schedulers + but one is blocked), otherwise the empty list is returned. + The Pids in the list represent all the + processes currently blocking normal multi-scheduling. + A Pid occurs only once in the list, even if + the corresponding process has blocked multiple times.

See also - erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling), - erlang:system_info(multi_scheduling_blockers), - - and - erlang:system_info(schedulers).

-
- otp_release - - + + erlang:system_flag(multi_scheduling, BlockState), + + erlang:system_info(multi_scheduling), + + erlang:system_info(multi_scheduling_blockers), + and + erlang:system_info(schedulers).

+
+ + otp_release + +

Returns a string containing the OTP release number of the - OTP release that the currently executing ERTS application is - part of.

-

As from OTP 17, the OTP release number corresponds to - the major OTP version number. No - erlang:system_info() argument gives the exact OTP - version. This is because the exact OTP version in the general case - is difficult to determine. For more information, see the description - of versions in - System principles in System Documentation.

-
- os_monotonic_time_source + OTP release that the currently executing ERTS application + is part of.

+

As from Erlang/OTP 17, the OTP release number corresponds to + the major OTP version number. No + erlang:system_info() argument gives the exact OTP + version. This is because the exact OTP version in the general case + is difficult to determine. For more information, see the + description of versions in + + System principles in System Documentation.

+
+ + os_monotonic_time_source

Returns a list containing information about the source of - OS - monotonic time that is used by the runtime system.

-

If [] is returned, no OS monotonic time is - available. The list contains two-tuples with Keys - as first element, and Values as second element. The - order of these tuples is undefined. The following - tuples can be part of the list, but more tuples can be - introduced in the future:

- - {function, Function} - -

Function is the name of the function - used. This tuple always exist if OS monotonic time is - available to the runtime system.

- - {clock_id, ClockId} - -

This tuple only exist if Function - can be used with different clocks. ClockId - corresponds to the clock identifier used when calling - Function.

- - {resolution, OsMonotonicTimeResolution} - -

Highest possible - resolution - of current OS monotonic time source as parts per - second. If no resolution information can be retrieved - from the OS, OsMonotonicTimeResolution is - set to the resolution of the time unit of - Functions return value. That is, the actual - resolution can be lower than - OsMonotonicTimeResolution. Also note that - the resolution does not say anything about the - accuracy, - and whether the - precision - do align with the resolution. You do, - however, know that the precision is not better than - OsMonotonicTimeResolution.

- - {extended, Extended} - -

Extended equals yes if - the range of time values has been extended; - otherwise, Extended equals no. The - range needs to be extended if Function - returns values that wrap fast. This typically - is the case when the return value is a 32-bit - value.

- - {parallel, Parallel} - -

Parallel equals yes if - Function is called in parallel from multiple - threads. If it is not called in parallel, because - calls needs to be serialized, Parallel equals - no.

- - {time, OsMonotonicTime} - -

OsMonotonicTime equals current OS - monotonic time in native - time unit.

-
-
- os_system_time_source + OS + monotonic time that is used by the runtime system.

+

If [] is returned, no OS monotonic time is + available. The list contains two-tuples with Keys + as first element, and Values as second element. The + order of these tuples is undefined. The following + tuples can be part of the list, but more tuples can be + introduced in the future:

+ + {function, Function} +

Function is the name of the function + used. This tuple always exists if OS monotonic time is + available to the runtime system.

+
+ {clock_id, ClockId} +

This tuple only exists if Function + can be used with different clocks. ClockId + corresponds to the clock identifier used when calling + Function.

+
+ {resolution, OsMonotonicTimeResolution} +

Highest possible + + resolution + of current OS monotonic time source as parts per + second. If no resolution information can be retrieved + from the OS, OsMonotonicTimeResolution is + set to the resolution of the time unit of + Functions return value. That is, the actual + resolution can be lower than + OsMonotonicTimeResolution. Notice that + the resolution does not say anything about the + + accuracy or whether the + + precision aligns with the resolution. You do, + however, know that the precision is not better than + OsMonotonicTimeResolution.

+
+ {extended, Extended} +

Extended equals yes if + the range of time values has been extended; + otherwise Extended equals no. The + range must be extended if Function + returns values that wrap fast. This typically + is the case when the return value is a 32-bit value.

+
+ {parallel, Parallel} +

Parallel equals yes if + Function is called in parallel from multiple + threads. If it is not called in parallel, because + calls must be serialized, Parallel equals + no.

+
+ {time, OsMonotonicTime} +

OsMonotonicTime equals current OS + monotonic time in native + time unit.

+
+
+
+ + os_system_time_source

Returns a list containing information about the source of - OS - system time that is used by the runtime system.

-

The list contains two-tuples with Keys - as first element, and Values as second element. The - order if these tuples is undefined. The following - tuples can be part of the list, but more tuples can be - introduced in the future:

- - {function, Function} - -

Function is the name of the funcion - used.

+ OS + system time that is used by the runtime system.

+

The list contains two-tuples with Keys + as first element, and Values as second element. The + order if these tuples is undefined. The following + tuples can be part of the list, but more tuples can be + introduced in the future:

+ + {function, Function} +

Function is the name of the funcion used.

- {clock_id, ClockId} - -

This tuple only exist if Function - can be used with different clocks. ClockId - corresponds to the clock identifier used when calling - Function.

+ {clock_id, ClockId} +

Exists only if Function + can be used with different clocks. ClockId + corresponds to the clock identifier used when calling + Function.

- {resolution, OsSystemTimeResolution} - -

Highest possible - resolution - of current OS system time source as parts per - second. If no resolution information can be retrieved - from the OS, OsSystemTimeResolution is - set to the resolution of the time unit of - Functions return value. That is, the actual - resolution may be lower than - OsSystemTimeResolution. Also note that - the resolution does not say anything about the - accuracy, - and whether the - precision - do align with the resolution. You do, - however, know that the precision is not better than - OsSystemTimeResolution.

+ {resolution, OsSystemTimeResolution} +

Highest possible + + resolution + of current OS system time source as parts per + second. If no resolution information can be retrieved + from the OS, OsSystemTimeResolution is + set to the resolution of the time unit of + Functions return value. That is, the actual + resolution can be lower than + OsSystemTimeResolution. Notice that + the resolution does not say anything about the + + accuracy or whether the + + precision do align with the resolution. You do, + however, know that the precision is not better than + OsSystemTimeResolution.

- {parallel, Parallel} - -

Parallel equals yes if - Function is called in parallel from multiple - threads. If it is not called in parallel, because - calls needs to be serialized, Parallel equals - no.

+ {parallel, Parallel} +

Parallel equals yes if + Function is called in parallel from multiple + threads. If it is not called in parallel, because + calls needs to be serialized, Parallel equals + no.

- {time, OsSystemTime} - -

OsSystemTime equals current OS - system time in native - time unit.

+ {time, OsSystemTime} +

OsSystemTime equals current OS + system time in native + time unit.

-
+
+
+ port_parallelism + + +

Returns the default port parallelism scheduling hint used. + For more information, see command-line argument + +spp + in erl(1).

- port_parallelism - - -

Returns the default port parallelism scheduling hint used. - For more information, see command-line argument - +spp in erl(1).

port_count

Returns the number of ports currently existing at the @@ -7855,9 +7947,10 @@ ok

Returns the maximum number of simultaneously existing ports at the local node as an integer. This limit can be configured at startup by using command-line flag - +Q in erl(1).

+ +Q in erl(1).

- process_count + + process_count

Returns the number of processes currently existing at the local node. The value is given as an integer. This is @@ -7866,74 +7959,78 @@ ok process_limit - +

Returns the maximum number of simultaneously existing processes at the local node. The value is given as an integer. This limit can be configured at startup by using - command-line flag +P - in erl(1).

+ command-line flag +P + in erl(1).

procs

Returns a binary containing a string of process and port information formatted as in Erlang crash dumps. For more - information, see Section - "How to interpret the Erlang crash dumps" + information, see section + How to interpret the Erlang crash dumps in the User's Guide.

scheduler_bind_type - -

Returns information about how the user has requested - schedulers to be bound or not bound.

-

Notice that even though a user has requested - schedulers to be bound, they can silently have failed - to bind. To inspect the scheduler bindings, call - erlang:system_info(scheduler_bindings).

-

For more information, see command-line argument - +sbt - in erl(1) and - erlang:system_info(scheduler_bindings).

+ +

Returns information about how the user has requested + schedulers to be bound or not bound.

+

Notice that although a user has requested + schedulers to be bound, they can silently have failed + to bind. To inspect the scheduler bindings, call + + erlang:system_info(scheduler_bindings).

+

For more information, see command-line argument + +sbt + in erl(1) and + + erlang:system_info(scheduler_bindings).

scheduler_bindings - -

Returns information about the currently used scheduler - bindings.

-

A tuple of a size equal to - erlang:system_info(schedulers) - is returned. The tuple elements are integers - or the atom unbound. Logical processor identifiers - are represented as integers. The Nth - element of the tuple equals the current binding for - the scheduler with the scheduler identifier equal to - N. For example, if the schedulers are bound, - element(erlang:system_info(scheduler_id), - erlang:system_info(scheduler_bindings)) returns - the identifier of the logical processor that the calling - process is executing on.

-

Notice that only schedulers online can be bound to logical - processors.

-

For more information, see command-line argument - +sbt - in erl(1) and - erlang:system_info(schedulers_online). -

+ +

Returns information about the currently used scheduler + bindings.

+

A tuple of a size equal to + + erlang:system_info(schedulers) + is returned. The tuple elements are integers + or the atom unbound. Logical processor identifiers + are represented as integers. The Nth + element of the tuple equals the current binding for + the scheduler with the scheduler identifier equal to + N. For example, if the schedulers are bound, + element(erlang:system_info(scheduler_id), + erlang:system_info(scheduler_bindings)) returns + the identifier of the logical processor that the calling + process is executing on.

+

Notice that only schedulers online can be bound to logical + processors.

+

For more information, see command-line argument + +sbt + in erl(1) and + + erlang:system_info(schedulers_online).

scheduler_id - +

Returns the scheduler ID (SchedulerId) of the scheduler thread that the calling process is executing on. SchedulerId is a positive integer, - where - . - See also - erlang:system_info(schedulers).

+ where .

+

See also + + erlang:system_info(schedulers).

schedulers - +

Returns the number of scheduler threads used by the emulator. Scheduler threads online schedules Erlang processes and Erlang ports, and execute Erlang code @@ -7941,45 +8038,57 @@ ok

The number of scheduler threads is determined at emulator boot time and cannot be changed later. However, the number of schedulers online can - be changed at any time.

+ be changed at any time.

See also - erlang:system_flag(schedulers_online, SchedulersOnline), - erlang:system_info(schedulers_online), - erlang:system_info(scheduler_id), - erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling), - erlang:system_info(normal_multi_scheduling_blockers) - and - erlang:system_info(multi_scheduling_blockers).

+ + erlang:system_flag(schedulers_online, + SchedulersOnline), + + erlang:system_info(schedulers_online), + + erlang:system_info(scheduler_id), + + erlang:system_flag(multi_scheduling, BlockState), + + erlang:system_info(multi_scheduling), + + erlang:system_info(normal_multi_scheduling_blockers) + and + erlang:system_info(multi_scheduling_blockers). +

schedulers_online - +

Returns the number of schedulers online. The scheduler - identifiers of schedulers online satisfy the relationship - .

-

For more information, see - erlang:system_info(schedulers) - and - erlang:system_flag(schedulers_online, SchedulersOnline).

+ identifiers of schedulers online satisfy the relationship + .

+

For more information, see + + erlang:system_info(schedulers) and + + erlang:system_flag(schedulers_online, + SchedulersOnline).

smp_support

Returns true if the emulator has been compiled with SMP support, otherwise false is returned.

- start_time - + start_time +

The Erlang monotonic - time in native - time unit at the - time when current Erlang runtime system instance started. See also - erlang:system_info(end_time). -

+ time in native + time unit at the + time when current Erlang runtime system instance started.

+

See also + erlang:system_info(end_time).

+
system_version

Returns a string containing version number and - some important properties, such as the number of schedulers.

+ some important properties, such as the number of schedulers.

system_architecture @@ -7993,112 +8102,114 @@ ok thread_pool_size - +

Returns the number of async threads in the async thread pool used for asynchronous driver calls - (driver_async()). + ( + driver_async()). The value is given as an integer.

- - time_correction - - -

Returns a boolean value indicating whether - time correction - is enabled or not. -

- time_offset - - -

Returns the state of the time offset:

- - preliminary - -

The time offset is preliminary, and will be changed - at a later time when being finalized. The preliminary time offset - is used during the preliminary phase of the - single - time warp mode.

- - final - -

The time offset is final. This either because - no - time warp mode is used, or because the time - offset have been finalized when - single - time warp mode is used.

- - volatile - -

The time offset is volatile. That is, it can - change at any time. This is because - multi - time warp mode is used.

-
-
- time_warp_mode - + time_correction + + +

Returns a boolean value indicating whether + + time correction is enabled or not.

+
+ time_offset + + +

Returns the state of the time offset:

+ + preliminary + +

The time offset is preliminary, and will be changed + and finalized later. The preliminary time offset + is used during the preliminary phase of the + + single time warp mode.

+
+ final + +

The time offset is final. This either because + + no time warp mode is used, or because the time + offset have been finalized when + + single time warp mode is used.

+
+ volatile + +

The time offset is volatile. That is, it can + change at any time. This is because + + multi-time warp mode is used.

+
+
+
+ + time_warp_mode +

Returns a value identifying the - time warp - mode being used:

- - no_time_warp - -

The no - time warp mode is used.

- - single_time_warp - -

The single - time warp mode is used.

- - multi_time_warp - -

The multi - time warp mode is used.

-
-
+ + time warp mode that is used:

+ + no_time_warp + The + no time warp mode is used. + + single_time_warp + The + single time warp mode is used. + + multi_time_warp + The + multi-time warp mode is used. + + +
tolerant_timeofday - -

Returns whether a pre erts-7.0 backwards compatible compensation - for sudden changes of system time is enabled or disabled. - Such compensation is enabled when the - time offset is - final, and - time correction - is enabled.

+ +

Returns whether a pre ERTS 7.0 backwards compatible + compensation for sudden changes of system time is enabled + or disabled. Such compensation is enabled when the + time offset + is final, and + + time correction is enabled.

trace_control_word

Returns the value of the node trace control word. For - more information, see function get_tcw in Section - Match Specifications in Erlang in the User's Guide.

+ more information, see function get_tcw in section + + Match Specifications in Erlang in the User's Guide.

update_cpu_info - +

The runtime system rereads the CPU information available - and updates its internally stored information about the - detected - CPU topology and the number of logical processors - configured, - online, and - available.

-

If the CPU information has changed since the last time - it was read, the atom changed is returned, otherwise - the atom unchanged. If the CPU information has changed, - you probably want to - adjust the - number of schedulers online. You typically want - to have as many schedulers online as - logical - processors available.

+ and updates its internally stored information about the + detected + CPU topology and the number of logical processors + configured, + online, + and + available.

+

If the CPU information has changed since the last time + it was read, the atom changed is returned, otherwise + the atom unchanged. If the CPU information has changed, + you probably want to + adjust the + number of schedulers online. You typically want + to have as many schedulers online as + logical + processors available.

version - +

Returns a string containing the version number of the emulator.

@@ -8117,11 +8228,11 @@ ok {wordsize, external} -

Returns the true word size of the emulator, that is, - the size of a pointer. The value is given in bytes - as an integer. On a pure 32-bit architecture, 4 is - returned. On both a half word and on a pure - 64-bit architecture, 8 is returned.

+

Returns the true word size of the emulator, that is, + the size of a pointer. The value is given in bytes + as an integer. On a pure 32-bit architecture, 4 is + returned. On both a half word and on a pure + 64-bit architecture, 8 is returned.

@@ -8140,32 +8251,35 @@ ok

Returns the current system monitoring settings set by - erlang:system_monitor/2 + + erlang:system_monitor/2 as {MonitorPid, Options}, - or undefined if there - are no settings. The order of the options can be different - from the one that was set.

+ or undefined if no settings exist. The order of the + options can be different from the one that was set.

- Sets or clears system performance monitoring options. + Set or clear system performance monitoring options.

When called with argument undefined, all system performance monitoring settings are cleared.

Calling the function with {MonitorPid, Options} as argument is the same as calling - erlang:system_monitor(MonitorPid, Options).

+ + erlang:system_monitor(MonitorPid, + Options).

Returns the previous system monitor settings just like - erlang:system_monitor/0.

+ + erlang:system_monitor/0.

- Sets system performance monitoring options. + Set system performance monitoring options.

Sets the system performance monitoring options. @@ -8184,12 +8298,12 @@ ok

One of the tuples is {timeout, GcTime}, where GcTime is the time for the garbage collection in milliseconds. The other tuples are - tagged with heap_size, heap_block_size + tagged with heap_size, heap_block_size, stack_size, mbuf_size, old_heap_size, and old_heap_block_size. These tuples are explained in the description of trace message - gc_minor_start (see - erlang:trace/3). + gc_minor_start + (see erlang:trace/3). New tuples can be added, and the order of the tuples in the Info list can be changed at any time without prior notice.

@@ -8220,7 +8334,7 @@ ok timeout, ready_input, ready_output, event, and outputv (when the port is used by distribution). Value Millis in - the timeout tuple informs about the + tuple timeout informs about the uninterrupted execution time of the process or port, which always is equal to or higher than the Time value supplied when starting the trace. New tuples can be @@ -8231,7 +8345,7 @@ ok drivers that take too long to execute. 1 ms is considered a good maximum time for a driver callback or a NIF. However, a time-sharing system is usually to - consider everything below 100 ms as "possible" and + consider everything < 100 ms as "possible" and fairly "normal". However, longer schedule times can indicate swapping or a misbehaving NIF/driver. Misbehaving NIFs and drivers can cause bad resource @@ -8249,10 +8363,11 @@ ok

The monitor message is sent if the sum of the sizes of all memory blocks allocated for all heap generations after a garbage collection is equal to or higher than Size.

-

When a process is killed by +

When a process is killed by + max_heap_size, it is killed before the garbage collection is complete and thus no large heap message - will be sent.

+ is sent.

busy_port @@ -8274,7 +8389,8 @@ ok

Returns the previous system monitor settings just like - erlang:system_monitor/0.

+ + erlang:system_monitor/0.

If a monitoring process gets so large that it itself starts to cause system monitor messages when garbage @@ -8299,7 +8415,8 @@ ok

Returns the current system profiling settings set by - erlang:system_profile/2 + + erlang:system_profile/2 as {ProfilerPid, Options}, or undefined if there are no settings. The order of the options can be different @@ -8319,106 +8436,116 @@ ok exclusive -

If a synchronous call to a port from a process is done, the - calling process is considered not runnable during the call - runtime to the port. The calling process is notified as - inactive, and later active when the port - callback returns.

+

If a synchronous call to a port from a process is done, the + calling process is considered not runnable during the call + runtime to the port. The calling process is notified as + inactive, and later active when the port + callback returns.

monotonic_timestamp -

Timestamps in profile messages will use - Erlang - monotonic time. The time-stamp (Ts) has the same - format and value as produced by - erlang:monotonic_time(nano_seconds).

+

Time stamps in profile messages use + Erlang + monotonic time. The time stamp (Ts) has the same + format and value as produced by + erlang:monotonic_time(nano_seconds).

runnable_procs -

If a process is put into or removed from the run queue, a - message, {profile, Pid, State, Mfa, Ts}, is sent to - ProfilerPid. Running processes that - are reinserted into the run queue after having been - preempted do not trigger this message.

+

If a process is put into or removed from the run queue, a + message, {profile, Pid, State, Mfa, Ts}, is sent to + ProfilerPid. Running processes that + are reinserted into the run queue after having been + pre-empted do not trigger this message.

runnable_ports -

If a port is put into or removed from the run queue, a - message, {profile, Port, State, 0, Ts}, is sent to - ProfilerPid.

+

If a port is put into or removed from the run queue, a + message, {profile, Port, State, 0, Ts}, is sent to + ProfilerPid.

scheduler -

If a scheduler is put to sleep or awoken, a message, - {profile, scheduler, Id, State, NoScheds, Ts}, is - sent to ProfilerPid.

+

If a scheduler is put to sleep or awoken, a message, + {profile, scheduler, Id, State, NoScheds, Ts}, is + sent to ProfilerPid.

strict_monotonic_timestamp -

Timestamps in profile messages will consisting of - Erlang - monotonic time and a monotonically increasing - integer. The time-stamp (Ts) has the same format and value - as produced by {erlang:monotonic_time(nano_seconds), - erlang:unique_integer([monotonic])}.

+

Time stamps in profile messages consist of + Erlang + monotonic time and a monotonically increasing + integer. The time stamp (Ts) has the same format and value + as produced by {erlang:monotonic_time(nano_seconds), + erlang:unique_integer([monotonic])}.

timestamp -

Timestamps in profile messages will include a - time-stamp (Ts) that has the same form as returned by - erlang:now(). This is also the default if no - timestamp flag is given. If cpu_timestamp has - been enabled via erlang:trace/3, this will also - effect the timestamp produced in profiling messages - when timestamp flag is enabled.

+

Time stamps in profile messages include a + time stamp (Ts) that has the same form as returned by + erlang:now(). This is also the default if no + time stamp flag is specified. If cpu_timestamp has + been enabled through + erlang:trace/3, + this also effects the time stamp produced in profiling messages + when flag timestamp is enabled.

-

erlang:system_profile is considered experimental - and its behavior can change in a future release.

+ +

erlang:system_profile is considered experimental + and its behavior can change in a future release.

+ - Current Erlang system time - -

Returns current - Erlang system time - in native - time unit.

- -

Calling erlang:system_time() is equivalent to: - erlang:monotonic_time() - + - erlang:time_offset().

- -

This time is not a monotonically increasing time - in the general case. For more information, see the documentation of - time warp modes in the - ERTS User's Guide.

+ Current Erlang system time. + +

Returns current + + Erlang system time in native + time unit.

+

Calling erlang:system_time() is equivalent to + + erlang:monotonic_time() + + + erlang:time_offset().

+ +

This time is not a monotonically increasing time + in the general case. For more information, see the documentation of + + time warp modes in the User's Guide.

+
+ - Current Erlang system time - -

Returns current - Erlang system time - converted into the Unit passed as argument.

- -

Calling erlang:system_time(Unit) is equivalent to: - erlang:convert_time_unit(erlang:system_time(), - native, Unit).

- -

This time is not a monotonically increasing time - in the general case. For more information, see the documentation of - time warp modes in the - ERTS User's Guide.

+ Current Erlang system time. + +

Returns current + + Erlang system time + converted into the Unit passed as argument.

+

Calling erlang:system_time(Unit) is equivalent + to + erlang:convert_time_unit(erlang:system_time(), + native, Unit).

+ +

This time is not a monotonically increasing time + in the general case. For more information, see the documentation of + + time warp modes in the User's Guide.

+
+ - Encodes a term to an Erlang external term format binary. + Encode a term to an Erlang external term format binary. +

Returns a binary data object that is the result of encoding Term according to the Erlang external @@ -8427,64 +8554,65 @@ ok 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.

-

See also - binary_to_term/1.

+

See also + binary_to_term/1.

- Encodes a term to en Erlang external term format binary. + Encode a term to en Erlang external term format binary. +

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

If option compressed is provided, the external term format is compressed. The compressed format is automatically - recognized by binary_to_term/1 as from Erlang R7B.

+ recognized by binary_to_term/1 as from Erlang/OTP R7B.

A compression level can be specified by giving option {compressed, Level}. Level is an integer with range 0..9, where:

- 0 - No compression is done (it is the same as - giving no compressed option). - 1 - Takes least time but may not compress - as well as the higher levels. - 6 - Default level when option compressed - is provided. - 9 - Takes most time and tries to produce a smaller +

0 - No compression is done (it is the same as + giving no compressed option).

+

1 - Takes least time but may not compress + as well as the higher levels.

+

6 - Default level when option compressed + is provided.

+

9 - Takes most time and tries to produce a smaller result. Notice "tries" in the preceding sentence; depending on the input term, level 9 compression either does or does - not produce a smaller result than level 1 compression. + not produce a smaller result than level 1 compression.

Option {minor_version, Version} - can be used to control - some encoding details. This option was introduced in OTP R11B-4. + can be used to control some + encoding details. This option was introduced in Erlang/OTP R11B-4. The valid values for Version are 0 and 1.

-

As from OTP 17.0, {minor_version, 1} is the default. It +

As from Erlang/OTP 17.0, {minor_version, 1} is the default. It forces any floats in the term to be encoded in a more space-efficient and exact way (namely in the 64-bit IEEE format, rather than converted to a textual representation).

-

As from OTP R11B-4, binary_to_term/1 can decode this +

As from Erlang/OTP R11B-4, binary_to_term/1 can decode this representation.

{minor_version, 0} means that floats are encoded using a textual representation. This option is useful to - ensure that releases before OTP R11B-4 can decode resulting + ensure that releases before Erlang/OTP R11B-4 can decode resulting binary.

-

See also - binary_to_term/1.

+

See also + binary_to_term/1.

- Throws an exception. + Throw an exception.

A non-local return from a function. If evaluated within a - catch, catch returns value Any.

-

Example:

+ catch, catch returns value Any. + Example:

 > catch throw({hello, there}).
 {hello,there}
@@ -8498,8 +8626,7 @@ ok

Returns the current time as {Hour, Minute, Second}.

The time zone and Daylight Saving Time correction depend on - the underlying OS.

-

Example:

+ the underlying OS. Example:

 > time().
 {9,42,44}
@@ -8508,86 +8635,94 @@ ok - Current time offset - -

Returns the current time offset between - Erlang monotonic time - and - Erlang system time in - native time unit. - Current time offset added to an Erlang monotonic time gives - corresponding Erlang system time.

- -

The time offset may or may not change during operation depending - on the time - warp mode used.

- - -

A change in time offset may be observed at slightly - different points in time by different processes.

- -

If the runtime system is in - multi - time warp mode, the time offset will be changed when - the runtime system detects that the - OS system - time has changed. The runtime system will, however, - not detect this immediately when it happens. A task checking - the time offset is scheduled to execute at least once a minute, - so under normal operation this should be detected within a - minute, but during heavy load it might take longer time.

-
+ Current time offset. + +

Returns the current time offset between + + Erlang monotonic time and + + Erlang system time in + native time unit. + Current time offset added to an Erlang monotonic time gives + corresponding Erlang system time.

+

The time offset may or may not change during operation depending + on the time + warp mode used.

+ +

A change in time offset can be observed at slightly + different points in time by different processes.

+

If the runtime system is in + multi-time + warp mode, the time offset is changed when + the runtime system detects that the + OS system + time has changed. The runtime system will, however, + not detect this immediately when it occurs. A task checking + the time offset is scheduled to execute at least once a minute; + so, under normal operation this is to be detected within a + minute, but during heavy load it can take longer time.

+
+ - Current time offset + Current time offset. -

Returns the current time offset between - Erlang monotonic time - and - Erlang system time - converted into the Unit passed as argument.

- -

Same as calling - erlang:convert_time_unit(erlang:time_offset(), native, Unit) - however optimized for commonly used Units.

+

Returns the current time offset between + + Erlang monotonic time and + + Erlang system time + converted into the Unit passed as argument.

+

Same as calling + + erlang:convert_time_unit( + erlang:time_offset(), native, + Unit) + however optimized for commonly used Units.

+ - Current Erlang System time + Current Erlang System time. -

Returns current - Erlang system time - on the format {MegaSecs, Secs, MicroSecs}. This format is - the same as os:timestamp/0 - and the deprecated erlang:now/0 - uses. The reason for the existence of erlang:timestamp() is - purely to simplify usage for existing code that assumes this timestamp - format. Current Erlang system time can more efficiently be retrieved in - the time unit of your choice using - erlang:system_time/1.

- -

The erlang:timestamp() BIF is equivalent to:

+

Returns current + + Erlang system time + on the format {MegaSecs, Secs, MicroSecs}. This format is + the same as + os:timestamp/0 + and the deprecated + erlang:now/0 + use. The reason for the existence of erlang:timestamp() is + purely to simplify use for existing code that assumes this time stamp + format. Current Erlang system time can more efficiently be retrieved + in the time unit of your choice using + + erlang:system_time/1.

+

The erlang:timestamp() BIF is equivalent to:

+ timestamp() -> ErlangSystemTime = erlang:system_time(micro_seconds), MegaSecs = ErlangSystemTime div 1000000000000, Secs = ErlangSystemTime div 1000000 - MegaSecs*1000000, MicroSecs = ErlangSystemTime rem 1000000, {MegaSecs, Secs, MicroSecs}. -

It, however, uses a native implementation which does - not build garbage on the heap and with slightly better - performance.

- -

This time is not a monotonically increasing time - in the general case. For more information, see the documentation of - time warp modes in the - ERTS User's Guide.

+

It, however, uses a native implementation that does + not build garbage on the heap and with slightly better + performance.

+ +

This time is not a monotonically increasing time + in the general case. For more information, see the documentation of + + time warp modes in the User's Guide.

+
-
+ Tail of a list. @@ -8605,7 +8740,7 @@ timestamp() -> - Sets trace flags for a process or processes. + Set trace flags for a process or processes.

Turns on (if How == true) or off (if @@ -8615,49 +8750,43 @@ timestamp() -> PidPortSpec.

PidPortSpec is either a process identifier (pid) for a local process, a port identifier, - or one of the following atoms:

+ or one of the following atoms:

all - -

All currently existing processes and ports and all that - will be created in the future.

+ All currently existing processes and ports and all that + will be created in the future. processes - -

All currently existing processes and all that will be created in the future.

+ All currently existing processes and all that will be created + in the future. ports - -

All currently existing ports and all that will be created in the future.

+ All currently existing ports and all that will be created in + the future. existing - -

All currently existing processes and ports.

+ All currently existing processes and ports. existing_processes - -

All currently existing processes.

+ All currently existing processes. existing_ports - -

All currently existing ports.

+ All currently existing ports. new - -

All processes and ports that will be created in the future.

+ All processes and ports that will be created in the future. new_processes - -

All processes that will be created in the future.

+ All processes that will be created in the future. new_ports - -

All ports that will be created in the future.

+ All ports that will be created in the future.

FlagList can contain any number of the following flags (the "message tags" refers to the list of - trace messages):

+ + trace messages):

all @@ -8668,21 +8797,29 @@ timestamp() -> send

Traces sending of messages.

-

Message tags: send and - send_to_non_existing_process.

+

Message tags: + + send and + + send_to_non_existing_process.

'receive'

Traces receiving of messages.

-

Message tags: 'receive'.

+

Message tags: + + 'receive'.

-call + call

Traces certain function calls. Specify which function - calls to trace by calling - erlang:trace_pattern/3.

-

Message tags: call and - return_from.

+ calls to trace by calling + erlang:trace_pattern/3.

+

Message tags: + + call and + + return_from.

silent @@ -8700,17 +8837,21 @@ timestamp() -> specification function {silent,Bool}, giving a high degree of control of which functions with which arguments that trigger the trace.

-

Message tags: call, - return_from, and - return_to. Or rather, the absence of.

+

Message tags: + + call, + + return_from, and + + return_to. Or rather, the absence of.

return_to

Used with the call trace flag. Traces the return from a traced function back to its caller. Only works for functions traced with - option local to - erlang:trace_pattern/3.

+ option local to + erlang:trace_pattern/3.

The semantics is that a trace message is sent when a call traced function returns, that is, when a chain of tail recursive calls ends. Only one trace @@ -8723,105 +8864,144 @@ timestamp() ->

To get trace messages containing return values from functions, use the {return_trace} match specification action instead.

-

Message tags: return_to.

+

Message tags: + + return_to.

procs

Traces process-related events.

-

Message tags: spawn, - spawned, - exit, - register, - unregister, - link, - unlink, - getting_linked, and - getting_unlinked.

+

Message tags: + + spawn, + + spawned, + + exit, + + register, + + unregister, + + link, + + unlink, + + getting_linked, and + + getting_unlinked.

ports

Traces port-related events.

-

Message tags: open, - closed, - register, - unregister, - getting_linked, and - getting_unlinked.

+

Message tags: + + open, + + closed, + + register, + + unregister, + + getting_linked, and + + getting_unlinked.

running

Traces scheduling of processes.

-

Message tags: in and - out.

+

Message tags: + + in and + + out.

exiting

Traces scheduling of exiting processes.

-

Message tags: in_exiting, - out_exiting, and - out_exited.

+

Message tags: + + in_exiting, + + out_exiting, and + + out_exited.

running_procs

Traces scheduling of processes just like running. - However this option also includes schedule events when the - process executes within the context of a port without - being scheduled out itself.

-

Message tags: in and - out.

+ However, this option also includes schedule events when the + process executes within the context of a port without + being scheduled out itself.

+

Message tags: + + in and + + out.

running_ports

Traces scheduling of ports.

-

Message tags: in and - out.

+

Message tags: + + in and + + out.

garbage_collection

Traces garbage collections of processes.

-

Message tags: gc_minor_start, - gc_max_heap_size and - gc_minor_end.

+

Message tags: + + gc_minor_start, + + gc_max_heap_size, and + + gc_minor_end.

timestamp -

Includes a time-stamp in all trace messages. The - time-stamp (Ts) has the same form as returned by +

Includes a time stamp in all trace messages. The + time stamp (Ts) has the same form as returned by erlang:now().

cpu_timestamp

A global trace flag for the Erlang node that makes all - trace time-stamps using the timestamp flag to be - in CPU time, not wall clock time. That is, cpu_timestamp - will not be used if monotonic_timestamp, or - strict_monotonic_timestamp is enabled. + trace time stamps using flag timestamp to be + in CPU time, not wall clock time. That is, cpu_timestamp + is not be used if monotonic_timestamp or + strict_monotonic_timestamp is enabled. Only allowed with PidPortSpec==all. If the host machine OS does not support high-resolution CPU time measurements, trace/3 exits with badarg. Notice that most OS do not synchronize this value across cores, so be prepared - that time might seem to go backwards when using this option.

+ that time can seem to go backwards when using this option.

monotonic_timestamp

Includes an - Erlang - monotonic time time-stamp in all trace messages. The - time-stamp (Ts) has the same format and value as produced by - erlang:monotonic_time(nano_seconds). - This flag overrides the cpu_timestamp flag.

+ Erlang + monotonic time time stamp in all trace messages. The + time stamp (Ts) has the same format and value as produced by + + erlang:monotonic_time(nano_seconds). + This flag overrides flag cpu_timestamp.

strict_monotonic_timestamp -

Includes an timestamp consisting of - Erlang - monotonic time and a monotonically increasing - integer in all trace messages. The time-stamp (Ts) has the - same format and value as produced by - {erlang:monotonic_time(nano_seconds), - erlang:unique_integer([monotonic])}. - This flag overrides the cpu_timestamp flag.

+

Includes an time stamp consisting of + Erlang + monotonic time and a monotonically increasing + integer in all trace messages. The time stamp (Ts) has the + same format and value as produced by { + + erlang:monotonic_time(nano_seconds), + + erlang:unique_integer([monotonic])}. + This flag overrides flag cpu_timestamp.

arity @@ -8859,34 +9039,34 @@ timestamp() -> {tracer, TracerModule, TracerState} -

Specifies that a tracer module should be called - instead of sending a trace message. The tracer module - can then ignore or change the trace message. For more details - on how to write a tracer module see - erl_tracer -

+

Specifies that a tracer module is to be called + instead of sending a trace message. The tracer module + can then ignore or change the trace message. For more details + on how to write a tracer module, see + erl_tracer.

-

If no tracer is given, the calling process - will be receiving all of the trace messages

+

If no tracer is specified, the calling process + receives all the trace messages.

The effect of combining set_on_first_link with - set_on_link is the same as having + set_on_link is the same as set_on_first_link alone. Likewise for set_on_spawn and set_on_first_spawn.

The tracing process receives the trace messages described - in the following list. Pid is the process identifier of the - traced process in which the traced event has occurred. The - third tuple element is the message tag.

+ in the following list. Pid is the process identifier of the + traced process in which the traced event has occurred. The + third tuple element is the message tag.

If flag timestamp, strict_monotonic_timestamp, or - monotonic_timestamp is given, the first tuple - element is trace_ts instead, and the time-stamp - is added as an extra element last in the message tuple. If - multiple timestamp flags are passed, timestamp has - precedence over strict_monotonic_timestamp which - in turn has precedence over monotonic_timestamp. All - timestamp flags are remembered, so if two are passed - and the one with highest precedence later is disabled - the other one will become active.

+ monotonic_timestamp is specified, the first tuple + element is trace_ts instead, and the time stamp + is added as an extra element last in the message tuple. If + multiple time stamp flags are passed, timestamp has + precedence over strict_monotonic_timestamp, which + in turn has precedence over monotonic_timestamp. All + time stamp flags are remembered, so if two are passed + and the one with highest precedence later is disabled, + the other one becomes active.

+

Trace messages:

@@ -8898,7 +9078,7 @@ timestamp() -> process To.

- + {trace, PidPort, send_to_non_existing_process, Msg, To} @@ -8911,9 +9091,9 @@ timestamp() ->

When PidPort receives message Msg. - If Msg is set to timeout, then a receive - statement may have timedout, or the process received - a message with the payload timeout.

+ If Msg is set to time-out, a receive + statement can have timed out, or the process received + a message with the payload timeout.

@@ -9047,7 +9227,7 @@ timestamp() ->

When Pid opens a new port Port with - the running the Driver.

+ the running Driver.

Driver is the name of the driver as an atom.

@@ -9055,7 +9235,7 @@ timestamp() -> {trace, Port, closed, Reason} -

When Port closed with Reason.

+

When Port closes with Reason.

@@ -9072,7 +9252,8 @@ timestamp() -> - {trace, Pid, out | out_exiting | out_exited, {M, F, Arity} | 0} + {trace, Pid, out | out_exiting | out_exited, {M, F, Arity} + | 0}

When Pid is scheduled out. The process was @@ -9086,11 +9267,13 @@ timestamp() ->

When Port is scheduled to run. Command is the - first thing the port will execute, it may however run several - commands before being scheduled out. On some rare - occasions, the current function cannot be determined, - then the last element is 0.

-

The possible commands are: call | close | command | connect | control | flush | info | link | open | unlink

+ first thing the port will execute, it can however run several + commands before being scheduled out. On some rare + occasions, the current function cannot be determined, + then the last element is 0.

+

The possible commands are call, close, + command, connect, control, flush, + info, link, open, and unlink.

@@ -9101,8 +9284,7 @@ timestamp() -> was Command. On some rare occasions, the current function cannot be determined, then the last element is 0. Command can contain the same - commands as in -

+ commands as in

@@ -9118,13 +9300,13 @@ timestamp() -> heap_size The size of the used part of the heap. - heap_block_size - The size of the memory block used for storing - the heap and the stack. + heap_block_size + The size of the memory block used for storing + the heap and the stack. old_heap_size The size of the used part of the old heap. - old_heap_block_size - The size of the memory block used for storing + old_heap_block_size + The size of the memory block used for storing the old heap. stack_size The size of the stack. @@ -9138,14 +9320,15 @@ timestamp() -> The total size of unique off-heap binaries referenced from the process heap. bin_vheap_block_size - The total size of binaries allowed in the virtual - heap in the process before doing a garbage collection. + The total size of binaries allowed in the virtual + heap in the process before doing a garbage collection. bin_old_vheap_size The total size of unique off-heap binaries referenced from the process old heap. bin_old_vheap_block_size - The total size of binaries allowed in the virtual - old heap in the process before doing a garbage collection. + The total size of binaries allowed in the virtual + old heap in the process before doing a garbage + collection.

All sizes are in words.

@@ -9154,13 +9337,12 @@ timestamp() -> {trace, Pid, gc_max_heap_size, Info}
-

- Sent when the max_heap_size +

Sent when the + max_heap_size is reached during garbage collection. Info contains the same kind of list as in message gc_start, - but the sizes reflect the sizes that triggered max_heap_size to - be reached. -

+ but the sizes reflect the sizes that triggered + max_heap_size to be reached.

@@ -9168,7 +9350,8 @@ timestamp() ->

Sent when young garbage collection is finished. Info - contains the same kind of list as in message gc_minor_start, + contains the same kind of list as in message + gc_minor_start, but the sizes reflect the new sizes after garbage collection.

@@ -9177,8 +9360,9 @@ timestamp() -> {trace, Pid, gc_major_start, Info}
-

Sent when fullsweep garbage collection is about to be started. Info - contains the same kind of list as in message gc_minor_start.

+

Sent when fullsweep garbage collection is about to be started. + Info contains the same kind of list as in message + gc_minor_start.

@@ -9186,15 +9370,16 @@ timestamp() ->

Sent when fullsweep garbage collection is finished. Info - contains the same kind of list as in message gc_minor_start - but the sizes reflect the new sizes after a fullsweep garbage collection.

+ contains the same kind of list as in message + gc_minor_start, but the sizes reflect the new sizes after + a fullsweep garbage collection.

If the tracing process/port dies or the tracer module returns - remove, the flags are silently removed.

+ remove, the flags are silently removed.

Each process can only be traced by one tracer. Therefore, attempts to trace an already traced process fail.

-

Returns: A number indicating the number of processes that +

Returns a number indicating the number of processes that matched PidPortSpec. If PidPortSpec is a process identifier, the return value is 1. @@ -9214,22 +9399,24 @@ timestamp() -> Notification when trace has been delivered.

The delivery of trace messages (generated by - erlang:trace/3, - seq_trace or - erlang:system_profile/2) + erlang:trace/3, + kernel:seq_trace, + or + erlang:system_profile/2) is dislocated on the time-line compared to other events in the system. If you know that Tracee has passed some specific point in its execution, and you want to know when at least all trace messages corresponding to events up to this point have reached the - tracer, use erlang:trace_delivered(Tracee). A - {trace_delivered, Tracee, Ref} message is sent to - the caller of erlang:trace_delivered(Tracee) when it - is guaranteed that all trace messages are delivered to + tracer, use erlang:trace_delivered(Tracee).

+

When it is guaranteed that all trace messages are delivered to the tracer up to the point that Tracee reached at the time of the call to - erlang:trace_delivered(Tracee).

+ erlang:trace_delivered(Tracee), then a + {trace_delivered, Tracee, Ref} + message is sent to the caller of + erlang:trace_delivered(Tracee) .

Notice that message trace_delivered does not imply that trace messages have been delivered. Instead it implies that all trace messages that @@ -9239,22 +9426,22 @@ timestamp() -> no trace messages have been delivered when the trace_delivered message arrives.

Notice that Tracee must refer - to a process currently, + to a process currently or previously existing on the same node as the caller of erlang:trace_delivered(Tracee) resides on. The special Tracee atom all denotes all processes that currently are traced in the node.

-

When used together with an - Tracer Module any message sent in the trace callback - is guaranteed to have reached it's recipient before the +

When used together with a + Tracer Module, any message sent in the trace callback + is guaranteed to have reached its recipient before the trace_delivered message is sent.

Example: Process A is Tracee, - port B is tracer, and process C is the port - owner of B. C wants to close B when - A exits. To ensure that the trace is not truncated, - C can call erlang:trace_delivered(A), when - A exits, and wait for message {trace_delivered, A, - Ref} before closing B.

+ port B is tracer, and process C is the port + owner of B. C wants to close B when + A exits. To ensure that the trace is not truncated, + C can call erlang:trace_delivered(A) when + A exits, and wait for message {trace_delivered, A, + Ref} before closing B.

Failure: badarg if Tracee does not refer to a process (dead or alive) on the same node as the caller of @@ -9264,22 +9451,23 @@ timestamp() -> - Trace information about a process or function. + Trace information about a process or function. -

Returns trace information about a port, process, function or event.

+

Returns trace information about a port, process, function, or + event.

To get information about a port or process, - PidPortFuncEvent is to - be a process identifier (pid), port identifier or one of - the atoms new, new_processes, new_ports. - The atom new or new_processes means that the default trace - state for processes to be created is returned. The atom new_ports - means that the default trace state for ports to be created is returned. -

-

The following Items are valid for ports and processes:

+ PidPortFuncEvent is to + be a process identifier (pid), port identifier, or one of + the atoms new, new_processes, or new_ports. The + atom new or new_processes means that the default trace + state for processes to be created is returned. The atom + new_ports means that the default trace state for ports to be + created is returned.

+

Valid Items for ports and processes:

flags @@ -9288,30 +9476,32 @@ timestamp() -> traces are enabled, and one or more of the followings atoms if traces are enabled: send, 'receive', set_on_spawn, call, - return_to, procs, ports, set_on_first_spawn, + return_to, procs, ports, + set_on_first_spawn, set_on_link, running, running_procs, - running_ports, silent, exiting + running_ports, silent, exiting, monotonic_timestamp, strict_monotonic_timestamp, garbage_collection, timestamp, and arity. The order is arbitrary.

tracer -

Returns the identifier for process, port or a tuple containing +

Returns the identifier for process, port, or a tuple containing the tracer module and tracer state tracing this - process. If this process is not being traced, the return + process. If this process is not traced, the return value is [].

-

To get information about a function, PidPortFuncEvent is to +

To get information about a function, + PidPortFuncEvent is to be the three-element tuple {Module, Function, Arity} or - the atom on_load. No wild cards are allowed. Returns + the atom on_load. No wildcards are allowed. Returns undefined if the function does not exist, or - false if the function is not traced. If PidPortFuncEvent - is on_load, the information returned refers to - the default value for code that will be loaded.

- -

The following Items are valid for functions:

+ false if the function is not traced. + If PidPortFuncEvent + is on_load, the information returned refers to + the default value for code that will be loaded.

+

Valid Items for functions:

traced @@ -9330,11 +9520,12 @@ timestamp() -> meta -

Returns the meta-trace tracer process, port or trace module +

Returns the meta-trace tracer process, port, or trace module for this function, if it has one. If the function is not meta-traced, the returned value is false. If the function is meta-traced but has once detected that - the tracer process is invalid, the returned value is [].

+ the tracer process is invalid, the returned value is + [].

meta_match_spec @@ -9347,21 +9538,22 @@ timestamp() ->

Returns the call count value for this function or true for the pseudo function on_load if call - count tracing is active. Otherwise false is returned. - See also - erlang:trace_pattern/3.

+ count tracing is active. Otherwise false is returned.

+

See also + erlang:trace_pattern/3.

call_time -

Returns the call time values for this function or +

Returns the call time values for this function or true for the pseudo function on_load if call - time tracing is active. Otherwise false is returned. - The call time values returned, [{Pid, Count, S, Us}], - is a list of each process that executed the function - and its specific counters. See also - erlang:trace_pattern/3.

+ time tracing is active. Otherwise false is returned. + The call time values returned, [{Pid, Count, S, Us}], + is a list of each process that executed the function + and its specific counters.

+

See also + + erlang:trace_pattern/3.

- all

Returns a list containing the @@ -9370,80 +9562,84 @@ timestamp() -> is active for this function.

-

To get information about an event, PidPortFuncEvent is to +

To get information about an event, + PidPortFuncEvent is to be one of the atoms send or 'receive'.

-

The only valid Item for events is:

+

One valid Item for events exists:

match_spec

Returns the match specification for this event, if it has one, or true if no match specification has been - set.

+ set.

The return value is {Item, Value}, where Value is the requested information as described earlier. - If a pid for a dead process was given, or the name of a + If a pid for a dead process was specified, or the name of a non-existing function, Value is undefined.

- Sets trace patterns for call, send or 'receive' tracing. + Set trace patterns for call, send, or 'receive' tracing. +

The same as - erlang:trace_pattern(Event, MatchSpec, []), + + erlang:trace_pattern(Event, MatchSpec, []), retained for backward compatibility.

- Sets trace pattern for message sending. + Set trace pattern for message sending.

Sets trace pattern for message sending. - Must be combined with - erlang:trace/3 + Must be combined with + erlang:trace/3 to set the send trace flag for one or more processes. - By default all messages, sent from send traced processes, - are traced. Use erlang:trace_pattern/3 to limit - traced send events based on the message content, the sender - and/or the receiver.

+ By default all messages sent from send traced processes + are traced. To limit + traced send events based on the message content, the sender + and/or the receiver, use erlang:trace_pattern/3.

Argument MatchSpec can take the following forms:

MatchSpecList

A list of match specifications. The matching is done - on the list [Receiver, Msg]. Receiver - is the process or port identity of the receiver and - Msg is the message term. The pid of the sending - process can be accessed with the guard function - self/0. An empty list is the same as true. - See the users guide section - Match Specifications in Erlang - for more information.

+ on the list [Receiver, Msg]. Receiver + is the process or port identity of the receiver and + Msg is the message term. The pid of the sending + process can be accessed with the guard function + self/0. An empty list is the same as true. + For more information, see section + + Match Specifications in Erlang in the User's Guide.

true

Enables tracing for all sent messages (from send - traced processes). Any match specification is - removed. This is the default.

+ traced processes). Any match specification is + removed. This is the default.

false

Disables tracing for all sent messages. - Any match specification is removed.

+ Any match specification is removed.

-

Argument FlagList must be [] - for send tracing.

-

The return value is always 1.

-

Example; only trace messages to a specific process Pid:

+

Argument FlagList must be [] + for send tracing.

+

The return value is always 1.

+

Examples:

+

Only trace messages to a specific process Pid:

 > erlang:trace_pattern(send, [{[Pid, '_'],[],[]}], []).
 1
@@ -9459,58 +9655,60 @@ timestamp() ->
 > erlang:trace_pattern(send, [{['$1', '_'],[{'=/=',{node,'$1'},{node}}],[]}], []).
 1
-

A match specification for send trace can use - all guard and body functions except caller.

+ +

A match specification for send trace can use + all guard and body functions except caller.

+
- Sets trace pattern for tracing of message receiving. + Set trace pattern for tracing of message receiving. -

Sets trace pattern for message receiving. - Must be combined with - erlang:trace/3 + Must be combined with + erlang:trace/3 to set the 'receive' trace flag for one or more processes. - By default all messages, received by 'receive' traced processes, - are traced. Use erlang:trace_pattern/3 to limit - traced receive events based on the message content, the sender - and/or the receiver.

+ By default all messages received by 'receive' traced + processes are traced. To limit + traced receive events based on the message content, the sender + and/or the receiver, use erlang:trace_pattern/3.

Argument MatchSpec can take the following forms:

MatchSpecList

A list of match specifications. The matching is done - on the list [Node, Sender, Msg]. Node - is the node name of the sender. Sender is the - process or port identity of the sender, or the atom - undefined if the sender is not known (which may - be the case for remote senders). Msg is the - message term. The pid of the receiving process can be - accessed with the guard function self/0. An empty - list is the same as true. See the users guide section - Match Specifications in Erlang - for more information.

+ on the list [Node, Sender, Msg]. Node + is the node name of the sender. Sender is the + process or port identity of the sender, or the atom + undefined if the sender is not known (which can + be the case for remote senders). Msg is the + message term. The pid of the receiving process can be + accessed with the guard function self/0. An empty + list is the same as true. For more information, see + section + Match Specifications in Erlang in the User's Guide.

true

Enables tracing for all received messages (to 'receive' - traced processes). Any match specification is - removed. This is the default.

+ traced processes). Any match specification is + removed. This is the default.

false

Disables tracing for all received messages. - Any match specification is removed.

+ Any match specification is removed.

-

Argument FlagList must be [] - for receive tracing.

-

The return value is always 1.

-

Example; only trace messages from a specific process Pid:

+

Argument FlagList must be [] + for receive tracing.

+

The return value is always 1.

+

Examples:

+

Only trace messages from a specific process Pid:

 > erlang:trace_pattern('receive', [{['_',Pid, '_'],[],[]}], []).
 1
@@ -9522,33 +9720,36 @@ timestamp() ->
 > erlang:trace_pattern('receive', [{['$1', '_', '_'],[{'=/=','$1',{node}}],[]}], []).
 1
-

A match specification for 'receive' trace can - use all guard and body functions except caller, - is_seq_trace, get_seq_token, set_seq_token, enable_trace, - disable_trace, trace, silent and process_dump.

+ +

A match specification for 'receive' trace can + use all guard and body functions except caller, + is_seq_trace, get_seq_token, set_seq_token, + enable_trace, disable_trace, trace, + silent, and process_dump.

+
- Sets trace patterns for tracing of function calls. + Set trace patterns for tracing of function calls.

Enables or disables call tracing for one or more functions. - Must be combined with - erlang:trace/3 + Must be combined with + erlang:trace/3 to set the call trace flag - for one or more processes.

+ for one or more processes.

Conceptually, call tracing works as follows. Inside - the Erlang Virtual Machine, a set of processes and + the Erlang virtual machine, a set of processes and a set of functions are to be traced. If a traced process calls a traced function, the trace action is taken. Otherwise, nothing happens.

To add or remove one or more processes to the set of traced processes, use - erlang:trace/3.

+ erlang:trace/3.

To add or remove functions to the set of traced functions, use erlang:trace_pattern/3.

The BIF erlang:trace_pattern/3 can also add match @@ -9560,10 +9761,10 @@ timestamp() -> fails, the action is not executed.

Argument MFA is to be a tuple, such as {Module, Function, Arity}, or the atom on_load - (described in the following). It can be the module, function, + (described below). It can be the module, function, and arity for a function (or a BIF in any module). - The atom '_' can be used as a wild card in any of the - following ways:

+ The atom '_' can be used as a wildcard in any of the + following ways:

{Module,Function,'_'} @@ -9580,7 +9781,7 @@ timestamp() ->

Other combinations, such as {Module,'_',Arity}, are - not allowed. Local functions match wild cards only if + not allowed. Local functions match wildcards only if option local is in FlagList.

If argument MFA is the atom on_load, the match specification and flag list are used on all @@ -9596,13 +9797,14 @@ timestamp() -> true

Enables tracing for the matching functions. - Any match specification is removed.

+ Any match specification is removed.

MatchSpecList

A list of match specifications. An empty list is equivalent to true. For a description of match - specifications, see the User's Guide.

+ specifications, see section + Match Specifications in Erlang in the User's Guide.

restart @@ -9613,7 +9815,7 @@ timestamp() -> pause -

For the FlagList options +

For the FlagList options call_count and call_time: pauses the existing counters. The behavior is undefined for other FlagList options.

@@ -9638,7 +9840,8 @@ timestamp() -> the process, a return_to message is also sent when this function returns to its caller.

- meta | {meta, Pid} | {meta, TracerModule, TracerState} + meta | {meta, Pid} | + {meta, TracerModule, TracerState}

Turns on or off meta-tracing for all types of function @@ -9646,7 +9849,7 @@ timestamp() -> the specified functions are called. If no tracer is specified, self() is used as a default tracer process.

Meta-tracing traces all processes and does not care - about the process trace flags set by trace/3, + about the process trace flags set by erlang:trace/3, the trace flags are instead fixed to [call, timestamp].

The match specification function {return_trace} @@ -9667,7 +9870,8 @@ timestamp() -> Paused and running counters can be restarted from zero with MatchSpec == restart.

To read the counter value, use - erlang:trace_info/2.

+ + erlang:trace_info/2.

call_time @@ -9675,17 +9879,18 @@ timestamp() -> (MatchSpec == false) call time tracing for all types of function calls. For every function, a counter is - incremented when the function is called. + incremented when the function is called. Time spent in the function is accumulated in two other counters, seconds and microseconds. - The counters are stored for each call traced process.

+ The counters are stored for each call traced process.

If call time tracing is started while already running, - the count and time is restarted from zero. To pause + the count and time restart from zero. To pause running counters, use MatchSpec == pause. Paused and running counters can be restarted from zero with MatchSpec == restart.

To read the counter value, use - erlang:trace_info/2.

+ + erlang:trace_info/2.

The options global and local are mutually @@ -9700,12 +9905,12 @@ timestamp() ->

When disabling trace, the option must match the type of trace set on the function. That is, local tracing must be disabled with option local and global tracing with - option global (or no option), and so forth.

+ option global (or no option), and so on.

Part of a match specification list cannot be changed directly. If a function has a match specification, it can be replaced with a new one. To change an existing match specification, use the BIF - erlang:trace_info/2 + erlang:trace_info/2 to retrieve the existing match specification.

Returns the number of functions matching argument MFA. This is zero if none matched.

@@ -9714,7 +9919,7 @@ timestamp() -> - Returns an integer by truncating a number + Return an integer by truncating a number.

Returns an integer by truncating Number, for example:

@@ -9727,7 +9932,7 @@ timestamp() -> - Returns the size of a tuple. + Return the size of a tuple.

Returns an integer that is the number of elements in Tuple, for example:

@@ -9740,11 +9945,11 @@ timestamp() -> - Converts a tuple to a list. + Convert a tuple to a list.

Returns a list corresponding to Tuple. - Tuple can contain any Erlang terms.

-

Example:

+ Tuple can contain any Erlang terms. + Example:

 > tuple_to_list({share, {'Ericsson_B', 163}}).
 [share,{'Ericsson_B',163}]
@@ -9753,112 +9958,110 @@ timestamp() -> - Get a unique integer value + Get a unique integer value. -

Generates and returns an - integer - unique on current runtime system instance. The same as calling - erlang:unique_integer([]).

+

Generates and returns an + + integer unique on current runtime system instance. + The same as calling + + erlang:unique_integer([]).

+ - Get a unique integer value - -

Generates and returns an - integer - unique on current runtime system - instance. The integer is unique in the - sense that this BIF, using the same set of - modifiers, will not return the same integer more - than once on the current runtime system instance. - Each integer value can of course be constructed - by other means.

- -

By default, when [] is passed as - ModifierList, both negative and - positive integers can be returned. This in order - to utilize the range of integers that do - not need heap memory allocation as much as possible. - By default the returned integers are also only - guaranteed to be unique, that is, any returned integer - can be smaller or larger than previously - returned integers.

- -

Valid Modifiers:

- - - positive - -

Return only positive integers.

-

Note that by passing the positive modifier - you will get heap allocated integers (bignums) - quicker.

-
- - monotonic - -

Return - strictly - monotonically increasing integers - corresponding to creation time. That is, the integer - returned will always be larger than previously - returned integers on the current runtime system - instance.

-

These values can be used to determine order between events - on the runtime system instance. That is, if both - X = erlang:unique_integer([monotonic]) and - Y = erlang:unique_integer([monotonic]) are - executed by different processes (or the same - process) on the same runtime system instance and - X < Y we know that X was created - before Y.

-

Strictly monotonically increasing values - are inherently quite expensive to generate and scales - poorly. This is because the values need to be - synchronized between cpu cores. That is, do not pass the monotonic - modifier unless you really need strictly monotonically - increasing values.

-
- -
- -

All valid Modifiers - can be combined. Repeated (valid) - Modifiers in the ModifierList - are ignored.

- -

Note that the set of integers returned by - unique_integer/1 using different sets of - Modifiers will overlap. - For example, by calling unique_integer([monotonic]), - and unique_integer([positive, monotonic]) - repeatedly, you will eventually see some integers being - returned by both calls.

- + Get a unique integer value. + +

Generates and returns an + + integer unique on current runtime system + instance. The integer is unique in the + sense that this BIF, using the same set of + modifiers, does not return the same integer more + than once on the current runtime system instance. + Each integer value can of course be constructed + by other means.

+

By default, when [] is passed as + ModifierList, both negative and + positive integers can be returned. This + to use the range of integers that do + not need heap memory allocation as much as possible. + By default the returned integers are also only + guaranteed to be unique, that is, any returned integer + can be smaller or larger than previously + returned integers.

+

Modifiers:

+ + positive + +

Returns only positive integers.

+

Notice that by passing the positive modifier + you will get heap allocated integers (bignums) quicker.

+
+ monotonic + +

Returns + strictly monotonically increasing integers + corresponding to creation time. That is, the integer + returned is always larger than previously + returned integers on the current runtime system + instance.

+

These values can be used to determine order between events + on the runtime system instance. That is, if both + X = erlang:unique_integer([monotonic]) and + Y = erlang:unique_integer([monotonic]) are + executed by different processes (or the same + process) on the same runtime system instance and + X < Y, we know that X was created + before Y.

+ +

Strictly monotonically increasing values + are inherently quite expensive to generate and scales + poorly. This is because the values need to be synchronized + between CPU cores. That is, do not pass the monotonic + modifier unless you really need strictly monotonically + increasing values.

+
+
+
+

All valid Modifiers + can be combined. Repeated (valid) + Modifiers in the ModifierList + are ignored.

+ +

The set of integers returned by + erlang:unique_integer/1 using different sets of + Modifiers will overlap. + For example, by calling unique_integer([monotonic]), + and unique_integer([positive, monotonic]) + repeatedly, you will eventually see some integers that are + returned by both calls.

+

Failures:

- - badarg - if ModifierList is not a - proper list. - badarg - if Modifier is not a - valid modifier. - + + badarg + if ModifierList is not a + proper list. + badarg + if Modifier is not a + valid modifier. +
- Current date and time according to Universal Time Coordinated (UTC). + Current date and time according to Universal Time Coordinated + (UTC).

Returns the current date and time according to Universal Time Coordinated (UTC) in the form {{Year, Month, Day}, {Hour, Minute, Second}} if supported by the underlying OS. Otherwise erlang:universaltime() is equivalent to - erlang:localtime().

-

Example:

+ erlang:localtime(). Example:

 > erlang:universaltime().
 {{1996,11,6},{14,18,43}}
@@ -9867,15 +10070,15 @@ timestamp() -> - Converts from Universal Time Coordinated (UTC) to local date and time. + Convert from Universal Time Coordinated (UTC) to local date + and time.

Converts Universal Time Coordinated (UTC) date and time to local date and time in the form {{Year, Month, Day}, {Hour, Minute, Second}} if supported by the underlying OS. Otherwise no conversion is done, and - Universaltime is returned.

-

Example:

+ Universaltime is returned. Example:

 > erlang:universaltime_to_localtime({{1996,11,6},{14,18,43}}).
 {{1996,11,7},{15,18,43}}
@@ -9886,7 +10089,7 @@ timestamp() -> - Removes a link to another process or port. + Remove a link to another process or port.

Removes the link, if there is one, between the calling process and the process or port referred to by @@ -9901,8 +10104,8 @@ timestamp() -> in the future (unless the link is setup again). If the caller is trapping exits, an {'EXIT', Id, _} message from the link - can have been placed in the caller's message queue before - the call.

+ can have been placed in the caller's message queue before + the call.

Notice that the {'EXIT', Id, _} message can be the result of the link, but can also be the result of Id @@ -9910,16 +10113,16 @@ timestamp() -> appropriate to clean up the message queue when trapping exits after the call to unlink(Id), as follows:

- unlink(Id), - receive - {'EXIT', Id, _} -> - true - after 0 -> - true - end +unlink(Id), +receive + {'EXIT', Id, _} -> + true +after 0 -> + true +end
-

Prior to OTP release R11B (ERTS version 5.5) unlink/1 - behaved completely asynchronously, i.e., the link was active +

Before Erlang/OTP R11B (ERTS 5.5) unlink/1 + behaved completely asynchronously, that is, the link was active until the "unlink signal" reached the linked entity. This had an undesirable effect, as you could never know when you were guaranteed not to be effected by the link.

@@ -9932,7 +10135,7 @@ timestamp() -> - Removes the registered name for a process (or port). + Remove the registered name for a process (or port).

Removes the registered name RegName associated with a @@ -9948,12 +10151,12 @@ true

- Gets the pid (or port) with a given registered name. + Get the pid (or port) with a specified registered name. +

Returns the process identifier or port identifier with the registered name RegName. Returns undefined - if the name is not registered.

-

Example:

+ if the name is not registered. Example:

 > whereis(db).
 <0.43.0>
@@ -9962,17 +10165,19 @@ true
- Lets other processes get a chance to execute. + Let other processes get a chance to execute.

Voluntarily lets other processes (if any) get a chance to - execute. Using erlang:yield() is similar to + execute. Using this function is similar to receive after 1 -> ok end, except that yield() is faster.

-

There is seldom or never any need to use this BIF, - especially in the SMP emulator, as other processes have a - chance to run in another scheduler thread anyway. - Using this BIF without a thorough grasp of how the scheduler - works can cause performance degradation.

+ +

There is seldom or never any need to use this BIF, + especially in the SMP emulator, as other processes have a + chance to run in another scheduler thread anyway. + Using this BIF without a thorough grasp of how the scheduler + works can cause performance degradation.

+
-- cgit v1.2.3