From a50c470e3d1af4660c09d993495dea56c50ad306 Mon Sep 17 00:00:00 2001 From: xsipewe Date: Fri, 11 Sep 2015 15:05:24 +0200 Subject: erts: Update erts time correction docs --- erts/doc/src/time_correction.xml | 764 ++++++++++++++++++++------------------- 1 file changed, 393 insertions(+), 371 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/time_correction.xml b/erts/doc/src/time_correction.xml index aed38fbb92..aec9efa3d3 100644 --- a/erts/doc/src/time_correction.xml +++ b/erts/doc/src/time_correction.xml @@ -35,31 +35,35 @@
New Extended Time Functionality -

As of OTP 18 (ERTS version 7.0) the time functionality of - Erlang has been extended. This both includes a +

As of OTP 18 (ERTS version 7.0) the time functionality of + Erlang has been extended. This includes a new API - for time, as well as + for time and time warp - modes which alters the behavior of the system when + modes that alter the system behavior when system time changes.

+

The default time warp mode has the same behavior as before, and the - old API will still work, so you are not required to change + old API still works. Thus, you are not required to change anything unless you want to. However, you are strongly encouraged to use the new API instead of the old API based on erlang:now/0. - erlang:now/0 has been deprecated since it is and forever - will be a scalability bottleneck. By using the new API you will + erlang:now/0 is deprecated, as it is and + will be a scalability bottleneck.

+ +

By using the new API, you automatically get scalability and performance improvements. This - will also enable you to use the - multi time warp mode - which improves accuracy, and precision of time measurements.

+ also enables you to use the + multi-time warp mode + that improves accuracy and precision of time measurements.

+
- Some Terminology -

In order to make it easier to understand this document we first - define some terminology. This is a mixture of our own terminology + Terminology +

To make it easier to understand this section, some terms + are defined. This is a mix of our own terminology (Erlang/OS system time, Erlang/OS monotonic time, time warp) and globally accepted terminology.

@@ -67,7 +71,7 @@
Monotonically Increasing

In a monotonically increasing sequence of values, all values - that have a predecessor are either larger than, or equal to its + that have a predecessor are either larger than or equal to its predecessor.

@@ -82,19 +86,19 @@
UT1 -

Universal Time. Based on the rotation of the earth. Conceptually - mean solar time at 0° longitude.

+

Universal Time. UT1 is based on the rotation of the earth + and conceptually means solar time at 0° longitude.

UTC -

Coordinated Universal Time. UTC almost align with - UT1, however, UTC uses the - SI definition of a second which is not exactly of the same length +

Coordinated Universal Time. UTC almost aligns with + UT1. However, UTC uses the + SI definition of a second, which has not exactly the same length as the second used by UT1. This means that UTC slowly drifts from - UT1. In order to keep UTC relatively in sync with UT1, leap seconds - are inserted, and potentially also deleted. That is, an UTC day may + UT1. To keep UTC relatively in sync with UT1, leap seconds + are inserted, and potentially also deleted. That is, an UTC day can be 86400, 86401, or 86399 seconds long.

@@ -104,14 +108,15 @@

Time since Epoch. Epoch is defined to be 00:00:00 UTC, - January 1, 1970. + 1970-01-01. A day in POSIX time is defined to be exactly 86400 seconds long. Strangely enough - Epoch is defined to be a time in UTC, and UTC have another + Epoch is defined to be a time in UTC, and UTC has another definition of how long a day is. Quoting the Open Group - "POSIX time is therefore not necessarily UTC, despite its appearance". The effect of this is that when an UTC leap second is + "POSIX time is therefore not necessarily UTC, despite its appearance". + The effect of this is that when an UTC leap second is inserted, POSIX time either stops for a second, or repeats the - last second. If an UTC leap second would be deleted (has never + last second. If an UTC leap second would be deleted (which has not happened yet), POSIX time would make a one second leap forward.

@@ -125,11 +130,11 @@
Time Precision -

The shortest time interval that can be be distinguished +

The shortest time interval that can be distinguished repeatedly and reliably when reading time values. Precision is limited by the resolution, but - resolution and precision might differ significantly.

+ resolution and precision can differ significantly.

@@ -143,21 +148,23 @@ Time Warp

A time warp is a leap forwards or backwards in time. That is, the difference of time values taken before and after the - time warp will not correspond to the actual elapsed time.

+ time warp does not correspond to the actual elapsed time.

OS System Time

The operating systems view of - POSIX time. It can be - retrieved by calling + POSIX time. To + retrieve it, call os:system_time(). This may or may not be an accurate view of POSIX time. This time may typically be adjusted both backwards and forwards without limitation. That is, time warps - may be observed. You can get information about the Erlang runtime - system's source of OS system time by calling + may be observed.

+ +

To get information about the Erlang runtime + system's source of OS system time, call erlang:system_info(os_system_time_source).

@@ -165,15 +172,17 @@
OS Monotonic Time

A monotonically increasing time provided by the operating - system. This time does not leap and have a relatively steady + system. This time does not leap and has a relatively steady frequency although not completely correct. However, it is not - uncommon that the OS monotonic time stops if the system is - suspended. This time typically increase since some + uncommon that OS monotonic time stops if the system is + suspended. This time typically increases since some unspecified point in time that is not connected to - OS system time. Note - that this type of time is not necessarily provided by all - operating systems. You can get information about the Erlang - runtime system's source of OS monotonic time by calling + OS system time. + This type of time is not necessarily provided by all + operating systems.

+ +

To get information about the Erlang + runtime system's source of OS monotonic time, call erlang:system_info(os_monotonic_time_source).

@@ -181,14 +190,17 @@
Erlang System Time

The Erlang runtime systems view of - POSIX time. It can be - retrieved by calling - erlang:system_time(). - This time may or may not be an accurate view of POSIX time, and may + POSIX time. To + retrieve it, call + erlang:system_time().

+ +

This time may or may not be an accurate view of POSIX time, + and may or may not align with OS system time. The runtime system works towards aligning the two - system times. Depending on time - warp mode used, this may be achieved by letting the Erlang + system times. Depending on the + time warp mode used, + this can be achieved by letting Erlang system time perform a time warp.

@@ -197,35 +209,43 @@
Erlang Monotonic Time

A monotonically increasing time provided by the - Erlang runtime system. The Erlang monotonic time increase since - some unspecified point in time. It can be retrieved by calling + Erlang runtime system. Erlang monotonic time increases since + some unspecified point in time. To retrieve it, call erlang:monotonic_time(). - The - accuracy, and +

+ +

The accuracy and precision of Erlang - monotonic time heavily depends on the accuracy and precision of - OS monotonic time, - the accuracy and precision of - OS system time as well - as on the - time warp mode - used. On a system that is lacking OS monotonic time, the Erlang - monotonic time can only guarantee monotonicity and can more or less - not give any other guarantees. The frequency adjustments made to - the Erlang monotonic time depends on the time warp mode - used.

- -

Internally in the runtime system the Erlang monotonic + monotonic time heavily depends on the following:

+ + + Accuracy and precision of + OS monotonic time + + Accuracy and precision of + OS system time + + time warp mode used + + + +

On a system without OS monotonic time, Erlang monotonic + time guarantees monotonicity, but cannot give + other guarantees. The frequency adjustments made to + Erlang monotonic time depend on the time warp mode used.

+ +

Internally in the runtime system, Erlang monotonic time is the "time engine" that is used for more or less - everything that has anything to do with time. All timers + everything that has anything to do with time. All timers, regardless of it is a receive ... after timer, BIF timer, - or a timer in the timer module are triggered + or a timer in the timer module, are triggered relative Erlang monotonic time. Even Erlang system time is based on Erlang monotonic time. By adding current Erlang monotonic time with current time - offset you get current Erlang system time. Current time - offset can be retrieved by calling + offset, you get current Erlang system time.

+ +

To retrieve current time offset, call erlang:time_offset/0.

@@ -234,176 +254,169 @@
Introduction -

Time is vital to an Erlang program and, more importantly, correct time is vital to an Erlang program. As Erlang is a language with - soft real time properties and we have the possibility to express - time in our programs, the Virtual Machine and the language has to be - very careful about what is considered a correct point in time and in + soft real-time properties and we can express + time in our programs, the Virtual Machine and the language must be + careful about what is considered a correct time and in how time functions behave.

-

In the beginning, Erlang was constructed assuming that the wall +

When Erlang was designed, it was assumed that the wall clock time in the system showed a monotonic time moving forward at - exactly the same pace as the definition of time. That more or less - meant that an atomic clock (or better) was expected to be attached + exactly the same pace as the definition of time. This more or less meant + that an atomic clock (or better time source) was expected to be attached to your hardware and that the hardware was then expected to be - locked away from any human (or unearthly) tinkering for all - eternity. While this might be a compelling thought, it's simply - never the case.

- -

A "normal" modern computer can not keep time. Not on itself and - not unless you actually have a chip level atomic clock wired to - it. Time, as perceived by your computer, will normally need to be - corrected. Hence the NTP protocol that together with the ntpd - process will do it's best to keep your computers time in sync with - the "real" time in the universe. Between NTP corrections, usually a + locked away from any human tinkering forever. While this can be a + compelling thought, it is simply never the case.

+ +

A "normal" modern computer cannot keep time, not on itself and + not unless you have a chip-level atomic clock wired to it. Time, + as perceived by your computer, must normally be corrected. Hence + the Network Time Protocol (NTP) protocol, together with the ntpd + process, does its best to keep your computer time in sync with + the correct time. Between NTP corrections, usually a less potent time-keeper than an atomic clock is used.

-

But NTP is not fail safe. The NTP server can be unavailable, the - ntp.conf can be wrongly configured or your computer may from time to - time be disconnected from the internet. Furthermore you can have a - user (or even system administrator) on your system that thinks the - right way to handle daylight saving time is to adjust the clock one - hour two times a year (a tip, that is not the right way to do - it...). To further complicate things, this user fetched your - software from the internet and has never ever thought about what's - the correct time as perceived by a computer. The user simply does - not care about keeping the wall clock in sync with the rest of the - universe. The user expects your program to have omnipotent knowledge +

However, NTP is not fail-safe. The NTP server can be unavailable, + ntp.conf can be wrongly configured, or your computer may + sometimes be disconnected from Internet. Furthermore, you can have a + user (or even system administrator) who thinks the correct + way to handle Daylight Saving Time is to adjust the clock one + hour two times a year (which is the incorrect way to do it). + To complicate things further, this user fetched your + software from Internet and has not considered what + the correct time is as perceived by a computer. The user does + not care about keeping the wall clock in sync with the correct + time. The user expects your program to have unlimited knowledge about the time.

Most programmers also expect time to be reliable, at least until - they realize that the wall clock time on their workstation is of by - a minute. Then they simply set it to the correct time, maybe or - maybe not in a smooth way. Most probably not in a smooth way.

+ they realize that the wall clock time on their workstation is off by + a minute. Then they set it to the correct time, but most probably + not in a smooth way.

-

The amount of problems that arise when you expect the wall clock - time on the system to always be correct may be immense. Therefore Erlang +

The number of problems that arise when you always expect the wall clock + time on the system to be correct can be immense. Erlang therefore introduced the "corrected estimate of time", or the "time - correction" many years ago. The time correction relies on the fact + correction", many years ago. The time correction relies on the fact that most operating systems have some kind of monotonic clock, - either a real time extension or some built in "tick counter" that is - independent of the wall clock settings. This counter may have - microsecond resolution or much less, but generally it has a drift - that is not to be ignored.

- + either a real-time extension or some built-in "tick counter" that is + independent of the wall clock settings. This counter can have + microsecond resolution or much less, but it has a drift that cannot + be ignored.

-
+ Time Correction

If time correction is enabled, the Erlang runtime system - will make use of both + makes use of both OS system time and OS monotonic time, - in order to make adjustments of the frequency of the Erlang - monotonic clock. Time correction will ensure that + to adjust the frequency of the Erlang + monotonic clock. Time correction ensures that Erlang monotonic time - will not warp, and that the frequency is relatively accurate. - The type of adjustments made to the frequency depends on the - time warp mode used. This will be discussed in more details in - the time warp modes - section below.

- -

By default time correction will be enabled if support for - it on the specific platform exist. Support for it includes - both an OS monotonic time provided by the OS, and an - implementation in the Erlang runtime system utilizing the - OS monotonic time. You can check if your system has support - for OS monotonic time by calling - erlang:system_info(os_monotonic_time_source), - and you can check if time correction is enabled on your - system by calling + does not warp and that the frequency is relatively accurate. + The type of frequency adjustments depends on the time warp mode used. + Section Time Warp Modes + provides more details.

+ +

By default time correction is enabled if support for + it exists on the specific platform. Support for it includes + both OS monotonic time, provided by the OS, and an + implementation in the Erlang runtime system using + OS monotonic time. To check if your system has support + for OS monotonic time, call + erlang:system_info(os_monotonic_time_source). + To check if time correction is enabled on your system, call erlang:system_info(time_correction).

-

Time correction is enabled or disabled by passing the +

To enable or disable time correction, pass command-line argument +c [true|false] - command line argument to erl.

+ to erl.

If time correction is disabled, Erlang monotonic time - may warp forwards, it may stop and even freeze for extended - periods of time, and there are no guarantees that the frequency + may warp forwards or stop, or even freeze for extended + periods of time. There are then no guarantees that the frequency of the Erlang monotonic clock is accurate or stable.

You typically never want to disable time correction. - Previously there was a performance penalty associated with time - correction, but nowadays it is most often the other way around. - By disabling time correction you are likely to get bad scalability, + Previously a performance penalty was associated with time + correction, but nowadays it is usually the other way around. + If time correction is disabled, you probably get bad scalability, bad performance, and bad time measurements.

- -
+ Time Warp Safe Code -

Time warp safe code is code that is able to handle +

Time warp safe code can handle a time warp of - Erlang system time. -

+ Erlang system time.

erlang:now/0 - behaves very bad when Erlang system time warps. When Erlang - system time do a time warp backwards, the values returned - from erlang:now/0 will freeze (if you disregard the - micro second increments made due to the actual call) until - OS system time reach the point of the last value returned by - erlang:now/0. This freeze might continue for very - long periods of time. It might take years, decades, - and even longer than this until the freeze stops.

+ behaves bad when Erlang system time warps. When Erlang + system time does a time warp backwards, the values returned + from erlang:now/0 freeze (if you disregard the + microsecond increments made because of the actual call) until + OS system time reaches the point of the last value returned by + erlang:now/0. This freeze can continue for a long time. It + can take years, decades, and even longer until the freeze stops.

All uses of erlang:now/0 are not necessarily time warp unsafe. If you do not use it to get time, it - will be time warp safe. However all uses of + is time warp safe. However, all uses of erlang:now/0 are suboptimal from a performance and scalability perspective. So you really want to replace - the usage of it with other functionality. For examples - of how to replace the usage of erlang:now/0, - see the Dos and Donts - section.

+ the use of it with other functionality. For examples + of how to replace the use of erlang:now/0, see Section + How to Work with the New + API.

-
Time Warp Modes - +

Current Erlang system time is determined by adding current Erlang monotonic time with current time offset. The time offset is managed differently depending on which time - warp mode you use. The time warp mode is set by passing the + warp mode you use.

+ +

To set the time warp mode, pass command-line argument +C [no_time_warp|single_time_warp|multi_time_warp] - command line argument to erl.

+ to erl.

No Time Warp Mode

The time offset is determined at runtime system start - and will after this not change. This is the default behavior. - Not because it is the best mode (which it isn't). It is + and does not change later. This is the default behavior, but + not because it is the best mode (which it is not). It is default only because this is how the runtime system - always has behaved up until ERTS version 7.0, and you have to - ensure that your Erlang code that may execute during a time + behaved until ERTS 7.0. + Ensure that your Erlang code that may execute during a time warp is time warp - safe before you can enable other modes.

+ safe before enabling other modes.

-

Since the time offset is not allowed to change, time - correction needs to adjust the frequency of the Erlang - monotonic clock in order to smoothly align Erlang system - time with OS system time. A big downside of this approach +

As the time offset is not allowed to change, time + correction must adjust the frequency of the Erlang + monotonic clock to align Erlang system time with OS + system time smoothly. A significant downside of this approach is that we on purpose will use a faulty frequency on the Erlang monotonic clock if adjustments are needed. This - error may be as big as 1%. This error will show up in all + error can be as large as 1%. This error will show up in all time measurements in the runtime system.

-

If time correction is not enabled, the Erlang monotonic - time will freeze when the OS system time leap backwards. - The freeze of the monotonic time will continue until - OS system time catch up. The freeze may continue for - a very long time. When OS system time leaps forwards, - Erlang monotonic time will also leap forward.

+

If time correction is not enabled, Erlang monotonic + time freezes when OS system time leaps backwards. + The freeze of monotonic time continues until + OS system time catches up. The freeze can continue for + a long time. When OS system time leaps forwards, + Erlang monotonic time also leaps forward.

@@ -411,26 +424,27 @@ Single Time Warp Mode

This mode is more or less a backwards compatibility mode as of its introduction.

+

On an embedded system it is not uncommon that the system - has no power supply at all, not even a battery, when it is - shut off. The system clock on such a system will typically - be way off when the system boots. If the + has no power supply, not even a battery, when it is + shut off. The system clock on such a system is typically + way off when the system boots. If no time warp mode is used, and the Erlang runtime system is started before - the OS system time has been corrected, the Erlang system - time may be wrong for a very long time, even centuries or - more.

-

If you for some reason need to use Erlang code that - is not + OS system time has been corrected, Erlang system time + can be wrong for a long time, centuries or even longer.

+ +

If you need to use Erlang code that is not time warp safe, - and you need to start the Erlang runtime system before the OS + and you need to start the Erlang runtime system before OS system time has been corrected, you may want to use the single - time warp mode. Note that there are limitations to when you can + time warp mode.

+ +

There are limitations to when you can execute time warp unsafe code using this mode. If it is possible - to only utilize time warp safe code, it is much better - to use the multi time - warp mode instead. -

+ to use time warp safe code only, it is much better + to use the multi-time + warp mode instead.

Using the single time warp mode, the time offset is handled in two phases:

@@ -438,158 +452,150 @@ Preliminary Phase -

The preliminary phase starts when the runtime +

This phase starts when the runtime system starts. A preliminary time offset based on - current OS system time is determined. This offset will - from now on be fixed during the whole preliminary phase.

+ current OS system time is determined. This offset is from + now on to be fixed during the whole preliminary phase.

If time correction is enabled, adjustments to the - Erlang monotonic clock will be made to keep its - frequency as correct as possible, but no - adjustments will be made trying to align Erlang system - time and OS system time. That is, during the preliminary - Erlang system time and OS system time might diverge - from each other, and no attempt to prevent this will - be made.

+ Erlang monotonic clock are made to keep its + frequency as correct as possible. However, no + adjustments are made trying to align Erlang system + time and OS system time. That is, during the preliminary phase + Erlang system time and OS system time can diverge + from each other, and no attempt is made to prevent this.

If time correction is disabled, changes in OS system - time will effect the monotonic clock the same way as + time affects the monotonic clock the same way as when the no time warp mode is used.

Final Phase - -

The final phase begin when the user finalize the time +

This phase begins when the user finalizes the time offset by calling erlang:system_flag(time_offset, finalize). - The finalization can only be performed once. -

+ The finalization can only be performed once.

During finalization, the time offset is adjusted and - fixated so that current Erlang system time align with - current OS system time. Since the time offset may - change during the finalization, the Erlang system time - may do a time warp at this point. The time offset will - from now on be fixed until the runtime system terminates. + fixated so that current Erlang system time aligns with + current OS system time. As the time offset can + change during the finalization, Erlang system time + can do a time warp at this point. The time offset is + from now on fixed until the runtime system terminates. If time correction has been enabled, the time - correction will from now on also make adjustments - in order to align Erlang system time with OS system - time. When the system is in the final phase it behaves + correction from now on also makes adjustments + to align Erlang system time with OS system + time. When the system is in the final phase, it behaves exactly as in the no time warp mode.

-
-

In order for this to work properly there are two - requirements that the user needs to ensure are - satisfied:

+

In order for this to work properly, the user must ensure + that the following two requirements are satisfied:

Forward Time Warp

The time warp made when finalizing the time offset can only be done forwards without encountering problems. - This implies that the user has to ensure that the OS + This implies that the user must ensure that OS system time is set to a time earlier or equal to actual - POSIX time before starting the Erlang runtime system. If - you are not completely sure the OS system time is correct, + POSIX time before starting the Erlang runtime system.

+ +

If you are not sure that OS system time is correct, set it to a time that is guaranteed to be earlier than actual POSIX time before starting the Erlang runtime - system just to be safe.

+ system, just to be safe.

+ Finalize Correct OS System Time -

The OS system time needs to be correct when the - the user finalizes the time offset.

+

OS system time must be correct when + the user finalizes the time offset.

+

If these requirements are not fulfilled, the system - may behave very bad. -

- -

Assuming that the requirements above are fulfilled, - time correction is enabled, and that the OS system time - is adjusted using some time adjustment protocol like NTP - or similar, only small adjustments of the Erlang monotonic - time should be needed in order to keep system times - aligned after finilization. As long as the system is not - suspended, the largest adjustments needed should be for + may behave very bad.

+ +

Assuming that these requirements are fulfilled, + time correction is enabled, and that OS system time + is adjusted using a time adjustment protocol such as NTP, + only small adjustments of Erlang monotonic + time are needed to keep system times + aligned after finalization. As long as the system is not + suspended, the largest adjustments needed are for inserted (or deleted) leap seconds.

-

In order to be able to use this mode you have - to ensure that all Erlang code that will execute in - both phases are +

To use this mode, ensure that + all Erlang code that will execute in both phases are time warp safe.

-

Code that only execute in the final phase does not have +

Code executing only in the final phase does not have to be able to cope with the time warp.

-
- Multi Time Warp Mode - -

Multi time warp mode in combination with time - correction is the preferred configuration. This since, - on almost all platforms, the Erlang runtime system will have - better performance, will scale better, will behave better, - and since the accuracy, and precision of time measurements - will be better. Only Erlang runtime systems executing on - ancient platforms will benefit from another configuration.

+ Multi-Time Warp Mode +

Multi-time warp mode in combination with time + correction is the preferred configuration. This as + the Erlang runtime system have better performance, scale + better, and behave better on almost all platforms. In + addition, the accuracy and precision of time measurements + are better. Only Erlang runtime systems executing on + ancient platforms benefit from another configuration.

The time offset may change at any time without limitations. That is, Erlang system time may perform time warps both - forwards and backwards at any time. Since we align - the Erlang system time with the OS system time by changing + forwards and backwards at any time. As we align + Erlang system time with OS system time by changing the time offset, we can enable a time correction that tries to adjust the frequency of the Erlang monotonic clock to be as - correct as possible. This will make time measurements using - the Erlang monotonic time more accurate and precise.

+ correct as possible. This makes time measurements using + Erlang monotonic time more accurate and precise.

If time correction is disabled, Erlang monotonic time - will leap forward if OS system time leaps forward. If the - OS system time leaps backwards, Erlang monotonic time will - stop briefly but it does not freeze for extended periods - of time. This since the time offset is changed in order to + leaps forward if OS system time leaps forward. If + OS system time leaps backwards, Erlang monotonic time + stops briefly, but it does not freeze for extended periods + of time. This as the time offset is changed to align Erlang system time with OS system time.

-

In order to be able to use this mode you have - to ensure that all Erlang code that will execute on the - runtime system is +

To use this mode, ensure that all + Erlang code that will execute on the runtime system is time warp safe.

-
- The New Time API - + New Time API +

The old time API is based on erlang:now/0. - The major issue with erlang:now/0 is that it was - intended to be used for so many unrelated things. This - tied these unrelated operations together and unnecessarily - caused performance, scalability as well as accuracy, and - precision issues for operations that do not need to have - such issues. The new API spreads different functionality - over multiple functions in order to improve on this.

- -

In order to be backwards compatible erlang:now/0 will - remain as is, but you are strongly discouraged from using - it. A lot of uses of erlang:now/0 will also - prevent you from using the new - multi time warp - mode which is an important part of this + erlang:now/0 was intended to be used for many unrelated + things. This tied these unrelated operations together and + caused issues with performance, scalability, accuracy, and + precision for operations that did not need to have + such issues. To improve this, the new API spreads different + functionality over multiple functions.

+ +

To be backwards compatible, erlang:now/0 + remains as is, but you are strongly discouraged from using + it. Much use of erlang:now/0 + prevents you from using the new + multi-time warp + mode, which is an important part of this new time functionality improvement.

Some of the new BIFs on some systems, perhaps surprisingly, - return negative integer values on a newly started run time - system. This is not a bug, but a memory usage optimization.

+ return negative integer values on a newly started runtime + system. This is not a bug, but a memory use optimization.

+ +

The new API consists of the following new BIFs:

-

The new API consists of a number of new BIFs:

erlang:convert_time_unit/3

erlang:monotonic_time/0

@@ -604,7 +610,9 @@

os:system_time/0

os:system_time/1

-

and a number of extensions of existing BIFs:

+ +

The new API also consists of extensions of the following existing BIFs:

+

erlang:monitor(time_offset, clock_service)

erlang:system_flag(time_offset, finalize)

@@ -619,102 +627,99 @@
- The New Erlang Monotonic Time -

The Erlang monotonic time as such is new as of ERTS - version 7.0. It has been introduced in order to be able - to detach time measurements such as elapsed time from - calender time. It is very common that one is interested - in measuring elapsed time or specifying a time relative - to another point in time without having any need to know - what the involved times are in UTC or any other - globally defined time scale. By introducing a time scale - that has a local definition of where it starts, it is - possible to manage time that do not concern calender - time on that time scale. Erlang monotonic time use + New Erlang Monotonic Time +

Erlang monotonic time as such is new as of ERTS 7.0. + It is introduced to detach time measurements, such as elapsed + time from calendar time. Many programmers want to measure elapsed + time or specify a time relative to another point in time without + knowing the involved times in UTC or any other globally defined + time scale. By introducing a time scale + with a local definition of where it starts, time that do + not concern calendar time on that time scale can be managed. + Erlang monotonic time uses such a time scale with a locally defined start.

-

The introduction of Erlang monotonic time gives us - the possibility to adjust the two Erlang times (Erlang +

The introduction of Erlang monotonic time allows + us to adjust the two Erlang times (Erlang monotonic time and Erlang system time) separately. By - doing this, accuracy of elapsed time does not have to + doing this, the accuracy of elapsed time does not have to suffer just because the system time happened to be wrong at some point in time. Separate adjustments of the two times are only performed in the time warp modes, and only fully separated in the - multi - time warp mode. All other modes than the - multi time warp mode are there for backwards - compatibility reasons, and when using these the - accuracy of Erlang monotonic time suffer since + multi-time + warp mode. All other modes than the + multi-time warp mode are for backwards + compatibility reasons. When using these modes, the + accuracy of Erlang monotonic time suffer, as the adjustments of Erlang monotonic time in these - modes are more or less tied to the Erlang system - time.

+ modes are more or less tied to Erlang system time.

The adjustment of system time could have been made smother than using a time warp approach, but we think - that would be a bad choice. Since we are able to - express and measure time that aren't connected to - calender time by the use of Erlang monotonic time, it + that would be a bad choice. As we can + express and measure time that is not connected to + calendar time by the use of Erlang monotonic time, it is better to expose the change in Erlang system time - immediately. This since it makes it possible for the - Erlang applications executing on the system to react - on the change in system time as soon as possible. This - is also more or less exactly how most OSes handle this + immediately. This as the Erlang applications + executing on the system can react on the change in + system time as soon as possible. This is also more or + less exactly how most operating systems handle this (OS monotonic time and OS system time). By adjusting - system time smoothly we would just hide the fact that + system time smoothly, we would just hide the fact that system time changed and make it harder for the Erlang applications to react to the change in a sensible way.

-

In order to be able to react to a change in Erlang - system time you have to be able to detect that it +

To be able to react to a change in Erlang + system time, you must be able to detect that it happened. The change in Erlang system time occurs when current time offset is changed. We have therefore - introduced the possibility to monitor the time offset - using - erlang:monitor(time_offset, clock_service). A process monitoring the time - offset will be sent a message on the following format + introduced the possibility to monitor the time offset using + erlang:monitor(time_offset, clock_service). + A process monitoring the time + offset is sent a message on the following format when the time offset is changed:

+ {'CHANGE', MonitorReference, time_offset, clock_service, NewTimeOffset}
Unique Values -

Besides reporting time erlang:now/0 also - produce unique and strictly monotonically increasing - values. In order to detach this functionality from - time measurements we have introduced +

Besides reporting time, erlang:now/0 also + produces unique and strictly monotonically increasing + values. To detach this functionality from + time measurements, we have introduced erlang:unique_integer().

- Dos and Don'ts + How to Work with the New API

Previously erlang:now/0 was the only option for doing - quite a lot of things. We will look at a few different things - erlang:now/0 could be used for, and how you want to do - this using the new API:

+ many things. This section deals with some things that + erlang:now/0 can be used for, and how you are to + these using the new API.

Retrieve Erlang System Time

- use erlang:now/0 in order to retrieve current Erlang - system time. + Use erlang:now/0 to retrieve current Erlang system time.

- use + Use erlang:system_time/1 - in order to retrieve current Erlang system time on the + to retrieve current Erlang system time on the time unit of your choice.

If you want the same format as returned by erlang:now/0, use erlang:timestamp/0. -

+

@@ -723,26 +728,27 @@ Measure Elapsed Time

- take timestamps with erlang:now/0 and calculate + Take timestamps with erlang:now/0 and calculate the difference in time with timer:now_diff/2.

- take timestamps with + Take timestamps with erlang:monotonic_time/0 and calculate the time difference using ordinary subtraction. The result will be in native time unit. If you want to convert the - result to another time unit you can do this using + result to another time unit, you can use erlang:convert_time_unit/3.

-

Another easier way of doing this is to use + +

An easier way to do this is to use erlang:monotonic_time/1 - with desired time unit. However, you may lose accuracy, - and precision this way. + with the desired time unit. However, you can then lose accuracy + and precision.

@@ -752,16 +758,16 @@ Determine Order of Events

- determine the order of events by saving a timestamp - with erlang:now/0 when the event happens. + Determine the order of events by saving a timestamp + with erlang:now/0 when the event occurs.

- determine the order of events by saving the integer + Determine the order of events by saving the integer returned by erlang:unique_integer([monotonic]) - when the event happens. These integers will be strictly + when the event occurs. These integers will be strictly monotonically ordered on current runtime system instance corresponding to creation time.

@@ -770,40 +776,43 @@
- Determine Order of Events With Time of the Event + Determine Order of Events with Time of the Event

- determine the order of events by saving a timestamp - with erlang:now/0 when the event happens. + Determine the order of events by saving a timestamp + with erlang:now/0 when the event occurs.

- determine the order of events by saving a tuple - containing + Determine the order of events by saving a tuple containing monotonic time and a strictly - monotonically increasing integer like this:

+ monotonically increasing integer as follows:

+ Time = erlang:monotonic_time(), UMI = erlang:unique_integer([monotonic]), EventTag = {Time, UMI} +

These tuples will be strictly monotonically ordered - on the current runtime system instance according to - creation time. Note that it is important that the + on current runtime system instance according to + creation time. It is important that the monotonic time is in the first element (the most significant element when comparing 2-tuples). Using the monotonic time in the tuples, you can calculate time between events.

-

If you are interested in the Erlang system time at the - time when the event occurred you can also save the time + +

If you are interested in Erlang system time at the + time when the event occurred, you can also save the time offset before or after saving the events using erlang:time_offset/0. Erlang monotonic time added with the time offset corresponds to Erlang system time.

+

If you are executing in a mode where time offset - may change and you want to be able to get the actual - Erlang system time when the event occurred you can + can change, and you want to get the actual + Erlang system time when the event occurred, you can save the time offset as a third element in the tuple (the least significant element when comparing 3-tuples).

@@ -814,16 +823,15 @@ EventTag = {Time, UMI} Create a Unique Name

- use the values returned from erlang:now/0 - in order to create a name unique on the current - runtime system instance. + Use the values returned from erlang:now/0 + to create a name unique on the current runtime system instance.

- use the value returned from + Use the value returned from erlang:unique_integer/0 - in order to create a name unique on the current runtime system + to create a name unique on the current runtime system instance. If you only want positive integers, you can use erlang:unique_integer([positive]).

@@ -832,48 +840,62 @@ EventTag = {Time, UMI}
- Seed Random Number Generation With a Unique Value + Seed Random Number Generation with a Unique Value

- seed random number generation using erlang:now(). + Seed random number generation using erlang:now().

- seed random number generation using a combination of + Seed random number generation using a combination of erlang:monotonic_time(), erlang:time_offset(), - erlang:unique_integer(), and other functionality. + erlang:unique_integer(), + and other functionality.

-

To sum this section up: Don't use erlang:now/0!

+

To sum up this section: Do not use erlang:now/0.

-
- Supporting Both New and Old OTP Releases -

Your code may be required to be able to run on a variety + + Support of Both New and Old OTP Releases +

It can be required that your code must run on a variety of OTP installations of different OTP releases. If so, you - can not just use the new API out of the box, since it will + cannot use the new API out of the box, as it will not be available on old pre OTP 18 releases. The solution - is not to avoid using the new API, since your - code then won't be able to benefit from the scalability - and accuracy improvements made. Instead you want to use the + is not to avoid using the new API, as your + code then would not benefit from the scalability + and accuracy improvements made. Instead, use the new API when available, and fall back on erlang:now/0 - when it is not available. Fortunately almost all of the new - API can easily be implemented using existing primitives - (except for - erlang:system_info(start_time), - erlang:system_info(end_time), - erlang:system_info(os_monotonic_time_source), and - erlang:system_info(os_system_time_source)). - By wrapping the API with functions that fall back on - erlang:now/0 when the new API is not available, - and using these wrappers instead of using the API directly - the problem is solved. These wrappers can for example + when the new API is unavailable.

+ +

Fortunately most of the new API can easily be + implemented using existing primitives, except for:

+ + + + erlang:system_info(start_time) + + + erlang:system_info(end_time) + + + erlang:system_info(os_monotonic_time_source) + + + erlang:system_info(os_system_time_source)) + + + +

By wrapping the API with functions that fall back on + erlang:now/0 when the new API is unavailable, + and using these wrappers instead of using the API directly, + the problem is solved. These wrappers can, for example, be implemented as in $ERL_TOP/erts/example/time_compat.erl.

-- cgit v1.2.3 From d3413b5ea34b592b92dc0d17a23c35c731368ad1 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 23 Sep 2015 14:48:47 +0200 Subject: erts: Review time correction docs --- erts/doc/src/time_correction.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/time_correction.xml b/erts/doc/src/time_correction.xml index aec9efa3d3..4de3739a36 100644 --- a/erts/doc/src/time_correction.xml +++ b/erts/doc/src/time_correction.xml @@ -584,7 +584,7 @@

To be backwards compatible, erlang:now/0 remains as is, but you are strongly discouraged from using - it. Much use of erlang:now/0 + it. Many use cases of erlang:now/0 prevents you from using the new multi-time warp mode, which is an important part of this @@ -630,14 +630,14 @@ New Erlang Monotonic Time

Erlang monotonic time as such is new as of ERTS 7.0. It is introduced to detach time measurements, such as elapsed - time from calendar time. Many programmers want to measure elapsed - time or specify a time relative to another point in time without - knowing the involved times in UTC or any other globally defined - time scale. By introducing a time scale - with a local definition of where it starts, time that do - not concern calendar time on that time scale can be managed. - Erlang monotonic time uses - such a time scale with a locally defined start.

+ time from calendar time. In many use cases there is a need to + measure elapsed time or specify a time relative to another point + in time without the need to know the involved times in UTC or + any other globally defined time scale. By introducing a time + scale with a local definition of where it starts, time that do + not concern calendar time can be managed on that time + scale. Erlang monotonic time uses such a time scale with a + locally defined start.

The introduction of Erlang monotonic time allows us to adjust the two Erlang times (Erlang -- cgit v1.2.3 From e17e236cd1661bc8f5bb1ebef0d80e93eb8f5b36 Mon Sep 17 00:00:00 2001 From: xsipewe Date: Tue, 1 Sep 2015 12:15:27 +0200 Subject: erts: Update module erlang docs Rebased 6ac77046b05cd3cb7b117 on OTP-18.1 Conflicts: erts/doc/src/erlang.xml --- erts/doc/src/erlang.xml | 6896 +++++++++++++++++++++++++---------------------- 1 file changed, 3702 insertions(+), 3194 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 37f0aa289e..8b20a5c12f 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -30,33 +30,34 @@ erlang.xml erlang - The Erlang BIFs + The Erlang BIFs. -

By convention, most built-in functions (BIFs) are seen as being - in the module erlang. A number of the BIFs are viewed more +

By convention, most Built-In Functions (BIFs) are seen as being + 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 and both the calls atom_to_list(Erlang) and - erlang:atom_to_list(Erlang) are identical.

-

In the text, auto-imported BIFs are listed without module prefix. + 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 may fail for a variety of reasons. All BIFs fail with +

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 that may make BIFs fail are - described in connection with the description of each individual - BIF.

-

Some BIFs may be used in guard tests, these are marked with + 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".

- ext_binary() + ext_binary() +

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

+

See erlang:timestamp/0.

@@ -139,12 +140,15 @@ - - - Arithmetical absolute value - -

Returns an integer or float which is the arithmetical - absolute value of Float or Int.

+ Arithmetical absolute value. + + Float = float() + Int = integer() + + +

Returns an integer or float that is the arithmetical + absolute value of Float or + Int, for example:

 > abs(-3.33).
 3.33
@@ -153,206 +157,217 @@
         

Allowed in guard tests.

+ - Compute adler32 checksum + Computes adler32 checksum. -

Computes and returns the adler32 checksum for Data.

+

Computes and returns the adler32 checksum for + Data.

+ - Compute adler32 checksum + Computes adler32 checksum. -

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

-

The following code:

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

- would assign the same value to Y as this would:

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

Continues computing the adler32 checksum by combining + 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:

+ + Y = erlang:adler32([Data1,Data2]).
+ - 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.

-

The following code:

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

- would assign the same value to Z as this would:

- - X = erlang:adler32(Data1), - Y = erlang:adler32(Data2), - Z = erlang:adler32_combine(X,Y,iolist_size(Data2)). - + Combines 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.

+

The following code:

+ + 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)).
+ - Append an extra element to a tuple - -

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

+ Appends an extra element to a tuple. + +

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

+

Example:

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

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

-

Note: If the number of elements in the arguments are known at - compile-time, the call is better written as +

Calls a fun, passing the elements in Args + 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 {Module, Function}, equivalent to - apply(Module, Function, Args). This usage is - deprecated and will stop working in a future release of - Erlang/OTP.

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

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

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

+

Example:

 > apply(lists, reverse, [[a, b, c]]).
 [c,b,a]
-

apply can be used to evaluate BIFs by using +

apply evaluates BIFs by using the module name erlang.

 > apply(erlang, atom_to_list, ['Erlang']).
 "Erlang"
-

Note: If the number of arguments are known at compile-time, +

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 if the applied function is not exported. The error handler can be redefined (see process_flag/2). - If the error_handler is undefined, or if the user has + 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 is generated.

+ - Return the binary representation of an atom - -

Returns a binary which corresponds to the text - representation of Atom. If Encoding - is latin1, there will be one byte for each character - in the text representation. If Encoding is - utf8 or - unicode, the characters will be encoded using UTF-8 - (meaning that characters from 16#80 up to 0xFF will be - encoded in two bytes).

- -

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

- + Returns 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 + in the text representation. If Encoding is + utf8 or + unicode, the characters are encoded using UTF-8 + (that is, characters from 16#80 through 0xFF 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 16#FF. 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 16#FF.

+

Example:

 > atom_to_binary('Erlang', latin1).
 <<"Erlang">>
+ - Text representation of an atom + Text representation of an atom. -

Returns a string which corresponds to the text - representation of Atom.

+

Returns a string corresponding to the text + representation of Atom, for example:

 > atom_to_list('Erlang').
 "Erlang"
+ - Extracts a part of a binary + Extracts 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:

- +

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:

1> Bin = <<1,2,3,4,5,6,7,8,9,10>>. 2> binary_part(Bin,{byte_size(Bin), -5}). -<<6,7,8,9,10>> - - -

If PosLen in any way references outside the binary, a badarg exception is raised.

- -

Start is zero-based, i.e.:

+<<6,7,8,9,10>> +

Failure: badarg if PosLen in any way + references outside the binary.

+

Start is zero-based, that is:

1> Bin = <<1,2,3>> 2> binary_part(Bin,{0,2}). -<<1,2>> - - -

See the STDLIB module binary for details about the PosLen semantics.

- +<<1,2>> +

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

Allowed in guard tests.

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

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

- +

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

Allowed in guard tests.

+ - Convert from text representation to an atom + Converts 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; furthermore, only Unicode characters up - to 0xFF are allowed.

- -

binary_to_atom(Binary, utf8) will fail if - the binary contains Unicode characters greater than 16#FF. - In a future release, such Unicode characters might be allowed - and binary_to_atom(Binary, utf8) - will not fail in that case. For more information on Unicode support in atoms - see note on UTF-8 encoded atoms - in the chapter about the external term format in the ERTS 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 0xFF are allowed.

+

binary_to_atom(Binary, utf8) fails if + the binary contains Unicode characters greater than 16#FF. + 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.

+

Examples:

 > binary_to_atom(<<"Erlang">>, latin1).
 'Erlang'
@@ -362,20 +377,24 @@
         called as binary_to_atom(<<208,128>>,utf8)
+ - Convert from text representation to an atom + Converts from text representation to an atom. -

Works like binary_to_atom/2, - but the atom must already exist.

-

Failure: badarg if the atom does not already exist.

+

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

+

Failure: badarg if the atom does not exist.

+ - Convert from text representation to a float + Converts from text representation to a float. -

Returns the float whose text representation is Binary.

+

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

 > binary_to_float(<<"2.2017764e+0">>).
 2.2017764
@@ -383,12 +402,13 @@ representation of a float.

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

Returns an integer whose text representation is - Binary.

+ Binary, for example:

 > binary_to_integer(<<"123">>).
 123
@@ -396,12 +416,13 @@ representation of an integer.

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

Returns an integer whose text representation in base - Base is Binary.

+ Base is Binary, for example:

 > binary_to_integer(<<"3FF">>, 16).
 1023
@@ -409,93 +430,101 @@ representation of an integer.

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

Returns a list of integers which correspond to the bytes of +

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

+ - Convert part of a binary to a list + Converts 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. Positions in the + position Stop in Binary. + The positions in the binary are numbered starting from 1.

- -

This function's indexing style of using one-based indices for - binaries is deprecated. New code should use the functions in - the STDLIB module binary instead. They consequently - use the same (zero-based) style of indexing.

+

The indexing style of using one-based indices for + binaries is deprecated for this function. New code is to + use the functions in module binary in STDLIB + instead. They therefore + use the same (zero-based) style of indexing.

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

Returns a list of integers which correspond to the bytes of - Bitstring. If the number of bits in the binary is not - divisible by 8, the last element of the list will be a bitstring - containing the remaining bits (1 up to 7 bits).

+

Returns a list of integers corresponding to the bytes of + Bitstring. If the number of bits in the binary + is not divisible by 8, the last element of the list is a bitstring + containing the remaining 1-7 bits.

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

Returns an Erlang term which is the result of decoding - the binary object Binary, which must be encoded +

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.

-
-

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

+

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.

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

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

safe -

Use this option when receiving binaries from an untrusted +

Use this option when receiving binaries from an untrusted source.

-

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

-

Currently, this prevents creation of new atoms directly, - creation of new atoms indirectly (as they are embedded in - certain structures like pids, refs, funs, etc.), and creation of - new external function references. None of those resources are - currently garbage collected, so unchecked creation of them can - exhaust available memory.

+

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.

+

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.

-

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

+

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

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

+ and + list_to_existing_atom/1.

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

Returns an integer which is the size in bits of Bitstring.

+

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

 > bit_size(<<433:16,3:3>>).
 19
@@ -504,30 +533,34 @@
         

Allowed in guard tests.

+ - Increment the reduction counter + Increments 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, and a context switch is - forced when the counter reaches the maximum number of reductions - for a process (2000 reductions in R12B).

+ 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).

-

This BIF might be removed in a future version of the Beam +

This BIF can be removed in a future version of the Beam machine without prior warning. It is unlikely to be implemented in other Erlang implementations.

+ - Return the size of a bitstring (or binary) + Returns the size of a bitstring (or binary). -

Returns an integer which 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 will be rounded up.)

+

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:

 > byte_size(<<433:16,3:3>>).
 3
@@ -536,12 +569,13 @@
         

Allowed in guard tests.

+ - Cancel a timer + Cancels a timer.

- Cancels a timer that has been created by either + Cancels a timer that has been created by erlang:start_timer(), or erlang:send_after(). TimerRef identifies the timer, and @@ -606,7 +640,7 @@ the timeout message has been sent, but it does not tell you whether or not it has arrived at its destination yet. When the Result is an integer, it represents the - time in milli-seconds left until the timer will expire. + time in milli-seconds left until the timer would have expired.

@@ -632,7 +666,7 @@ - Cancel a timer + Cancels a timer.

Cancels a timer. The same as calling erlang:cancel_timer(TimerRef, @@ -641,100 +675,99 @@ - Check if a module has old code + Checks if a module has old code. -

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

+

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

See also code(3).

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

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

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

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

Check if the node local process identified by Pid - is executing old code for Module.

-

Currently available Options:

+

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

+

The available Options are as follows:

{allow_gc, boolean()} - Determines if garbage collection is allowed when performing - the operation. If {allow_gc, false} is passed, and - a garbage collection is needed in order to determine the - result of the operation, the operation will be aborted - (see information on CheckResult below). - The default is to allow garbage collection, i.e., - {allow_gc, true}. +

Determines if garbage collection is allowed when performing + 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). + The default is to allow garbage collection, that is, + {allow_gc, true}.

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

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}.

-

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

-

CheckResult informs about the result of - the request:

+

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.

+

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

true - The process identified by Pid is - executing old code for Module. - That is, the current call of the process executes old - 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. +

The process identified by Pid + executes old code for Module. + That is, the current call of the process executes old + 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 is - not executing old code for Module. +

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

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

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}.

See also 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. + If Module is not an atom. badarg - - If OptionList is not a valid list of options. + If OptionList is an invalid list of options.
+ Convert time unit of a time value @@ -753,99 +786,101 @@ - Compute crc32 (IEEE 802.3) checksum + Computes crc32 (IEEE 802.3) checksum. -

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

+

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

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

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

-

The following code:

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

- would assign the same value to Y as this would:

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

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

+

The following code:

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

assigns the same value to Y as this:

+ + Y = erlang:crc32([Data1,Data2]).
+ - 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.

-

The following code:

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

- would assign the same value to Z as this would:

+ Combines 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.

+

The following code:

+ + 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)).
+ - Current date + Current date.

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

-

The time zone and daylight saving time correction depend on +

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

+

Example:

 > date().
 {1995,2,19}
+ - Extracts a protocol packet from a binary + Extracts a protocol packet from a binary. -

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

-

If an entire packet is contained in Bin it is + 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}.

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 not known. decode_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.

-

If the packet does not conform to the protocol format +

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

-

The following values of Type are valid:

+

The following Types are valid:

raw | 0 -

No packet handling is done. Entire binary is +

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

1 | 2 | 4

Packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. - The length of header can be one, two, or four bytes; + The length of the header can be one, two, or four bytes; the order of the bytes is big-endian. The header - will be stripped off when the packet is returned.

+ is stripped off when the packet is returned.

line -

A packet is a line terminated with newline. The +

A packet is a line-terminated with newline. The newline character is included in the returned packet - unless the line was truncated according to the option + unless the line was truncated according to option line_length.

asn1 | cdr | sunrm | fcgi | tpkt @@ -864,41 +899,46 @@

The Hypertext Transfer Protocol. The packets are returned with the format according to - HttpPacket described above. 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 - (like "Sec-Websocket-Key").

-

The protocol type http should only be used for - the first line when a HttpRequest or a - HttpResponse is expected. The following calls - should use httph to get HttpHeader's until - http_eoh is returned that marks the end of the + 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".

+

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 variants http_bin and httph_bin will return +

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

The following options are available:

{packet_size, integer() >= 0} -

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

+

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} -

For packet type line, truncate lines longer - than the indicated length.

-

Option line_length also applies to http* - packet types as an alias for option packet_size in the - case when packet_size itself is not set. This usage is - only intended for backward compatibility.

+

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.

+

Examples:

 > erlang:decode_packet(1,<<3,"abcd">>,[]).
 {ok,<<"abc">>,<<"d">>}
@@ -909,13 +949,11 @@
 
     
       
-      Delete element at index in a tuple
+      Deletes element at index in a tuple.
       1..tuple_size(Tuple1)
       
-		  

- Returns a new tuple with element at Index removed from - tuple Tuple1. -

+

Returns a new tuple with element at Index + removed from tuple Tuple1, for example:

 > erlang:delete_element(2, {one, two, three}).
 {one,three}
@@ -924,78 +962,82 @@ - Make the current code for a module old + Makes 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 should not be - used elsewhere.

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

-

Failure: badarg if there is already an old version of +

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

+ - Stop monitoring + Stops monitoring. -

If MonitorRef is a reference which the calling process - obtained by calling +

If MonitorRef is a reference that the + calling process obtained by calling 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 - due to the monitor will be placed in the caller's message queue - in the future. A {'DOWN', MonitorRef, _, _, _} message - might have been placed in the caller's message queue prior to - the call, though. Therefore, in most cases, it is advisable +

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', + MonitorRef, _, _, _} message + can have been placed in the caller message queue before + the call, though. 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 + after monitoring has been stopped. + 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 asynchronous, i.e., the monitor was active - until the "demonitor signal" reached the monitored entity. This - had one undesirable effect, though. 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: - asynchronously send a "demonitor signal" to the monitored entity - and ignore any future results of the monitor.

+

Before OTP R11B (ERTS 5.5), demonitor/1 + behaved asynchronous, that is, the monitor was active + until the "demonitor signal" reached the monitored entity. + This had an undesirable effect, as you could never know when + you were guaranteed not to receive a DOWN + message 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.

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 remote - reference).

+ cheap to check. If checking is cheap, the call fails with + badarg for example, if MonitorRef is a + remote reference.

+ - Stop monitoring + Stops monitoring.

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

+ of OptionList.

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

-

Currently the following Options are valid:

+

The available Options are as follows:

flush -

Remove (one) {_, MonitorRef, _, _, _} message, - if there is one, from the caller's message queue after +

Removes (one) {_, + MonitorRef, _, _, _} message, + if there is one, from the caller message queue after monitoring has been stopped.

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

- demonitor(MonitorRef), receive {_, MonitorRef, _, _, _} -> @@ -1006,78 +1048,90 @@
info -

The returned value is one of the following:

- - true -

The monitor was found and removed. In this case - no 'DOWN' message due to this monitor have - been nor will be placed in the message queue - of the caller. -

-
- false -

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's message queue. -

-
-
-

If the info option is combined with the flush - option, false will be returned if a flush was needed; - otherwise, true. -

+

The returned value is one of the following:

+ + true + The monitor was found and removed. In this case, + no 'DOWN' message corresponding to this + monitor has been delivered and will not be delivered. + + false + 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. + + +

If option info is combined with option flush, + false is returned if a flush was needed, + otherwise true.

-

More options may be added in the future.

+

More options can be added in a future release.

-

Failure: badarg if OptionList is not a list, or - if Option is not a valid option, or the same failure as for - demonitor/1

+

Failures:

+ + badarg + If OptionList is not a list. + + badarg + If Option is an invalid option. + + badarg + The same failure as for + demonitor/1. + +
+ - Force the disconnection of a node + Forces the disconnection of a node. -

Forces the disconnection of a node. This will appear to - the node Node as if the local node has crashed. This - BIF is mainly used in the Erlang network authentication - protocols. Returns true if disconnection succeeds, +

Forces the disconnection of a node. This appears to + the node Node as if the local node has crashed. + This BIF is mainly used in the Erlang network authentication + protocols.

+

Returns true if disconnection succeeds, otherwise false. If the local node is not alive, - the function returns ignored.

+ ignored is returned.

+ - Print a term on standard output + Prints a term on standard output. -

Prints a text representation of Term on the standard - output. On OSE the term is printed to the ramlog.

+

Prints a text representation of Term on the + standard output. On OSE, the term is printed to the ramlog.

This BIF is intended for debugging only.

+ 1..tuple_size(Tuple) - Get Nth element of a tuple + Returns the Nth element of a tuple.

Returns the Nth element (numbering from 1) of - Tuple.

+ Tuple, for example:

 > element(2, {a, b, c}).
 b

Allowed in guard tests.

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

Returns the process dictionary and deletes it.

+

Returns the process dictionary and deletes it, for + example:

 > put(key1, {1, 2, 3}),
 put(key2, [a, b, c]),
@@ -1085,13 +1139,16 @@ b
[{key1,{1,2,3}},{key2,[a,b,c]}]
+ - Return and delete a value from the process dictionary + Returns and deletes 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.

+

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

+

Example:

 > put(key1, {merry, lambs, are, playing}),
 X = erase(key1),
@@ -1099,16 +1156,19 @@ b
{{merry,lambs,are,playing},undefined}
+ - Stop execution with a given reason + Stops execution with a given reason.

Stops the execution of the calling process with the reason - Reason, where Reason is any term. The actual - exit reason will be {Reason, Where}, where Where + 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:

 > catch error(foobar).
 {'EXIT',{foobar,[{erl_eval,do_apply,5},
@@ -1118,29 +1178,34 @@ b
{shell,eval_loop,3}]}}
+ - Stop execution with a given reason + Stops execution with a given reason.

Stops the execution of the calling process with the reason - Reason, where Reason is any term. The actual - exit reason will be {Reason, Where}, where Where + 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). Args is expected to be the list of - arguments for the current function; in Beam it will be used - to provide the actual arguments for the current function in - the Where term. Since evaluating this function causes + 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 process to terminate, it has no return value.

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

Stops the execution of the calling process with the exit - reason Reason, where Reason is any term. Since +

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

+

Example:

 > exit(foobar).
 ** exception exit: foobar
@@ -1148,110 +1213,117 @@ b
{'EXIT',foobar}
+ - Send an exit signal to a process or a port + Sends 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 apply if Reason is any term - except normal or kill:

-

If Pid is not trapping exits, Pid itself will - exit 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 pid of the process - which sent the exit signal. See also - process_flag/2.

-

If Reason is the atom normal, Pid will - 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 will unconditionally exit with - exit reason killed.

+

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, + 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. +

+ - Calculate the maximum size for a term encoded in the Erlang - external term format + Calculates 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 condition applies always:

-

 > Size1 = byte_size(term_to_binary(Term)),
 > Size2 = erlang:external_size(Term),
 > true = Size1 =< Size2.
-true
-          
-

-

This is equivalent to a call to: erlang:external_size(Term, []) -

+true +

This is equivalent to a call to:

+erlang:external_size(Term, [])
+ - Calculate the maximum size for a term encoded in the Erlang - external term format + Calculates 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 condition applies always:

-

 > Size1 = byte_size(term_to_binary(Term, Options)),
 > Size2 = erlang:external_size(Term, Options),
 > true = Size1 =< Size2.
-true
-          
-

-

The option {minor_version, Version} specifies how floats - are encoded. See - term_to_binary/2 for - a more detailed description. -

+true +

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

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

Returns a float by converting Number to a float.

+

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

 > float(55).
 55.0

Allowed in guard tests.

-

Note that if used on the top-level in a guard, it will - test whether the argument is a floating point number; for - clarity, use +

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.

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

+ described earlier.

+ - Text representation of a float + Text representation of a float. -

The same as float_to_binary(Float,[{scientific,20}]).

+

The same as + float_to_binary(Float,[{scientific,20}]).

+ - Text representation of a float formatted using given options + Text representation of a float formatted using given options. -

Returns a binary which corresponds to the text +

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

+ point formatting. Options behaves in the same + way as float_to_list/2.

+

Examples:

 > float_to_binary(7.12, [{decimals, 4}]).
 <<"7.1200">>
@@ -1259,31 +1331,42 @@ true
 <<"7.12">>
+ - Text representation of a float + Text representation of a float. -

The same as float_to_list(Float,[{scientific,20}]).

+

The same as + float_to_list(Float,[{scientific,20}]).

+ - Text representation of a float formatted using given options - -

Returns a string which corresponds to the text - representation of Float using fixed decimal point formatting. - When decimals option is specified - the returned value will contain at most Decimals number of - digits past the decimal point. If the number doesn't fit in the - internal static buffer of 256 bytes, the function throws badarg. - When compact option is provided - the trailing zeros at the end of the list are truncated (this option is - only meaningful together with the decimals option). When - scientific option is provided, the float will be formatted using - scientific notation with Decimals digits of precision. If - Options is [] the function behaves like - float_to_list/1. -

+ Text representation of a float formatted using given options. + +

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

+ + 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. + + If option compact is provided, the trailing zeros + at the end of the list are truncated. This option is only + meaningful together with option decimals. + + If option scientific is provided, the float is + formatted using scientific notation with Decimals + digits of precision. + + If Options is [], the function behaves as + float_to_list/1. + + +

Examples:

 > float_to_list(7.12, [{decimals, 4}]).
 "7.1200"
@@ -1291,36 +1374,40 @@ true
 "7.12"
+ - Information about a fun + Information about a fun. -

Returns a list containing information about the fun - Fun. Each element of the list is a tuple. The order of - the tuples is not defined, and more tuples may be added in a +

Returns a list with information about the fun + Fun. Each list element is a tuple. The order + of the tuples is undefined, and more tuples can be added in a future release.

This BIF is mainly intended for debugging, but it can - occasionally be useful in library functions that might need - to verify, for instance, the arity of a fun.

+ sometimes be useful in library functions that need + to verify, for example, the arity of a fun.

-

There are two types of funs with slightly different - semantics:

-

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. Note that module M does not even need - to be loaded when the fun fun M:F/A is created.

-

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

-

The following elements will always be present in the list +

Two types of funs have slightly different semantics:

+ + 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. + + 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). + + +

The following elements are always present in the list for both local and external funs:

{type, Type} -

Type is either local or external.

+

Type is local or external.

{module, Module} @@ -1335,148 +1422,154 @@ true

Name (an atom) is a function name.

If Fun is a local fun, Name is the name of the local function that implements the fun. - (This name was generated by the compiler, and is generally + (This name was generated by the compiler, and is only of informational use. As it is a local function, it - is not possible to call it directly.) + cannot be called directly.) If no code is currently loaded for the fun, [] - will be returned instead of an atom.

+ is returned instead of an atom.

If Fun is an external fun, Name is the name of the exported function that the fun refers to.

{arity, Arity}

Arity is the number of arguments that the fun - should be called with.

+ is to be called with.

{env, Env}

Env (a list) is the environment or free variables - for the fun. (For external funs, the returned list is - always empty.)

+ for the fun. For external funs, the returned list is + always empty.

-

The following elements will only be present in the list if +

The following elements are only present in the list if Fun is local:

{pid, Pid} -

Pid is the pid of the process that originally - created the fun.

+

Pid is the process identifier of the process + that originally created the fun.

{index, Index} -

Index (an integer) is an index into the module's +

Index (an integer) is an index into the module fun table.

{new_index, Index} -

Index (an integer) is an index into the module's +

Index (an integer) is an index into the module fun table.

{new_uniq, Uniq} -

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

+

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

{uniq, Uniq}

Uniq (an integer) is a unique value for this fun. - Starting in the R15 release, this integer is calculated from - the compiled code for the entire module. Before R15, this - integer was based on only the body of the 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.

+ + Information about a fun. - Information about a fun

Returns information about Fun as specified by - Item, in the form {Item,Info}.

+ Item, in the form + {Item,Info}.

For any fun, Item can be any of the atoms - module, name, arity, env, or type.

-

For a local fun, Item can also be any of the atoms - index, new_index, new_uniq, + module, name, arity, env, or + type.

+

For a local fun, Item can also be any of the + atoms index, new_index, new_uniq, uniq, and pid. For an external fun, the value of any of these items is always the atom undefined.

See erlang:fun_info/1.

+ - Text representation of a fun + Text representation of a fun. -

Returns a string which corresponds to the text +

Returns a string corresponding to the text representation of Fun.

+ - Check if a function is exported and loaded + Checks 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.

+ with the given name, otherwise returns false.

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

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

Forces an immediate garbage collection of the currently - executing process. The function should not be used, unless - it has been noticed -- or there are good reasons to suspect -- +

Forces an immediate garbage collection of the + executing process. The function is not to be used unless + it has been noticed (or there are good reasons to suspect) that the spontaneous garbage collection will occur too late - or not at all. Improper use may seriously degrade system - performance.

+ or not at all.

+ +

Improper use can seriously degrade system performance.

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

The same as garbage_collect(Pid, []).

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

Garbage collect the node local process identified by - Pid.

-

Currently available Options:

+

Garbage collects the node local process identified by + Pid.

+

The available Options are as follows:

{async, RequestId} - - The garbage_collect/2 function will return + 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 will be passed a - message on the form:
- {garbage_collect, RequestId, GCResult}. -
+ 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 will be performed at once, i.e. the same as - calling + collection is performed at once, that is, the same as calling garbage_collect/0. - In all other cases a request for garbage collection will - be sent to the process identified by Pid, + 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 will block until - GCResult is available and can be - returned.

+ 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:

+ the garbage collection request as follows:

true @@ -1485,14 +1578,13 @@ true false - No garbage collection was performed. This since the + No garbage collection was performed, as the process identified by Pid terminated before the request could be satisfied. -

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

+

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

Failures:

badarg @@ -1501,17 +1593,18 @@ true badarg - If OptionList is not a valid list of options. + If OptionList is an invalid list of options.
+ - Return the process dictionary + Returns the process dictionary.

Returns the process dictionary as a list of - {Key, Val} tuples.

+ {Key, Val} tuples, for example:

 > put(key1, merry),
 put(key2, lambs),
@@ -1520,13 +1613,15 @@ true
 [{key1,merry},{key2,lambs},{key3,{are,playing}}]
+ - Return a value from the process dictionary + Returns 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:

 > put(key1, merry),
 put(key2, lambs),
@@ -1535,14 +1630,16 @@ true
 {are,playing}
+ - Get the magic cookie of the local node + Gets the magic cookie of the local node. -

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

+

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

+ Return a list of all keys from the process dictionary @@ -1558,10 +1655,10 @@ true - Return a list of keys from the process dictionary + Returns a list of keys from the process dictionary. -

Returns a list of keys which are associated with the value - Val in the process dictionary.

+

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

 > put(mary, {1, 2}),
 put(had, {1, 2}),
@@ -1573,40 +1670,40 @@ true
 [mary,had,a,little,lamb]
+ - Get the call stack back-trace of the last exception + Gets the call stack back-trace of the last exception. -

Get the call stack back-trace (stacktrace) of the last - exception in the calling process as a list of +

Gets the call stack back-trace (stacktrace) of the + last exception in the calling process as a list of {Module,Function,Arity,Location} tuples. - The Arity field in the first tuple may be the argument - list of that function call instead of an arity integer, + 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 may also be reset to [].

+ the stacktrace can also be reset to [].

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

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

-

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

+

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 + The second element of the tuple is a string (list of characters) representing the filename of the source file - of the function.

+ of the function.
line - -

The second element of the tuple is the line number + 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.

+ where the exception occurred or the function was called.

See also @@ -1614,49 +1711,56 @@ true erlang:error/2.

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

Returns the pid of the group leader for the process which - evaluates the function.

+

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

Every process is a member of some process group and all - groups have a group leader. All IO from the group + 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.

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

Sets the group leader of Pid to GroupLeader. - Typically, this is used when a processes started from a - certain shell should have another group leader than +

Sets the group leader of Pid + to GroupLeader. + Typically, this is used when a process started from a + certain shell is to have another group leader than init.

See also group_leader/0.

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

The same as halt(0, []).

+

Example:

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

The same as halt(Status, []).

+

Example:

 > halt(17).
 os_prompt% echo $?
@@ -1664,178 +1768,188 @@ os_prompt% echo $?
 os_prompt% 
+ - Halt the Erlang runtime system + Halts 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: -

+ Depending on Status, the following occurs:

integer() - The runtime system exits with the integer value Status - as status code to the calling environment (operating system). + 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, - and then the runtime system exits with status code 1. + An Erlang crash dump is produced with Status + as slogan. Then the runtime system exits with status code 1. abort The runtime system aborts producing a core dump, if that is - enabled in the operating system. + enabled in the OS. -

Note that on many platforms, only the status codes 0-255 are - supported by the operating system. -

-

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 the flush - option is ignored and flushing is not done. -

+

On many platforms, the OS supports only status + codes 0-255.

+

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 + flush is ignored and flushing is not done.

+ - Hash function (deprecated) + Hash function (deprecated).

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

+ 1..Range. The range is 1..2^27-1.

-

This BIF is deprecated as the hash value may differ on - different architectures. Also the hash values for integer - terms larger than 2^27 as well as large binaries are very +

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 poor. The BIF is retained for backward compatibility - reasons (it may have been used to hash records into a file), - but all new code should use one of the BIFs + 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.

+ - Head of a list + Head of a list. -

Returns the head of List, that is, the first element.

+

Returns the head of List, that is, + the first element, for example:

 > hd([1,2,3,4,5]).
 1

Allowed in guard tests.

-

Failure: badarg if List is the empty list [].

+

Failure: badarg if List is the empty + list [].

+ - Hibernate a process until a message is sent to it + Hibernates 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, which is + allocation has been reduced as much as possible. This is useful if the process does not expect to receive any messages - in the near future.

-

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

+ 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 + 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 will be awaken immediately in the same way as - described above.

+ 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. - Then it garbage collects the process. After the garbage - collection, all live data is in one continuous heap. The heap + is the following. It 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 - which it holds (even if that size is less than the minimum + that it holds (even if that size is less than the minimum heap size for the process).

If the size of the live data in the process is less than the minimum heap size, the first garbage collection occurring - after the process has been awaken will ensure that the heap + after the process is awakened ensures that the heap size is changed to a size not smaller than the minimum heap size.

-

Note that emptying the call stack means that any surrounding - catch is removed and has to be re-inserted after +

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

- Insert an element at index in a tuple + Inserts an element at index in a tuple. 1..tuple_size(Tuple1) + 1 -

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

+

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:

 > erlang:insert_element(2, {one, two, three}, new).
 {one,new,two,three}
+ - Text representation of an integer + Text representation of an integer. -

Returns a binary which corresponds to the text - representation of Integer.

+

Returns a binary corresponding to the text + representation of Integer, for example:

 > integer_to_binary(77).
 <<"77">>
+ - Text representation of an integer + Text representation of an integer. -

Returns a binary which corresponds to the text - representation of Integer in base Base.

+

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

 > integer_to_binary(1023, 16).
 <<"3FF">>
+ - Text representation of an integer + Text representation of an integer. -

Returns a string which corresponds to the text - representation of Integer.

+

Returns a string corresponding to the text + representation of Integer, for example:

 > integer_to_list(77).
 "77"
+ - Text representation of an integer + Text representation of an integer. -

Returns a string which corresponds to the text - representation of Integer in base Base.

+

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

 > integer_to_list(1023, 16).
 "3FF"
+ - Convert an iolist to a binary + Converts an iolist to a binary. -

Returns a binary which is made from the integers and - binaries in IoListOrBinary.

+

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

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
@@ -1847,278 +1961,311 @@ os_prompt% 
<<1,2,3,1,2,3,4,5,4,6>>
+ - Size of an iolist + Size of an iolist. -

Returns an integer which is the size in bytes - of the binary that would be the result of - iolist_to_binary(Item).

+

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

 > iolist_size([1,2|<<3,4>>]).
 4
+ - Check whether the local node is alive + Checks 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, it - returns false.

+

Returns true if the local node is alive (that is, if + the node can be part of a distributed system), otherwise + false.

+ - Check whether a term is an atom + Checks whether a term is an atom. -

Returns true if Term is an atom; - otherwise returns false.

+

Returns true if Term is an atom, + otherwise false.

Allowed in guard tests.

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

Returns true if Term is a binary; - otherwise returns false.

- +

Returns true if Term is a binary, + otherwise false.

A binary always contains a complete number of bytes.

-

Allowed in guard tests.

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

Returns true if Term is a bitstring (including a binary); - otherwise returns false.

- +

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

Allowed in guard tests.

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

Returns true if Term is - either the atom true or the atom false - (i.e. a boolean); otherwise returns false.

+

Returns true if Term is the + atom true or the atom false (that is, a boolean). + Otherwise returns false.

Allowed in guard tests.

+ - Check if a function is a BIF implemented in C + Checks if a function is a BIF implemented in C. -

Returns true if Module:Function/Arity is - a BIF implemented in C; otherwise returns false. - This BIF is useful for builders of cross reference tools.

+

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

+

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

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

Returns true if Term is a floating point - number; otherwise returns false.

+ number, otherwise false.

Allowed in guard tests.

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

Returns true if Term is a fun; otherwise - returns false.

+

Returns true if Term is a fun, otherwise + false.

Allowed in guard tests.

+ - Check whether a term is a fun with a given arity + Checks whether a term is a fun with a given arity.

Returns true if Term is a fun that can be - applied with Arity number of arguments; otherwise - returns false.

+ applied with Arity number of arguments, otherwise + false.

Allowed in guard tests.

+ - Check whether a term is an integer + Checks whether a term is an integer. -

Returns true if Term is an integer; - otherwise returns false.

+

Returns true if Term is an integer, + otherwise false.

Allowed in guard tests.

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

Returns true if Term is a list with - zero or more elements; otherwise returns false.

+ zero or more elements, otherwise false.

Allowed in guard tests.

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

Returns true if Term is a map; - otherwise returns false.

+

Returns true if Term is a map, + otherwise false.

Allowed in guard tests.

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

Returns true if Term is either an integer or a - floating point number; otherwise returns false.

+

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

Allowed in guard tests.

+ - Check whether a term is a pid + Checks whether a term is a process identifier. -

Returns true if Term is a pid (process - identifier); otherwise returns false.

+

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

Allowed in guard tests.

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

Returns true if Term is a port identifier; - otherwise returns false.

+

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

Allowed in guard tests.

+ - Check whether a process is alive + Checks whether a process is alive. -

- 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 +

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.

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

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

+

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 is a - tuple, that its first element is RecordTag, and that - the size is correct. However, if the RecordTag is - not a literal atom, the is_record/2 BIF will be - called instead and the size of the tuple will not be - verified.

+ specially. 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 + not a literal atom, the BIF is_record/2 is called + instead and the size of the tuple is not verified.

-

Allowed in guard tests, if RecordTag is a literal - atom.

+

Allowed in guard tests, if RecordTag is + a literal atom.

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

RecordTag must be an atom. Returns true if - Term is a tuple, its first element is RecordTag, - and its size is Size. Otherwise, returns false.

-

Allowed in guard tests, provided that RecordTag is + Checks whether a term appears to be a record. + +

RecordTag must be an atom.

+

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

+

Allowed in guard tests if RecordTag is a literal atom and Size is a literal integer.

-

This BIF is documented for completeness. In most cases - is_record/2 should be used.

+

This BIF is documented for completeness. Usually + is_record/2 is to be used.

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

Returns true if Term is a reference; - otherwise returns false.

+

Returns true if Term is a reference, + otherwise false.

Allowed in guard tests.

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

Returns true if Term is a tuple; - otherwise returns false.

+

Returns true if Term is a tuple, + otherwise false.

Allowed in guard tests.

+ - Length of a list + Length of a list. -

Returns the length of List.

+

Returns the length of List, for example:

 > length([1,2,3,4,5,6,7,8,9]).
 9

Allowed in guard tests.

+ - Create a link to another process (or port) + Creates a link to another process (or port).

Creates a link between the calling process and another - process (or port) PidOrPort, if there is not such a link + process (or port) PidOrPort, if there is + not such a link already. If a process attempts to create a link to itself, nothing is done. Returns true.

-

If PidOrPort does not exist, the behavior of the BIF depends - on if the calling process is trapping exits or not (see +

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):

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. + 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 + and/or PidOrPort is remote, link/1 + returns true, but an exit signal with reason noproc is sent to the calling process.
+ - Convert from text representation to an atom - -

Returns the atom whose text representation is String.

-

String may only contain ISO-latin-1 - characters (i.e. numbers below 256) as the current - implementation does not allow unicode characters >= 256 in - atoms. For more information on Unicode support in atoms - see note on UTF-8 encoded atoms - in the chapter about the external term format in the ERTS User's Guide.

+ Converts 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 + encoded atoms + in Section "External Term Format" in the User's Guide.

+

Example:

 > list_to_atom("Erlang").
 'Erlang'
+ - Convert a list to a binary + Converts a list to a binary. -

Returns a binary which is made from the integers and - binaries in IoList.

+

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

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
@@ -2130,14 +2277,16 @@ os_prompt% 
<<1,2,3,1,2,3,4,5,4,6>>
+ + Converts a list to a bitstring. - Convert a list to a bitstring -

Returns a bitstring which is made from the integers and - bitstrings in BitstringList. (The last tail in BitstringList - is allowed to be 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:

 > Bin1 = <<1,2,3>>.
 <<1,2,3>>
@@ -2149,21 +2298,25 @@ os_prompt% 
<<1,2,3,1,2,3,4,5,4,6,7:46>>
+ - Convert from text representation to an atom + Converts from text representation to an atom. -

Returns the atom whose text representation is String, +

Returns the atom whose text representation is + String, but only if there already exists such atom.

Failure: badarg if there does not already exist an atom whose text representation is String.

+ - Convert from text representation to a float + Converts from text representation to a float. -

Returns the float whose text representation is String.

+

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

 > list_to_float("2.2017764e+0").
 2.2017764
@@ -2171,12 +2324,13 @@ os_prompt% representation of a float.

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

Returns an integer whose text representation is - String.

+ String, for example:

 > list_to_integer("123").
 123
@@ -2184,12 +2338,14 @@ os_prompt% representation of an integer.

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

Returns an integer whose text representation in base - Base is String.

+ Base is String, + for example:

 > list_to_integer("3FF", 16).
 1023
@@ -2197,47 +2353,52 @@ os_prompt% representation of an integer.

+ - Convert from text representation to a pid + Converts from text representation to a pid. -

Returns a pid whose text representation is String.

- -

This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.

-
+

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

 > list_to_pid("<0.4.1>").
 <0.4.1>

Failure: badarg if String contains a bad - representation of a pid.

+ representation of a process identifier.

+ +

This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.

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

Returns a tuple which corresponds to List. List - can contain any Erlang terms.

+

Returns a tuple corresponding to List, + for example

 > list_to_tuple([share, ['Ericsson_B', 163]]).
 {share, ['Ericsson_B', 163]}
+

List can contain any Erlang terms.

+ - Load object code for a module + Loads object code for a module. -

If Binary contains the object code for the module - Module, this BIF loads that object code. Also, if - the code for the module Module already exists, all +

If Binary contains the object code for module + Module, this BIF loads that object code. If + the code for module Module already exists, all export references are replaced so they point to the newly loaded code. The previously loaded code is kept in the system - as old code, as there may still be processes which are - executing that code. It returns either - {module, Module}, or {error, Reason} if loading - fails. Reason is one of the following:

+ as old code, as there can still be processes executing + that code.

+

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

badfile @@ -2247,118 +2408,122 @@ os_prompt% not_purged -

Binary contains a module which 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)) and should not be - used elsewhere.

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

+ - Load NIF library + Loads NIF library. -

In releases older than OTP R14B, NIFs were an - experimental feature. Versions of OTP older than R14B might +

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 R13B03 the return value on - failure was - {error,Reason,Text}.

+ interfaces. For example, in 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 sharable object/dynamic library file minus - the OS-dependent file extension (.so for Unix and .dll for - Windows). See erl_nif - on how to implement a NIF library.

-

LoadInfo can be any term. It will be passed on to + implemented functions (NIFs) for a module. Path + is a file path to the sharable 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 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 atoms below, - while Text is a human readable string that may give - some more information about the failure.

+ 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.

+ The OS failed to load the NIF library. bad_lib - -

The library did not fulfil the requirements as a NIF - library of the calling module.

+ The library did not fulfill the requirements as a NIF + library of the calling module. load | reload | upgrade - -

The corresponding library callback was not successful.

+ The corresponding library callback was unsuccessful. old_code - -

The call to load_nif/2 was made from the old - code of a module that has been upgraded. This is not - allowed.

+ The call to load_nif/2 was made from the old + code of a module that has been upgraded; this is not + allowed.
+ - List of all loaded modules + Lists all loaded modules. -

Returns a list of all loaded Erlang modules (current and/or +

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

See also code(3).

+ - Current local date and time + Current local date and time. -

Returns the current local date and time - {{Year, Month, Day}, {Hour, Minute, Second}}.

-

The time zone and daylight saving time correction depend - on the underlying OS.

+

Returns the current local date and time, + {{Year, Month, Day}, {Hour, Minute, Second}}, + for example:

 > erlang:localtime().
 {{1996,11,6},{14,45,17}}
+

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

+ - Convert from local to Universal Time Coordinated (UTC) date and time + Converts from local to Universal Time Coordinated (UTC) date and time.

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

+ (UTC), if supported by the underlying OS. Otherwise + no conversion is done and Localtime + is returned.

+

Example:

 > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}).
 {{1996,11,6},{13,45,17}}
-

Failure: badarg if Localtime does not denote - a valid date and time.

+

Failure: badarg if Localtime denotes an + invalid date and time.

+ - Convert from local to Universal Time Coordinated (UTC) date and time + Converts from local to Universal Time Coordinated (UTC) date and time.

Converts local date and time to Universal Time Coordinated - (UTC) just like erlang:localtime_to_universaltime/1, - but the caller decides if daylight saving time is active or - not.

-

If IsDst == true the Localtime is during - daylight saving time, if IsDst == false it is not, - and if IsDst == undefined the underlying OS may + (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 erlang:localtime_to_universaltime(Localtime).

+

Examples:

 > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, true).
 {{1996,11,6},{12,45,17}}
@@ -2366,13 +2531,14 @@ os_prompt% 
{{1996,11,6},{13,45,17}} > erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, undefined). {{1996,11,6},{13,45,17}} -

Failure: badarg if Localtime does not denote - a valid date and time.

+

Failure: badarg if Localtime denotes an + invalid date and time.

+ - Return a unique reference + Returns a unique reference.

Return a unique reference. The reference is unique among @@ -2383,200 +2549,209 @@ os_prompt% created on an older node with the same node name.

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

Returns a new tuple of the given Arity, where all - elements are InitialValue.

+

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

 > erlang:make_tuple(4, []).
 {[],[],[],[]}
+ - Create a new tuple with given arity and contents - -

erlang:make_tuple first creates a tuple of size Arity - where each element has the value DefaultValue. It then fills - in 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 - last occurrence will be used.

+ Creates a new tuple with given arity and contents. + +

Creates a tuple of size Arity, where each element + has value DefaultValue, and then fills in + 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:

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

Returns an integer which is the number of key-value pairs in Map.

+

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

 > map_size(#{a=>1, b=>2, c=>3}).
 3

Allowed in guard tests.

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

Return the largest of Term1 and Term2; - if the terms compare equal, Term1 will be returned.

+

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

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

Computes an MD5 message digest from Data, where - the length of the digest is 128 bits (16 bytes). Data +

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.

-

See The MD5 Message Digest Algorithm (RFC 1321) for more - information about MD5.

-

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.

+ - 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.

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

+ - Create an MD5 context + Creates an MD5 context.

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

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

Updates an MD5 Context with Data, and returns - a NewContext.

+

Updates an MD5 Context with + Data and returns a + NewContext.

+ + Information about dynamically allocated memory. - Information about dynamically allocated memory - -

Returns a list containing information about memory - dynamically allocated by the Erlang emulator. Each element of - the list is a tuple {Type, Size}. The first element - Typeis an atom describing memory type. The second - element Sizeis memory size in bytes. A description of - each memory type follows:

+ +

Returns a list with information about memory + dynamically allocated by the Erlang emulator. Each list + 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:

total -

The total amount of memory currently allocated, which is - the same as the sum of memory size for processes +

The total amount of memory currently allocated. This is + the same as the sum of the memory size for processes and system.

processes -

The total amount of memory currently allocated by +

The total amount of memory currently allocated for the Erlang processes.

processes_used

The total amount of memory currently used by the Erlang - processes.

-

This memory is part of the memory presented as + processes. This is part of the memory presented as processes memory.

system -

The total amount of memory currently allocated by +

The total amount of memory currently allocated for the emulator that is not directly related to any Erlang - process.

-

Memory presented as processes is not included in - this memory.

+ process. Memory presented as processes is not + included in this memory.

atom -

The total amount of memory currently allocated for atoms.

-

This memory is part of the memory presented as +

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

atom_used -

The total amount of memory currently used for atoms.

-

This memory is part of the memory presented as +

The total amount of memory currently used for atoms. + This memory is part of the memory presented as atom memory.

binary

The total amount of memory currently allocated for - binaries.

-

This memory is part of the memory presented as - system memory.

+ binaries. This memory is part of the memory presented + as system memory.

code

The total amount of memory currently allocated for - Erlang code.

-

This memory is part of the memory presented as - system memory.

+ Erlang code. This memory is part of the memory presented + as system memory.

ets

The total amount of memory currently allocated for ets - tables.

-

This memory is part of the memory presented as + tables. This memory is part of the memory presented as system memory.

low -

Only on 64-bit halfword emulator.

-

The total amount of memory allocated in low memory areas - that are restricted to less than 4 Gb even though - the system may have more physical memory.

-

May be removed in future releases of halfword emulator.

+

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 + emulator.

maximum

The maximum total amount of memory allocated since - the emulator was started.

-

This tuple is only present when the emulator is run with - instrumentation.

+ the emulator was started. This tuple is only present + when the emulator is run with instrumentation.

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

The system value is not complete. Some allocated - memory that should be part of the system value are - not.

+ memory that is to be part of this value is not.

When the emulator is run with instrumentation, the system value is more accurate, but memory - directly allocated by malloc (and friends) are still + directly allocated for malloc (and friends) is still not part of the system value. Direct calls to - malloc are only done from OS specific runtime - libraries and perhaps from user implemented Erlang drivers + malloc are only done from OS-specific runtime + libraries and perhaps from user-implemented Erlang drivers that do not use the memory allocation functions in the driver interface.

-

Since the total value is the sum of processes - and system the error in system will propagate +

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 also introduce + not gathered atomically, which introduces an error in the result.

-

The different values has the following relation to each +

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

@@ -2584,69 +2759,62 @@ os_prompt% 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 may be added in the future.

+

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

The total value is supposed to be the total amount of memory dynamically allocated by the emulator. Shared libraries, the code of the emulator itself, and - the emulator stack(s) are not supposed to be included. That + 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, due to fragmentation and pre-reservation of - memory areas, the size of the memory segments which contain - the dynamically allocated memory blocks can be substantially + equal to the total size of all pages mapped to the emulator.

+

Furthermore, 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.

-

- Since erts version 5.6.4 erlang:memory/0 requires that +

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

+ allocators are enabled (default behavior).

-

Failure:

- - notsup - - If an erts_alloc(3) - allocator has been disabled. - - +

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

+ + Information about dynamically allocated memory. - 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 of memory_type() atoms, in which case a corresponding list of {memory_type(), Size :: integer >= 0} tuples is returned.

-

- Since erts version 5.6.4 erlang:memory/1 requires that +

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

+ allocators are enabled (default behavior).

Failures:

badarg - If Type is not one of the memory types listed in the - documentation of + If Type is not one of the memory types + listed in the decription of erlang:memory/0. badarg - If maximum is passed as Type and the emulator - is not run in instrumented mode. + If maximum is passed as Type and + the emulator is not run in instrumented mode. notsup @@ -2658,35 +2826,39 @@ os_prompt% erlang:memory/0.

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

Return the smallest of Term1 and Term2; - if the terms compare equal, Term1 will be returned.

+

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

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

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

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 should not be + code(3)) and is not to be used elsewhere.

+ - Start monitoring + Starts monitoring.

Send a monitor request of type Type to the entity identified by Item. The caller of @@ -2695,14 +2867,14 @@ os_prompt% {Tag, MonitorRef, Type, Object, Info}

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

-

Currently valid Types:

+

Valid Types:

process

Monitor the existence of the process identified by - Item. Currently valid + Item. Valid Items in combination with the - process Type:

+ process Type can be any of the following:

pid() @@ -2721,10 +2893,10 @@ os_prompt% will become monitored.

-

When a process is monitored by registered name, the - process that has the registered name at the time when the +

When a registered name is used, the + process that has the registered name when the monitor request reach its destination will be monitored. - The monitor will not be effected, if the registered name is + The monitor is not effected if the registered name is unregistered, or unregistered and later registered on another process.

The monitor is triggered either when the monitored process @@ -2732,22 +2904,22 @@ os_prompt% lost. In the case the connection to it is lost, we do not know if it still exist or not. After this type of monitor has been triggered, the monitor is automatically removed.

-

When the monitor is triggered a 'DOWN' message will - be sent to the monitoring process. A 'DOWN' message has +

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

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

where MonitorRef and Type are the same as - described above, and:

+

Here MonitorRef and Type are the same as + described earlier, and:

Object

equals:

Item - If Item was specified by a - pid. + If Item is specified by a + process identifier. {RegisteredName, Node} - If Item was specified as + If Item is specified as RegisteredName, or {RegisteredName, Node} where Node corresponds to the node that the monitored process resides on. @@ -2760,26 +2932,26 @@ os_prompt% connection to the node where the monitored process resides).

-

The monitoring is turned off either when the 'DOWN' - message is sent, or when +

The monitoring is turned off when the 'DOWN' + message is sent or when demonitor/1 is called.

If an attempt is made to monitor a process on an older node - (where remote process monitoring is not implemented or one + (where remote process monitoring is not implemented or where remote process monitoring by registered name is not implemented), the call fails with badarg.

-

The format of the 'DOWN' message changed in the 5.2 - version of the emulator (OTP release R9B) for monitor - by registered name. The Object element of +

The format of the 'DOWN' message changed in ERTS + version 5.2 (OTP R9B) for monitoring + by registered name. Element Object of the 'DOWN' message could in earlier versions - sometimes be the pid of the monitored process and sometimes - be the registered name. Now the Object element is + 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 (emulator version 5.2 - or greater) will always get 'DOWN' messages on + the node name. Processes on new nodes (ERTS version 5.2 + or higher) always get 'DOWN' messages on the new format even if they are monitoring processes on old - nodes. Processes on old nodes will always get 'DOWN' + nodes. Processes on old nodes always get 'DOWN' messages on the old format.

@@ -2836,7 +3008,7 @@ os_prompt%

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 may observe the change of the time offset + Note that you can observe the change of the time offset when calling erlang:time_offset() before you get the 'CHANGE' message.

@@ -2844,64 +3016,68 @@ os_prompt%

Making several calls to monitor/2 for the same Item and/or Type is not - an error; it results in many, completely independent, - monitorings.

+ an error; it results in as many independent monitorings.

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

+ are expected to be supported in a future release.

-

If/when monitor/2 is extended, other - possible values for Tag, Object, and +

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

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

Monitors the status of the node Node. If Flag - is true, monitoring is turned on; if Flag is - false, monitoring is turned off.

+

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

Making several calls to monitor_node(Node, true) for - the same Node is not an error; it results in as many, - completely independent, monitorings.

+ the same Node is not an error; it results + in as many independent monitorings.

If Node fails or does not exist, the message {nodedown, Node} is delivered to the process. If a process has made two calls to monitor_node(Node, true) - and Node terminates, two nodedown messages are - delivered to the process. If there is no connection to - Node, there will be an attempt to create one. If this - fails, a nodedown message is delivered.

+ and Node terminates, two nodedown messages + are delivered to the process. If there is no connection to + Node, an attempt is made to create one. + If this fails, a nodedown message is delivered.

Nodes connected through hidden connections can be monitored - as any other node.

+ as any other nodes.

Failure: badarg if the local node is not alive.

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

Behaves as monitor_node/2 except that it allows an +

Behaves as + monitor_node/2 + except that it allows an extra option to be given, namely allow_passive_connect. - The option allows the BIF to wait the normal net connection - timeout for the monitored node to connect itself, + 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 - (i.e. it is blocked). The state where this might be useful can - only be achieved by using the kernel option - dist_auto_connect once. If that kernel option is not - used, the allow_passive_connect option has no - effect.

+ (that is, it is blocked). The state where this can be useful + can only be achieved by using the Kernel option + dist_auto_connect once. If that option is not + used, option allow_passive_connect has no effect.

-

The allow_passive_connect option is used +

Option allow_passive_connect is used internally and is seldom needed in applications where the - network topology and the kernel options in effect is known in - advance.

+ network topology and the Kernel options in effect + are known in advance.

Failure: badarg if the local node is not alive or the option list is malformed.

+ Current Erlang monotonic time @@ -2949,61 +3125,68 @@ os_prompt% - Stop execution with a given reason + Stops execution with a given 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 - will not generate false warnings.

+ 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.

+ - Stop execution with a given reason + Stops execution with a given 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 - will not generate false warnings.

+ 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.

+ - Name of the local node + Name of the local node.

Returns the name of the local node. If the node is not alive, nonode@nohost is returned instead.

Allowed in guard tests.

+ - At which node is a pid, port or reference located + At which node a pid, port, or reference is located. -

Returns the node where Arg is located. Arg can - be a pid, a reference, or a port. If the local node is not +

Returns the node where Arg is located. + Arg can + be a process identifier, a reference, or a port. + If the local node is not alive, nonode@nohost is returned.

Allowed in guard tests.

+ - All visible nodes in the system + All visible nodes in the system. -

Returns a list of all visible nodes in the system, excluding +

Returns a list of all visible nodes in the system, except the local node. Same as nodes(visible).

+ - All nodes of a certain type in the system + All nodes of a certain type in the system. -

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

Returns a list of nodes according to the argument given. + 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:

@@ -3025,22 +3208,24 @@ os_prompt% known -

Nodes which are known to this node, i.e., connected, - previously connected, etc.

+

Nodes that are known to this node, for example, connected + and previously connected.

Some equalities: [node()] = nodes(this), nodes(connected) = nodes([visible, hidden]), and nodes() = nodes(visible).

If the local node is not alive, - nodes(this) == nodes(known) == [nonode@nohost], for - any other Arg the empty list [] is returned.

+ nodes(this) == nodes(known) == [nonode@nohost]. For + any other Arg the empty list + [] is returned.

+ + Elapsed time since 00:00 GMT. - Elapsed time since 00:00 GMT

This function is deprecated! Do not use it! See the users guide chapter @@ -3050,107 +3235,101 @@ os_prompt% section for information on 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) + the elapsed time since 00:00 GMT, January 1, 1970 (zero hour), on the assumption that the underlying OS supports this. - Otherwise, some other point in time is chosen. It is also - guaranteed that subsequent calls to this BIF returns + Otherwise some other point in time is chosen. It is also + guaranteed that subsequent calls to this BIF return continuously increasing values. Hence, the return value from - now() can be used to generate unique time-stamps, - and if it is called in a tight loop on a fast machine + now() 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.

-

It can only be used to check the local time of day if - the time-zone info of the underlying operating system is +

Can only be used to check the local time of day if + the time-zone information of the underlying OS is properly configured.

+ - Open a port + Opens 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. -

+ process.

The name of the executable as well as the arguments - given in cd, env, args and arg0 is subject to - Unicode file name translation if the system is running - in Unicode file name mode. To avoid - translation or force i.e. UTF-8, supply the executable + given 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 force, that is, UTF-8, supply the executable and/or arguments as a binary in the correct - encoding. See the file module, the - - file:native_name_encoding/0 function and the - stdlib users guide - for details.

- -

The characters in the name (if given as a list) - can only be > 255 if the Erlang VM is started in - Unicode file name translation mode, otherwise the name + 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 filename translation mode. Otherwise the name of the executable is limited to the ISO-latin-1 character set.

- -

PortName is one of the following:

+

PortName can be any of the following:

{spawn, Command} -

Starts an external program. Command is the name - of the external program which will be run. Command +

Starts an external program. Command + is the name of the external program to be run. + Command runs outside the Erlang work space unless an Erlang - driver with the name Command is found. If found, - that driver will be started. A driver runs in the Erlang + driver with the name Command is found. + If found, that driver is started. A driver runs in the Erlang workspace, which means that it is linked with the Erlang runtime system.

When starting external programs on Solaris, the system call vfork is used in preference to fork for performance reasons, although it has a history of - being less robust. If there are problems with using - vfork, setting the environment variable - ERL_NO_VFORK to any value will cause fork + being less robust. If there are problems using + vfork, setting environment variable + ERL_NO_VFORK to any value causes fork to be used instead.

- -

For external programs, the PATH is searched +

For external programs, PATH is searched (or an equivalent method is used to find programs, - depending on operating system). This is done by invoking - the shell on certain platforms. The first space - separated token of the command will be considered as the + 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 or directory names. Use - {spawn_executable, Command} instead if spaces in executable - file names is desired.

+ programs having 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 + 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. The FileName in its whole - is used as the name of the executable, including any - spaces. If arguments are to be passed, the - args and arg0 PortSettings can be used.

- -

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

+ 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 will - implicitly be invoked, but there will still be no - command argument expansion or implicit PATH search.

- -

If the FileName cannot be run, an error - exception, with the posix error code as the reason, is - raised. The error reason may differ between operating - systems. Typically the error enoent is raised - when one tries to run a program that is not found and + 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.

@@ -3160,19 +3339,18 @@ os_prompt% 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 operating system - (shell and user). Hence, its use is very - limited.

+ used for various servers in the Erlang OS (shell + and user). Hence, its use is limited.

PortSettings is a list of settings for the port. - Valid settings are:

+ The valid settings are as follows:

{packet, N}

Messages are preceded by their length, sent in N - bytes, with the most significant byte first. Valid values - for N are 1, 2, or 4.

+ bytes, with the most significant byte first. The valid values + for N are 1, 2, and 4.

stream @@ -3183,116 +3361,108 @@ os_prompt% {line, L}

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

+ (delimited by the OS-dependent new line 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).

L specifies the maximum line length in bytes. - Lines longer than this will be delivered in more than one - message, with the Flag set to noeol for all + 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 newline - sequence, the last line will also be delivered with - the Flag set to noeol. In all other cases, + anywhere else than immediately following a new line + sequence, the last line is also delivered with + Flag set to noeol. Otherwise lines are delivered with Flag set to eol.

-

The {packet, N} and {line, L} settings are - mutually exclusive.

+

The {packet, N} and {line, + L} settings are mutually exclusive.

{cd, Dir} -

This is only valid for {spawn, Command} and - {spawn_executable, FileName}. +

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

+ working directory. Dir must be a string.

{env, Env} -

This is only valid for {spawn, Command} and +

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

-

Env should be a list of tuples {Name, Val}, - where Name is the name of an environment variable, - and Val is the value it is to have in the spawned - port process. Both Name and Val must be - strings. The one exception is Val being the atom +

Env is to be a list of tuples + {Name, Val}, + where Name is the name of an + environment variable, and Val is the + value it is to have in the spawned + 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. -

+ removes the environment variable.

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

This option is only valid for {spawn_executable, FileName} +

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, similar behavior is mimicked.

- -

The arguments are not expanded by the shell prior to - being supplied to the executable, most notably this - means that file wildcard expansion will not happen. Use - filelib:wildcard/1 - to expand wildcards for the arguments. Note that even if + 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 wildcard expansion does not happen. + To expand wildcards for the arguments, use + filelib:wildcard/1. + Notice that even if the program is a Unix shell script, meaning that the - shell will ultimately be invoked, wildcard expansion - will not happen and the script will be provided with the - untouched arguments. On Windows®, wildcard expansion - is always up to the program itself, why this isn't an - issue.

- -

Note also that the actual executable name (a.k.a. argv[0]) - should not be given in this list. The proper executable name will - automatically be used as argv[0] where applicable.

- -

If one, for any reason, wants to explicitly set the - program name in the argument vector, the arg0 - option can be used.

- + shell ultimately is invoked, wildcard expansion + does not happen, 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 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()} - -

This option is only valid for {spawn_executable, FileName} +

Only valid for {spawn_executable, FileName} and explicitly specifies the program name argument when - running an executable. This might in some circumstances, - on some operating systems, be desirable. How the program - responds to this is highly system dependent and no specific + 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 -

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

+

Only valid for {spawn, Command}, where + Command refers to an external program, and + 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 (i.e., 128+signal).

-

If the eof option has been given as well, - the eof message and the exit_status message - appear in an unspecified order.

-

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

+ 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 + and exit_status appear in an unspecified order.

+

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

use_stdio -

This is only valid for {spawn, Command} and +

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

nouse_stdio -

The opposite of use_stdio. Uses file descriptors +

The opposite of use_stdio. It uses file descriptors 3 and 4 for communication with Erlang.

stderr_to_stdout @@ -3304,14 +3474,15 @@ os_prompt%
overlapped_io -

Affects ports to external programs on Windows® only. - The standard input and standard output handles of the port program - will, if this option is supplied, be opened with the flag - FILE_FLAG_OVERLAPPED, so that the port program can (and has to) do +

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.

+ experienced Windows programmer. On all other platforms, this + option is silently discarded.

in @@ -3323,213 +3494,213 @@ os_prompt% binary -

All IO from the port are binary data objects as opposed +

All I/O from the port is binary data objects as opposed to lists of bytes.

eof -

The port will not be closed at the end of the file and - produce an exit signal. Instead, it will remain open and - a {Port, eof} message will be sent to the process +

The port is not closed at the end of the file and does not + produce an exit signal. Instead, it remains open and + a {Port, eof} message is sent to the process holding the port.

hide -

When running on Windows, suppress creation of a new +

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

- {parallelism, Boolean} + {parallelism, Boolean} -

Set scheduler hint for port parallelism. If set to true, - the VM will schedule port tasks when doing so will improve - parallelism in the system. If set to false, the VM will - try to perform port tasks immediately, improving latency at the - expense of parallelism. The default can be set on system startup - by passing the - +spp command line argument - to erl(1). -

+ +

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).

-

The default is stream for all types of port and +

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 which - most closely describes the error, or einval if no Posix code - is appropriate:

+ badarg, system_limit, or the POSIX error code that + most closely describes the error, or einval if no POSIX + code is appropriate:

badarg - -

Bad input arguments to open_port.

+ Bad input arguments to open_port. system_limit - -

All available ports in the Erlang emulator are in use.

+ All available ports in the Erlang emulator are in use. enomem - -

There was not enough memory to create the port.

+ Not enough memory to create the port. eagain - -

There are no more available operating system processes.

+ No more available OS processes. enametoolong - -

The external command given was too long.

+ Too long external command. emfile - -

There are no more available file descriptors (for the operating system process - that the Erlang emulator runs in).

+ No more available file descriptors (for the + OS process that the Erlang emulator runs in). enfile - -

The file table is full (for the entire operating system).

+ Full file table (for the entire OS). eacces - -

The Command given in {spawn_executable, Command} does not point out an executable file.

+ Command given in {spawn_executable, Command} + does not point out an executable file. enoent - -

The FileName given in {spawn_executable, FileName} does not point out an existing file.

+ FileName given in + {spawn_executable, FileName} + does not point out an existing file.

During use of a port opened using {spawn, Name}, - {spawn_driver, Name} or {spawn_executable, Name}, + {spawn_driver, Name}, or {spawn_executable, Name}, errors arising when sending messages to it are reported to the owning process using signals of the form - {'EXIT', Port, PosixCode}. See file(3) for - possible values of PosixCode.

+ {'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 - time can be configured by passing the - +Q - command line flag to - erl(1).

+ time can be configured by passing command-line flag + +Q to + erl(1).

+ Range = 1..2^32, Hash = 1..Range - Portable hash function + Portable hash function. -

Portable hash function that will give the same hash for +

Portable hash function that gives the same hash for the same Erlang term regardless of machine architecture and - ERTS version (the BIF was introduced in ERTS 4.9.1.1). Range - can be between 1 and 2^32, the function returns a hash value - for Term within the range 1..Range.

-

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

+ ERTS version (the BIF was introduced in ERTS 4.9.1.1). + Range is 1..2^32. The function returns a hash value for + Term within the range + 1..Range.

+

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.

+ 1..2^32 0..Range-1 - Portable hash function + Portable hash function. -

Portable hash function that will give the same hash for +

Portable hash function that gives the same hash for the same Erlang term regardless of machine architecture and - ERTS version (the BIF was introduced in ERTS 5.2). Range can - be between 1 and 2^32, the function returns a hash value for - Term within the range 0..Range-1. When called - without the Range argument, a value in the range - 0..2^27-1 is returned.

-

This BIF should always be used for hashing terms. It + ERTS version (the BIF was introduced in ERTS 5.2). + Range is 1..2^32. The function returns a hash value for + Term within the range + 0..Range-1. 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 distributes small integers better than phash/2, and it is faster for bignums and binaries.

-

Note that the range 0..Range-1 is different from - the range of phash/2 (1..Range).

+

Notice that the range 0..Range-1 is + different from the range of phash/2, which is + 1..Range.

+ - Text representation of a pid + Text representation of a pid. -

Returns a string which corresponds to the text +

Returns a string corresponding to the text representation of Pid.

-

This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.

+

This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.

+ - Close an open port + Closes an open port.

Closes an open port. Roughly the same as - Port ! {self(), close} except for the error behaviour - (see below), being synchronous, and that the port does - not reply with {Port, closed}. Any process may + 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 - port identified by Port, an exit signal due - to that link will be received by the process prior to the return - from port_close/1.

+ a port identified by Port, an exit signal is sent + because that link will be received before the return from + port_close/1

For comparison: Port ! {self(), close} fails with - badarg if Port cannot be sent to (i.e., - Port refers neither to a port nor to a process). If - Port is a closed port nothing happens. If Port + badarg if Port cannot be sent to (that is, + Port refers not to a port and not to 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, but if - the calling process is not the port owner the port owner fails with badsig.

- -

Note that any process can close a port using - Port ! {PortOwner, close} just as if it itself was + 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 of OTP-R16 Port ! {PortOwner, close} is truly - asynchronous. Note that this operation has always been +

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 due to its error + 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 linked to the previously open port identified by - Port, an exit signal due to this link - was received by the process prior to this exception. - - +

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 linked to the port, the exit + identified by Port, the exit signal is sent because + this link was delivered to the calling process before this + exception occurs.

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

Sends data to a port. Same as - Port ! {PortOwner, {command, Data}} except for the error - behaviour and being synchronous (see below). Any process may - send data to a port with port_command/2, not only the + 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}} - fails with badarg if Port cannot be sent to - (i.e., Port refers neither to a port nor to a process). - If Port is a closed port the data message disappears + fails with badarg if Port + cannot be sent to (that + is, Port refers not to a port and not to 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 - also if Data is not a valid IO list.

-

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

-

If the port is busy, the calling process will be suspended - until the port is not busy anymore.

-

As of OTP-R16 Port ! {PortOwner, {command, Data}} is - truly asynchronous. Note that this operation has always been + also if Data is an invalid I/O list.

+

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 due to its error + however still fully synchronous. This because of its error behavior.

Failures:

@@ -3537,46 +3708,46 @@ os_prompt% If Port is not an identifier of an open port, or the registered name of an open port. If the calling - process was linked to the previously open port identified by - Port, an exit signal due to this link - was received by the process prior to this exception. + process was linked to the port, the exit signal is sent + because this link was delivered to the calling process + before this exception occurs. badarg - If Data is not a valid io list. + If Data is an invalid I/O list.
+ - Send data to a port + Sends 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 is returned.

-

If the port is busy, the calling process will be suspended - until the port is not busy anymore.

-

Currently the following Options are valid:

+

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:

force - The calling process will not be suspended if the port is - busy; instead, the port command is forced through. The - call will fail with a notsup exception if the + 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 the - - driver flag. + information, see driver flag + . nosuspend - The calling process will not be suspended if the port is - busy; instead, the port command is aborted and + The calling process is not suspended if the port is + busy, instead the port command is aborted and false is returned. -

More options may be added in the future.

+

More options can be added in a future release.

Failures:

@@ -3584,84 +3755,89 @@ os_prompt% If Port is not an identifier of an open port, or the registered name of an open port. If the calling - process was linked to the previously open port identified by - Port, an exit signal due to this link - was received by the process prior to this exception. + process was linked to the port, the exit signal is sent + because this link was delivered to the calling process + before this exception occurs. badarg - If Data is not a valid io list. + If Data is an invalid I/O list. badarg - If OptionList is not a valid option list. + If OptionList is an invalid option list. notsup - If the force option has been passed, but the + If option force has been passed, but the driver of the port does not allow forcing through a busy port.
+ - Set the owner of a port + Sets the owner of a port.

Sets the port owner (the connected port) to Pid. - Roughly the same as Port ! {Owner, {connect, Pid}} + Roughly the same as + Port ! {Owner, {connect, Pid}} except for the following:

-

The error behavior differs, see below.

+

The error behavior differs, see the following.

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

-

port_connect/1 is synchronous, see below.

+

port_connect/1 is synchronous, see the following.

The new port owner gets linked to the port.

-

The old port owner stays linked to the port and have to call - unlink(Port) if this is not desired. Any process may +

The old port owner stays linked to the port and must call + unlink(Port) if this is not desired. Any process can set the port owner to be any process with port_connect/2.

-

For comparison: Port ! {self(), {connect, Pid}} fails - with badarg if Port cannot be sent to (i.e., - Port refers neither to a port nor to a process). If - Port is a closed port nothing happens. If Port +

For comparison: + Port ! {self(), {connect, Pid}} fails + with badarg if Port cannot be sent to (that is, + Port refers not to a port and not to 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, connected} to the old - port owner. Note that the old port owner is still linked to - the port, and that the new is not. If Port is an open + port owner. Notice that the old port owner is still linked to + 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 pid.

-

Note that any process can set the port owner using - Port ! {PortOwner, {connect, Pid}} just as if it - itself was the port owner, but the reply always goes to + 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 of OTP-R16 Port ! {PortOwner, {connect, Pid}} is - truly asynchronous. Note that this operation has always been +

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 due to its error + however still fully synchronous. This 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 linked to the previously open port identified by - Port, an exit signal due to this link - was received by the process prior to this exception. + If Port is not an identifier of an open port, or + the registered name of an open port. If the calling + process was linked to the port, the exit signal is sent + because this link was delivered to the calling process + before this exception occurs. badarg If process identified by Pid is not an existing @@ -3669,53 +3845,74 @@ os_prompt%
+ - Perform a synchronous control operation on a port + Performs a synchronous control operation on a port.

Performs a synchronous control operation on a port. - The meaning of Operation and Data depends on - the port, i.e., on the port driver. Not all port drivers + The meaning of Operation and + Data depends on + the port, that is, on the port driver. Not all port drivers support this control feature.

-

Returns: a list of integers in the range 0 through 255, or a +

Returns a list of integers in the range 0..255, or a binary, depending on the port driver. The meaning of the returned data also depends on the port driver.

-

Failure: badarg if Port is not an open port or - the registered name of an open port, if Operation - cannot fit in a 32-bit integer, if the port driver does not - support synchronous control operations, or if the port driver - so decides for any reason (probably something wrong with - Operation or Data).

+

Failures:

+ + badarg + + 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. + + badarg + + 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). + +
+ - Synchronous call to a port with term data + Performs a synchronous call to a port with term data.

Performs a synchronous call to a port. The meaning of - Operation and Data depends on the port, i.e., + Operation and Data + depends on the port, that is, on the port driver. Not all port drivers support this feature.

-

Port is a port identifier, referring to a driver.

+

Port is a port identifier, + referring to a driver.

Operation is an integer, which is passed on to the driver.

-

Data is any Erlang term. This data is converted to - binary term format and sent to the port.

-

Returns: a term from the driver. The meaning of the returned +

Data is any Erlang term. This data is converted + to binary term format and sent to the port.

+

Returns a term from the driver. The meaning of the returned data also depends on the port driver.

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 linked to the previously open port identified by - Port, an exit signal due to this link - was received by the process prior to this exception. + If Port is not an identifier of an open port, + or the registered name of an open port. If the calling + process was linked to the port, the exit signal is sent + because this link was delivered to the calling process + before this exception occurs. badarg - If Operation does not fit in a - 32-bit integer. + If Operation does not fit in a 32-bit integer. badarg @@ -3725,171 +3922,192 @@ os_prompt% badarg If the port driver so decides for any reason (probably - something wrong with Operation, or - Data). + something wrong with Operation + or Data).
+ - Information about a port + Information about a port.

Returns a list containing tuples with information about - the Port, or undefined if the port is not open. - The order of the tuples is not defined, nor are all the - tuples mandatory. + Port, or undefined if the port is not open. + The order of the tuples is undefined, and all the + tuples are not mandatory. If undefined is returned and the calling process was linked to a previously open port identified by - Port, an exit signal due to this link - was received by the process prior to the return from + Port, an exit signal is sent because this link + was received by the process before the return from port_info/1.

-

Currently the result will containt information about the - following Items: registered_name (if the port has - a registered name), id, connected, links, - name, input, and output. For more information - about the different Items, see +

The result contains information about the following + Items:

+ + registered_name (if the port has a registered + name) + id + connected + links + name + input + output + +

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

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

+ - Information about the connected process of a port + 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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the internal index of a port + Information about the internal index of a port.

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

+ index can be used to separate ports.

If the port identified by Port is not open, undefined is returned. If undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the input of a port + 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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the links of a port + 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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the locking of a port + Information about the locking of a port. -

Locking is currently either false - (emulator without SMP support), port_level (port specific - locking), or driver_level (driver specific locking). Note - that these results are highly implementation specific and might - change in the future.

+

Locking is one of the following:

+ + false (emulator without SMP support) + port_level (port-specific locking) + driver_level (driver-specific locking) + +

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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the memory size of a port + Information about the memory size of a port. -

Bytes is the total amount of memory, - in bytes, allocated for this port by the runtime system. Note - that the port itself might have allocated memory which is not +

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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the monitors of a port + Information about the monitors of a port.

Monitors represent processes that this port - is monitoring.

+ monitors.

If the port identified by Port is not open, undefined is returned. If undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the name of a port + 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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the OS pid of a port + Information about the OS pid of a port.

OsPid is the process identifier (or equivalent) of an OS process created with @@ -3899,430 +4117,466 @@ os_prompt%

If the port identified by Port is not open, undefined is returned. If undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the output of a port + Information about the output of a port.

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

+ or Port ! {Owner, {command, Data}.

If the port identified by Port is not open, undefined is returned. If undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent before this link + was received by the process before the return from port_info/2.

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

+ - Information about the parallelism hint of a port + Information about the parallelism hint of a port.

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

+ hint being used by this port. For more information, see option + parallelism + of open_port/2.

+ - Information about the queue size of a port + Information about the queue size of a port. -

Bytes is the total amount of data, - in bytes, queued by the port using the ERTS driver queue +

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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Information about the registered name of a port + 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 undefined is returned and the calling process was linked to a previously open port identified - by Port, an exit signal due to this link - was received by the process prior to the return from + by Port, an exit signal is sent because this link + was received by the process before the return from port_info/2.

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

+ - Text representation of a port identifier + Text representation of a port identifier. -

Returns a string which corresponds to the text +

Returns a string corresponding to the text representation of the port identifier Port.

-

This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.

+

This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.

+ - All open ports + Lists all open ports.

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

- -

Note that a port that is exiting, exists but is not open.

+ ports existing on the local node.

+

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

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

Returns a list of Erlang modules which are pre-loaded in +

Returns a list of Erlang modules that are preloaded in the system. As all loading of code is done through the file system, the file system must have been loaded previously. - Hence, at least the module init must be pre-loaded.

+ Hence, at least the module init must be preloaded.

+ - Write information about a local process on standard error + Writes information about a local process on standard error.

Writes information about the local process Pid on - standard error. The currently allowed value for the atom + 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 the current function printed first. The format of the output is not further defined.

+ - Set process flag trap_exit for the calling process + Sets 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} messages, which can be received as ordinary + arriving to a process are converted to {'EXIT', From, Reason} + messages, which can be received as ordinary messages. If trap_exit is set to false, the process exits if it receives an exit signal other than normal and the exit signal is propagated to its - linked processes. Application processes should normally - not trap exits.

+ linked processes. Application processes are normally + not to trap exits.

Returns the old value of the flag.

See also exit/2.

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

This is used by a process to redefine the error handler +

Used by a process to redefine the error handler for undefined function calls and undefined registered - processes. Inexperienced users should not use this flag - since code auto-loading is dependent on the correct + processes. Inexperienced users are not to use this flag, + as code auto-loading depends on the correct operation of the error handling module.

Returns the old value of the flag.

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

This changes the minimum heap size for the calling - process.

+

Changes the minimum heap size for the calling process.

Returns the old value of the flag.

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

This changes the minimum binary virtual heap size for the calling +

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

-

Returns the old value of the flag.

+

Returns the old value of the flag.

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

- This sets the process priority. Level is an atom. - There are currently four priority levels: low, - normal, high, and max. The default - priority level is normal. NOTE: The - max priority level is reserved for internal use in - the Erlang runtime system, and should not be used - by others. -

-

Internally in each priority level processes are scheduled - in a round robin fashion. -

+ Sets the process priority. Level is an atom. + There are four priority levels: low, + normal, high, and max. Default + is normal.

+ +

Priority level max is reserved for internal use in + the Erlang runtime system, and is not to be used + by others.

+
+

Internally in each priority level, processes are scheduled + in a round robin fashion.

Execution of processes on priority normal and - priority low will be interleaved. Processes on - priority low will be selected for execution less - frequently than processes on priority normal. -

-

When there are runnable processes on priority high - no processes on priority low, or normal will - be selected for execution. Note, however, that this does - not mean that no processes on priority low, - or normal will be able to run when there are - processes on priority high running. On the runtime - system with SMP support there might be more processes running - in parallel than processes on priority high, i.e., - a low, and a high priority process might - execute at the same time. -

-

When there are runnable processes on priority max + 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, + no processes on priority low or normal are + 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 + system with SMP support, more processes can be running + 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, no processes on priority low, normal, or - high will be selected for execution. As with the - high priority, processes on lower priorities might - 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 amount + high are selected for execution. As with priority + high, processes on lower priorities can + execute in parallel with processes on priority max.

+

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. -

-

NOTE: You should not depend on the scheduling + execution.

+ +

Do not depend on the scheduling to remain exactly as it is today. Scheduling, at least on - the runtime system with SMP support, is very likely to be - modified in the future in order to better utilize available - processor cores. -

-

There is currently no automatic mechanism for - avoiding priority inversion, such as priority inheritance, - or priority ceilings. When using priorities you have - to take this into account and handle such scenarios by - yourself. -

+ the runtime system with SMP support, is likely to be + changed in a future release to use available + processor cores better.

+
+

There is no automatic mechanism for + avoiding priority inversion, such as priority inheritance + or priority ceilings. When using priorities, + take this into account and handle such scenarios by + yourself.

Making calls from a high priority process into code - that you don't have control over may cause the high - priority process to wait for a processes with lower - priority, i.e., effectively decreasing the priority of the + that you have 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 - isn't the case with one version of the code that you don't - have under your control, it might be the case in a future - version of it. This might, for example, happen if a - high priority process triggers code loading, since - the code server runs on priority normal. -

+ is not the case with one version of the code that you have no + control over, it can be the case in a future + version of it. This can, for example, occur if a + high priority process triggers code loading, as + the code server runs on priority normal.

Other priorities than normal are normally not needed. - When other priorities are used, they need to be used - with care, especially the high priority must - be used with care. A process on high priority should - only perform work for short periods of time. Busy looping for - long periods of time in a high priority process will - most likely cause problems, since there are important servers - in OTP running on priority normal. -

+ When other priorities are used, use them with care, + 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 + run on priority normal.

Returns the old value of the flag.

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

N must be an integer in the interval 0..10000. - If N > 0, call saving is made active for the - process, which means that information about the N - most recent global function calls, BIF calls, sends and + If N is greater than 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 receives made by the process are saved in a list, which can be retrieved with process_info(Pid, last_calls). A global function call is one in which the module of the function is explicitly mentioned. Only a fixed amount of information - is saved: a tuple {Module, Function, Arity} for - function calls, and the mere atoms send, - 'receive' and timeout for sends and receives - ('receive' when a message is received and - timeout when a receive times out). If N = 0, + is saved, as follows:

+ + 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) + +

If N = 0, call saving is disabled for the process, which is the default. Whenever the size of the call saving list is set, its contents are reset.

Returns the old value of the flag.

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

Set or clear the sensitive flag for the current process. +

Sets or clears flag sensitive for the current process. When a process has been marked as sensitive by calling - process_flag(sensitive, true), features in the run-time - system that can be used for examining the data and/or inner working + process_flag(sensitive, true), features in the runtime + system that can be used for examining the data or inner working of the process are silently disabled.

Features that are disabled include (but are not limited to) the following:

-

Tracing: Trace flags can still be set for the process, but no - trace messages of any kind will be generated. - (If the sensitive flag is turned off, trace messages will - again be generated if there are any trace flags set.)

-

Sequential tracing: The sequential trace token will be propagated - as usual, but no sequential trace messages will be generated.

-

process_info/1,2 cannot be used to read out the message - queue or the process dictionary (both will be returned as empty lists).

+ + 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 + propagated as usual, but no sequential trace messages are + generated. + +

process_info/1,2 cannot be used to read out the + message queue or the process dictionary (both are returned + as empty lists).

Stack back-traces cannot be displayed for the process.

In crash dumps, the stack, messages, and the process dictionary - will be omitted.

+ are omitted.

If {save_calls,N} has been set for the process, no - function calls will be saved to the call saving list. - (The call saving list will not be cleared; furthermore, send, receive, - and timeout events will still be added to the list.)

+ 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.)

Returns the old value of the flag.

+ - Set process flags for a process + Sets process flags for a process. -

Sets certain flags for the process Pid, in the same - manner as +

Sets certain flags for the process Pid, + in the same manner as process_flag/2. - Returns the old value of the flag. The allowed values for + 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.

-

Failure: badarg if Pid is not a local process.

+ process_flag/2, namely save_calls.

+

Failure: badarg if Pid + is not a local process.

+ + Information about a process. - Information about a process

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 not defined, nor - are all the InfoTuples mandatory. The InfoTuples - part of the result may be changed without prior notice. - Currently InfoTuples with the following items - are part of the result: - current_function, initial_call, status, - message_queue_len, messages, links, - dictionary, trap_exit, error_handler, - priority, group_leader, total_heap_size, - heap_size, stack_size, reductions, and - garbage_collection. - If the process identified by Pid has a registered name - also an InfoTuple with the item registered_name - will appear. -

-

See process_info/2 - for information about specific InfoTuples.

+ 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:

+ + current_function + initial_call + status + message_queue_len + messages + links + dictionary + trap_exit + error_handler + priority + group_leader + total_heap_size + heap_size + stack_size + reductions + 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.

-

This BIF is intended for debugging only, use - process_info/2 - for all other purposes. -

+

This BIF is intended for debugging only. For + all other purposes, use + process_info/2.

-

Failure: badarg if Pid is not a local process.

+

Failure: badarg if Pid is not a + local process.

+ + Information about a process. - Information about a process -

Returns information about the process identified by Pid - as specified by the Item or the ItemList, or 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 due to - historical reasons, and is kept for backward compatibility. -

-

If an ItemList is given, the result is an - InfoTupleList. The InfoTuples in the - InfoTupleList will appear with the corresponding - Items in the same order as the Items appeared - in the ItemList. Valid Items may appear multiple - times in the ItemList. -

-

If registered_name is part of an ItemList +

Returns information about the process identified by + Pid, as specified by + Item or ItemList, + or 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 than when a single - Item =:= registered_name is given, and than when - process_info/1 is used. -

-

Currently the following InfoTuples with corresponding + {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:

{backtrace, Bin} -

The binary Bin contains the same information as - the output from +

Binary Bin contains the same information + as the output from erlang:process_display(Pid, backtrace). Use binary_to_list/1 to obtain the string of characters from the binary.

{binary, BinInfo} -

BinInfo is a list containing miscellaneous information - about binaries currently being referred to by this process. - This InfoTuple may be changed or removed without prior - notice.

+

BinInfo is a list containing miscellaneous + information about binaries currently being 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 may be + catches in this process. This InfoTuple can be changed or removed without prior notice.

- {current_function, {Module, Function, Arity}} + {current_function, {Module, + Function, Arity}} -

Module, Function, Arity is +

Module, Function, + Arity is the current function call of the process.

- {current_location, {Module, Function, Arity, Location}} + {current_location, {Module, + Function, Arity, + Location}} -

Module, Function, Arity is +

Module, Function, + Arity is the current function call of the process. - Location is a list of two-tuples that describes the - location in the source code. -

+ Location is a list of two-tuples describing the + location in the source code.

{current_stacktrace, Stack} -

Return the current call stack back-trace (stacktrace) +

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} -

Dictionary is the dictionary of the process.

+

Dictionary is the process dictionary.

{error_handler, Module} @@ -4331,34 +4585,36 @@ os_prompt% {garbage_collection, GCInfo} -

GCInfo is a list which contains miscellaneous +

GCInfo is a list containing miscellaneous information about garbage collection for this process. - The content of GCInfo may be changed without + The content of GCInfo can be changed without prior notice.

{group_leader, GroupLeader} -

GroupLeader is group leader for the IO of +

GroupLeader is group leader for the I/O of the process.

{heap_size, Size} -

Size is the size in words of youngest heap generation - of the process. This generation currently include the stack - of the process. This information is highly implementation - dependent, and may change if the implementation change. -

+

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.

- {initial_call, {Module, Function, Arity}} + {initial_call, {Module, Function, + Arity}} -

Module, Function, Arity is +

Module, Function, + Arity is the initial function call with which the process was spawned.

{links, PidsAndPorts} -

PidsAndPorts is a list of pids and - port identifiers, with processes or ports to which the process +

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} @@ -4372,14 +4628,14 @@ os_prompt% {memory, Size}

Size is the size in bytes of the process. This - includes call stack, heap and internal structures.

+ 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 info item messages (see below).

+ the information item messages (see the following).

{messages, MessageQueue} @@ -4388,31 +4644,35 @@ os_prompt% {min_heap_size, MinHeapSize} -

MinHeapSize is the minimum heap size for the process.

+

MinHeapSize is the minimum heap size + for the process.

{min_bin_vheap_size, MinBinVHeapSize} -

MinBinVHeapSize is the minimum binary virtual heap size for the process.

+

MinBinVHeapSize is the minimum binary virtual + heap size for the process.

{monitored_by, Pids} -

A list of pids that are monitoring the process (with +

A list of process identifiers monitoring the process (with monitor/2).

{monitors, Monitors}

A list of monitors (started by monitor/2) that are active for the process. For a local process - monitor or a remote process monitor by pid, the list item - is {process, Pid}, and for a remote process + monitor or a remote process monitor by a process + identifier, the list item is {process, Pid}. + For a remote process monitor by name, the list item is {process, {RegName, Node}}.

- {priority, Level} + {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} @@ -4427,166 +4687,203 @@ os_prompt% {sequential_trace_token, [] | SequentialTraceToken} -

SequentialTraceToken the sequential trace token for - the process. This InfoTuple may be changed or removed - without prior notice.

+

SequentialTraceToken is the sequential trace + token for the process. This InfoTuple can be + changed or removed without prior notice.

{stack_size, Size} -

Size is the stack size of the process in words.

+

Size is the stack size, in words, + of the process.

{status, Status} -

Status is the status of the process. Status - is exiting, garbage_collecting, - waiting (for a message), running, - runnable (ready to run, but another process is - running), or suspended (suspended on a "busy" port - or by the erlang:suspend_process/[1,2] BIF).

+

Status is the status of the process and is one + of the following:

+ + exiting + garbage_collecting + waiting (for a message) + running + runnable (ready to run, but another process is + running) + suspended (suspended on a "busy" port + or by the BIF erlang:suspend_process/[1,2]) +
{suspending, SuspendeeList} -

SuspendeeList is a list of {Suspendee, - ActiveSuspendCount, OutstandingSuspendCount} tuples. - Suspendee is the pid of a process that have been or is to - be suspended by the process identified by Pid via the - erlang:suspend_process/2 - BIF, or the - erlang:suspend_process/1 - BIF. ActiveSuspendCount is the number of times the - Suspendee has been suspended by Pid. +

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:

+ + + 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, and if - OutstandingSuspendCount =/= 0 the asynchronous - option of erlang:suspend_process/2 has been used and - the suspendee has not yet been suspended by Pid. - Note that the ActiveSuspendCount and - OutstandingSuspendCount are not the total suspend count - on Suspendee, only the parts contributed by Pid. -

+ completed suspend requests sent by Pid, that is:

+ + 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. + + +

Notice that ActiveSuspendCount and + OutstandingSuspendCount are not the + total suspend count on Suspendee, + only the parts contributed by Pid.

{total_heap_size, Size} -

Size is the total size in words of all heap - fragments of the process. This currently include the stack - of the process. -

+

Size is the total size, in words, of all heap + fragments of the process. This includes the process stack.

{trace, InternalTraceFlags} -

InternalTraceFlags is an integer representing - internal trace flag for this process. This InfoTuple - may be changed or removed without prior notice.

+

InternalTraceFlags is an integer + 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 it is false.

+

Boolean is true if the process + is trapping exits, otherwise false.

-

Note however, that not all implementations support every one - of the above Items.

-

Failure: badarg if Pid is not a local process, - or if Item is not a valid Item.

+

Notice that not all implementations support all + these Items.

+

Failures:

+ + badarg + If Pid is not a local process. + badarg + If Item is an invalid + Item. +
+ - All processes + All processes.

Returns a list of process identifiers corresponding to - all the processes currently existing on the local node. -

-

Note that a process that is exiting, exists but is not alive, i.e., - is_process_alive/1 will return false for a process - that is exiting, but its process identifier will be 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().
 [<0.0.0>,<0.2.0>,<0.4.0>,<0.5.0>,<0.7.0>,<0.8.0>]
+ - Remove old code for a module + Removes old code for a module. -

Removes old code for Module. Before this BIF is used, - erlang:check_process_code/2 should be called to check - that no processes are executing old code in the module.

+

Removes old code for Module. + Before this BIF is used, + erlang:check_process_code/2 is 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)) and should not be - used elsewhere.

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

Failure: badarg if there is no old code for Module.

+ - 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 already exists, the old value is deleted and - replaced by Val and the function returns the old value.

- -

The values stored when put is evaluated within - the scope of a catch will not be retracted if a - throw is evaluated, or if an error occurs.

-
+ Adds 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:

 > X = put(name, walrus), Y = put(name, carpenter),
 Z = get(name),
 {X, Y, Z}.
 {undefined,walrus,carpenter}
+ +

The values stored when put is evaluated within + the scope of a catch are not retracted if a + throw is evaluated, or if an error occurs.

+
+ + Stops execution with an exception of given class, reason, and call stack backtrace. - Stop execution with an exception of given 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 given class, reason, and call stack backtrace (stacktrace).

This BIF is intended for debugging and for use in - the Erlang operating system. In general, it should - be avoided in applications, unless you know - very well what you are doing.

+ the Erlang OS. Avoid to use it in applications, + unless you really know what you are doing.

-

Class is one of error, exit or - throw, so if it were not for the stacktrace - erlang:raise(Class, Reason, Stacktrace) is - equivalent to erlang:Class(Reason). - Reason is any term and Stacktrace is a list as - returned from get_stacktrace(), that is a list of - 4-tuples {Module, Function, Arity | Args, - Location} where Module and Function - are atoms and the third element is an integer arity or an - argument list. The stacktrace may also contain {Fun, - Args, Location} tuples where - Fun is a local fun and Args is an argument list.

-

The Location element at the end is optional. +

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).

+

Reason is any term. + Stacktrace is a list as + returned from get_stacktrace(), that is, a list of + four-tuples {Module, Function, Arity | Args, + Location}, where Module and Function + are atoms, and the third element is an integer arity or an + 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.

The stacktrace is used as the exception stacktrace for the - calling process; it will be truncated to the current + calling process; it is truncated to the current maximum stacktrace depth.

-

Because 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, that is badarg. If you want to be - really sure not to return you can call - error(erlang:raise(Class, Reason, Stacktrace)) +

Since 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 + sure not to return, you can call + error(erlang:raise(Class, Reason, + Stacktrace)) and hope to distinguish exceptions later.

+ - Read the state of a timer + Reads the state of a timer.

Read the state of a timer that has been created by either @@ -4626,7 +4923,7 @@ os_prompt% the timeout message has been sent, but it does not tell you whether or not it has arrived at its destination yet. When the Result is an integer, it represents the - time in milli-seconds left until the timer will expire. + time in milli-seconds left until the timer expires.

@@ -4651,70 +4948,86 @@ os_prompt% - Read the state of a timer + Reads the state of a timer.

Read the state of a timer. The same as calling erlang:read_timer(TimerRef, []).

+ - Text representation of a reference + Text representation of a reference. -

Returns a string which corresponds to the text +

Returns a string corresponding to the text representation of Ref.

-

This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.

+

This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.

+ - Register a name for a pid (or port) + Registers a name for a pid (or port). -

Associates the name RegName with a pid or a port - identifier. RegName, which must be an atom, can be used - instead of the pid / port identifier in the send operator +

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:

 > register(db, Pid).
 true
-

Failure: badarg if PidOrPort is not an existing, - local process or port, if RegName is already in use, - if the process or port is already registered (already has a - name), or if RegName is the atom undefined.

+

Failures:

+ + badarg + If PidOrPort is not an existing local + process or port. + badarg + If RegName is already in use. + badarg + If the process or port is already registered + (already has a name). + badarg + If RegName is the atom + undefined. +
+ - All registered names + All registered names. -

Returns a list of names which have been registered using - register/2.

+

Returns a list of names that have been registered using + register/2, for + example:

 > registered().
 [code_server, file_server, init, user, my_db]
+ - Resume a suspended process + Resumes a suspended process.

Decreases the suspend count on the process identified by - Suspendee. Suspendee should previously have been - suspended via - erlang:suspend_process/2, + 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 reach zero, Suspendee - will be resumed, i.e., the state of the Suspendee is changed - from suspended into the state Suspendee was in before it was - suspended. -

+ 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.

@@ -4722,7 +5035,7 @@ true badarg - If Suspendee isn't a process identifier. + If Suspendee is not a process identifier. badarg @@ -4732,58 +5045,65 @@ true badarg - If the process identified by Suspendee is not alive. + If the process identified by Suspendee + is not alive.
+ - Return an integer by rounding a number + Returns an integer by rounding a number. -

Returns an integer by rounding Number.

+

Returns an integer by rounding Number, + for example:

-> round(5.5).
+round(5.5).
 6

Allowed in guard tests.

+ - Pid of the calling process + Returns pid of the calling process. -

Returns the pid (process identifier) of the calling process.

+

Returns the process identifier of the calling process, for + example:

 > self().
 <0.26.0>

Allowed in guard tests.

+ - Send a message + Sends a message. -

Sends a message and returns Msg. This is the same as - Dest ! Msg.

-

Dest may be a remote or local pid, a (local) port, a - locally registered name, or a tuple {RegName, Node} +

Sends a message and returns Msg. This + is the same as Dest ! Msg.

+

Dest can be a remote or local process identifier, + a (local) port, a locally registered name, or a tuple + {RegName, Node} for a registered name at another node.

+ + Sends a message conditionally. - Send a message conditionally - -

Sends a message and returns ok, or does not send - the message but returns something else (see below). Otherwise - the same as - erlang:send/2. See - also - erlang:send_nosuspend/2,3. - for more detailed explanation and warnings.

-

The possible options are:

+ +

Either sends a message and returns ok, or does not send + the message but returns something else (see the following). + Otherwise the same as + erlang:send/2. + For more detailed explanation and warnings, see + erlang:send_nosuspend/2,3.

+

The options are as follows:

nosuspend @@ -4793,16 +5113,17 @@ true noconnect

If the destination node would have to be auto-connected - before doing the send, noconnect is returned + to do the send, noconnect is returned instead.

-

As with erlang:send_nosuspend/2,3: Use with extreme - care!

+

As with erlang:send_nosuspend/2,3: use with extreme + care.

+ Start a timer @@ -4819,288 +5140,334 @@ true - Start a timer + Starts a timer.

Starts a timer. The same as calling erlang:send_after(Time, Dest, Msg, []).

+ - Try to send a message without ever blocking + Tries to send a message without ever blocking.

The same as - erlang:send(Dest, Msg, [nosuspend]), but returns true if + 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.

-

This function is intended for send operations towards an +

This function is intended for send operations to an unreliable remote node without ever blocking the sending (Erlang) process. If the connection to the remote node (usually not a real Erlang node, but a node written in C or - Java) is overloaded, this function will not send the message but return false instead.

-

The same happens, if Dest refers to a local port that - is busy. For all other destinations (allowed for the ordinary - send operator '!') this function sends the message and + Java) is overloaded, this function does not send the message + and returns false.

+

The same occurs if Dest refers to a local port + that is busy. For all other destinations (allowed for the ordinary + send operator '!'), this function sends the message and returns true.

-

This function is only to be used in very rare circumstances +

This function is only to be used in rare circumstances where a process communicates with Erlang nodes that can - disappear without any trace causing the TCP buffers and - the drivers queue to be over-full before the node will actually - be shut down (due to tick timeouts) by net_kernel. The - normal reaction to take when this happens is some kind of + disappear without any trace, causing the TCP buffers and + the drivers queue to be over-full before the node is + shut down (because of tick time-outs) by net_kernel. + The normal reaction to take when this occurs is some kind of premature shutdown of the other node.

-

Note that ignoring the return value from this function would - result in unreliable message passing, which is +

Notice that ignoring the return value from this function would + result in an unreliable message passing, which is contradictory to the Erlang programming model. The message is not sent if this function returns false.

-

Note also that in many systems, transient states of +

In many systems, transient states of overloaded queues are normal. The fact that this function - returns false does not in any way mean that the other + 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 could be sent on the (TCP) channel - without blocking, the message is not guaranteed to have - arrived at the remote node. Also in the case of a disconnected + 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 + arrive at the remote node. For a disconnected non-responsive node, the return value is true (mimics - the behaviour of the ! operator). The expected - behaviour as well as the actions to take when the function - returns false are application and hardware specific.

+ the behavior of operator !). The expected + behavior and the actions to take when the function + returns false are application- and hardware-specific.

-

Use with extreme care!

+

Use with extreme care.

+ - Try to send a message without ever blocking + Tries to send a message without ever blocking.

The same as - erlang:send(Dest, Msg, [nosuspend | Options]), - but with boolean return value.

+ erlang:send(Dest, + Msg, [nosuspend | Options]), + but with a Boolean return value.

This function behaves like erlang:send_nosuspend/2), - but takes a third parameter, a list of options. The only - currently implemented option is noconnect. The option - noconnect makes the function return false if + but takes a third parameter, a list of options. + The only option is noconnect, which + makes the function return false if the remote node is not currently reachable by the local - node. The normal behaviour is to try to connect to the node, - which may stall the process for a shorter period. The use of - the noconnect option makes it possible to be - absolutely sure not to get even the slightest delay when + node. The normal behavior is to try to connect to the node, + which can stall the process during a short period. The use of + option noconnect makes it possible to be + sure not to get the slightest delay when sending to a remote process. This is especially useful when - communicating with nodes who expect to always be - the connecting part (i.e. nodes written in C or Java).

+ communicating with nodes that expect to always be + the connecting part (that is, nodes written in C or Java).

Whenever the function returns false (either when a suspend would occur or when noconnect was specified and the node was not already connected), the message is guaranteed not to have been sent.

-

Use with extreme care!

+

Use with extreme care.

+ - Set the magic cookie of a node + Sets the magic cookie of a node.

Sets the magic cookie of Node to the atom - Cookie. If Node is the local node, the function + Cookie. If Node is the + local node, the function also sets the cookie of all other unknown nodes to - Cookie (see - Distributed Erlang in the Erlang Reference Manual).

+ Cookie (see Section + Distributed Erlang + in the Erlang Reference Manual in System Documentation).

Failure: function_clause if the local node is not alive.

+ - 1..tuple_size(Tuple1) - Set Nth element of a tuple + 1..tuple_size(Tuple1 + Sets the Nth element of a tuple. -

Returns a tuple which is a copy of the argument Tuple1 - with the element given by the integer argument Index +

Returns a tuple that is a copy of argument + Tuple1 + with the element given by integer argument + Index (the first element is the element with index 1) replaced by - the argument Value.

+ argument Value, for example:

 > setelement(2, {10, green, bottles}, red).
 {10,red,bottles}
+ - Size of a tuple or binary + Size of a tuple or binary. -

Returns an integer which is the size of the argument - Item, which must be either a tuple or a binary.

+

Returns an integer that is the size of argument + Item, which must be a tuple or a binary, + for example:

 > size({morni, mulle, bwange}).
 3

Allowed in guard tests.

+ - Create a new process with a fun as entry point + Creates a new process with a fun as entry point. -

Returns the pid of a new process started by the application - of Fun to the empty list []. Otherwise works - like spawn/3.

+

Returns the process identifier of a new process started by the + application of Fun to the empty list + []. Otherwise + works like spawn/3.

+ - Create a new process with a fun as entry point on a given node + Creates a new process with a fun as entry point on a given node. -

Returns the 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 +

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.

+ - Create a new process with a function as entry point - -

Returns the pid of a new process started by the application - of Module:Function to Args. The new process - created will be placed in the system scheduler queue and be - run some time later.

-

error_handler:undefined_function(Module, Function, Args) is evaluated by the new process if - Module:Function/Arity does not exist (where - Arity is the length of Args). The error handler + Creates 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. + The new created process is placed in the system scheduler + queue and will be run some time later.

+

error_handler:undefined_function(Module, + Function, Args) + is evaluated by the new process if + Module:Function/Arity + does not exist (where Arity is the length of + Args). The error handler can be redefined (see process_flag/2). If error_handler is undefined, or the user has - redefined the default error_handler its replacement is - undefined, a failure with the reason undef will occur.

+ redefined the default error_handler, its replacement is + undefined, and a failure with reason undef occurs.

+

Example:

 > spawn(speed, regulator, [high_speed, thin_cut]).
 <0.13.1>
+ - Create a new process with a function as entry point on a given node + Creates a new process with a function as entry point on a given node. -

Returns the pid of a new process started by the application - of Module:Function to Args on Node. If - Node does not exists, a useless pid is returned. +

Returns the process identifier (pid) of a new process started + by the application + of Module:Function + to Args on Node. If + Node does not exist, a useless pid is returned. Otherwise works like spawn/3.

+ - Create and link to a new process with a fun as entry point + Creates and links to a new process with a fun as entry point. -

Returns the pid of a new process started by the application - of Fun to the empty list []. A link is created between +

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.

+ - Create and link to a new process with a fun as entry point on a specified node + Creates and links to a new process with a fun as entry point on a specified node. -

Returns the pid of a new process started by the application - of Fun to the empty list [] on Node. A link is +

Returns the process identifier (pid) of a new process started + by the application of Fun to the empty + list [] on Node. A link is created between the calling process and the new process, - atomically. If Node does not exist, a useless pid is - returned (and due to the link, an exit signal with exit - reason noconnection will be received). Otherwise works + atomically. If Node does not exist, + a useless pid is + returned (and, because of the link, an exit signal with exit + reason noconnection is received). Otherwise works like spawn/3.

+ - Create and link to a new process with a function as entry point + Creates and links to a new process with a function as entry point. -

Returns the pid of a new process started by the application - of Module:Function to Args. A link is created +

Returns the process identifier of a new process started by + the applicatio of Module:Function + to Args. A link is created between the calling process and the new process, atomically. Otherwise works like spawn/3.

+ - Create and link to a new process with a function as entry point on a given node + Creates and links to a new process with a function as entry point on a given node. -

Returns the pid of a new process started by the application - of Module:Function to Args on Node. A +

Returns the process identifier (pid) of a new process + started by the application + of Module:Function + to Args on Node. A link is created between the calling process and the new - process, atomically. If Node does not exist, a useless - pid is returned (and due to the link, an exit signal with exit - reason noconnection will be received). Otherwise works + process, atomically. If Node does + not exist, a useless pid + is returned (and, because of the link, an exit signal with exit + reason noconnection is received). Otherwise works like spawn/3.

+ - Create and monitor a new process with a fun as entry point + Creates and monitors a new process with a fun as entry point. -

Returns the pid of a new process started by the application - of Fun to the empty list [] and reference for a monitor - created to the new process. +

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.

+ - Create and monitor a new process with a function as entry point + Creates and monitors a new process with a function as entry point.

A new process is started by the application - of Module:Function to Args, and the process is - monitored at the same time. Returns the pid and a reference - for the monitor. - Otherwise works like + 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.

+ - - Create a new process with a fun as entry point + Creates a new process with a fun as entry point. + -

Returns the pid of a new process started by the application - of Fun to the empty list []. Otherwise - works like +

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 the option monitor is given, the newly created - process will be monitored and both the pid and reference for - the monitor will be returned.

+

If option monitor is given, the newly created + process is monitored, and both the pid and reference for + the monitor is returned.

+ - - Create a new process with a fun as entry point on a given node + Creates a new process with a fun as entry point on a given node. + -

Returns the 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 +

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.

+ - - Create a new process with a function as entry point + Creates a new process with a function as entry point. + -

Works exactly like +

Works as spawn/3, except that an extra option list is given when creating the process.

-

If the option monitor is given, the newly created - process will be monitored and both the pid and reference for - the monitor will be returned.

+

If option monitor is given, the newly created + process is monitored, and both the pid and reference for + the monitor is returned.

+

The options are as follows:

link @@ -5109,112 +5476,123 @@ true monitor -

Monitor the new process (just like +

Monitors the new process (like monitor/2 does).

- {priority, Level} + {priority, Level

Sets the priority of the new process. Equivalent to executing - process_flag(priority, Level) in the start function of the new process, - except that the priority will be 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) + 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).

{fullsweep_after, Number} -

This option is only useful for performance tuning. - In general, you should not use this option unless you - know that there is problem with execution times and/or - memory consumption, and you should measure to make sure - that the option improved matters. -

+

Useful only for performance tuning. Do not use this + option unless you + know that there is problem with execution times or + memory consumption, and ensure + that the option improves matters.

The Erlang runtime system uses a generational garbage collection scheme, using an "old heap" for data that has survived at least one garbage collection. When there is no more room on the old heap, a fullsweep garbage - collection will be done.

-

The fullsweep_after option makes it possible to + collection is done.

+

Option fullsweep_after makes it possible to specify the maximum number of generational collections - before forcing a fullsweep even if there is still room on - the old heap. Setting the number to zero effectively - disables the general collection algorithm, meaning that + before forcing a fullsweep, even if there is room on + the old heap. Setting the number to zero + disables the general collection algorithm, that is, all live data is copied at every garbage collection.

-

Here are a few cases when it could be useful to change - fullsweep_after. Firstly, if binaries that are no - longer used should be thrown away as soon as possible. - (Set Number to zero.) Secondly, a process that - mostly have short-lived data will be fullsweeped seldom - or never, meaning that the old heap will contain mostly - garbage. To ensure a fullsweep once in a while, set - Number to a suitable value such as 10 or 20. - Thirdly, in embedded systems with limited amount of RAM - and no virtual memory, one might want to preserve memory - by setting Number to zero. (The value may be set - globally, see - erlang:system_flag/2.)

+

A few cases when it can be useful to change + fullsweep_after:

+ + If binaries that are no longer used are to be + thrown away as soon as possible. (Set + Number to zero.) + + 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. + + 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.) + +
{min_heap_size, Size} -

This option is only useful for performance tuning. - In general, you should not use this option unless you - know that there is problem with execution times and/or - memory consumption, and you should measure to make sure - that the option improved matters. -

-

Gives a minimum heap size in words. Setting this value - higher than the system default might speed up some +

Useful only for performance tuning. Do not use this + option unless you know that there is problem with + execution times or memory consumption, and + ensure that the option improves matters.

+

Gives a minimum heap size, in words. Setting this value + higher than the system default can speed up some processes because less garbage collection is done. - Setting too high value, however, might waste memory and - slow down the system due to worse data locality. - Therefore, it is recommended to use this option only for + However, setting a too high value can waste memory and + slow down the system because of worse data locality. + Therefore, use this option only for fine-tuning an application and to measure the execution time with various Size values.

{min_bin_vheap_size, VSize} -

This option is only useful for performance tuning. - In general, you should not use this option unless you - know that there is problem with execution times and/or - memory consumption, and you should measure to make sure - that the option improved matters. -

-

Gives a minimum binary virtual heap size in words. Setting this value - higher than the system default might speed up some +

Useful only for performance tuning. Do not use this + 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. + Setting this value + higher than the system default can speed up some processes because less garbage collection is done. - Setting too high value, however, might waste memory. - Therefore, it is recommended to use this option only for + However, setting a too high value can waste memory. + Therefore, use this option only for fine-tuning an application and to measure the execution time with various VSize values.

-
+ - - Create a new process with a function as entry point on a given node + Creates a new process with a function as entry point on a given node. + -

Returns the pid of a new process started by the application - of Module:Function to Args on Node. If +

Returns the process identifier (pid) of a new process started + by the application + of Module:Function to + Args on Node. If Node does not exist, a useless pid is returned. Otherwise works like spawn_opt/4.

-

The monitor option is currently not supported by +

Option monitor is not supported by spawn_opt/5.

+ 0..byte_size(Bin) - Split a binary into two + Splits a binary into two. -

Returns a tuple containing the binaries which are the result - of splitting Bin into two parts at position Pos. +

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 will be three binaries altogether.

+ there are three binaries altogether.

+

Example:

 > B = list_to_binary("0123456789").
 <<"0123456789">>
@@ -5228,9 +5606,10 @@ true
7
+ - Start a timer + Starts a timer.

Starts a timer. When the timer expires, the message @@ -5268,7 +5647,7 @@ true is not allowed to be negative.

- If Dest is a pid(), it has to + 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 @@ -5278,11 +5657,11 @@ true is given if the name does not refer to a process.

- If Dest is a pid(), the timer will - be automatically canceled if the process referred to by the + If Dest is a pid(), the timer is + automatically canceled if the process referred to by the pid() is not alive, or when the process exits. This - feature was introduced in erts version 5.4.11. Note that - timers will not be automatically canceled when + feature was introduced in ERTS version 5.4.11. Notice that + timers are not automatically canceled when Dest is an atom().

See also @@ -5290,13 +5669,14 @@ true erlang:cancel_timer/2, and erlang:read_timer/2.

-

Failure: badarg if the arguments does not satisfy - the requirements specified above.

+

Failure: badarg if the arguments do not satisfy + the requirements specified here.

+ - Start a timer + Starts a timer.

Starts a timer. The same as calling erlang:start_timer(Time, @@ -5305,126 +5685,137 @@ true - Information about context switches + Information about context switches. -

ContextSwitches is the total number of context - switches since the system started.

+

Returns the total number of context switches since the + system started.

+ - Information about exact reductions + Information about exact reductions. -

statistics(exact_reductions) is - a more expensive operation than - statistics(reductions) - especially on an Erlang machine with SMP support.

-
+

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.

+
+ - Information about garbage collection + Information about garbage collection. -

This information may not be valid for all implementations.

+

Returns information about garbage collection, for example:

 > statistics(garbage_collection).
-{85,23961,0}
-
+{85,23961,0} +

This information can be invalid for some implementations.

+ - Information about io + Information about I/O. -

Input is the total number of bytes received - through ports, and Output is the total number of - bytes output to ports.

+

Returns Input, + which is the total number of bytes + received through ports, and Output, + which is the total number of bytes output to ports.

+ - Information about reductions + Information about reductions. - -

Since erts-5.5 (OTP release 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).

-
+

Returns information about reductions, for example:

 > statistics(reductions).
-{2046,11}
-
+{2046,11} +

As from ERTS 5.5 (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).

+
+ - Information about the run-queue + Information about the run-queue. -

Returns the total length of the run queues, that is, the number - of processes that are ready to run on all available run queues.

+

Returns the total length of run-queues, that is, the number + of processes that are ready to run on all available run-queues.

+ - Information about run-time + Information about runtime. -

Note that the run-time is the sum of the run-time for all - threads in the Erlang run-time system and may therefore be greater - than the wall-clock time. The time is returned in milliseconds.

+

Returns information about runtime, in milliseconds.

+

The runtime is the sum of the runtime for all threads + in the Erlang runtime system and can therefore be greater + than the wall clock time.

+

Example:

 > statistics(runtime).
-{1690,1620}
-
+{1690,1620}
+ - Information about each schedulers work time - - -

- Returns a list of tuples with {SchedulerId, - ActiveTime, TotalTime}, where - SchedulerId is an integer id of the scheduler, ActiveTime is - the duration the scheduler has been busy, TotalTime is the total time duration since - scheduler_wall_time - activation. The time unit is not defined and may be subject to change - between releases, operating systems and system restarts. - scheduler_wall_time should only be used to calculate relative - values for scheduler-utilization. ActiveTime can never exceed TotalTime. -

- -

The definition of a busy scheduler is when it is not idle or not - scheduling (selecting) a process or port, meaning; executing process - code, executing linked-in-driver or NIF code, executing - built-in-functions or any other runtime handling, garbage collecting - or handling any other memory management. Note, a scheduler may also be - busy even if the operating system has scheduled out the scheduler - thread. -

- -

- Returns undefined if the system flag - scheduler_wall_time - is turned off. -

- -

The list of scheduler information is unsorted and may appear in different order - between calls. -

-

Using scheduler_wall_time to calculate scheduler utilization.

+ Information about each schedulers work time. + + +

Returns a list of tuples with + {SchedulerId, ActiveTime, + TotalTime}, where + SchedulerId is an integer ID of the scheduler, + ActiveTime is + the duration the scheduler has been busy, and + TotalTime is the total time duration since + 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 + calculate relative values for scheduler-use. + ActiveTime can never exceed + TotalTime.

+

The definition of a busy scheduler is when it is not idle + and is not scheduling (selecting) a process or port, + that is:

+ + Executing process code + Executing linked-in-driver or NIF code + Executing built-in-functions, 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.

+

Returns undefined if system flag + 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-use:

 > erlang:system_flag(scheduler_wall_time, true).
 false
 > Ts0 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
-ok
-
-

Some time later we will take another snapshot and calculate scheduler-utilization per scheduler.

+ok +

Some time later the user takes another snapshot and calculates + scheduler-use per scheduler, for example:

 > Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
 ok
@@ -5437,86 +5828,90 @@ ok
  {5,0.9717956667018103},
  {6,0.9739235846420741},
  {7,0.973237033077876},
- {8,0.9741297293248656}]
-
-

Using the same snapshots to calculate a total scheduler-utilization.

+ {8,0.9741297293248656}] +

Using the same snapshots to calculate a total scheduler-use:

 > {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
-
+0.9769136803764825 -

scheduler_wall_time is by default disabled. Use erlang:system_flag(scheduler_wall_time, true) to enable it.

+

scheduler_wall_time is by default disabled. To + enable it, use + erlang:system_flag(scheduler_wall_time, true).

+ - Information about wall-clock + Information about wall clock. -

wall_clock can be used in the same manner as +

Returns information about wall clock. wall_clock can + be used in the same manner as runtime, except that real time is measured as opposed to runtime or CPU time.

+ - Suspend a process + Suspends a process.

Increases the suspend count on the process identified by - Suspendee and puts it in the suspended state if it isn't - already in the suspended state. A suspended process will not be - scheduled for execution until the process has been resumed. -

- + 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 will not leave the suspended state until its suspend - count reach zero. The suspend count of Suspendee - is decreased when + 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 will automatically be + erlang:suspend_process(Suspendee). + All increased suspend + counts on other processes acquired by a process are automatically decreased when the process terminates.

- -

Currently the following options (Opts) are available:

+

The options (Opts) are as follows:

asynchronous A suspend request is sent to the process identified by - Suspendee. Suspendee will eventually suspend - unless it is resumed before it was able to suspend. The caller - of erlang:suspend_process/2 will return immediately, - regardless of whether the Suspendee has suspended yet - or not. Note that the point in time when the Suspendee - will actually suspend cannot be deduced from other events - in the system. The only guarantee given is that the - Suspendee will eventually suspend (unless it - is resumed). If the asynchronous option has not - been passed, the caller of erlang:suspend_process/2 will - be blocked until the Suspendee has actually suspended. + 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 will be suspended - unless the calling process already is suspending the - Suspendee. If unless_suspending is combined - with the asynchronous option, a suspend request will be - sent unless the calling process already is suspending the - Suspendee or if a suspend request already has been sent - and is in transit. If the calling process already is suspending - the Suspendee, or if combined with the asynchronous - option and a send request already is in transit, - false is returned and the suspend count on Suspendee - will remain 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 was increased, true is returned; otherwise, - false is returned.

- + Suspendee is increased, true + is returned, otherwise false.

This BIF is intended for debugging only.

@@ -5524,310 +5919,324 @@ ok badarg - If Suspendee isn't a process identifier. + If Suspendee is not a process identifier. badarg - If the process identified by Suspendee is same the 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 isn't 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 current system limit - is larger than 2 000 000 000 suspends, and it will never be less - than that. + 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.
+ - Suspend a process - -

Suspends the process identified by Suspendee. The - same as calling - erlang:suspend_process(Suspendee, []). For more information see the documentation of erlang:suspend_process/2. -

+ Suspends a process. + +

Suspends the process identified by + Suspendee. The same as calling + erlang:suspend_process(Suspendee, + []). + For more information, see + erlang:suspend_process/2.

This BIF is intended for debugging only.

+ - Set system flag backtrace_depth + Sets system flag backtrace_depth.

Sets the maximum depth of call stack back-traces in the exit reason element of 'EXIT' tuples.

Returns the old value of the flag.

+ + Sets system flag cpu_topology. - Set system flag cpu_topology

- This argument is deprecated and - scheduled for removal in erts-5.10/OTP-R16. Instead of using - this argument you are advised to use the erl command - line argument +sct. - When this argument has been removed a final CPU topology to use - will be determined at emulator boot time.

+ 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).

+

When this argument is removed, a final CPU topology + to use will be determined at emulator boot time.

-

Sets the user defined CpuTopology. The user defined - CPU topology will override any automatically detected - CPU topology. By passing undefined as CpuTopology - the system will revert back to the CPU topology automatically +

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. -

+ 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 will be sent a request - to rebind according to the new CPU topology. -

-

The user defined CPU topology can also be set by passing - the +sct command - line argument to erl. -

-

For information on the CpuTopology type - and more, see the documentation of - erlang:system_info(cpu_topology), - and the erl +sct - and +sbt - command line flags. -

+ 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).

+

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).

+ - Set system flag dirty CPU schedulers online + Sets system_flag_dirty_cpu_schedulers_online.

- Sets the amount of dirty CPU schedulers online. Valid range is - where N is the - lesser 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.

-

Note that the number of dirty CPU schedulers online may change if the number of - schedulers online changes. For example, if there are 12 schedulers and all are - online, and 6 dirty CPU schedulers, all online as well, 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.

-

Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in order - to try out the functionality.

-

For more information see +

The number of dirty CPU schedulers online can change if the + number of schedulers online changes. 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.

+

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_online).

+ - Set system flag fullsweep_after + Sets system flag fullsweep_after. -

Number is a non-negative integer which indicates +

Sets system flag fullsweep_after. + Number is a non-negative integer indicating how many times generational garbage collections can be done without forcing a fullsweep collection. The value - applies to new processes; processes already running are + applies to new processes, while processes already running are not affected.

Returns the old value of the flag.

In low-memory systems (especially without virtual - memory), setting the value to 0 can help to conserve + memory), setting the value to 0 can help to conserve memory.

-

An alternative way to set this value is through the - (operating system) environment variable - ERL_FULLSWEEP_AFTER.

+

This value can also be set through (OS) + environment variable ERL_FULLSWEEP_AFTER.

+ - 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 only - effects processes spawned after the change of - min_heap_size has been made. - The min_heap_size can be set for individual - processes by use of + Sets 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 + 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.

+ process_flag/2.

Returns the old value of the flag.

+ - Set system flag min_bin_vheap_size + Sets system flag min_bin_vheap_size. -

Sets the default minimum binary virtual heap size for processes. The - size is given in words. The new min_bin_vhheap_size only - effects processes spawned after the change of +

Sets the default minimum binary virtual heap size for + processes. The size is given in words. + The new min_bin_vhheap_size effects only + processes spawned after the change of min_bin_vhheap_size has been made. - The min_bin_vheap_size can be set for individual - processes by use of + min_bin_vheap_size can be set for individual + processes by using spawn_opt/N or - process_flag/2.

+ process_flag/2.

Returns the old value of the flag.

+ - Set system flag multi_scheduling + Sets system flag multi_scheduling.

If multi-scheduling is enabled, more than one scheduler thread is used by the emulator. Multi-scheduling can be - blocked. When multi-scheduling has been blocked, only - one scheduler thread will schedule Erlang processes.

-

If BlockState =:= block, multi-scheduling will - be blocked. If BlockState =:= unblock and no-one - else is blocking multi-scheduling and this process has - only blocked one time, multi-scheduling will be unblocked. - One process can block multi-scheduling multiple times. - If a process has blocked multiple times, it has to + blocked. When multi-scheduling is blocked, only + one scheduler thread schedules Erlang processes.

+

If BlockState =:= block, multi-scheduling is + blocked. If BlockState =:= unblock and no one + else blocks multi-scheduling, and this process has + blocked only once, multi-scheduling is unblocked.

+

One process can block 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 exits, it will release its + has blocked multi-scheduling exits, it releases its blocking of multi-scheduling.

The return values are disabled, blocked, or enabled. The returned value describes the state just after the call to erlang:system_flag(multi_scheduling, BlockState) - has been made. The return values are described in the - documentation of erlang:system_info(multi_scheduling).

-

NOTE: Blocking of multi-scheduling should normally - not be needed. If you feel that you need to - block multi-scheduling, think through the - problem at least a couple of times again. - Blocking multi-scheduling should only be used - as a last resort since it will most likely be - a very inefficient way to solve the - problem.

-

See also erlang:system_info(multi_scheduling), + has been made. For information about the return values, see + erlang:system_info(multi_scheduling).

+

Blocking of multi-scheduling is normally not needed. + If you feel that you need to block multi-scheduling, + 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(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 you are advised to use the erl command - line argument +sbt. - When this argument has been removed a final scheduler bind type - to use will be determined at emulator boot time.

+ 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 will be determined at emulator boot time.

Controls if and how schedulers are bound to logical processors.

-

When erlang:system_flag(scheduler_bind_type, How) is - called, an asynchronous signal is sent to all schedulers - online which causes them to try to bind or unbind as requested. - NOTE: If a scheduler fails to bind, this - will often be silently ignored. This since it isn't always - possible to verify valid logical processor identifiers. If - an error is reported, it will be reported to the - error_logger. If you want to verify that the - schedulers actually have bound as requested, call - erlang:system_info(scheduler_bindings). -

-

Schedulers can currently only be bound on newer Linux, +

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.

+

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).

+
+

Schedulers can be bound on newer Linux, Solaris, FreeBSD, and Windows systems, but more systems will be - supported in the future. -

+ supported in future releases.

In order for the runtime system to be able to bind schedulers, - the CPU topology needs to be known. If the runtime system fails - to automatically detect the CPU topology, it can be defined. + 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 - the erl +sct command - line flag. -

-

The runtime system will by default not bind schedulers - to logical processors. -

-

NOTE: If the Erlang runtime system is the only - operating system process that binds threads to logical processors, - this improves the performance of the runtime system. However, - if other operating system processes (as for example another Erlang - runtime system) also bind threads to logical processors, there - might be a performance penalty instead. In some cases this - performance penalty might be severe. If this is the case, you - are advised to not bind the schedulers.

-

Schedulers can be bound in different ways. The How - argument determines how schedulers are bound. How can - currently be one of:

+ command-line flag +sct + in erl(1).

+

The runtime system does by default not bind schedulers + 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.

+
+

Schedulers can be bound in different ways. Argument + How determines how schedulers are + bound and can be any of the following:

unbound -

Same as the erl command line argument - +sbt u. +

Same as command-line argument + +sbt u in erl(1).

no_spread -

Same as the erl command line argument - +sbt ns. +

Same as command-line argument + +sbt ns in erl(1).

thread_spread -

Same as the erl command line argument - +sbt ts. +

Same as command-line argument + +sbt ts in erl(1).

processor_spread -

Same as the erl command line argument - +sbt ps. +

Same as command-line argument + +sbt ps in erl(1).

spread -

Same as the erl command line argument - +sbt s. +

Same as command-line argument + +sbt s in erl(1).

no_node_thread_spread -

Same as the erl command line argument - +sbt nnts. +

Same as command-line argument + +sbt nnts in erl(1).

no_node_processor_spread -

Same as the erl command line argument - +sbt nnps. +

Same as command-line argument + +sbt nnps in erl(1).

thread_no_node_processor_spread -

Same as the erl command line argument - +sbt tnnps. +

Same as command-line argument + +sbt tnnps in erl(1).

default_bind -

Same as the erl command line argument - +sbt db. +

Same as command-line argument + +sbt db in erl(1).

-

The value returned equals How before the - scheduler_bind_type flag was changed.

-

Failure:

+

The returned value equals How before flag + scheduler_bind_type was changed.

+

Failures:

notsup @@ -5835,80 +6244,82 @@ ok badarg -

If How isn't one of the documented alternatives.

+

If How is not one of the documented + alternatives.

badarg -

If no CPU topology information is available.

+

If CPU topology information is unavailable.

The scheduler bind type can also be set by passing - the +sbt command - line argument to erl. -

+ command-line argument + +sbt to erl(1).

For more information, see erlang:system_info(scheduler_bind_type), erlang:system_info(scheduler_bindings), - the erl +sbt - and +sct command line - flags. -

+ as well as command-line flags + +sbt + and +sct + in erl(1).

+ - Set system flag scheduler_wall_time + Sets system flag scheduler_wall_time.

- Turns on/off scheduler wall time measurements.

-

For more information see, - erlang:statistics(scheduler_wall_time). -

+ Turns on or off scheduler wall time measurements.

+

For more information, see + erlang:statistics(scheduler_wall_time).

+ - Set system flag schedulers_online + Sets system flag schedulers_online.

- Sets the amount of schedulers online. Valid range is - . -

+ Sets the number of schedulers online. Range is + .

Returns the old value of the flag.

-

Note that 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 there are 12 schedulers and all are - online, and 6 dirty CPU schedulers, all online as well, 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), +

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.

+

For more information, see + erlang:system_info(schedulers) and - erlang:system_info(schedulers_online). -

+ erlang:system_info(schedulers_online).

+ - Set system flag trace_control_word + Sets system flag trace_control_word. -

Sets the value of the node's trace control word to - TCW. TCW should be an unsigned integer. For - more information see documentation of the +

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 - function in the match specification documentation in the - ERTS User's Guide.

+ in Section "Match Specifications in Erlang" in the + User's Guide.

Returns the old value of the flag.

- + Finalize the Time Offset -

Finalizes the time offset +

+ Finalizes the time offset when the single time warp mode is being used. If another time warp mode than the "single time warp mode" is used, the time offset state will be left @@ -5932,71 +6343,74 @@ ok + + Information about the system allocators. - Information about the allocators of the system -

- Returns various information about the - allocators of the + +

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

+ - allocated_areas + allocated_areas

Returns a list of tuples with information about miscellaneous allocated memory areas.

-

Each tuple contains an atom describing type of memory as - first element and amount of allocated memory in bytes as - second element. In those cases when there is information - present about allocated and used memory, a third element - is present. This third element contains the amount of +

Each tuple contains an atom describing the type of + memory as first element and the amount of allocated + memory in bytes as second element. When information + about allocated and used memory is present, also a + third element is present, containing the amount of used memory in bytes.

erlang:system_info(allocated_areas) is intended - for debugging, and the content is highly implementation - dependent. The content of the results will therefore - change when needed without prior notice.

-

Note: The sum of these values is not + for debugging, and the content is highly + implementation-dependent. The content of the results + 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. If you are interested - in the total amount of memory allocated by the emulator - see erlang:memory/0,1.

+ areas are not part of the result. For information about + the total amount of memory allocated by the emulator, see + erlang:memory/0,1.

- allocator + allocator -

Returns {Allocator, Version, Features, Settings}.

-

Explanation:

+ +

Returns {Allocator, Version, + Features, Settings, where:

-

Allocator corresponds to the malloc() - implementation used. If Allocator equals +

Allocator corresponds to the + malloc() implementation used. If + Allocator equals undefined, the malloc() implementation - used could not be identified. Currently - glibc can be identified.

+ used cannot be identified. glibc can be + identified.

-

Version is a list of integers (but not a - string) representing the version of +

Version is a list of integers + (but not a string) representing the version of the malloc() implementation used.

-

Features is a list of atoms representing - allocation features used.

+

Features is a list of atoms + representing the allocation features used.

-

Settings is a list of subsystems, their - configurable parameters, and used values. Settings - may differ between different combinations of +

Settings is a list of subsystems, + their configurable parameters, and used values. Settings + can differ between different combinations of platforms, allocators, and allocation features. Memory sizes are given in bytes.

@@ -6004,59 +6418,63 @@ ok

See also "System Flags Effecting erts_alloc" in erts_alloc(3).

- alloc_util_allocators + 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 the - "the - alloc_util framework" section in the - erts_alloc(3) documentation. -

+ +

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} + {allocator, Alloc} +

Returns information about the specified allocator. - As of erts version 5.6.1 the return value is a list - of {instance, InstanceNo, InstanceInfo} tuples + 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. As of erts version - 5.10.4 the returned list when calling + a specific instance of the allocator. As from + ERTS 5.10.4, the returned list when calling erlang:system_info({allocator, mseg_alloc}) also - include an {erts_mmap, _} tuple as one element - in the list. - If Alloc is not a recognized allocator, - undefined is returned. If Alloc is disabled, + includes an {erts_mmap, _} tuple as one element + in the list. If Alloc is not a + recognized allocator, undefined is returned. + If Alloc is disabled, false is returned.

-

Note: The information returned is highly - implementation dependent and may be changed, or removed +

Notice that the information returned is highly + implementation-dependent and can be changed or removed at any time without prior notice. It was initially intended as a tool when developing new allocators, but - since it might be of interest for others it has been + as it can be of interest for others it has been briefly documented.

The recognized allocators are listed in erts_alloc(3). After reading the erts_alloc(3) documentation, the returned information - should more or less speak for itself. But it can be worth + 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 - value is calls. mbcs, and sbcs are - abbreviations for, respectively, multi-block carriers, and - single-block carriers. Sizes are presented in bytes. When - it is not a size that is presented, it is the amount of - something. Sizes and amounts are often presented by three - values, the first is current value, the second is maximum - value since the last call to - erlang:system_info({allocator, Alloc}), and - the third is maximum value since the emulator was started. - If only one value is present, it is the current value. + values, the first value is giga calls, and the second + value is calls. mbcs and sbcs denote + multi-block carriers, and single-block carriers, + respectively. Sizes are presented in bytes. When a + size is not presented, it is the amount of something. + Sizes and amounts are often presented by three values:

+ + The first is the current value. + The second is the maximum value since the last call + to erlang:system_info({allocator, Alloc}). + The third is the maximum value since the emulator + was started. + +

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 memory pool size and - the second value used memory size.

+ values. The first value is the memory pool size and + the second value is the used memory size.

- {allocator_sizes, Alloc} + {allocator_sizes, Alloc} +

Returns various size information for the specified allocator. The information returned is a subset of the information returned by @@ -6066,103 +6484,103 @@ ok + + Information about the CPU topology of the system. - All LevelEntrys of a list must contain the same LevelTag, except on the top level where both node and - processor LevelTags may co-exist. + processor LevelTags can coexist. - {LevelTag, SubLevel} == {LevelTag, [], SubLevel} + {LevelTag, + SubLevel} == {LevelTag, [], + SubLevel} - More LevelTags may be introduced in the future. + More LevelTags can be introduced in a + future release. - The info_list() may be extended in the future. + The info_list() can be extended in a future release. - Information about the CPU topology of the system -

Returns various information about the - CPU topology - of the current system - (emulator) as specified by Item:

+ + +

Returns various information about the CPU topology of + the current system (emulator) as specified by + Item:

cpu_topology -

Returns the CpuTopology which currently is used by the - emulator. The CPU topology is used when binding schedulers +

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 + 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 NUMA (non-uniform memory access) - nodes, and thread refers to hardware threads - (e.g. Intels hyper-threads).

-

A level in the CpuTopology term can be omitted if - only one entry exists and the InfoList is empty. -

+

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 either processor - or node. processor can either be on the + 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 either be on the top level or a sub level to + 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 - and only one NUMA node. Cache hierarchy is not part of - the CpuTopology type yet, but will be in the - future. Other things may also make it into the CPU - topology in the future. In other words, expect the - CpuTopology type to change. -

-
- {cpu_topology, defined} - -

Returns the user defined CpuTopology. For more - information see the documentation of - the erl +sct command - line flag, and the documentation of the - cpu_topology - argument. -

-
- {cpu_topology, detected} - -

Returns the automatically detected CpuTopology. The - emulator currently only 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 the documentation of the - cpu_topology - argument. -

+ 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.

+
+ {cpu_topology, defined} + + +

Returns the user-defined CpuTopology. + For more information, see command-line flag + +sct in + erl(1) and argument + cpu_topology.

+
+ {cpu_topology, detected} + + +

Returns the automatically detected + CpuTopology. 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, used} -

Returns the CpuTopology which is used by the - emulator. For more information see the - documentation of the - cpu_topology - argument. -

+

Returns CpuTopology used by the emulator. + For more information, see argument + cpu_topology.

+ @@ -6224,7 +6642,7 @@ ok - Information about the system + Information about the system.

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

@@ -6241,8 +6659,7 @@ ok Other possible return values are debug, purify, quantify, purecov, gcov, valgrind, gprof, and lcnt. Possible return values - may be added and/or removed at any time without prior notice. -

+ can be added or removed at any time without prior notice.

c_compiler_used @@ -6250,26 +6667,25 @@ ok 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. -

+ version of the compiler, or undefined if unknown.

check_io

Returns a list containing miscellaneous information - regarding the emulators internal I/O checking. Note, - the content of the returned list may vary between - platforms and over time. The only thing guaranteed is + about the emulators internal I/O checking. Notice that + the content of the returned list can vary between + platforms and over time. It is only guaranteed that a list is returned.

compat_rel

Returns the compatibility mode of the local node as an integer. The integer returned represents the - Erlang/OTP release which the current emulator has been + 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 the command - line flag +R, see - erl(1).

+ mode can be configured at startup by using command-line flag + +R in + erl(1).

cpu_topology @@ -6282,19 +6698,19 @@ ok creation of a node is stored in process identifiers, port identifiers, and references. This makes it (to some extent) possible to distinguish between identifiers from - different incarnations of a node. Currently valid - creations are integers in the range 1..3, but this may - (probably will) change in the future. If the node is not - alive, 0 is returned.

+ different incarnations of a node. The valid + creations are integers in the range 1..3, but this will + probably change in a future release. If the node is not + alive, 0 is returned.

debug_compiled

Returns true if the emulator has been debug - compiled; otherwise, false. -

+ compiled, otherwise false.

- delayed_node_table_gc + delayed_node_table_gc +

Returns the amount of time in seconds that garbage collection of an entry in a node table will be delayed. This limit can be set on startup by passing the @@ -6302,124 +6718,130 @@ ok flag to erl. For more information see the documentation of the command line flag.

- dirty_cpu_schedulers + 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, and BIFs - that cannot be managed cleanly by the emulator's normal schedulers. -

-

The number of dirty CPU scheduler threads is determined at emulator - boot time and cannot be changed after that. The number of dirty CPU - scheduler threads online can however be changed at any time. The number of - dirty CPU schedulers can be set on startup by passing - the +SDcpu or - +SDPcpu command line flags, - see erl(1). -

-

Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in - order to try out the functionality.

-

See also erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline), + native functions, such as NIFs, linked-in driver code, + and BIFs that cannot be managed cleanly by the normal + emulator schedulers.

+

The number of dirty CPU scheduler threads is determined + at emulator boot time and cannot be changed after that. + However, the number of dirty CPU scheduler threads online + 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 + erl(1).

+

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).

- dirty_cpu_schedulers_online - -

Returns the number of dirty CPU schedulers online. The return value - satisfies the following relationship: - , where N is - the lesser of the return values of erlang:system_info(dirty_cpu_schedulers) and - erlang:system_info(schedulers_online). -

-

The number of dirty CPU schedulers online can be set on startup by passing - the +SDcpu command line flag, see - erl(1). -

-

Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in - order to try out the functionality.

+ dirty_cpu_schedulers_online + + +

Returns the number of dirty CPU schedulers online. + The return value satisfies + , + where N is the smallest of the return values of + erlang:system_info(dirty_cpu_schedulers) and + erlang:system_info(schedulers_online).

+

The number of dirty CPU schedulers online can be set at + startup by passing command-line flag + +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). -

-
- 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 that - cannot be managed cleanly by the emulator's normal schedulers. -

-

This value can be set on startup by passing - the +SDio command line flag, see - erl(1). -

-

Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in - order to try out the functionality.

+ 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 + 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_cpu_schedulers_online), and - erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline). -

+ 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 the "How to interpret the Erlang crash dumps" - chapter in the ERTS User's Guide.

+ information, see Section + "How to interpret the Erlang crash dumps" + in the User's Guide.

- dist_buf_busy_limit + dist_buf_busy_limit +

Returns the value of the distribution buffer busy limit - in bytes. This limit can be set on startup by passing the - +zdbbl command line - flag to erl.

+ in bytes. This limit can be set at startup by passing + command-line flag + +zdbbl + to erl.

dist_ctrl

Returns a list of tuples - {Node, ControllingEntity}, one entry for each - connected remote node. The Node is the name of the - node and the ControllingEntity is the port or pid - responsible for the communication to that node. More - specifically, the ControllingEntity for nodes - connected via TCP/IP (the normal case) is the socket - actually used in communication with the specific node.

+ {Node, ControllingEntity}, + one entry for each connected remote node. + Node is the node name + and ControllingEntity is the port or process + identifier responsible for the communication to that node. + More specifically, ControllingEntity for + nodes connected through TCP/IP (the normal case) is the socket + used in communication with the specific node.

driver_version -

Returns a string containing the erlang driver version - used by the runtime system. It will be on the form +

Returns a string containing the Erlang driver version + used by the runtime system. It has the form "<major ver>.<minor ver>".

dynamic_trace

Returns an atom describing the dynamic trace framework - compiled into the virtual machine. It can currently be either - dtrace, systemtap or none. For a - commercial or standard build, this is always none, - the other return values indicate a custom configuration - (e.g. ./configure --with-dynamic-trace=dtrace). See - the dyntrace - manual page and the + 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 for more information - about dynamic tracing.

+ Erlang source code top directory.

dynamic_trace_probes -

Returns a boolean() indicating if dynamic trace probes - (either dtrace or systemtap) are built into the - emulator. This can only be true if the virtual - machine was built for dynamic tracing - (i.e. system_info(dynamic_trace) returns +

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).

end_time @@ -6433,8 +6855,8 @@ ok elib_malloc

This option will be removed in a future release. - The return value will always be false since - 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 @@ -6448,27 +6870,28 @@ ok ets_limit -

Returns the maximum number of ETS tables allowed. This limit - can be increased on startup by passing the +e command line flag to - erl or by setting the environment variable - ERL_MAX_ETS_TABLES before starting the Erlang runtime - system.

+

Returns the maximum number of ETS tables allowed. This + limit can be increased at startup by passing + command-line flag + +e to + erl(1) or by setting environment variable + ERL_MAX_ETS_TABLES before starting the Erlang + runtime system.

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 below.

+

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

Returns a list describing the default garbage collection settings. A process spawned on the local node by a - spawn or spawn_link will use these + spawn or spawn_link uses these garbage collection settings. The default settings can be - changed by use of + changed by using system_flag/2. spawn_opt/4 can spawn a process that does not use the default @@ -6482,8 +6905,8 @@ ok heap_type -

Returns the heap type used by the current emulator. - Currently only the following heap type exists:

+

Returns the heap type used by the current emulator. One + heap type exists:

private @@ -6498,51 +6921,51 @@ ok

Returns a binary containing a string of miscellaneous system information formatted as in Erlang crash dumps. - For more information see the - "How to interpret the Erlang crash dumps" chapter in the ERTS - User's Guide.

+ For more information, see Section + "How to interpret the Erlang crash dumps" + in the User's Guide.

kernel_poll

Returns true if the emulator uses some kind of - kernel-poll implementation; otherwise, false.

+ kernel-poll implementation, otherwise false.

loaded

Returns a binary containing a string of loaded module information formatted as in Erlang crash dumps. For more - information see the "How to interpret the Erlang crash dumps" chapter - in the ERTS 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 - on the system. The return value is either an integer, or - the atom unknown if the emulator wasn't able to - detect 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.

- 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 wasn't - able to detect logical processors available. The number - of logical processors available is less than or equal to - the number of logical - processors online. -

+ +

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.

- 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 wasn't able to + 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. -

+ logical processors configured.

machine @@ -6550,27 +6973,30 @@ ok min_heap_size -

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

+

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

min_bin_vheap_size -

Returns {min_bin_vheap_size, MinBinVHeapSize} where MinBinVHeapSize is the current system wide +

Returns {min_bin_vheap_size, + MinBinVHeapSize}, where + MinBinVHeapSize is the current system-wide minimum binary virtual heap size for spawned processes.

modified_timing_level -

Returns the modified timing level (an integer) if - modified timing has been enabled; otherwise, - undefined. See the +T command line flag - in the documentation of the - erl(1) - command for more information on modified timing.

+

Returns the modified timing-level (an integer) if + modified timing is enabled, otherwise, undefined. + For more information about modified timing, see + command-line flag + +T + in erl(1)

- multi_scheduling + multi_scheduling -

Returns disabled, blocked, or enabled. - A description of the return values:

+ +

Returns disabled, blocked, or enabled:

disabled @@ -6581,32 +7007,38 @@ ok blocked

The emulator has more than one scheduler thread, - but all scheduler threads but one have been blocked, - i.e., only one scheduler thread will schedule - Erlang processes and execute Erlang code.

+ but all scheduler threads except one are blocked, + that is, only one scheduler thread schedules + Erlang processes and executes Erlang code.

enabled

The emulator has more than one scheduler thread, - and no scheduler threads have been blocked, i.e., - all available scheduler threads will schedule + and no scheduler threads are blocked, that is, + all available scheduler threads schedule Erlang processes and execute Erlang code.

-

See also erlang:system_flag(multi_scheduling, BlockState), - erlang:system_info(multi_scheduling_blockers), and +

See also + erlang:system_flag(multi_scheduling, BlockState), + erlang:system_info(multi_scheduling_blockers), + and erlang:system_info(schedulers).

- multi_scheduling_blockers + multi_scheduling_blockers -

Returns a list of PIDs when multi-scheduling - is blocked; otherwise, the empty list. The PIDs - in the list is PIDs of the processes currently - blocking multi-scheduling. A PID will only be - present once in the list, even if the corresponding + +

Returns a list of Pids when + multi-scheduling is blocked, otherwise the empty list is + returned. The Pids in the list are + Pids of the processes currently + blocking multi-scheduling. A Pid is + present 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), and +

See also + erlang:system_flag(multi_scheduling, BlockState), + erlang:system_info(multi_scheduling), + and erlang:system_info(schedulers).

nif_version @@ -6614,19 +7046,19 @@ ok

Returns a string containing the erlang NIF version used by the runtime system. It will be on the form "<major ver>.<minor ver>".

- otp_release + otp_release +

Returns a string containing the OTP release number of the - OTP release that the currently executing ERTS application is + OTP release that the currently executing ERTS application is part of.

-

As of OTP release 17, the OTP release number corresponds to - the major OTP version number. There is no - erlang:system_info() argument giving the exact OTP - version. This since the exact OTP version in the general case - is hard to determine. For more information see - the - documentation of versions in the system principles - guide.

+

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 @@ -6745,130 +7177,137 @@ ok time unit.

- port_parallelism -

Returns the default port parallelism scheduling hint used. - For more information see the - +spp command line argument - of 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 local node as an integer. The same value as - length(erlang:ports()) returns, but more efficient.

+

Returns the number of ports currently existing at the + local node. The value is given as an integer. This is + the same value as returned by + length(erlang:ports()), but more efficient.

- port_limit + port_limit +

Returns the maximum number of simultaneously existing - ports at the local node as an integer. This limit - can be configured at startup by using the - +Q - command line flag of - erl(1).

+ ports at the local node as an integer. This limit can be + configured at startup by using command-line flag + +Q in erl(1).

process_count -

Returns the number of processes currently existing at - the local node as an integer. The same value as - length(processes()) returns, but more efficient.

+

Returns the number of processes currently existing at the + local node. The value is given as an integer. This is + the same value as returned by + length(processes()), but more efficient.

- process_limit + process_limit +

Returns the maximum number of simultaneously existing - processes at the local node as an integer. This limit - can be configured at startup by using the - +P - command line flag of - erl(1).

+ 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).

procs

Returns a binary containing a string of process and port information formatted as in Erlang crash dumps. For more - information see the "How to interpret the Erlang crash dumps" chapter - in the ERTS User's Guide.

+ information, see Section + "How to interpret the Erlang crash dumps" + in the User's Guide.

- scheduler_bind_type + scheduler_bind_type -

Returns information on how user has requested + +

Returns information about how the user has requested schedulers to be bound or not bound.

-

NOTE: Even though user has requested - schedulers to be bound, they might have silently failed - to bind. In order to inspect actual scheduler bindings call - erlang:system_info(scheduler_bindings). -

-

For more information, see - the erl +sbt - command line argument, and - erlang:system_info(scheduler_bindings). -

-
- scheduler_bindings - -

Returns information on currently used scheduler +

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).

+
+ scheduler_bindings + + +

Returns information about the currently used scheduler bindings.

A tuple of a size equal to - erlang:system_info(schedulers) is returned. The elements of the tuple are integers + 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. E.g., if the schedulers have been bound, + N. For example, if the schedulers are bound, element(erlang:system_info(scheduler_id), - erlang:system_info(scheduler_bindings)) will return + erlang:system_info(scheduler_bindings)) returns the identifier of the logical processor that the calling - process is executing on. -

-

Note that only schedulers online can be bound to logical + process is executing on.

+

Notice that only schedulers online can be bound to logical processors.

-

For more information, see - the erl +sbt - command line argument, +

For more information, see command-line argument + +sbt + in erl(1) and erlang:system_info(schedulers_online).

- scheduler_id + scheduler_id -

Returns the scheduler id (SchedulerId) of the + +

Returns the scheduler ID (SchedulerId) of the scheduler thread that the calling process is executing - on. SchedulerId is a positive integer; where - . See also + on. SchedulerId is a positive integer, + where + . + See also erlang:system_info(schedulers).

- 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 - and Erlang linked in driver code.

+ and Erlang linked-in driver code.

The number of scheduler threads is determined at - emulator boot time and cannot be changed after - that. The amount of schedulers online can - however be changed at any time.

-

See also erlang:system_flag(schedulers_online, SchedulersOnline), + emulator boot time and cannot be changed later. + However, the number of schedulers online can + 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), and - and erlang:system_info(multi_scheduling_blockers).

+ erlang:system_info(multi_scheduling), + and + erlang:system_info(multi_scheduling_blockers).

- schedulers_online + schedulers_online -

Returns the amount of schedulers online. The scheduler - identifiers of schedulers online satisfy the following - relationship: - . -

+ +

Returns the number of schedulers online. The scheduler + identifiers of schedulers online satisfy the relationship + .

For more information, see - erlang:system_info(schedulers), + erlang:system_info(schedulers) and - erlang:system_flag(schedulers_online, SchedulersOnline). -

- + erlang:system_flag(schedulers_online, SchedulersOnline).

+
smp_support

Returns true if the emulator has been compiled - with smp support; otherwise, false.

+ with SMP support, otherwise false is returned.

start_time

The Erlang monotonic @@ -6880,7 +7319,7 @@ ok 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 @@ -6890,23 +7329,28 @@ ok threads

Returns true if the emulator has been compiled - with thread support; otherwise, false is - returned.

+ with thread support, otherwise false is returned.

- thread_pool_size + thread_pool_size +

Returns the number of async threads in the async thread pool used for asynchronous driver calls - (driver_async()) - as an integer.

+ (driver_async()). + The value is given as an integer.

- time_correction -

Returns a boolean value indicating whether + + time_correction + + +

Returns a boolean value indicating whether time correction is enabled or not.

- time_offset -

Returns the state of the time offset:

+ time_offset + + +

Returns the state of the time offset:

preliminary

The time offset is preliminary, and will be changed @@ -6949,8 +7393,9 @@ ok time warp mode is being used.

- tolerant_timeofday + 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 @@ -6961,89 +7406,91 @@ ok trace_control_word -

Returns the value of the node's trace control word. - For more information see documentation of the function - get_tcw in "Match Specifications in Erlang", - ERTS User's Guide.

+

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.

- update_cpu_info + update_cpu_info -

The runtime system rereads the CPU information available and - updates its internally stored information about the - detected CPU - topology and the amount of logical processors + +

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 is returned. If the CPU information has changed + 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 amount - of schedulers online. You typically want to have as - many schedulers online as - logical processors - available. -

+ adjust the + number of schedulers online. You typically want + to have as many schedulers online as + logical + processors available.

- version + version +

Returns a string containing the version number of the emulator.

wordsize -

Same as {wordsize, internal}.

+

Same as {wordsize, internal}.

{wordsize, internal}

Returns the size of Erlang term words in bytes as an - integer, i.e. on a 32-bit architecture 4 is returned, - and on a pure 64-bit architecture 8 is returned. On a + integer, that is, 4 is returned on a 32-bit architecture, + and 8 is returned on a pure 64-bit architecture. On a halfword 64-bit emulator, 4 is returned, as the Erlang - terms are stored using a virtual wordsize of half the - system's wordsize.

+ terms are stored using a virtual word size of half the + system word size.

{wordsize, external} -

Returns the true wordsize of the emulator, i.e. the size - of a pointer, in bytes as an integer. On a pure 32-bit - architecture 4 is returned, on both a halfword and pure +

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.

-

The scheduler argument has changed name to - scheduler_id. This in order to avoid mixup with - the schedulers argument. The scheduler - argument was introduced in ERTS version 5.5 and renamed - in ERTS version 5.5.1.

+

Argument scheduler has changed name to + scheduler_id to avoid mix up with argument + schedulers. Argument scheduler was + introduced in ERTS 5.5 and renamed in + ERTS 5.5.1.

+ Current system performance monitoring settings. - Current system performance monitoring settings

Returns the current system monitoring settings set by erlang:system_monitor/2 - as {MonitorPid, Options}, or undefined if there - are no settings. The order of the options may be different + as {MonitorPid, Options}, + or undefined if there + are no settings. 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 the argument undefined, all +

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 +

Calling the function with {MonitorPid, + Options} as argument is the same as calling erlang:system_monitor(MonitorPid, Options).

Returns the previous system monitor settings just like erlang:system_monitor/0.

@@ -7052,102 +7499,101 @@ ok + Sets system performance monitoring options. - Set system performance monitoring options -

Sets system performance monitoring options. MonitorPid - is a local pid that will receive system monitor messages, and - the second argument is a list of monitoring options:

+

Sets the system performance monitoring options. + MonitorPid is a local process identifier (pid) + receiving system monitor messages. The + second argument is a list of monitoring options:

{long_gc, Time}

If a garbage collection in the system takes at least - Time wallclock milliseconds, a message + Time wall clock milliseconds, a message {monitor, GcPid, long_gc, Info} is sent to - MonitorPid. GcPid is the pid that was - garbage collected and Info is a list of two-element - tuples describing the result of the garbage collection. - One of the tuples is {timeout, GcTime} where - GcTime is the actual time for the garbage + MonitorPid. GcPid is the pid that + was garbage collected. Info is a list of two-element + tuples describing the result of the garbage collection.

+

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, - stack_size, mbuf_size, old_heap_size, - and old_heap_block_size. These tuples are - explained in the documentation of the - gc_start - trace message (see - erlang:trace/3). - New tuples may be added, and the order of the tuples in - the Info list may be changed at any time without prior - notice. -

+ 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_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.

{long_schedule, Time} -

If a process or port in the system runs uninterrupted +

If a process or port in the system runs uninterrupted for at least Time wall clock milliseconds, a message {monitor, PidOrPort, long_schedule, Info} is sent to MonitorPid. PidOrPort is the - process or port that was running and Info is a - list of two-element tuples describing the event. In case - of a pid(), the tuples {timeout, Millis}, - {in, Location} and {out, Location} will be + process or port that was running. Info is a + list of two-element tuples describing the event.

+

If a pid(), the tuples {timeout, Millis}, + {in, Location}, and {out, Location} are present, where Location is either an MFA ({Module, Function, Arity}) describing the function where the process was scheduled in/out, or the - atom undefined. In case of a port(), the + atom undefined.

+

If a port(), the tuples {timeout, Millis} and {port_op,Op} - will be present. Op will be one of proc_sig, + are present. Op is one of proc_sig, timeout, input, output, - event or dist_cmd, depending on which - driver callback was executing. proc_sig is an - internal operation and should never appear, while the + event, or dist_cmd, depending on which + driver callback was executing.

+

proc_sig is an + internal operation and is never to appear, while the others represent the corresponding driver callbacks timeout, ready_input, ready_output, - event and finally outputv (when the port - is used by distribution). The Millis value in - the timeout tuple will tell you the actual - uninterrupted execution time of the process or port, - which will always be >= the Time value - supplied when starting the trace. New tuples may be - added to the Info list in the future, and the - order of the tuples in the list may be changed at any - time without prior notice. -

-

This can be used to detect problems with NIF's or - drivers that take too long to execute. Generally, 1 ms - is considered a good maximum time for a driver callback - or a NIF. However, a time sharing system should usually - consider everything below 100 ms as "possible" and - fairly "normal". Schedule times above that might however - indicate swapping or a NIF/driver that is - misbehaving. Misbehaving NIF's and drivers could cause - bad resource utilization and bad overall performance of - the system.

+ event, and outputv (when the port + is used by distribution). Value Millis in + the timeout tuple 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 + added to the Info list in a future release. The + order of the tuples in the list can be changed at any + time without prior notice.

+

This can be used to detect problems with NIFs or + 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 + fairly "normal". However, longer schedule times can + indicate swapping or a misbehaving NIF/driver. + Misbehaving NIFs and drivers can cause bad resource + use and bad overall system performance.

{large_heap, Size}

If a garbage collection in the system results in the allocated size of a heap being at least Size words, a message {monitor, GcPid, large_heap, Info} - is sent to MonitorPid. GcPid and Info - are the same as for long_gc above, except that - the tuple tagged with timeout is not present. - Note: As of erts version 5.6 the monitor message - is sent if the sum of the sizes of all memory blocks allocated - for all heap generations is equal to or larger than Size. - Previously the monitor message was sent if the memory block - allocated for the youngest generation was equal to or larger - than Size. -

+ is sent to MonitorPid. + GcPid and Info + are the same as for long_gc earlier, except that + the tuple tagged with timeout is not present.

+

As of ERTS 5.6, the monitor message is sent + if the sum of the sizes of all memory blocks allocated + for all heap generations is equal to or higher than Size. + Previously the monitor message was sent if the memory block + allocated for the youngest generation was equal to or higher + than Size.

busy_port

If a process in the system gets suspended because it sends to a busy port, a message {monitor, SusPid, busy_port, Port} is sent to - MonitorPid. SusPid is the pid that got - suspended when sending to Port.

+ MonitorPid. SusPid is the pid + that got suspended when sending to Port.

busy_dist_port @@ -7155,8 +7601,8 @@ ok sends to a process on a remote node whose inter-node communication was handled by a busy port, a message {monitor, SusPid, busy_dist_port, Port} is sent to - MonitorPid. SusPid is the pid that got - suspended when sending through the inter-node + MonitorPid. SusPid is the pid + that got suspended when sending through the inter-node communication port Port.

@@ -7165,74 +7611,77 @@ ok

If a monitoring process gets so large that it itself starts to cause system monitor messages when garbage - collecting, the messages will enlarge the process's + collecting, the messages enlarge the process message queue and probably make the problem worse.

Keep the monitoring process neat and do not set the system monitor limits too tight.

-

Failure: badarg if MonitorPid does not exist or is not a local process.

+

Failures:

+ + badarg + If MonitorPid does not exist. + badarg + If MonitorPid is not a local process. +
+ Current system profiling settings. - Current system profiling settings

Returns the current system profiling settings set by erlang:system_profile/2 - as {ProfilerPid, Options}, or undefined if there - are no settings. The order of the options may be different + as {ProfilerPid, Options}, + or undefined if there + are no settings. The order of the options can be different from the one that was set.

+ Current system profiling settings. - Current system profiling settings

Sets system profiler options. ProfilerPid - is a local pid or port that will receive profiling messages. The - receiver is excluded from all profiling. + is a local process identifier (pid) or port receiving profiling + messages. The receiver is excluded from all profiling. The second argument is a list of profiling options:

exclusive -

- If a synchronous call to a port from a process is done, the +

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 subsequently active when the port - callback returns. -

+ inactive, and later active when the port + callback returns.

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 is reinserted into the - run queue after having been preemptively scheduled out will 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-emptively + scheduled out 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.

-

erlang:system_profile is considered experimental and - its behaviour may change in the future.

+

erlang:system_profile is considered experimental + and its behavior can change in a future release.

@@ -7276,11 +7725,12 @@ ok
- Encode a term to an Erlang external term format binary + Encodes a term to an Erlang external term format binary. -

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

-

This can be used for a variety of purposes, for example +

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

+

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

@@ -7288,67 +7738,81 @@ ok binary_to_term/1.

+ - Encode a term to en Erlang external term format binary - -

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

-

If the option compressed is provided, the external - term format will be compressed. The compressed format is - automatically recognized by binary_to_term/1 in R7B and later.

-

It is also possible to specify a compression level by giving - the option {compressed, Level}, where Level is an - integer from 0 through 9. 0 means that no compression - will be done (it is the same as not giving any compressed option); - 1 will take the least time but may not compress as well as - the higher levels; 9 will take the most time and may produce - a smaller result. Note the "mays" in the preceding sentence; depending - on the input term, level 9 compression may or may not produce a smaller - result than level 1 compression.

-

Currently, compressed gives the same result as - {compressed, 6}.

-

The option {minor_version, Version} can be use to control - some details of the encoding. This option was - introduced in R11B-4. Currently, the allowed values for Version - are 0 and 1.

-

{minor_version, 1} is since 17.0 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). binary_to_term/1 - in R11B-4 and later is able decode this representation.

-

{minor_version, 0} meaning that floats - will be encoded using a textual representation; this option is useful if - you want to ensure that releases prior to R11B-4 can decode resulting + Encodes 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.

+

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 cannot compress, + as well as the higher levels. + 9 - Takes most time and can produce a smaller + result. Notice "can" 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. + +

compressed and {compressed, 6} give the same + result.

+

Option {minor_version, Version} + can be used to control + some encoding details. This option was introduced in OTP R11B-4. + The valid values for Version are + 0 and 1.

+

As from 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 + 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 binary.

See also binary_to_term/1.

+ - Throw an exception + Throws an exception.

A non-local return from a function. If evaluated within a - catch, catch will return the value Any.

+ catch, catch returns value Any.

+

Example:

 > catch throw({hello, there}).
 {hello,there}

Failure: nocatch if not evaluated within a catch.

+ - Current time + Current time.

Returns the current time as {Hour, Minute, Second}.

-

The time zone and daylight saving time correction depend on +

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

+

Example:

 > time().
 {9,42,44}
+ Current time offset @@ -7433,147 +7897,150 @@ timestamp() -> - Tail of a list + Tail of a list. -

Returns the tail of List, that is, the list minus - the first element.

+

Returns the tail of List, that is, + the list minus the first element, for example:

 > tl([geesties, guilies, beasties]).
 [guilies, beasties]

Allowed in guard tests.

-

Failure: badarg if List is the empty list [].

+

Failure: badarg if List + is the empty list [].

+ + Sets trace flags for a process or processes. - Set trace flags for a process or processes

Turns on (if How == true) or off (if - How == false) the trace flags in FlagList for - the process or processes represented by PidSpec.

-

PidSpec is either a pid for a local process, or one of - the following atoms:

+ How == false) the trace flags in + FlagList for + the process or processes represented by + PidSpec.

+

PidSpec is either a process identifier + (pid) for a local process, or one of the following atoms:

existing -

All processes currently existing.

+

All currently existing processes.

new -

All processes that will be created in the future.

+

All processes that are created in the future.

all

All currently existing processes and all processes that - will be created in the future.

+ are created in the future.

-

FlagList can contain any number of the following - flags (the "message tags" refers to the list of messages - following below):

+

FlagList can contain any number of the + following flags (the "message tags" refers to the list of the + following messages):

all -

Set all trace flags except {tracer, Tracer} and - cpu_timestamp that are in their nature different +

Sets all trace flags except {tracer, Tracer} and + cpu_timestamp, which are in their nature different than the others.

send -

Trace sending of messages.

-

Message tags: send, +

Traces sending of messages.

+

Message tags: send and send_to_non_existing_process.

'receive' -

Trace receiving of messages.

+

Traces receiving of messages.

Message tags: 'receive'.

procs -

Trace process related events.

+

Traces process-related events.

Message tags: spawn, exit, register, unregister, link, - unlink, getting_linked, + unlink, getting_linked, and getting_unlinked.

call -

Trace certain function calls. Specify which function +

Traces certain function calls. Specify which function calls to trace by calling erlang:trace_pattern/3.

-

Message tags: call, return_from.

+

Message tags: call and return_from.

silent -

Used in conjunction with the call trace flag. - The call, return_from and return_to - trace messages are inhibited if this flag is set, - but if there are match specs they are executed as normal.

+

Used with the call trace flag. + The call, return_from, and return_to + trace messages are inhibited if this flag is set, but they + are executed as normal if there are match specifications.

Silent mode is inhibited by executing erlang:trace(_, false, [silent|_]), - or by a match spec executing the {silent, false} - function.

+ or by a match specification executing the function + {silent, false}.

The silent trace flag facilitates setting up a trace on many or even all processes in the system. - Then the interesting trace can be activated and - deactivated using the {silent,Bool} - match spec function, giving a high degree - of control of which functions with which - arguments that triggers the trace.

-

Message tags: call, return_from, + The trace is activated and deactivated using the match + 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.

return_to -

Used in conjunction with the call trace flag. - Trace the actual return from a traced function back to +

Used with the call trace flag. + Traces the return from a traced function back to its caller. Only works for functions traced with - the local option to + option local to erlang:trace_pattern/3.

The semantics is that a trace message is sent when a - call traced function actually returns, that is, when a - chain of tail recursive calls is ended. There will be - only one trace message sent per chain of tail recursive - calls, why the properties of tail recursiveness for + call traced function returns, that is, when a + chain of tail recursive calls ends. Only one trace + message is sent per chain of tail recursive calls, + so the properties of tail recursiveness for function calls are kept while tracing with this flag. Using call and return_to trace together makes it possible to know exactly in which function a process executes at any time.

To get trace messages containing return values from - functions, use the {return_trace} match_spec - action instead.

+ functions, use the {return_trace} match + specification action instead.

Message tags: return_to.

running -

Trace scheduling of processes.

-

Message tags: in, and out.

+

Traces scheduling of processes.

+

Message tags: in and out.

exiting -

Trace scheduling of an exiting processes.

+

Traces scheduling of exiting processes.

Message tags: in_exiting, out_exiting, and out_exited.

garbage_collection -

Trace garbage collections of processes.

-

Message tags: gc_start, gc_end.

+

Traces garbage collections of processes.

+

Message tags: gc_start and gc_end.

timestamp -

Include a time stamp in all trace messages. The time - stamp (Ts) is of 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 timestamps be in CPU time, not wallclock. It is - only allowed with PidSpec==all. If the host - machine operating system does not support high resolution + trace time-stamps to be in CPU time, not wall clock time. + Only allowed with PidSpec==all. If the host + machine OS does not support high-resolution CPU time measurements, trace/3 exits with badarg. Note that most operating systems do not synchronize this value across cores, so be prepared @@ -7581,38 +8048,39 @@ timestamp() -> arity -

Used in conjunction with the call trace flag. - {M, F, Arity} will be specified instead of +

Used with the call trace flag. + {M, F, Arity} is specified instead of {M, F, Args} in call trace messages.

set_on_spawn

Makes any process created by a traced process inherit - its trace flags, including the set_on_spawn flag.

+ its trace flags, including flag set_on_spawn.

set_on_first_spawn

Makes the first process created by a traced process - inherit its trace flags, excluding - the set_on_first_spawn flag.

+ inherit its trace flags, excluding flag + set_on_first_spawn.

set_on_link

Makes any process linked by a traced process inherit its - trace flags, including the set_on_link flag.

+ trace flags, including flag set_on_link.

set_on_first_link

Makes the first process linked to by a traced process - inherit its trace flags, excluding - the set_on_first_link flag.

+ inherit its trace flags, excluding flag + set_on_first_link.

{tracer, Tracer} -

Specify where to send the trace messages. Tracer - must be the pid of a local process or the port identifier +

Specifies where to send the trace messages. Tracer + must be the process identifier of a local process + or the port identifier of a local port. If this flag is not given, trace - messages will be sent to the process that called + messages are sent to the process that called erlang:trace/3.

@@ -7620,27 +8088,28 @@ timestamp() -> set_on_link is the same as having set_on_first_link alone. Likewise for set_on_spawn and set_on_first_spawn.

-

If the timestamp flag is not given, the tracing - process will receive the trace messages described below. - Pid is the pid of the traced process in which - the traced event has occurred. The third element of the tuple +

If flag timestamp is not given, the tracing + process receives the trace messages described in the + following. 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 the timestamp flag is given, the first element of - the tuple will be trace_ts instead and the timestamp +

If flag timestamp is given, the first tuple + element is trace_ts instead, and the time-stamp is added last in the tuple.

{trace, Pid, 'receive', Msg} -

When Pid receives the message Msg.

+

When Pid receives message Msg.

{trace, Pid, send, Msg, To} -

When Pid sends the message Msg to - the process To.

+

When Pid sends message Msg to + process To.

{trace, Pid, send_to_non_existing_process, Msg, To} -

When Pid sends the message Msg to +

When Pid sends message Msg to the non-existing process To.

{trace, Pid, call, {M, F, Args}} @@ -7648,7 +8117,7 @@ timestamp() ->

When Pid calls a traced function. The return values of calls are never supplied, only the call and its arguments.

-

Note that the trace flag arity can be used to +

Trace flag arity can be used to change the contents of this message, so that Arity is specified instead of Args.

@@ -7656,35 +8125,34 @@ timestamp() ->

When Pid returns to the specified function. This trace message is sent if both - the call and the return_to flags are set, + the flags call and return_to are set, and the function is set to be traced on local function calls. The message is only sent when returning - from a chain of tail recursive function calls where at + from a chain of tail recursive function calls, where at least one call generated a call trace message - (that is, the functions match specification matched and + (that is, the functions match specification matched, and {message, false} was not an action).

{trace, Pid, return_from, {M, F, Arity}, ReturnValue}

When Pid returns from the specified - function. This trace message is sent if the call - flag is set, and the function has a match specification + function. This trace message is sent if flag call + is set, and the function has a match specification with a return_trace or exception_trace action.

{trace, Pid, exception_from, {M, F, Arity}, {Class, Value}}

When Pid exits from the specified - function due to an exception. This trace message is sent - if the call flag is set, and the function has + function because of an exception. This trace message is + sent if flag call is set, and the function has a match specification with an exception_trace action.

{trace, Pid, spawn, Pid2, {M, F, Args}}

When Pid spawns a new process Pid2 with the specified function call as entry point.

-

Note that Args is supposed to be the argument - list, but may be any term in the case of an erroneous - spawn.

+

Args is supposed to be the argument list, + but can be any term if the spawn is erroneous.

{trace, Pid, exit, Reason} @@ -7714,148 +8182,159 @@ timestamp() -> {trace, Pid, unregister, RegName}

When Pid gets the name RegName unregistered. - Note that this is done automatically when a registered + This is done automatically when a registered process exits.

{trace, Pid, in, {M, F, Arity} | 0} -

When Pid is scheduled to run. The process will - run in function {M, F, Arity}. On some rare - occasions the current function cannot be determined, then - the last element Arity is 0.

+

When Pid is scheduled to run. The process + runs in function {M, F, Arity}. On some rare + occasions, the current function cannot be determined, + then the last element Arity is 0.

{trace, Pid, out, {M, F, Arity} | 0}

When Pid is scheduled out. The process was - running in function {M, F, Arity}. On some rare occasions + running in function {M, F, Arity}. On some rare occasions, the current function cannot be determined, then the last - element Arity is 0.

+ element Arity is 0.

- {trace, Pid, gc_start, Info} + {trace, Pid, gc_start, Info} +

Sent when garbage collection is about to be started. Info is a list of two-element tuples, where the first element is a key, and the second is the value. - You should not depend on the tuples have any defined - order. Currently, the following keys are defined:

+ Do not depend on any order of the tuples. + The following keys are defined:

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. + 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 - the old heap. + the old heap.
stack_size - The actual size of the stack. + The size of the stack. recent_size The size of the data that survived the previous garbage - collection. + collection.
mbuf_size The combined size of message buffers associated with - the process. - + the process. bin_vheap_size - The total size of unique off-heap binaries referenced from the process heap. + The total size of unique off-heap binaries referenced + from the process heap. bin_vheap_block_size - The total size of binaries, in words, 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. + The total size of unique off-heap binaries referenced + from the process old heap. bin_vheap_block_size - The total size of binaries, in words, 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.

{trace, Pid, gc_end, Info}

Sent when garbage collection is finished. Info - contains the same kind of list as in the gc_start - message, but the sizes reflect the new sizes after + contains the same kind of list as in message gc_start, + but the sizes reflect the new sizes after garbage collection.

-

If the tracing process dies, the flags will be silently +

If the tracing process dies, the flags are silently removed.

-

Only one process can trace a particular process. For this - reason, attempts to trace an already traced process will fail.

+

Only one process can trace a particular process. Therefore, + attempts to trace an already traced process fail.

Returns: A number indicating the number of processes that - matched PidSpec. If PidSpec is a pid, - the return value will be 1. If PidSpec is - all or existing the return value will be + matched PidSpec. + If PidSpec is a process + identifier, the return value is 1. + If PidSpec + is all or existing, the return value is the number of processes running, excluding tracer processes. - If PidSpec is new, the return value will be + If PidSpec is new, the return value is 0.

-

Failure: If specified arguments are not supported. For - example cpu_timestamp is not supported on all - platforms.

+

Failure: badarg if the specified arguments are + not supported. For example, cpu_timestamp is not + supported on all platforms.

+ - Notification when trace has been delivered + Notification when trace has been delivered.

The delivery of trace messages is dislocated on the time-line - compared to other events in the system. If you know that the - Tracee has passed some specific point in its execution, + 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 - you can use erlang:trace_delivered(Tracee). A + 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 have been delivered to - the tracer up to the point that the Tracee had reached + 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).

-

Note that the trace_delivered message does not - imply that trace messages have been delivered; instead, it implies - that all trace messages that should be delivered have - been delivered. It is not an error if Tracee isn't, and - hasn't been traced by someone, but if this is the case, - no trace messages will have been delivered when the +

Notice that message trace_delivered does not + imply that trace messages have been delivered. + Instead it implies that all trace messages that + are to be delivered have been delivered. + It is not an error if Tracee is not, and + has not been traced by someone, but if this is the case, + no trace messages have been delivered when the trace_delivered message arrives.

-

Note that Tracee has to refer to a process currently, +

Notice that that Tracee must refer + 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 + The special Tracee atom all + denotes all processes that currently are traced in the node.

-

An example: Process A is Tracee, port B is +

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. C - can ensure that the trace isn't truncated by calling - erlang:trace_delivered(A) when A exits and wait - for the {trace_delivered, A, Ref} message before closing - B.

-

Failure: badarg if Tracee does not refer to a + can ensure that the trace is not truncated by calling + erlang:trace_delivered(A) when A exits and waits + 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 erlang:trace_delivered(Tracee) resides on.

+ + Traces information about a process or function. - Trace information about a process or function

Returns trace information about a process or function.

-

To get information about a process, PidOrFunc should - be a pid or the atom new. The atom new means - that the default trace state for processes to be created will - be returned. Item must have one of the following - values:

+

To get information about a process, + PidOrFunc is to + be a process identifier (pid) or the atom new. + The atom new means that the default trace state for + processes to be created is returned.

+

The following Items are valid:

flags -

Return a list of atoms indicating what kind of traces is - enabled for the process. The list will be empty if no +

Returns a list of atoms indicating what kind of traces is + enabled for the process. The list is empty if no traces are enabled, and one or more of the followings atoms if traces are enabled: send, 'receive', set_on_spawn, call, @@ -7866,129 +8345,132 @@ timestamp() -> tracer -

Return the identifier for process or port tracing this +

Returns the identifier for process or port tracing this process. If this process is not being traced, the return - value will be [].

+ value is [].

-

To get information about a function, PidOrFunc should - be a three-element tuple: {Module, Function, Arity} or +

To get information about a function, PidOrFunc is to + be the three-element tuple {Module, Function, Arity} or the atom on_load. No wildcards are allowed. Returns - undefined if the function does not exist or - false if the function is not traced at all. Item - must have one of the following values:

+ undefined if the function does not exist, or + false if the function is not traced.

+

The following Items are valid::

traced -

Return global if this function is traced on +

Returns global if this function is traced on global function calls, local if this function is - traced on local function calls (i.e local and global - function calls), and false if neither local nor - global function calls are traced.

+ traced on local function calls (that is, local and global + function calls), and false if local or + global function calls are not traced.

match_spec -

Return the match specification for this function, if it +

Returns the match specification for this function, if it has one. If the function is locally or globally traced but has no match specification defined, the returned value is [].

meta -

Return the meta trace tracer process or port for this - function, if it has one. If the function is not meta - traced the returned value is false, and if - the function is meta traced but has once detected that - the tracer proc is invalid, the returned value is [].

+

Returns the meta-trace tracer process or port 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 [].

meta_match_spec -

Return the meta trace match specification for this - function, if it has one. If the function is meta traced +

Returns the meta-trace match specification for this + function, if it has one. If the function is meta-traced but has no match specification defined, the returned value is [].

call_count -

Return the call count value for this function or +

Returns the call count value for this function or true for the pseudo function on_load if call - count tracing is active. Return false otherwise. + count tracing is active. Otherwise false is returned. See also erlang:trace_pattern/3.

call_time -

Return 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. Returns false otherwise. + time tracing is active. Otherwise false is returned. The call time values returned, [{Pid, Count, S, Us}], - is a list of each process that has executed the function and its specific counters. - See also + is a list of each process that executed the function + and its specific counters. See also erlang:trace_pattern/3.

all -

Return a list containing the {Item, Value} tuples - for all other items, or return false if no tracing +

Returns a list containing the + {Item, Value} tuples + for all other items, or returns false if no tracing is active for this function.

-

The actual return value will be {Item, Value}, where - Value is the requested information as described above. +

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 - non-existing function, Value will be undefined.

-

If PidOrFunc is the on_load, the information + non-existing function, Value is undefined.

+

If PidOrFunc is on_load, the information returned refers to the default value for code that will be loaded.

+ + Sets trace patterns for global call tracing. - Set trace patterns for global call tracing

The same as erlang:trace_pattern(MFA, MatchSpec, []), retained for backward compatibility.

+ + Sets trace patterns for tracing of function calls. - Set trace patterns for tracing of function calls -

This BIF is used to enable or disable call tracing for - exported functions. It must be combined with +

Enables or disables call tracing for + exported functions. Must be combined with erlang:trace/3 to set the call trace flag for one or more processes.

-

Conceptually, call tracing works like this: Inside - the Erlang virtual machine there is a set of processes to be - traced and a set of functions to be traced. Tracing will be +

Conceptually, call tracing works as follows. Inside + the Erlang Virtual Machine, a set of processes and + a set of functions are to be traced. Tracing is enabled on the intersection of the set. That is, if a process included in the traced process set calls a function included - in the traced function set, the trace action will be taken. - Otherwise, nothing will happen.

-

Use - erlang:trace/3 to - add or remove one or more processes to the set of traced - processes. Use erlang:trace_pattern/2 to add or remove - exported functions to the set of traced functions.

-

The erlang:trace_pattern/3 BIF can also add match + in the traced function set, 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.

+

To add or remove exported functions to the set of traced + functions, use erlang:trace_pattern/2.

+

The BIF erlang:trace_pattern/3 can also add match specifications to an exported function. A match specification - comprises a pattern that the arguments to the function must - match, a guard expression which must evaluate to true + comprises a pattern that the function arguments must + match, a guard expression that must evaluate to true, and an action to be performed. The default action is to send a trace message. If the pattern does not match or the guard - fails, the action will not be executed.

-

The MFA argument should be a tuple like - {Module, Function, Arity} or the atom on_load - (described below). It can be the module, function, and arity - for an exported function (or a BIF in any module). - The '_' atom can be used to mean any of that kind. + 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, + and arity for an exported function (or a BIF in any module). + The atom '_' can be used to mean any of that kinds. Wildcards can be used in any of the following ways:

{Module,Function,'_'} @@ -8006,197 +8488,213 @@ timestamp() ->

Other combinations, such as {Module,'_',Arity}, are - not allowed. Local functions will match wildcards only if - the local option is in the FlagList.

-

If the MFA argument is the atom on_load, - the match specification and flag list will be used on all + 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 modules that are newly loaded.

-

The MatchSpec argument can take any of the following - forms:

+

Argument MatchSpec can take the + following forms:

false -

Disable tracing for the matching function(s). Any match - specification will be removed.

+

Disables tracing for the matching function or functions. + Any match specification is removed.

true -

Enable tracing for the matching function(s).

+

Enables tracing for the matching function or functions.

MatchSpecList

A list of match specifications. An empty list is - equivalent to true. See the ERTS User's Guide - for a description of match specifications.

+ equivalent to true. For a description of match + specifications, see the User's Guide.

restart -

For the FlagList option call_count and call_time: - restart the existing counters. The behaviour is undefined +

For the FlagList options call_count + and call_time: restarts + the existing counters. The behavior is undefined for other FlagList options.

pause -

For the FlagList option call_count and call_time: pause - the existing counters. The behaviour is undefined for - other FlagList options.

+

For the FlagList options + call_count and call_time: pauses + the existing counters. The behavior is undefined for + other FlagList options.

-

The FlagList parameter is a list of options. - The following options are allowed:

+

Parameter FlagList is a list of options. + The following are the valid options:

global -

Turn on or off call tracing for global function calls +

Turns on or off call tracing for global function calls (that is, calls specifying the module explicitly). Only - exported functions will match and only global calls will + exported functions match and only global calls generate trace messages. This is the default.

local -

Turn on or off call tracing for all types of function - calls. Trace messages will be sent whenever any of +

Turns on or off call tracing for all types of function + calls. Trace messages are sent whenever any of the specified functions are called, regardless of how they - are called. If the return_to flag is set for - the process, a return_to message will also be sent + are called. If flag return_to is set for + the process, a return_to message is also sent when this function returns to its caller.

meta | {meta, Pid} -

Turn on or off meta tracing for all types of function - calls. Trace messages will be sent to the tracer process +

Turns on or off meta-tracing for all types of function + calls. Trace messages are sent to the tracer process or port Pid whenever any of the specified functions are called, regardless of how they are called. - If no Pid is specified, self() is used as a - default tracer process.

-

Meta tracing traces all processes and does not care + If no Pid 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, the trace flags are instead fixed to [call, timestamp].

-

The match spec function {return_trace} works with - meta trace and send its trace message to the same tracer - process.

+

The match specification function {return_trace} + works with meta-trace and sends its trace message to the + same tracer process.

call_count

Starts (MatchSpec == true) or stops - (MatchSpec == false) call count tracing for all - types of function calls. For every function a counter is + (MatchSpec == false) + call count tracing for all + types of function calls. For every function, a counter is incremented when the function is called, in any process. No process trace flags need to be activated.

If call count tracing is started while already running, - the count is restarted from zero. Running counters can be - paused with MatchSpec == pause. Paused and running - counters can be restarted from zero with + the count is restarted from zero. To pause running + counters, use MatchSpec == pause. + Paused and running counters can be restarted from zero with MatchSpec == restart.

-

The counter value can be read with +

To read the counter value, use erlang:trace_info/2.

call_time

Starts (MatchSpec == true) or stops - (MatchSpec == false) call time tracing for all - types of function calls. For every function a counter is - incremented when the function is called. Time spent in the function - is accumulated in two other counters, seconds and micro-seconds. + (MatchSpec == false) call time + tracing for all + types of function calls. For every function, a counter is + 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.

If call time tracing is started while already running, - the count and time is restarted from zero. Running counters can be - paused with MatchSpec == pause. Paused and running - counters can be restarted from zero with + the count and time is restarted from zero. To pause + running counters, use MatchSpec == pause. + Paused and running counters can be restarted from zero with MatchSpec == restart.

-

The counter value can be read with +

To read the counter value, use erlang:trace_info/2.

-
-

The global and local options are mutually - exclusive and global is the default (if no options are - specified). The call_count and meta options - perform a kind of local tracing, and can also not be combined - with global. A function can be either globally or +

The options global and local are mutually + exclusive, and global is the default (if no options are + specified). The options call_count and meta + perform a kind of local tracing, and cannot be combined + with global. A function can be globally or locally traced. If global tracing is specified for a - specified set of functions; local, meta, call time and call count - tracing for the matching set of local functions will be - disabled, and vice versa.

+ set of functions, then local, meta, call time, and call count + tracing for the matching set of local functions is + disabled, and conversely.

When disabling trace, the option must match the type of trace - that is set on the function, so that local tracing must be - disabled with the local option and global tracing with - the global option (or no option at all), and so forth.

-

There is no way to directly change part of a match - specification list. If a function has a match specification, - you can replace it with a completely new one. If you need to - change an existing match specification, use the + 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.

+

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 - BIF to retrieve the existing match specification.

-

Returns the number of exported functions that matched - the MFA argument. This will be zero if none matched at - all.

+ to retrieve the existing match specification.

+

Returns the number of exported functions matching + argument MFA. This is zero if none matched.

+ - Return an integer by the truncating a number + Returns an integer by truncating a number -

Returns an integer by the truncating Number.

+

Returns an integer by truncating Number, + for example:

 > trunc(5.5).
 5

Allowed in guard tests.

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

Returns an integer which is the number of elements in Tuple.

+

Returns an integer that is the number of elements in + Tuple, for example:

 > tuple_size({morni, mulle, bwange}).
 3

Allowed in guard tests.

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

Returns a list which corresponds to Tuple. - Tuple may contain any Erlang terms.

+

Returns a list corresponding to Tuple. + Tuple can contain any Erlang terms.

+

Example:

 > tuple_to_list({share, {'Ericsson_B', 163}}).
 [share,{'Ericsson_B',163}]
+ - 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), also called GMT, in the form + Time Coordinated (UTC) in the form {{Year, Month, Day}, {Hour, Minute, Second}} if - supported by the underlying operating system. If not, - erlang:universaltime() is equivalent to + supported by the underlying OS. + Otherwise erlang:universaltime() is equivalent to erlang:localtime().

+

Example:

 > erlang:universaltime().
 {{1996,11,6},{14,18,43}}
+ - Convert from Universal Time Coordinated (UTC) to local date and time + Converts from Universal Time Coordinated (UTC) to local date and time.

Converts Universal Time Coordinated (UTC) date and time to - local date and time, if this is supported by the underlying - OS. Otherwise, no conversion is done, and + 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:

 > erlang:universaltime_to_localtime({{1996,11,6},{14,18,43}}).
 {{1996,11,7},{15,18,43}}
-

Failure: badarg if Universaltime does not denote - a valid date and time.

+

Failure: badarg if Universaltime denotes + an invalid date and time.

+ Get a unique integer value @@ -8293,25 +8791,30 @@ timestamp() -> - Remove a link, if there is one, to another process or port + Removes a link, if there is one, to another process or port.

Removes the link, if there is one, between the calling - process and the process or port referred to by Id.

+ process and the process or port referred to by + Id.

Returns true and does not fail, even if there is no - link to Id, or if Id does not exist.

-

Once unlink(Id) has returned it is guaranteed that + link to Id, or if Id + does not exist.

+

Once unlink(Id) has returned, + it is guaranteed that the link between the caller and the entity referred to by - Id has no effect on the caller in the future (unless - the link is setup again). If caller is trapping exits, an - {'EXIT', Id, _} message due to the link might have - been placed in the caller's message queue prior to the call, - though. Note, the {'EXIT', Id, _} message can be the - result of the link, but can also be the result of Id - calling exit/2. Therefore, it may be - appropriate to cleanup the message queue when trapping exits - after the call to unlink(Id), as follow:

+ Id has no effect on the caller + in the future (unless + the link is setup again). If the caller is trapping exits, an + {'EXIT', Id, _} + message is received, as the link 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 + calling exit/2. Therefore, it can be + appropriate to clean up the message queue when trapping exits + after the call to unlink(Id), as follows:

- unlink(Id), receive {'EXIT', Id, _} -> @@ -8320,23 +8823,25 @@ timestamp() -> true end -

Prior to OTP release R11B (erts version 5.5) unlink/1 - behaved completely asynchronous, i.e., the link was active +

Before OTP R11B (ERTS 5.5) unlink/1 + behaved asynchronous, that is, the link was active until the "unlink signal" reached the linked entity. This - had one undesirable effect, though. You could never know when + had an undesirable effect, as you could never know when you were guaranteed not to be effected by the link.

-

Current behavior can be viewed as two combined operations: +

The current behavior can be viewed as two combined operations: asynchronously send an "unlink signal" to the linked entity and ignore any future results of the link.

+ - Remove the registered name for a process (or port) + Removes the registered name for a process (or port). -

Removes the registered name RegName, associated with a - pid or a port identifier.

+

Removes the registered name RegName + associated with a + process identifier or a port identifier, for example:

 > unregister(db).
 true
@@ -8345,31 +8850,34 @@ true name.

+ - Get the pid (or port) with a given registered name + Gets the pid (or port) with a given registered name. -

Returns the pid or port identifier with the registered name - RegName. Returns undefined if the name is not - registered.

+

Returns the process identifier or port identifier with + the registered name RegName. Returns undefined + if the name is not registered.

+

Example:

 > whereis(db).
 <0.43.0>
+ - Let other processes get a chance to execute + Lets other processes get a chance to execute. -

Voluntarily let other processes (if any) get a chance to +

Voluntarily lets other processes (if any) get a chance to execute. Using erlang:yield() 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 will have a - chance to run in another scheduler thread anyway. - Using this BIF without a thorough grasp of how the scheduler - works may cause performance degradation.

+ 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 From 07c1d0d975fbecf295a3c9f04f7b09e7a8b6ff99 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 23 Sep 2015 20:09:49 +0200 Subject: erts: Review module erlang docs --- erts/doc/src/erlang.xml | 455 +++++++++++++++++++++++------------------------- 1 file changed, 222 insertions(+), 233 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 8b20a5c12f..a51774b9f0 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -251,10 +251,7 @@

Example:

 > apply(lists, reverse, [[a, b, c]]).
-[c,b,a]
-

apply evaluates BIFs by using - the module name erlang.

-
+[c,b,a]
 > apply(erlang, atom_to_list, ['Erlang']).
 "Erlang"

If the number of arguments are known at compile time, @@ -282,16 +279,16 @@ in the text representation. If Encoding is utf8 or unicode, the characters are encoded using UTF-8 - (that is, characters from 16#80 through 0xFF are + (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 16#FF. In a future release, + 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 16#FF.

+ character greater than 255.

Example:

 > atom_to_binary('Erlang', latin1).
@@ -358,9 +355,9 @@
         If Encoding
         is utf8 or unicode, the binary must contain
         valid UTF-8 sequences. Only Unicode characters up
-        to 0xFF are allowed.

+ to 255 are allowed.

binary_to_atom(Binary, utf8) fails if - the binary contains Unicode characters greater than 16#FF. + 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 @@ -450,11 +447,11 @@ position Stop in Binary. The positions in the binary are numbered starting from 1.

-

The indexing style of using one-based indices for - binaries is deprecated for this function. New code is to - use the functions in module binary in STDLIB - instead. They therefore - use the same (zero-based) style of 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.

@@ -698,7 +695,7 @@

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

-

The available Options are as follows:

+

The available Options are as follows:

{allow_gc, boolean()} @@ -770,7 +767,7 @@ - Convert time unit of a time value + Converts time unit of a time value.

Converts the Time value of time unit FromUnit to the corresponding @@ -878,7 +875,7 @@ line -

A packet is a line-terminated with newline. The +

A packet is a line terminated with newline. The newline character is included in the returned packet unless the line was truncated according to option line_length.

@@ -1809,7 +1806,7 @@ os_prompt%
Hash function (deprecated).

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

+ 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 @@ -2034,7 +2031,7 @@ os_prompt%

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

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

+ is a BIF implemented in C, otherwise false.

@@ -2366,8 +2363,8 @@ os_prompt%

Failure: badarg if String contains a bad representation of a process identifier.

-

This BIF is intended for debugging and for use in the - Erlang OS. It is not to be used in application programs.

+

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

@@ -3161,9 +3158,9 @@ os_prompt% - At which node a pid, port, or reference is located. + At which node a pid, port, or reference originates. -

Returns the node where Arg is located. +

Returns the node where Arg originates. Arg can be a process identifier, a reference, or a port. If the local node is not @@ -3208,17 +3205,19 @@ os_prompt% known -

Nodes that are known to this node, for example, connected - and previously connected.

+

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. +

Some equalities: [node()] = nodes(this), nodes(connected) = nodes([visible, hidden]), and nodes() = nodes(visible).

-

If the local node is not alive, - nodes(this) == nodes(known) == [nonode@nohost]. For - any other Arg the empty list - [] is returned.

@@ -3260,7 +3259,7 @@ os_prompt% given 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 force, that is, UTF-8, supply the executable + 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 @@ -3585,9 +3584,10 @@ os_prompt%

Portable hash function that gives the same hash for the same Erlang term regardless of machine architecture and ERTS version (the BIF was introduced in ERTS 4.9.1.1). - Range is 1..2^32. The function returns a hash value for + The function returns a hash value for Term within the range - 1..Range.

+ 1..Range. The maximum value for + 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.

@@ -3604,9 +3604,10 @@ os_prompt%

Portable hash function that gives the same hash for the same Erlang term regardless of machine architecture and ERTS version (the BIF was introduced in ERTS 5.2). - Range is 1..2^32. The function returns a hash value for - Term within the range - 0..Range-1. When without argument + 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 Range, a value in the range 0..2^27-1 is returned.

This BIF is always to be used for hashing terms. It @@ -3625,8 +3626,8 @@ os_prompt%

Returns a string corresponding to the text representation of Pid.

-

This BIF is intended for debugging and for use in the - Erlang OS. It is not to be used in application programs.

+

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

@@ -3641,19 +3642,18 @@ os_prompt% 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 - a port identified by Port, an exit signal is sent - because that link will be received before the return from - port_close/1

-

For comparison: Port ! {self(), close} fails with - badarg if Port cannot be sent to (that is, - Port refers not to a port and not to a process). If - Port is a closed port, nothing happens. - If Port + the port identified by Port, the exit + 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 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.

@@ -3665,10 +3665,10 @@ os_prompt% 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 linked to the port, the exit - identified by Port, the exit signal is sent because - this link was delivered to the calling process before this - exception occurs.

+ 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.

@@ -3683,10 +3683,10 @@ os_prompt% can send data to a port with port_command/2, not only the port owner (the connected process).

For comparison: Port ! {PortOwner, {command, Data}} - fails with badarg if Port - cannot be sent to (that - is, Port refers not to a port and not to a process). - If Port is a closed port, the data message disappears + 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 @@ -3707,10 +3707,11 @@ 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 linked to the port, the exit signal is sent - because this link was delivered to the calling process - before this exception occurs. + 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 @@ -3754,10 +3755,11 @@ 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 linked to the port, the exit signal is sent - because this link was delivered to the calling process - before this exception occurs. + 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 @@ -3805,9 +3807,9 @@ os_prompt% set the port owner to be any process with port_connect/2.

For comparison: - Port ! {self(), {connect, Pid}} fails - with badarg if Port cannot be sent to (that is, - Port refers not to a port and not to a process). If + Port ! {self(), {connect, Pid}} + 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, @@ -3835,9 +3837,10 @@ os_prompt% If Port is not an identifier of an open port, or the registered name of an open port. If the calling - process was linked to the port, the exit signal is sent - because this link was delivered to the calling process - before this exception occurs. + 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 @@ -3906,9 +3909,10 @@ os_prompt% If Port is not an identifier of an open port, or the registered name of an open port. If the calling - process was linked to the port, the exit signal is sent - because this link was delivered to the calling process - before this exception occurs. + 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 @@ -3937,11 +3941,10 @@ 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 undefined is returned and the calling process - was linked to a previously open port identified by - Port, an exit signal is sent because this link - was received by the process before the return from - port_info/1.

+ 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:

@@ -3968,11 +3971,10 @@ os_prompt%

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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -3985,11 +3987,10 @@ os_prompt%

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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4002,11 +4003,10 @@ os_prompt%

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

If the port identified by Port is not open, - undefined is returned. If undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4019,11 +4019,10 @@ os_prompt%

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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4042,11 +4041,10 @@ 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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4061,11 +4059,10 @@ os_prompt% 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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4078,11 +4075,10 @@ os_prompt%

Monitors represent processes that this port monitors.

If the port identified by Port is not open, - undefined is returned. If undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4095,11 +4091,10 @@ os_prompt%

Name is the command name set by open_port/2.

If the port identified by Port is not open, - undefined is returned. If undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4115,11 +4110,10 @@ os_prompt% 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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4135,11 +4129,10 @@ os_prompt% port_command/3, or Port ! {Owner, {command, Data}.

If the port identified by Port is not open, - undefined is returned. If undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent before this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4164,11 +4157,10 @@ os_prompt% 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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4181,11 +4173,10 @@ os_prompt%

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 undefined is returned and - the calling process was linked to a previously open port identified - by Port, an exit signal is sent because this link - was received by the process before the return from - port_info/2.

+ 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.

@@ -4198,15 +4189,15 @@ os_prompt%

Returns a string corresponding to the text representation of the port identifier Port.

-

This BIF is intended for debugging and for use in the - Erlang OS. It is not to be used in application programs.

+

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

- Lists all open ports. + Lists all existing ports.

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

@@ -4502,8 +4493,8 @@ os_prompt%

Returns information about the process identified by Pid, as specified by - Item or ItemList, - or undefined if the process is not alive.

+ 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 @@ -4774,8 +4765,7 @@ os_prompt% badarg If Pid is not a local process. badarg - If Item is an invalid - Item. + If Item is an invalid item. @@ -4847,8 +4837,7 @@ os_prompt% exception of given class, reason, and call stack backtrace (stacktrace).

-

This BIF is intended for debugging and for use in - the Erlang OS. Avoid to use it in applications, +

This BIF is intended for debugging. Avoid to use it in applications, unless you really know what you are doing.

Class is error, exit, or @@ -4963,8 +4952,8 @@ os_prompt%

Returns a string corresponding to the text representation of Ref.

-

This BIF is intended for debugging and for use in the - Erlang OS. It is not to be used in application programs.

+

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

@@ -5208,7 +5197,7 @@ true 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 @@ -5267,13 +5256,23 @@ true Size of a tuple or binary. -

Returns an integer that is the size of argument - Item, which must be a tuple or a binary, - for example:

+

Returns the number of elements in a tuple or the number of + bytes in a binary or bitstring, for example:

 > size({morni, mulle, bwange}).
-3
+3 +> size(<<11, 22, 33>>). +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 + bit_size/1.

@@ -5307,9 +5306,7 @@ true

Returns the process identifier of a new process started by the application of Module:Function - to Args. - The new created process is placed in the system scheduler - queue and will be run some time later.

+ to Args.

error_handler:undefined_function(Module, Function, Args) is evaluated by the new process if @@ -5319,8 +5316,8 @@ true can be redefined (see process_flag/2). If error_handler is undefined, or the user has - redefined the default error_handler, its replacement is - undefined, and a failure with reason undef occurs.

+ redefined the default error_handler and its replacement is + undefined, a failure with reason undef occurs.

Example:

 > spawn(speed, regulator, [high_speed, thin_cut]).
@@ -5364,10 +5361,9 @@ true
list [] on Node. A link is created between the calling process and the new process, atomically. If Node does not exist, - a useless pid is - returned (and, because of the link, an exit signal with exit - reason noconnection is received). Otherwise works - like spawn/3.

+ a useless pid is returned and an exit signal with + reason noconnection is sent to the calling + process. Otherwise works like spawn/3.

@@ -5376,7 +5372,7 @@ true Creates and links to a new process with a function as entry point.

Returns the process identifier of a new process started by - the applicatio of Module:Function + the application of Module:Function to Args. A link is created between the calling process and the new process, atomically. Otherwise works like @@ -5394,10 +5390,9 @@ true to Args on Node. A link is created between the calling process and the new process, atomically. If Node does - not exist, a useless pid - is returned (and, because of the link, an exit signal with exit - reason noconnection is received). Otherwise works - like spawn/3.

+ 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.

@@ -5761,7 +5756,7 @@ true Information about runtime.

Returns information about runtime, in milliseconds.

-

The runtime is the sum of the runtime for all threads +

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.

Example:

@@ -5787,7 +5782,7 @@ true 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 - calculate relative values for scheduler-use. + calculate relative values for scheduler-utilization. ActiveTime can never exceed TotalTime.

The definition of a busy scheduler is when it is not idle @@ -5808,14 +5803,14 @@ true 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-use:

+

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-use per scheduler, for example:

+ scheduler-utilization per scheduler, for example:

 > Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
 ok
@@ -5829,7 +5824,7 @@ ok
  {6,0.9739235846420741},
  {7,0.973237033077876},
  {8,0.9741297293248656}]
-

Using the same snapshots to calculate a total scheduler-use:

+

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.
@@ -5961,9 +5956,7 @@ ok
         

Suspends the process identified by Suspendee. The same as calling erlang:suspend_process(Suspendee, - []). - For more information, see - erlang:suspend_process/2.

+ []).

This BIF is intended for debugging only.

@@ -6163,7 +6156,7 @@ ok

Controls if and how schedulers are bound to logical processors.

-

When erlang:system_flag(scheduler_bind_type, How +

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.

If a scheduler fails to bind, this is often silently @@ -6283,9 +6276,9 @@ ok Sets the number of schedulers online. Range is .

Returns the old value of the flag.

-

The emulator was built with support for - dirty schedulers. - Changing the number of schedulers online can also change the +

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 @@ -6563,7 +6556,7 @@ ok

Returns the automatically detected - CpuTopology. The + 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, @@ -7030,10 +7023,10 @@ ok

Returns a list of Pids when multi-scheduling is blocked, otherwise the empty list is - returned. The Pids in the list are - Pids of the processes currently - blocking multi-scheduling. A Pid is - present only once in the list, even if the corresponding + returned. The Pids in the list + 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), @@ -7177,7 +7170,7 @@ ok time unit.

- port_parallelism + port_parallelism

Returns the default port parallelism scheduling hint used. @@ -7569,7 +7562,7 @@ ok fairly "normal". However, longer schedule times can indicate swapping or a misbehaving NIF/driver. Misbehaving NIFs and drivers can cause bad resource - use and bad overall system performance.

+ utilization and bad overall system performance.

{large_heap, Size} @@ -7756,15 +7749,15 @@ ok 0 - No compression is done (it is the same as giving no compressed option). - 1 - Takes least time but cannot compress, + 1 - Takes least time but may not compress as well as the higher levels. - 9 - Takes most time and can produce a smaller - result. Notice "can" in the preceding sentence; depending + 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. -

compressed and {compressed, 6} give the same - result.

Option {minor_version, Version} can be used to control some encoding details. This option was introduced in OTP R11B-4. @@ -7938,8 +7931,8 @@ timestamp() ->

FlagList can contain any number of the - following flags (the "message tags" refers to the list of the - following messages):

+ following flags (the "message tags" refers to the list of + trace messages):

all @@ -7985,7 +7978,7 @@ timestamp() -> {silent, false}.

The silent trace flag facilitates setting up a trace on many or even all processes in the system. - The trace is activated and deactivated using the match + The trace can then be activated and deactivated using the match specification function {silent,Bool}, giving a high degree of control of which functions with which arguments that trigger the trace.

@@ -8088,15 +8081,14 @@ timestamp() -> set_on_link is the same as having set_on_first_link alone. Likewise for set_on_spawn and set_on_first_spawn.

-

If flag timestamp is not given, the tracing - process receives the trace messages described in the - following. Pid is the process identifier of the - traced process in which - the traced event has occurred. The third tuple element - is the message tag.

+

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.

If flag timestamp is given, the first tuple element is trace_ts instead, and the time-stamp - is added last in the tuple.

+ is added last in the message tuple.

+ {trace, Pid, 'receive', Msg} @@ -8301,13 +8293,12 @@ timestamp() -> denotes all processes that currently are traced in the node.

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. C - can ensure that the trace is not truncated by calling - erlang:trace_delivered(A) when A exits and waits - 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 @@ -8317,7 +8308,7 @@ timestamp() -> - Traces information about a process or function. + Trace information about a process or function. @@ -8444,23 +8435,21 @@ timestamp() ->

Enables or disables call tracing for - exported functions. Must be combined with + one or more functions. Must be combined with erlang:trace/3 to set the call trace flag for one or more processes.

Conceptually, call tracing works as follows. Inside the Erlang Virtual Machine, a set of processes and - a set of functions are to be traced. Tracing is - enabled on the intersection of the set. That is, if a process - included in the traced process set calls a function included - in the traced function set, the trace action is taken. + 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.

-

To add or remove exported functions to the set of traced - functions, use erlang:trace_pattern/2.

+

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 - specifications to an exported function. A match specification + specifications to a function. A match specification comprises a pattern that the function arguments must match, a guard expression that must evaluate to true, and an action to be performed. The default action is to send a @@ -8469,22 +8458,22 @@ timestamp() ->

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, - and arity for an exported function (or a BIF in any module). - The atom '_' can be used to mean any of that kinds. - Wildcards can be used in any of the following ways:

+ and arity for a function (or a BIF in any module). + The atom '_' can be used as a wildcard in any of the + following ways:

{Module,Function,'_'} -

All exported functions of any arity named Function +

All functions of any arity named Function in module Module.

{Module,'_','_'} -

All exported functions in module Module.

+

All functions in module Module.

{'_','_','_'} -

All exported functions in all loaded modules.

+

All functions in all loaded modules.

Other combinations, such as {Module,'_',Arity}, are @@ -8498,12 +8487,12 @@ timestamp() -> false -

Disables tracing for the matching function or functions. +

Disables tracing for the matching functions. Any match specification is removed.

true -

Enables tracing for the matching function or functions.

+

Enables tracing for the matching functions.

MatchSpecList @@ -8534,7 +8523,7 @@ timestamp() ->

Turns on or off call tracing for global function calls (that is, calls specifying the module explicitly). Only exported functions match and only global calls - generate trace messages. This is the default.

+ generate trace messages. This is the default.

local @@ -8615,7 +8604,7 @@ timestamp() -> use the BIF erlang:trace_info/2 to retrieve the existing match specification.

-

Returns the number of exported functions matching +

Returns the number of functions matching argument MFA. This is zero if none matched.

@@ -8791,7 +8780,7 @@ timestamp() -> - Removes a link, if there is one, to another process or port. + Removes 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 @@ -8805,9 +8794,9 @@ timestamp() -> Id has no effect on the caller in the future (unless the link is setup again). If the caller is trapping exits, an - {'EXIT', Id, _} - message is received, as the link can have - been placed in the caller's message queue before the call.

+ {'EXIT', Id, _} message from the link + 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 -- cgit v1.2.3 From db5f5eeaa8ffab49758beb95552c1cf14b49a55d Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 1 Oct 2015 18:57:21 +0200 Subject: erts: Review newer additions to erlang.xml Trying to adopt same style as done by xsipewe in e17e236cd1661bc for later additions. --- erts/doc/src/erlang.xml | 274 ++++++++++++++++++++++++------------------------ 1 file changed, 136 insertions(+), 138 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index a51774b9f0..221869799d 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -66,7 +66,7 @@ -

Currently supported time unit representations:

+

Supported time unit representations:

PartsPerSecond :: integer() >= 1

Time unit expressed in parts per second. That is, @@ -93,11 +93,11 @@ used by the Erlang runtime system.

The native time unit is determined at - runtime system start, and will remain the same until + 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 may differ from the + runtime system instance can differ from the native time unit of the old runtime system instance.

@@ -106,8 +106,7 @@ 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 will be - rounded downwards.

+ not add up to a whole number, the result is rounded downwards.

The value of the native time unit gives @@ -121,7 +120,7 @@ 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 may differ + unit and the resolution of time values can differ significantly.

@@ -578,7 +577,7 @@ TimerRef identifies the timer, and was returned by the BIF that created the timer.

-

Currently available Options:

+

Available Options:

{async, Async} @@ -587,7 +586,7 @@ defaults to false which will cause the cancellation to be performed synchronously. When Async is set to true, the cancel - operation will be performed asynchronously. That is, + 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. @@ -598,17 +597,17 @@

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

+ is given. When the operation is performed

synchronously

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

asynchronously @@ -616,10 +615,10 @@

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

@@ -628,30 +627,30 @@

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.

- When the Result equals false, a + 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 has corresponded to a timer. If the timer has expired, - the timeout message has been sent, but it does not tell you - whether or not it has arrived at its destination yet. When the - Result is an integer, it represents the - time in milli-seconds left until the timer would have expired. + 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 will take much longer time than if it + 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 the {async, true} - option. If using the {async, false} option, the calling - process will be blocked until the operation has been - performed. + 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 @@ -2537,7 +2536,7 @@ os_prompt%

Returns a unique reference. -

Return a unique +

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

Known issue: When a node is restarted multiple @@ -2863,7 +2862,7 @@ os_prompt% following format if the monitored state is changed:

{Tag, MonitorRef, Type, Object, Info}

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

+ takes time before the signal reaches its destination.

Valid Types:

process @@ -2976,8 +2975,8 @@ os_prompt% 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 changed due to - the finalization or not.

+ regardless of whether the time offset value was actually changed + or not.

If the runtime system is in multi @@ -3077,7 +3076,7 @@ os_prompt% - Current Erlang monotonic time + Current Erlang monotonic time.

Returns the current Erlang @@ -3090,7 +3089,7 @@ os_prompt% monotonically increasing time, but not a strictly monotonically increasing time. That is, consecutive calls to - erlang:monotonic_time/0 may produce the same result.

+ 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. @@ -3098,9 +3097,9 @@ os_prompt% 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 - will be a negative value), the past (time at start will be a - positive value), or the runtime system start (time at start will - be zero). The monotonic time as of runtime system start can be + 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).

@@ -4881,7 +4880,7 @@ os_prompt% TimerRef identifies the timer, and was returned by the BIF that created the timer.

-

Currently available Options:

+

Available Options:

{async, Async} @@ -4889,12 +4888,12 @@ os_prompt% Asynchronous request for state information. Async defaults to false which will cause the operation to be performed synchronously. In this case, the Result - will be returned by erlang:read_timer(). When - Async is set to true, erlang:read_timer() - will send an asynchronous request for the state information - to the timer service that manages the timer, and then return + 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} will be + TimerRef, Result} is sent to the caller of erlang:read_timer() when the operation has been processed.

@@ -4904,26 +4903,27 @@ os_prompt% More Options may be added in the future.

- When the Result equals false, a + 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 either because the timer had expired, - had been canceled, or because TimerRef - never has corresponded to a timer. If the timer has expired, - the timeout message has been sent, but it does not tell you - whether or not it has arrived at its destination yet. When the - Result is an integer, it represents the - time in milli-seconds left until the timer expires. + 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 will take much longer time than if it + 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 the {async, true} - option. If using the {async, false} option, the calling + 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.

@@ -5119,10 +5119,9 @@ true

Starts a timer. When the timer expires, the message - Msg will be sent to the process + Msg is sent to the process identified by Dest. Appart from - the format of the message sent to - Dest when the timer expires + the format of the timeout message, erlang:send_after/4 works exactly as erlang:start_timer/4.

@@ -5609,24 +5608,27 @@ true

Starts a timer. When the timer expires, the message {timeout, TimerRef, Msg} - will be sent to the process identified by + is sent to the process identified by Dest.

-

Currently available Options:

+

Available Options:

- {abs, Abs} + {abs, false}

- Absolute Time value. Abs - defaults to false which means that the - Time value will be interpreted - as a time in milli-seconds relative current + This is the default. It means the + Time value is interpreted + as a time in milli-seconds relative current Erlang - monotonic time. When Abs is set to - true, the Time value will - be interpreted as an absolute Erlang monotonic time of - milli-seconds - time unit. + monotonic time. +

+
+ {abs, true} + +

+ Absolute Time value. The + Time value is interpreted as an + absolute Erlang monotonic time in milli-seconds.

@@ -5634,7 +5636,7 @@ true More Options may be added in the future.

- The absolute point in time that the timer is set to expire on + 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)]. @@ -5646,7 +5648,7 @@ true 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 will be interpreted as the name of a + 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. @@ -5654,7 +5656,7 @@ true

If Dest is a pid(), the timer is automatically canceled if the process referred to by the - pid() is not alive, or when the process exits. This + 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(). @@ -5990,7 +5992,7 @@ ok +sct in erl(1).

When this argument is removed, a final CPU topology - to use will be determined at emulator boot time.

+ to use is determined at emulator boot time.

Sets the user-defined CpuTopology. The user-defined @@ -6152,7 +6154,7 @@ ok argument, use command-line argument +sbt in erl(1). When this argument is removed, a final scheduler bind - type to use will be determined at emulator boot time.

+ type to use is determined at emulator boot time.

Controls if and how schedulers are bound to logical processors.

@@ -6313,26 +6315,24 @@ ok

Finalizes the time offset - when the single - time warp mode is being used. If another time warp mode than - the "single time warp mode" is used, the time offset state will be left - unchanged.

-

Returns the old state identifier. That is, if:

+ 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:

-

preliminary is returned, finalization was +

If preliminary is returned, finalization was performed and the time offset is now final.

-

final is returned, the time offset was - already in the final state. This either due to another +

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 - due to the - no - time warp mode being used.

+ because no + time warp mode is used.

-

volatile is returned, the time offset - cannot be finalized due to the +

If volatile is returned, the time offset + cannot be finalized because multi - time warp mode being used.

+ time warp mode is used.

@@ -6704,11 +6704,11 @@ ok delayed_node_table_gc -

Returns the amount of time in seconds that garbage collection - of an entry in a node table will be delayed. This limit can be set - on startup by passing the - +zdntgc command line - flag to erl. For more information see the documentation of the +

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.

dirty_cpu_schedulers @@ -6854,9 +6854,9 @@ ok eager_check_io

- Returns the value of the erl - +secio command line - flag which is either true or false. See the + 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.

@@ -7036,8 +7036,9 @@ ok
nif_version -

Returns a string containing the erlang NIF version - used by the runtime system. It will be 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>".

otp_release @@ -7058,11 +7059,11 @@ ok

Returns a list containing information about the source of OS monotonic time that is used by the runtime system.

-

In case [] is returned, no OS monotonic time is +

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 if these tuples is undefined. Currently the following - tuples may be part of the list, but more tuples may be + 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} @@ -7081,18 +7082,17 @@ ok resolution of current OS monotonic time source as parts per second. If no resolution information can be retreived - from the OS, OsMonotonicTimeResolution will be + from the OS, OsMonotonicTimeResolution is set to the resolution of the time unit of Functions return value. That is, the actual - resolution may be lower than + resolution can be lower than OsMonotonicTimeResolution. Also note that the resolution does not say anything about the accuracy, - and that the + and whether the precision - might not align with the resolution. You do, - however, know that the precision won't be - better than + do align with the resolution. You do, + however, know that the precision is not better than OsMonotonicTimeResolution.

{extended, Extended} @@ -7124,8 +7124,8 @@ ok 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. Currently the following - tuples may be part of the list, but more tuples may be + 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} @@ -7143,18 +7143,17 @@ ok resolution of current OS system time source as parts per second. If no resolution information can be retreived - from the OS, OsSystemTimeResolution will be + 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 that the + and whether the precision - might not align with the resolution. You do, - however, know that the precision won't be - better than + do align with the resolution. You do, + however, know that the precision is not better than OsSystemTimeResolution.

{parallel, Parallel} @@ -7353,19 +7352,18 @@ ok time warp mode.

final -

The time offset is final. This - either due to the use of the +

The time offset is final. This either because no - time warp mode, or due to the time offset having - been finalized when using the + time warp mode is used, or because the time + offset have been finalized when single - time warp mode.

+ time warp mode is used.

volatile -

The time offset is volatile. That is, it may - change at any time. This due to the +

The time offset is volatile. That is, it can + change at any time. This is because multi - time warp mode being used.

+ time warp mode is used.

time_warp_mode @@ -7375,15 +7373,15 @@ ok no_time_warp

The no - time warp mode is being used.

+ time warp mode is used.

single_time_warp

The single - time warp mode is being used.

+ time warp mode is used.

multi_time_warp

The multi - time warp mode is being used.

+ time warp mode is used.

tolerant_timeofday @@ -7862,8 +7860,8 @@ ok

Returns current Erlang system time on the format {MegaSecs, Secs, MicroSecs}. This format is - the same that os:timestamp/0 - and the now deprecated erlang:now/0 + 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 @@ -7877,7 +7875,7 @@ timestamp() -> Secs = ErlangSystemTime div 1000000 - MegaSecs*1000000, MicroSecs = ErlangSystemTime rem 1000000, {MegaSecs, Secs, MicroSecs}. -

It however use a native implementation which does +

The BIF uses a native implementation which does not build garbage on the heap and with slightly better performance.

@@ -8035,7 +8033,7 @@ timestamp() -> Only allowed with PidSpec==all. If the host machine OS does not support high-resolution CPU time measurements, trace/3 exits with - badarg. Note that most operating systems do + 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.

@@ -8708,17 +8706,17 @@ timestamp() -> Each integer value can of course be constructed by other means.

-

By default, i.e. when [] is passed as +

By default, when [] is passed as ModifierList, both negative and - positive integers will be returned. This is order - to be able to utilize the range of integers that do - not need to be heap allocated as much as possible. + 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, i.e., any integer returned - may be either smaller, or larger than previously + guaranteed to be unique, that is, any returned integer + can be smaller or larger than previously returned integers.

-

Currently valid Modifiers:

+

Valid Modifiers:

positive @@ -8736,7 +8734,7 @@ timestamp() -> returned will always be larger than previously returned integers on the current runtime system instance.

-

These values can be used when ordering events +

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 @@ -8746,15 +8744,15 @@ timestamp() -> before Y.

Strictly monotonically increasing values are inherently quite expensive to generate and scales - poorly. This since the values needs to be - synchronized. That is, do not pass the monotonic + 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 currently valid Modifiers +

All valid Modifiers can be combined. Repeated (valid) Modifiers in the ModifierList are ignored.

-- cgit v1.2.3 From ef9119ca3662c4e60e2d49c7edc0622cc73c21a0 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 5 Oct 2015 15:37:20 +0200 Subject: erts: Spell-check erlang.xml --- erts/doc/src/erlang.xml | 63 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 221869799d..e4f3a06cc5 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -1693,7 +1693,7 @@ true file The second element of the tuple is a string (list of - characters) representing the filename of the source file + characters) representing the file name of the source file of the function. line @@ -1718,7 +1718,7 @@ 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 startup, init is both + process. Initially, at system start-up, init is both its own group leader and the group leader of all processes.

@@ -2429,7 +2429,7 @@ os_prompt%

Loads and links a dynamic library containing native implemented functions (NIFs) for a module. Path - is a file path to the sharable object/dynamic library file minus + 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 @@ -2804,7 +2804,7 @@ os_prompt% badarg If Type is not one of the memory types - listed in the decription of + listed in the description of erlang:memory/0. badarg @@ -3012,7 +3012,7 @@ os_prompt%

Making several calls to monitor/2 for the same Item and/or Type is not - an error; it results in as many independent monitorings.

+ an error; it results in as many independent monitoring instances.

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

@@ -3034,7 +3034,7 @@ os_prompt% is false, monitoring is turned off.

Making several calls to monitor_node(Node, true) for the same Node is not an error; it results - in as many independent monitorings.

+ in as many independent monitoring instances.

If Node fails or does not exist, the message {nodedown, Node} is delivered to the process. If a process has made two calls to monitor_node(Node, true) @@ -3256,8 +3256,8 @@ os_prompt% process.

The name of the executable as well as the arguments given in cd, env, args, and arg0 are - subject to Unicode filename translation if the system is running - in Unicode filename mode. To avoid + 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 @@ -3267,7 +3267,7 @@ os_prompt% 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 filename translation mode. Otherwise the name + 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:

@@ -3280,7 +3280,7 @@ os_prompt% runs outside the Erlang work space unless an Erlang driver with the name Command is found. If found, that driver is started. A driver runs in the Erlang - workspace, which means that it is linked with the Erlang + work space, which means that it is linked with the Erlang runtime system.

When starting external programs on Solaris, the system call vfork is used in preference to fork @@ -3296,8 +3296,8 @@ os_prompt% 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 filenames or directory names. - If spaces in executable filenames are desired, use + programs having spaces in file names or directory names. + If spaces in executable file names are desired, use {spawn_executable, Command} instead.

{spawn_driver, Command} @@ -3408,14 +3408,14 @@ os_prompt% 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 wildcard expansion does not happen. - To expand wildcards for the arguments, use + 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, wildcard expansion + shell ultimately is invoked, wild card expansion does not happen, and the script is provided with the - untouched arguments. On Windows, wildcard expansion + 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]) @@ -4313,8 +4313,8 @@ os_prompt% high are selected for execution. As with priority high, processes on lower priorities can execute in parallel with processes on priority max.

-

Scheduling is pre-emptive. Regardless of priority, a process - is pre-empted when it has consumed more than a certain number +

Scheduling is preemptive. Regardless of priority, a process + is preempted when it has consumed more than a certain number of reductions since the last time it was selected for execution.

@@ -5120,7 +5120,7 @@ true

Starts a timer. When the timer expires, the message Msg is sent to the process - identified by Dest. Appart from + identified by Dest. Apart from the format of the timeout message, erlang:send_after/4 works exactly as erlang:start_timer/4.

@@ -7067,21 +7067,21 @@ ok introduced in the future:

{function, Function} -

Function is the name of the funcion +

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 identifer used when calling + 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 retreived + 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 @@ -7135,14 +7135,14 @@ ok {clock_id, ClockId}

This tuple only exist if Function can be used with different clocks. ClockId - corresponds to the clock identifer used when calling + 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 retreived + 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 @@ -7654,9 +7654,8 @@ ok

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-emptively - scheduled out do not trigger this message.

+ are reinserted into the run queue after having been + preempted do not trigger this message.

runnable_ports @@ -8341,7 +8340,7 @@ timestamp() ->

To get information about a function, PidOrFunc is to be the three-element tuple {Module, Function, Arity} or - the atom on_load. No wildcards are allowed. Returns + the atom on_load. No wild cards are allowed. Returns undefined if the function does not exist, or false if the function is not traced.

The following Items are valid::

@@ -8457,7 +8456,7 @@ timestamp() -> {Module, Function, Arity}, or the atom on_load (described in the following). It can be the module, function, and arity for a function (or a BIF in any module). - The atom '_' can be used as a wildcard in any of the + The atom '_' can be used as a wild card in any of the following ways:

{Module,Function,'_'} @@ -8475,7 +8474,7 @@ timestamp() ->

Other combinations, such as {Module,'_',Arity}, are - not allowed. Local functions match wildcards only if + not allowed. Local functions match wild cards 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 @@ -8722,7 +8721,7 @@ timestamp() -> positive

Return only positive integers.

Note that by passing the positive modifier - you will get heap allocated integers (big-nums) + you will get heap allocated integers (bignums) quicker.

@@ -8758,7 +8757,7 @@ timestamp() -> are ignored.

Note that the set of integers returned by - unique_integer/1 using diffrent sets of + unique_integer/1 using different sets of Modifiers will overlap. For example, by calling unique_integer([monotonic]), and unique_integer([positive, monotonic]) -- cgit v1.2.3