diff options
Diffstat (limited to 'erts/doc')
-rw-r--r-- | erts/doc/src/alt_dist.xml | 22 | ||||
-rw-r--r-- | erts/doc/src/crash_dump.xml | 8 | ||||
-rw-r--r-- | erts/doc/src/driver.xml | 142 | ||||
-rw-r--r-- | erts/doc/src/driver_entry.xml | 8 | ||||
-rw-r--r-- | erts/doc/src/erl.xml | 63 | ||||
-rw-r--r-- | erts/doc/src/erl_dist_protocol.xml | 12 | ||||
-rw-r--r-- | erts/doc/src/erl_driver.xml | 24 | ||||
-rw-r--r-- | erts/doc/src/erl_nif.xml | 767 | ||||
-rw-r--r-- | erts/doc/src/erlang.xml | 353 | ||||
-rw-r--r-- | erts/doc/src/erlc.xml | 10 | ||||
-rw-r--r-- | erts/doc/src/erlsrv.xml | 22 | ||||
-rw-r--r-- | erts/doc/src/erts_alloc.xml | 164 | ||||
-rw-r--r-- | erts/doc/src/escript.xml | 20 | ||||
-rw-r--r-- | erts/doc/src/inet_cfg.xml | 13 | ||||
-rw-r--r-- | erts/doc/src/match_spec.xml | 40 | ||||
-rw-r--r-- | erts/doc/src/notes.xml | 522 | ||||
-rw-r--r-- | erts/doc/src/tty.xml | 8 | ||||
-rw-r--r-- | erts/doc/src/zlib.xml | 24 |
18 files changed, 1672 insertions, 550 deletions
diff --git a/erts/doc/src/alt_dist.xml b/erts/doc/src/alt_dist.xml index 9a68b3cf40..a929aec97f 100644 --- a/erts/doc/src/alt_dist.xml +++ b/erts/doc/src/alt_dist.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2000</year><year>2009</year> + <year>2000</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>How to implement an alternative carrier for the Erlang distribution</title> @@ -939,7 +939,7 @@ connection that is not functioning.</item> <item>'R': Get creation number of listen socket, which is used to dig out the number stored in the lock file to differentiate - between invocations of Erlang nodes with the same name.\011 </item> + between invocations of Erlang nodes with the same name.</item> </list> <p>The control interface gets a buffer to return its value in, but is free to allocate it's own buffer is the provided one is @@ -949,11 +949,11 @@ ( 2) char* buf, int count, char** res, int res_size) ( 3) { ( 4) /* Local macro to ensure large enough buffer. */ -( 5) #define ENSURE(N) \\ -( 6) do { \\ -( 7) if (res_size < N) { \\ -( 8) *res = ALLOC(N); \\ -( 9) } \\ +( 5) #define ENSURE(N) \ +( 6) do { \ +( 7) if (res_size < N) { \ +( 8) *res = ALLOC(N); \ +( 9) } \ (10) } while(0) (11) UdsData *ud = (UdsData *) handle; @@ -1075,7 +1075,7 @@ Eshell V5.0 (abort with ^G) (bing@hador)2></pre> <p>...</p> <pre> -$ <input>erl -pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin -proto_dist uds \\ </input> +$ <input>erl -pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin -proto_dist uds \ </input> <input> -no_epmd -sname bong</input> Erlang (BEAM) emulator version 5.0 @@ -1084,7 +1084,7 @@ Eshell V5.0 (abort with ^G) <p>One can utilize the ERL_FLAGS environment variable to store the complicated parameters in:</p> <pre> -$ <input>ERL_FLAGS=-pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin \\ </input> +$ <input>ERL_FLAGS=-pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin \ </input> <input> -proto_dist uds -no_epmd</input> $ <input>export ERL_FLAGS</input> $ <input>erl -sname bang</input> diff --git a/erts/doc/src/crash_dump.xml b/erts/doc/src/crash_dump.xml index 5182929358..b3c4671c3d 100644 --- a/erts/doc/src/crash_dump.xml +++ b/erts/doc/src/crash_dump.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1999</year><year>2009</year> + <year>1999</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>How to interpret the Erlang crash dumps</title> @@ -96,7 +96,7 @@ allocators see <seealso marker="erts_alloc">erts_alloc(3)</seealso>.</item> <item>"<em><A></em>: Cannot reallocate <em><N></em> - bytes of memory\011(of type "<em><T></em>")." - Same as + bytes of memory (of type "<em><T></em>")." - Same as above with the exception that memory was being reallocated instead of being allocated when the system ran out of memory.</item> <item>"Unexpected op code <em>N</em>" - Error in compiled diff --git a/erts/doc/src/driver.xml b/erts/doc/src/driver.xml index c396ee0b90..12c79aee90 100644 --- a/erts/doc/src/driver.xml +++ b/erts/doc/src/driver.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2001</year><year>2009</year> + <year>2001</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>How to implement a driver</title> @@ -510,11 +510,11 @@ static int do_select(const char* s, our_data_t* data) PGconn* conn = data->conn; /* if there's an error return it now */ if (PQsendQuery(conn, s) == 0) { -\011ei_x_buff x; -\011ei_x_new_with_version(&x); -\011encode_error(&x, conn); -\011driver_output(data->port, x.buff, x.index); -\011ei_x_free(&x); + ei_x_buff x; + ei_x_new_with_version(&x); + encode_error(&x, conn); + driver_output(data->port, x.buff, x.index); + ei_x_free(&x); } /* else wait for ready_output to get results */ return 0; @@ -532,31 +532,31 @@ static void ready_io(ErlDrvData drv_data, ErlDrvEvent event) ei_x_buff x; ei_x_new_with_version(&x); if (data->connecting) { -\011ConnStatusType status; -\011PQconnectPoll(conn); -\011status = PQstatus(conn); -\011if (status == CONNECTION_OK) -\011 encode_ok(&x); -\011else if (status == CONNECTION_BAD) -\011 encode_error(&x, conn); + ConnStatusType status; + PQconnectPoll(conn); + status = PQstatus(conn); + if (status == CONNECTION_OK) + encode_ok(&x); + else if (status == CONNECTION_BAD) + encode_error(&x, conn); } else { -\011PQconsumeInput(conn); -\011if (PQisBusy(conn)) -\011 return; -\011res = PQgetResult(conn); -\011encode_result(&x, res, conn); -\011PQclear(res); -\011for (;;) { -\011 res = PQgetResult(conn); -\011 if (res == NULL) -\011\011break; -\011 PQclear(res); -\011} + PQconsumeInput(conn); + if (PQisBusy(conn)) + return; + res = PQgetResult(conn); + encode_result(&x, res, conn); + PQclear(res); + for (;;) { + res = PQgetResult(conn); + if (res == NULL) + break; + PQclear(res); + } } if (x.index > 1) { -\011driver_output(data->port, x.buff, x.index); -\011if (data->connecting) -\011 driver_select(data->port, (ErlDrvEvent)data->socket, DO_WRITE, 0); + driver_output(data->port, x.buff, x.index); + if (data->connecting) + driver_select(data->port, (ErlDrvEvent)data->socket, DO_WRITE, 0); } ei_x_free(&x); } @@ -592,17 +592,17 @@ static void ready_io(ErlDrvData drv_data, ErlDrvEvent event) connect(ConnectStr) -> case erl_ddll:load_driver(".", "pg_async") of -\011ok -> ok; -\011{error, already_loaded} -> ok; -\011_ -> exit({error, could_not_load_driver}) + ok -> ok; + {error, already_loaded} -> ok; + _ -> exit({error, could_not_load_driver}) end, Port = open_port({spawn, ?MODULE}, [binary]), port_control(Port, ?DRV_CONNECT, ConnectStr), case return_port_data(Port) of -\011ok -> -\011 {ok, Port}; -\011Error -> -\011 Error + ok -> + {ok, Port}; + Error -> + Error end. disconnect(Port) -> @@ -617,8 +617,8 @@ select(Port, Query) -> return_port_data(Port) -> receive -\011{Port, {data, Data}} -> -\011 binary_to_term(Data) + {Port, {data, Data}} -> + binary_to_term(Data) end. ]]></code> <p>The Erlang code is slightly different, this is because we @@ -662,22 +662,22 @@ return_port_data(Port) -> call-back <c><![CDATA[ready_async]]></c>.</p> <code type="none"><![CDATA[ static ErlDrvEntry next_perm_driver_entry = { - NULL,\011\011\011/* init */ + NULL, /* init */ start, - NULL, \011\011\011/* stop */ - output,\011\011\011 - NULL,\011\011\011/* ready_input */ - NULL,\011\011\011/* ready_output */ - "next_perm", /* the name of the driver */ - NULL,\011\011\011/* finish */ - NULL,\011\011\011/* handle */ - NULL,\011\011\011/* control */ - NULL,\011\011\011/* timeout */ - NULL,\011\011\011/* outputv */ + NULL, /* stop */ + output, + NULL, /* ready_input */ + NULL, /* ready_output */ + "next_perm", /* the name of the driver */ + NULL, /* finish */ + NULL, /* handle */ + NULL, /* control */ + NULL, /* timeout */ + NULL, /* outputv */ ready_async, - NULL,\011\011\011/* flush */ - NULL,\011\011\011/* call */ - NULL\011\011\011/* event */ + NULL, /* flush */ + NULL, /* call */ + NULL /* event */ }; ]]></code> <p>The <c><![CDATA[output]]></c> function allocates the work-area of the @@ -699,7 +699,7 @@ struct our_async_data { }; our_async_data::our_async_data(ErlDrvPort p, int command, -\011\011\011 const char* buf, int len) + const char* buf, int len) : prev(command == 2), data((int*)buf, (int*)buf + len / sizeof(int)) { @@ -722,9 +722,9 @@ static void do_perm(void* async_data) { our_async_data* d = reinterpret_cast<our_async_data*>(async_data); if (d->prev) -\011prev_permutation(d->data.begin(), d->data.end()); + prev_permutation(d->data.begin(), d->data.end()); else -\011next_permutation(d->data.begin(), d->data.end()); + next_permutation(d->data.begin(), d->data.end()); } ]]></code> <p>In the <c><![CDATA[ready_async]]></c> function, the output is sent back to the @@ -742,9 +742,9 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData async_data) int n = d->data.size(), result_n = n*2 + 3; ErlDrvTermData* result = new ErlDrvTermData[result_n], * rp = result; for (vector<int>::iterator i = d->data.begin(); -\011 i != d->data.end(); ++i) { -\011*rp++ = ERL_DRV_INT; -\011*rp++ = *i; + i != d->data.end(); ++i) { + *rp++ = ERL_DRV_INT; + *rp++ = *i; } *rp++ = ERL_DRV_NIL; *rp++ = ERL_DRV_LIST; @@ -767,16 +767,16 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData async_data) load() -> case whereis(next_perm) of -\011undefined -> -\011 case erl_ddll:load_driver(".", "next_perm") of -\011\011ok -> ok; -\011\011{error, already_loaded} -> ok; -\011\011E -> exit(E) -\011 end, -\011 Port = open_port({spawn, "next_perm"}, []), -\011 register(next_perm, Port); -\011_ -> -\011 ok + undefined -> + case erl_ddll:load_driver(".", "next_perm") of + ok -> ok; + {error, already_loaded} -> ok; + E -> exit(E) + end, + Port = open_port({spawn, "next_perm"}, []), + register(next_perm, Port); + _ -> + ok end. list_to_integer_binaries(L) -> @@ -793,8 +793,8 @@ next_perm(L, Nxt) -> B = list_to_integer_binaries(L), port_control(next_perm, Nxt, B), receive -\011Result -> -\011 Result + Result -> + Result end. all_perm(L) -> diff --git a/erts/doc/src/driver_entry.xml b/erts/doc/src/driver_entry.xml index 6b7d2acf24..e71b48bd92 100644 --- a/erts/doc/src/driver_entry.xml +++ b/erts/doc/src/driver_entry.xml @@ -4,7 +4,7 @@ <cref> <header> <copyright> - <year>2001</year><year>2009</year> + <year>2001</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>driver_entry</title> @@ -188,7 +188,7 @@ typedef struct erl_drv_entry { <p>This is called when the port is closed, with <c>port_close/1</c> or <c>Port ! {self(), close}</c>. Note that terminating the port owner process also closes the - p\011 port.</p> + port.</p> </item> <tag><marker id="output"/>void (*output)(ErlDrvData drv_data, char *buf, int len)</tag> <item> diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index 90a3c53a37..bb741c7836 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -4,7 +4,7 @@ <comref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erl</title> @@ -131,9 +131,8 @@ see <seealso marker="kernel:app">app(4)</seealso> and <seealso marker="kernel:application">application(3)</seealso>.</p> </item> - <tag><c><![CDATA[-args_file FileName]]></c></tag> + <tag><marker id="args_file"><c><![CDATA[-args_file FileName]]></c></marker></tag> <item> - <marker id="args_file"></marker> <p>Command line arguments are read from the file <c><![CDATA[FileName]]></c>. The arguments read from the file replace the '<c><![CDATA[-args_file FileName]]></c>' flag on the resulting command line.</p> @@ -197,9 +196,8 @@ <seealso marker="kernel:app">app(4)</seealso> and <seealso marker="kernel:application">application(3)</seealso>.</p> </item> - <tag><c><![CDATA[-connect_all false]]></c></tag> + <tag><marker id="connect_all"><c><![CDATA[-connect_all false]]></c></marker></tag> <item> - <marker id="connect_all"></marker> <p>If this flag is present, <c><![CDATA[global]]></c> will not maintain a fully connected network of distributed Erlang nodes, and then global name registration cannot be used. See @@ -252,7 +250,7 @@ run as a distributed node. Hidden nodes always establish hidden connections to all other nodes except for nodes in the same global group. Hidden connections are not published on - neither of the connected nodes, i.e. neither of the connected + either of the connected nodes, i.e. neither of the connected nodes are part of the result from <c><![CDATA[nodes/0]]></c> on the other node. See also hidden global groups, <seealso marker="kernel:global_group">global_group(3)</seealso>.</p> @@ -282,9 +280,8 @@ <p>Makes <c><![CDATA[init]]></c> write some debug information while interpreting the boot script.</p> </item> - <tag><c><![CDATA[-instr]]></c>(emulator flag)</tag> + <tag><marker id="instr"><c><![CDATA[-instr]]></c>(emulator flag)</marker></tag> <item> - <marker id="instr"></marker> <p>Selects an instrumented Erlang runtime system (virtual machine) to run, instead of the ordinary one. When running an instrumented runtime system, some resource usage data can be @@ -410,7 +407,7 @@ <tag><c><![CDATA[-setcookie Cookie]]></c></tag> <item> <p>Sets the magic cookie of the node to <c><![CDATA[Cookie]]></c>, see - <seealso marker="erlang#erlang:set_cookie/2">erlang:set_cookie/2</seealso>.</p> + <seealso marker="erlang#set_cookie/2">erlang:set_cookie/2</seealso>.</p> </item> <tag><c><![CDATA[-shutdown_time Time]]></c></tag> <item> @@ -431,9 +428,8 @@ flag and those running with the <c><![CDATA[-name]]></c> flag, as node names must be unique in distributed Erlang systems.</p> </item> - <tag><c><![CDATA[-smp [enable|auto|disable]]]></c></tag> + <tag><marker id="smp"><c><![CDATA[-smp [enable|auto|disable]]]></c></marker></tag> <item> - <marker id="smp"></marker> <p><c>-smp enable</c> and <c>-smp</c> starts the Erlang runtime system with SMP support enabled. This may fail if no runtime system with SMP support is available. <c>-smp auto</c> starts @@ -462,9 +458,8 @@ <p><c><![CDATA[erl]]></c> invokes the code for the Erlang emulator (virtual machine), which supports the following flags:</p> <taglist> - <tag><c><![CDATA[+a size]]></c></tag> + <tag><marker id="async_thread_stack_size"><c><![CDATA[+a size]]></c></marker></tag> <item> - <marker id="async_thread_stack_size"></marker> <p>Suggested stack size, in kilowords, for threads in the async-thread pool. Valid range is 16-8192 kilowords. The default suggested stack size is 16 kilowords, i.e, 64 @@ -478,9 +473,8 @@ suggestion, and it might even be ignored on some platforms.</p> </item> - <tag><c><![CDATA[+A size]]></c></tag> + <tag><marker id="async_thread_pool_size"><c><![CDATA[+A size]]></c></marker></tag> <item> - <marker id="async_thread_pool_size"></marker> <p>Sets the number of threads in async thread pool, valid range is 0-1024. Default is 0.</p> </item> @@ -527,11 +521,16 @@ <p>Calling <c>erlang:halt/1</c> with a string argument will still produce a crash dump.</p> </item> - <tag><c><![CDATA[+h Size]]></c></tag> + <tag><c><![CDATA[+hms Size]]></c></tag> <item> <p>Sets the default heap size of processes to the size <c><![CDATA[Size]]></c>.</p> </item> + <tag><c><![CDATA[+hmbs Size]]></c></tag> + <item> + <p>Sets the default binary virtual heap size of processes to the size + <c><![CDATA[Size]]></c>.</p> + </item> <tag><c><![CDATA[+K true | false]]></c></tag> <item> <p>Enables or disables the kernel poll functionality if @@ -545,23 +544,20 @@ <p>Enables auto load tracing, displaying info while loading code.</p> </item> - <tag><c><![CDATA[+MFlag Value]]></c></tag> + <tag><marker id="erts_alloc"><c><![CDATA[+MFlag Value]]></c></marker></tag> <item> - <marker id="erts_alloc"></marker> <p>Memory allocator specific flags, see <seealso marker="erts_alloc">erts_alloc(3)</seealso> for further information.</p> </item> - <tag><c><![CDATA[+P Number]]></c></tag> + <tag><marker id="max_processes"><c><![CDATA[+P Number]]></c></marker></tag> <item> - <marker id="max_processes"></marker> <p>Sets the maximum number of concurrent processes for this system. <c><![CDATA[Number]]></c> must be in the range 16..134217727. Default is 32768.</p> </item> - <tag><c><![CDATA[+R ReleaseNumber]]></c></tag> + <tag><marker id="compat_rel"><c><![CDATA[+R ReleaseNumber]]></c></marker></tag> <item> - <marker id="compat_rel"></marker> <p>Sets the compatibility mode.</p> <p>The distribution mechanism is not backwards compatible by default. This flags sets the emulator in compatibility mode @@ -587,9 +583,8 @@ <item> <p>Force ets memory block to be moved on realloc.</p> </item> - <tag><c><![CDATA[+S Schedulers:SchedulerOnline]]></c></tag> + <tag><marker id="+S"><c><![CDATA[+S Schedulers:SchedulerOnline]]></c></marker></tag> <item> - <marker id="+S"></marker> <p>Sets the amount of scheduler threads to create and scheduler threads to set online when SMP support has been enabled. Valid range for both values are 1-1024. If the @@ -610,9 +605,8 @@ <item> <p>Scheduling specific flags.</p> <taglist> - <tag>+sbt BindType</tag> + <tag><marker id="+sbt"><c>+sbt BindType</c></marker></tag> <item> - <marker id="+sbt"></marker> <p>Set scheduler bind type. Currently valid <c>BindType</c>s: </p> <taglist> @@ -667,9 +661,8 @@ <seealso marker="erlang#system_flag_scheduler_bind_type">erlang:system_flag(scheduler_bind_type, SchedulerBindType)</seealso>. </p> </item> - <tag><c>+sct CpuTopology</c></tag> + <tag><marker id="+sct"><c>+sct CpuTopology</c></marker></tag> <item> - <marker id="+sct"></marker> <list type="bulleted"> <item><c><![CDATA[<Id> = integer(); when 0 =< <Id> =< 65535]]></c></item> <item><c><![CDATA[<IdRange> = <Id>-<Id>]]></c></item> @@ -786,16 +779,18 @@ </item> </taglist> </item> - <tag><c><![CDATA[+sss size]]></c></tag> + <tag><marker id="sched_thread_stack_size"><c><![CDATA[+sss size]]></c></marker></tag> <item> - <marker id="sched_thread_stack_size"></marker> <p>Suggested stack size, in kilowords, for scheduler threads. Valid range is 4-8192 kilowords. The default stack size is OS dependent.</p> </item> - <tag><c><![CDATA[+T Level]]></c></tag> + <tag><marker id="+t"><c><![CDATA[+t size]]></c></marker></tag> + <item> + <p>Set the maximum number of atoms the VM can handle. Default is 1048576.</p> + </item> + <tag><marker id="+T"><c><![CDATA[+T Level]]></c></marker></tag> <item> - <marker id="+T"></marker> <p>Enables modified timing and sets the modified timing level. Currently valid range is 0-9. The timing of the runtime system will change. A high level usually means a greater change than diff --git a/erts/doc/src/erl_dist_protocol.xml b/erts/doc/src/erl_dist_protocol.xml index 9a203289e9..5978af178a 100644 --- a/erts/doc/src/erl_dist_protocol.xml +++ b/erts/doc/src/erl_dist_protocol.xml @@ -129,8 +129,8 @@ By default EPMD listens on port 4369. <cell align="center">PortNo</cell> <cell align="center">NodeType</cell> <cell align="center">Protocol</cell> - <cell align="center">LowestVersion</cell> <cell align="center">HighestVersion</cell> + <cell align="center">LowestVersion</cell> <cell align="center">Nlen</cell> <cell align="center">NodeName</cell> <cell align="center">Elen</cell> @@ -150,16 +150,16 @@ By default EPMD listens on port 4369. <item> 0 = tcp/ip-v4, ... </item> - <tag><c>LowestVersion</c></tag> - <item> - The lowest distribution version that this node can handle. - See the next field for possible values. - </item> <tag><c>HighestVersion</c></tag> <item> The highest distribution version that this node can handle. The value in R6B and later is 5. </item> + <tag><c>LowestVersion</c></tag> + <item> + The lowest distribution version that this node can handle. + The value in R6B and later is 5. + </item> <tag><c>Nlen</c></tag> <item> The length of the <c>NodeName</c>. diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml index 0b11f4bbcb..5061230a33 100644 --- a/erts/doc/src/erl_driver.xml +++ b/erts/doc/src/erl_driver.xml @@ -4,7 +4,7 @@ <cref> <header> <copyright> - <year>2001</year><year>2009</year> + <year>2001</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erl_driver</title> @@ -171,8 +171,8 @@ asynchronous function calls, using a thread pool provided by Erlang. There is also a select call, that can be used for asynchronous drivers.</item> - <tag>Multi-threading</tag> - <item><marker id="multi_threading"></marker> + <tag><marker id="multi_threading">Multi-threading</marker></tag> + <item> <p>A POSIX thread like API for multi-threading is provided. The Erlang driver thread API only provide a subset of the functionality provided by the POSIX thread API. The subset provided is @@ -245,9 +245,8 @@ <item>A driver can add and later remove drivers.</item> <tag>Monitoring processes</tag> <item>A driver can monitor a process that does not own a port.</item> - <tag>Version management</tag> + <tag><marker id="version_management">Version management</marker></tag> <item> - <marker id="version_management"></marker> <p>Version management is enabled for drivers that have set the <seealso marker="driver_entry#extended_marker">extended_marker</seealso> field of their @@ -299,6 +298,8 @@ typedef struct ErlDrvSysInfo { int smp_support; int async_threads; int scheduler_threads; + int nif_major_version; + int nif_minor_version; } ErlDrvSysInfo; </code> @@ -365,9 +366,14 @@ typedef struct ErlDrvSysInfo { (the same as returned by <seealso marker="erts:erlang#system_info_schedulers">erlang:system_info(schedulers)</seealso>). </item> + <tag><c>nif_major_version</c></tag> + <item>The value of <c>ERL_NIF_MAJOR_VERSION</c> when the runtime system was compiled. + </item> + <tag><c>nif_minor_version</c></tag> + <item>The value of <c>ERL_NIF_MINOR_VERSION</c> when the runtime system was compiled. + </item> </taglist> </item> - <tag><marker id="ErlDrvBinary"/>ErlDrvBinary</tag> <item> <p/> @@ -1292,7 +1298,7 @@ typedef struct ErlIOVec { has been set in the <seealso marker="driver_entry">driver_entry</seealso>, data can be forced into the driver via - <seealso marker="erlang#erlang:port_command/3">port_command(Port, Data, [force])</seealso> + <seealso marker="erlang#port_command/3">port_command(Port, Data, [force])</seealso> even though the driver has signaled that it is busy. </p> </desc> diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index c636d65ef3..0dd46a951a 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -34,31 +34,37 @@ <lib>erl_nif</lib> <libsummary>API functions for an Erlang NIF library</libsummary> <description> - <warning><p>The NIF concept is introduced in R13B03 as an + <warning><p>The NIF concept was introduced in R13B03 as an EXPERIMENTAL feature. The interfaces may be changed in any way - in coming releases. The API introduced in this release is very - sparse and contains only the most basic functions to read and - write Erlang terms. - </p></warning> + in coming releases. The plan is however to lift the experimental label and + maintain interface backward compatibility from R14B.</p> + <p>Incompatible changes in <em>R13B04</em>:</p> + <list> + <item>The function prototypes of the NIFs have changed to expect <c>argc</c> and <c>argv</c> + arguments. The arity of a NIF is by that no longer limited to 3.</item> + <item><c>enif_get_data</c> renamed as <c>enif_priv_data</c>.</item> + <item><c>enif_make_string</c> got a third argument for character encoding.</item> + </list> + </warning> <p>A NIF library contains native implementation of some functions - of an erlang module. The native implemented functions (NIFs) are + of an Erlang module. The native implemented functions (NIFs) are called like any other functions without any difference to the caller. Each NIF must also have an implementation in Erlang that will be invoked if the function is called before the NIF library has been successfully loaded. A typical such stub implementation is to throw an exception. But it can also be used as a fallback implementation if the NIF library is not implemented for some - architecture.</p> + architecture.</p> <p>A minimal example of a NIF library can look like this:</p> <p/> <code type="none"> /* niftest.c */ #include "erl_nif.h" -static ERL_NIF_TERM hello(ErlNifEnv* env) +static ERL_NIF_TERM hello(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { - return enif_make_string(env, "Hello world!"); + return enif_make_string(env, "Hello world!", ERL_NIF_LATIN1); } static ErlNifFunc nif_funcs[] = @@ -69,7 +75,7 @@ static ErlNifFunc nif_funcs[] = ERL_NIF_INIT(niftest,nif_funcs,NULL,NULL,NULL,NULL) </code> - <p>and the erlang module would have to look something like + <p>and the Erlang module would have to look something like this:</p> <p/> <code type="none"> @@ -100,26 +106,140 @@ ok </code> <p>A better solution for a real module is to take advantage of - the new attribute <c>on_load</c> to automatically load the NIF - library when the module is loaded.</p> + the new directive <seealso + marker="doc/reference_manual:code_loading#on_load">on_load</seealso> to automatically + load the NIF library when the module is loaded.</p> + <note><p>A NIF must be exported or used locally by the module (or both). + An unused local stub function will be optimized away by the compiler + causing loading of the NIF library to fail.</p> + </note> <p>A loaded NIF library is tied to the Erlang module code version that loaded it. If the module is upgraded with a new version, the - new code will have to load its own NIF library (or maybe choose not + new Erlang code will have to load its own NIF library (or maybe choose not to). The new code version can however choose to load the exact same NIF library as the old code if it wants to. Sharing the same dynamic library will mean that static data defined by the library will be shared as well. To avoid unintentionally shared static data, each Erlang module code can keep its own private data. This - global private data can be set when the NIF library is loaded and - then retrieved by calling <seealso marker="erl_nif#enif_get_data">enif_get_data()</seealso>.</p> - <p>There is currently no way to explicitly unload a NIF - library. A library will be automatically unloaded when the module - code that it belongs to is purged by the code server. A NIF - library will can also be unloaded by replacing it with another - version of the library by a second call to + private data can be set when the NIF library is loaded and + then retrieved by calling <seealso marker="#enif_priv_data">enif_priv_data()</seealso>.</p> + <p>There is no way to explicitly unload a NIF library. A library will be + automatically unloaded when the module code that it belongs to is purged + by the code server. A NIF library will also be unloaded if it is replaced + by another version of the library by a second call to <c>erlang:load_nif/2</c> from the same module code.</p> </description> + <section> + <title>FUNCTIONALITY</title> + <p>All functions that a NIF library needs to do with Erlang are + performed through the NIF API functions. There are functions + for the following functionality:</p> + <taglist> + <tag>Read and write Erlang terms</tag> + <item><p>Any Erlang terms can be passed to a NIF as function arguments and + be returned as function return values. The terms are of C-type <c>ERL_NIF_TERM</c> + and can only be read or written using API functions. Most functions to read + the content of a term are prefixed <c>enif_get_</c> and usually return + true (or false) if the term was of the expected type (or not). + The functions to write terms are all prefixed <c>enif_make_</c> and usually + return the created <c>ERL_NIF_TERM</c>. There are also some functions + to query terms, like <c>enif_is_atom</c>, <c>enif_is_identical</c> and + <c>enif_compare</c>.</p></item> + <tag>Binaries</tag> + <item><p>Terms of type binary are accessed with the help of the struct type + <seealso marker="#ErlNifBinary">ErlNifBinary</seealso> + that contains a pointer (<c>data</c>) to the raw binary data and the length + (<c>size</c>) of the data in bytes. Both <c>data</c> and <c>size</c> are + read-only and should only be written using calls to API functions. + Instances of <c>ErlNifBinary</c> are however always allocated by the user + (usually as local variables).</p> + <p>The raw data pointed to by <c>data</c> is only mutable after a call to + <seealso marker="#enif_alloc_binary">enif_alloc_binary</seealso> or + <seealso marker="#enif_realloc_binary">enif_realloc_binary</seealso>. + All other functions that operates on a binary will leave the data as read-only. + A mutable binary must in the end either be freed with + <seealso marker="#enif_release_binary">enif_release_binary</seealso> + or made read-only by transferring it to an Erlang term with + <seealso marker="#enif_make_binary">enif_make_binary</seealso>. + But it does not have do happen in the same NIF call. Read-only binaries + does not have to be released.</p> + <p>Binaries are sequences of whole bytes. Bitstrings with an arbitrary + bit length have no support yet.</p> + </item> + <tag>Resource objects</tag> + <item><p>The use of resource objects is a way to return pointers to + native data structures from a NIF in a safe way. A resource object is + just a block of memory allocated with + <seealso marker="#enif_alloc_resource">enif_alloc_resource()</seealso>. + A handle ("safe pointer") to this memory block can then be returned to Erlang by the use of + <seealso marker="#enif_make_resource">enif_make_resource()</seealso>. + The term returned by <c>enif_make_resource</c> + is totally opaque in nature. It can be stored and passed between processses + on the same node, but the only real end usage is to pass it back as argument to a NIF. + The NIF can then do <seealso marker="#enif_get_resource">enif_get_resource()</seealso> + and get back a pointer to the memory block that is guaranteed to still be + valid. A resource object will not be deallocated until the last handle term + has been garbage collected by the VM and the resource has been + released with <seealso marker="#enif_release_resource">enif_release_resource()</seealso> + (not necessarily in that order).</p> + <p>All resource objects are created as instances of some <em>resource type</em>. + This makes resources from different modules to be distinguishable. + A resource type is created by calling + <seealso marker="#enif_open_resource_type">enif_open_resource_type()</seealso> + when a library is loaded. Objects of that resource type can then later be allocated + and <c>enif_get_resource</c> verifies that the resource is of the expected type. + A resource type can have a user supplied destructor function that is + automatically called when resources of that type are released (by either + the garbage collector or <c>enif_release_resource</c>). Resource types + are uniquely identified by a supplied name string.</p> + <p>Resource types support upgrade in runtime by allowing a loaded NIF + library to takeover an already existing resource type and thereby + "inherit" all existing objects of that type. The destructor of the new + library will thereafter be called for the inherited objects and the + library with the old destructor function can be safely unloaded. Existing + resource objects, of a module that is upgraded, must either be deleted + or taken over by the new NIF library. The unloading of a library will be + postponed as long as it exists resource objects with a destructor + function in the library. + </p> + <p>Here is a template example of how to create and return a resource object.</p> + <p/> + <code type="none"> + ERL_NIF_TERM term; + MyStruct* ptr = enif_alloc_resource(env, my_resource_type, sizeof(MyStruct)); + + /* initialize struct ... */ + term = enif_make_resource(env, ptr); + + if (keep_a_reference_of_our_own) { + /* store 'ptr' in static variable, private data or other resource object */ + } + else { + enif_release_resource(env, obj); + /* resource now only owned by "Erlang" */ + } + return term; +} +</code> + + </item> + <tag>Threads and concurrency</tag> + <item><p>A NIF is thread-safe without any explicit synchronization as + long as it acts as a pure function and only reads the supplied + arguments. As soon as you write towards a shared state either through + static variables or <seealso marker="#enif_priv_data">enif_priv_data</seealso> + you need to supply your own explicit synchronization. Resource objects + will also require synchronization if you treat them as mutable.</p> + <p>The library initialization callbacks <c>load</c>, <c>reload</c> and + <c>upgrade</c> are all thread-safe even for shared state data.</p> + <p>Avoid doing lengthy work in NIF calls as that may degrade the + responsiveness of the VM. NIFs are called directly by the same scheduler + thread that executed the calling Erlang code. The calling scheduler will thus + be blocked from doing any other work until the NIF returns.</p> + </item> + </taglist> + </section> <section> <title>INITIALIZATION</title> <taglist> @@ -143,9 +263,11 @@ ok and there is no previously loaded library for this module.</p> <p><c>*priv_data</c> can be set to point to some private data that the library needs in able to keep a state between NIF - calls. <c>enif_get_data()</c> will return this pointer.</p> + calls. <c>enif_priv_data()</c> will return this pointer. + <c>*priv_data</c> will be initialized to NULL when <c>load</c> is + called.</p> <p><c>load_info</c> is the second argument to <seealso - marker="erlang#erlang:load_nif-2">erlang:load_nif/2</seealso>.</p> + marker="erlang#load_nif-2">erlang:load_nif/2</seealso>.</p> <p>The library will fail to load if <c>load</c> returns anything other than 0. <c>load</c> can be NULL in case no initialization is needed.</p> @@ -165,13 +287,12 @@ ok <tag><marker id="upgrade"/>int (*upgrade)(ErlNifEnv* env, void** priv_data, void** old_priv_data, ERL_NIF_TERM load_info)</tag> <item><p><c>upgrade</c> is called when the NIF library is loaded and there is no previously loaded library for this module - code, BUT there is old code of this module with a - loaded NIF library.</p> + code, BUT there is old code of this module with a loaded NIF library.</p> <p>Works the same as <c>load</c>. The only difference is that <c>*old_priv_data</c> already contains the value set by the last call to <c>load</c> or <c>reload</c> for the old module - code. It is allowed to write to both *priv_data and - *old_priv_data.</p> + code. <c>*priv_data</c> will be initialized to NULL when <c>upgrade</c> + is called. It is allowed to write to both *priv_data and *old_priv_data.</p> <p>The library will fail to load if <c>upgrade</c> returns anything other than 0 or if <c>upgrade</c> is NULL.</p> </item> @@ -179,10 +300,10 @@ ok <tag><marker id="unload"/>void (*unload)(ErlNifEnv* env, void* priv_data)</tag> <item><p><c>unload</c> is called when the module code that the NIF library belongs to is purged as old. New code - of the same module may or may not exist.</p> + of the same module may or may not exist. Note that <c>unload</c> is not + called for a replaced library as a consequence of <c>reload</c>.</p> </item> - </taglist> </section> @@ -190,7 +311,15 @@ ok <title>DATA TYPES</title> <taglist> - <tag><marker id="ErlDrvEnv"/>ErlDrvEnv</tag> + <tag><marker id="ERL_NIF_TERM"/>ERL_NIF_TERM</tag> + <item> + <p>Variables of type <c>ERL_NIF_TERM</c> can refer to any Erlang term. + This is an opaque type and values of it can only by used either as + arguments to API functions or as return values from NIFs. A variable of + type <c>ERL_NIF_TERM</c> is only valid until the NIF call, where it was + obtained, returns.</p> + </item> + <tag><marker id="ErlNifEnv"/>ErlNifEnv</tag> <item> <p><c>ErlNifEnv</c> contains information about the context in which a NIF call is made. This pointer should not be @@ -205,81 +334,151 @@ ok <p/> <code type="none"> typedef struct { - const char* name; - unsigned arity; - ERL_NIF_TERM (*fptr)(ErlNifEnv* env, ...); + const char* <em>name</em>; + unsigned <em>arity</em>; + ERL_NIF_TERM (*<em>fptr</em>)(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); } ErlNifFunc; </code> <p>Describes a NIF by its name, arity and implementation. <c>fptr</c> is a pointer to the function that implements the - NIF. The number of arguments must match the arity. A NIF of - arity 2 will thus look like:</p> - <p/> - <code type="none"> -ERL_NIF_TERM my_nif(ErlNifEnv* env, ERL_NIF_TERM arg1, ERL_NIF_TERM arg2) -{ - /* ... */ -} -</code> - <p>The maximum allowed arity for a NIF is 3 in current implementation.</p> + NIF. The argument <c>argv</c> of a NIF will contain the + function arguments passed to the NIF and <c>argc</c> is the + length of the array, i.e. the function arity. <c>argv[N-1]</c> + will thus denote the Nth argument to the NIF. Note that the + <c>argc</c> argument allows for the same C function to + implement several Erlang functions with different arity (but + same name probably).</p> </item> <tag><marker id="ErlNifBinary"/>ErlNifBinary</tag> <item> <p/> <code type="none"> typedef struct { - unsigned size; - unsigned char* data; + unsigned <em>size</em>; + unsigned char* <em>data</em>; } ErlNifBinary; </code> <p><c>ErlNifBinary</c> contains transient information about an inspected binary term. <c>data</c> is a pointer to a buffer of <c>size</c> bytes with the raw content of the binary.</p> </item> - <tag><marker id="ERL_NIF_TERM"/>ERL_NIF_TERM</tag> + <tag><marker id="ErlNifResourceType"/>ErlNifResourceType</tag> <item> - <p>Variables of type <c>ERL_NIF_TERM</c> can refere to any - Erlang term. This is an opaque type and values of it can only - by used either as arguments to API functions or as return - values from NIFs. A variable of type <c>ERL_NIF_TERM</c> is - only valid until the NIF call, where it was obtained, - returns.</p> - </item> + <p>Each instance of <c>ErlNifResourceType</c> represent a class of + memory managed resource objects that can be garbage collected. + Each resource type has a unique name and a destructor function that + is called when objects of its type are released.</p> + </item> + <tag><marker id="ErlNifResourceDtor"/>ErlNifResourceDtor</tag> + <item> + <p/> + <code type="none"> +typedef void ErlNifResourceDtor(ErlNifEnv* env, void* obj); +</code> + <p>The function prototype of a resource destructor function. + A destructor function is not allowed to call any term-making functions.</p> + </item> + <tag><marker id="ErlNifCharEncoding"/>ErlNifCharEncoding</tag> + <item> + <p/> + <code type="none"> +typedef enum { + ERL_NIF_LATIN1 +}ErlNifCharEncoding; +</code> + <p>The character encoding used in strings. The only supported + encoding is currently <c>ERL_NIF_LATIN1</c> for iso-latin-1 + (8-bit ascii).</p> + </item> + <tag><marker id="ErlNifSysInfo"/>ErlNifSysInfo</tag> + <item> + <p>Used by <seealso marker="#enif_system_info">enif_system_info</seealso> + to return information about the runtime system. Contains currently + the exact same content as <seealso marker="erl_driver#ErlDrvSysInfo">ErlDrvSysInfo</seealso>.</p> + </item> + </taglist> </section> <funcs> - <func><name><ret>void*</ret><nametext>enif_get_data(ErlNifEnv* env)</nametext></name> - <fsummary>Get the private data of a NIF library</fsummary> - <desc><p>Returns the pointer to the private data that was set by <c>load</c>, <c>reload</c> or <c>upgrade</c>.</p></desc> - </func> <func><name><ret>void*</ret><nametext>enif_alloc(ErlNifEnv* env, size_t size)</nametext></name> <fsummary>Allocate dynamic memory.</fsummary> - <desc><p>Allocate memory of <c>size</c> bytes.</p></desc> - </func> - <func><name><ret>void</ret><nametext>enif_free(ErlNifEnv* env, void* ptr)</nametext></name> - <fsummary>Free dynamic memory</fsummary> - <desc><p>Free memory allocated by <c>enif_alloc</c>.</p></desc> - </func> - <func><name><ret>int</ret><nametext>enif_is_binary(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> - <fsummary>Determine if a term is a binary</fsummary> - <desc><p>Return true if <c>term</c> is a binary</p></desc> - </func> - <func><name><ret>int</ret><nametext>enif_inspect_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, ErlNifBinary* bin)</nametext></name> - <fsummary>Inspect the content of a binary</fsummary> - <desc><p>Initialize the structure pointed to by <c>bin</c> with - transient information about the binary term - <c>bin_term</c>. Return false if <c>bin_term</c> is not a binary.</p></desc> + <desc><p>Allocate memory of <c>size</c> bytes. Return NULL if allocation failed.</p></desc> </func> <func><name><ret>int</ret><nametext>enif_alloc_binary(ErlNifEnv* env, unsigned size, ErlNifBinary* bin)</nametext></name> <fsummary>Create a new binary.</fsummary> <desc><p>Allocate a new binary of size of <c>size</c> bytes. Initialize the structure pointed to by <c>bin</c> to - refer to the allocated binary.</p></desc> + refer to the allocated binary. The binary must either be released by + <seealso marker="#enif_release_binary">enif_release_binary()</seealso> + or ownership transferred to an Erlang term with + <seealso marker="#enif_make_binary">enif_make_binary()</seealso>. + An allocated (and owned) <c>ErlNifBinary</c> can be kept between NIF + calls.</p> + <p>Return false if allocation failed.</p> + </desc> </func> - <func><name><ret>void</ret><nametext>enif_release_binary(ErlNifEnv* env, ErlNifBinary* bin)</nametext></name> - <fsummary>Release a binary.</fsummary> - <desc><p>Release a binary obtained from <c>enif_alloc_binary</c> or <c>enif_inspect_binary</c>.</p></desc> + <func><name><ret>void*</ret><nametext>enif_alloc_resource(ErlNifEnv* env, ErlNifResourceType* type, unsigned size)</nametext></name> + <fsummary>Allocate a memory managed resource object</fsummary> + <desc><p>Allocate a memory managed resource object of type <c>type</c> and size <c>size</c> bytes.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_compare(ErlNifEnv* env, ERL_NIF_TERM lhs, ERL_NIF_TERM rhs)</nametext></name> + <fsummary>Compare two terms</fsummary> + <desc><p>Return an integer less than, equal to, or greater than + zero if <c>lhs</c> is found, respectively, to be less than, + equal, or greater than <c>rhs</c>. Corresponds to the Erlang + operators <c>==</c>, <c>/=</c>, <c>=<</c>, <c><</c>, + <c>>=</c> and <c>></c> (but <em>not</em> <c>=:=</c> or <c>=/=</c>).</p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_cond_broadcast(ErlNifCond *cnd)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_cond_broadcast">erl_drv_cond_broadcast()</seealso>. + </p></desc> + </func> + <func><name><ret>ErlNifCond*</ret><nametext>enif_cond_create(char *name)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_cond_create">erl_drv_cond_create()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_cond_destroy(ErlNifCond *cnd)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_cond_destroy">erl_drv_cond_destroy()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_cond_signal(ErlNifCond *cnd)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_cond_signal">erl_drv_cond_signal()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_cond_wait(ErlNifCond *cnd, ErlNifMutex *mtx)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_cond_wait">erl_drv_cond_wait()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_equal_tids(ErlNifTid tid1, ErlNifTid tid2)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_equal_tids">erl_drv_equal_tids()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_free(ErlNifEnv* env, void* ptr)</nametext></name> + <fsummary>Free dynamic memory</fsummary> + <desc><p>Free memory allocated by <c>enif_alloc</c>.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_get_atom(ErlNifEnv* env, + ERL_NIF_TERM term, char* buf, unsigned size) + </nametext></name> + <fsummary>Get the text representation of an atom term</fsummary> + <desc><p>Write a null-terminated string, in the buffer pointed to by + <c>buf</c> of size <c>size</c>, consisting of the string + representation of the atom <c>term</c>. Return the number of bytes + written (including terminating null character) or 0 if + <c>term</c> is not an atom with maximum length of + <c>size-1</c>.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_get_double(ErlNifEnv* env, ERL_NIF_TERM term, double* dp)</nametext></name> + <fsummary>Read a floating-point number term.</fsummary> + <desc><p>Set <c>*dp</c> to the floating point value of + <c>term</c> or return false if <c>term</c> is not a float.</p></desc> </func> <func><name><ret>int</ret><nametext>enif_get_int(ErlNifEnv* env, ERL_NIF_TERM term, int* ip)</nametext></name> <fsummary>Read an integer term.</fsummary> @@ -287,45 +486,145 @@ typedef struct { <c>term</c> or return false if <c>term</c> is not an integer or is outside the bounds of type <c>int</c></p></desc> </func> - <func><name><ret>int</ret><nametext>enif_get_ulong(ErlNifEnv* env, ERL_NIF_TERM term, unsigned long* ip)</nametext></name> - <fsummary>Read an unsigned long integer</fsummary> - <desc><p>Set <c>*ip</c> to the unsigned long integer value of - <c>term</c> or return false if <c>term</c> is not an unsigned - integer or is outside the bounds of type <c>unsigned long</c></p></desc> - </func> <func><name><ret>int</ret><nametext>enif_get_list_cell(ErlNifEnv* env, ERL_NIF_TERM list, ERL_NIF_TERM* head, ERL_NIF_TERM* tail)</nametext></name> <fsummary>Get head and tail from a list</fsummary> <desc><p>Set <c>*head</c> and <c>*tail</c> from <c>list</c> or return false if <c>list</c> is not a non-empty list.</p></desc> </func> - <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_binary(ErlNifEnv* env, ErlNifBinary* bin)</nametext></name> - <fsummary>Make a binary term.</fsummary> - <desc><p>Make a binary term from <c>bin</c>. Will also release - the binary.</p></desc> + <func><name><ret>int</ret><nametext>enif_get_long(ErlNifEnv* env, ERL_NIF_TERM term, long int* ip)</nametext></name> + <fsummary>Read an long integer term.</fsummary> + <desc><p>Set <c>*ip</c> to the long integer value of + <c>term</c> or return false if <c>term</c> is not an integer or is + outside the bounds of type <c>long int</c>.</p></desc> </func> - <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_badarg(ErlNifEnv* env)</nametext></name> - <fsummary>Make a badarg exception.</fsummary> - <desc><p>Make a badarg exception to be returned from a NIF.</p></desc> + <func><name><ret>int</ret><nametext>enif_get_resource(ErlNifEnv* env, ERL_NIF_TERM term, ErlNifResourceType* type, void** objp)</nametext></name> + <fsummary>Get the pointer to a resource object</fsummary> + <desc><p>Set <c>*objp</c> to point to the resource object referred to by <c>term</c>. + The pointer is valid until the calling NIF returns and should not be released.</p> + <p>Return false if <c>term</c> is not a handle to a resource object + of type <c>type</c>.</p></desc> </func> - <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_int(ErlNifEnv* env, int i)</nametext></name> - <fsummary>Create an integer term</fsummary> - <desc><p>Create an integer term.</p></desc> + <func><name><ret>int</ret><nametext>enif_get_string(ErlNifEnv* env, + ERL_NIF_TERM list, char* buf, unsigned size, + ErlNifCharEncoding encode)</nametext></name> + <fsummary>Get a C-string from a list.</fsummary> + <desc><p>Write a null-terminated string, in the buffer pointed to by + <c>buf</c> with size <c>size</c>, consisting of the characters + in the string <c>list</c>. The characters are written using encoding + <seealso marker="#ErlNifCharEncoding">encode</seealso>. + Return the number of bytes written (including terminating null + character), or <c>-size</c> if the string was truncated due to + buffer space, or 0 if <c>list</c> is not a string that can be + encoded with <c>encode</c> or if <c>size</c> was less than 1. + The written string is always null-terminated unless buffer + <c>size</c> is less than 1.</p></desc> </func> - <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_ulong(ErlNifEnv* env, unsigned long i)</nametext></name> - <fsummary>Create an integer term from an unsigned long int</fsummary> - <desc><p>Create an integer term from an <c>unsigned long int</c>.</p></desc> + <func><name><ret>int</ret><nametext>enif_get_tuple(ErlNifEnv* env, ERL_NIF_TERM term, int* arity, const ERL_NIF_TERM** array)</nametext></name> + <fsummary>Inspect the elements of a tuple.</fsummary> + <desc><p>If <c>term</c> is a tuple, set <c>*array</c> to point + to an array containing the elements of the tuple and set + <c>*arity</c> to the number of elements. Note that the array + is read-only and <c>(*array)[N-1]</c> will be the Nth element of + the tuple. <c>*array</c> is undefined if the arity of the tuple + is zero.</p><p>Return false if <c>term</c> is not a + tuple.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_get_uint(ErlNifEnv* env, ERL_NIF_TERM term, unsigned int* ip)</nametext></name> + <fsummary>Read an unsigned integer term.</fsummary> + <desc><p>Set <c>*ip</c> to the unsigned integer value of + <c>term</c> or return false if <c>term</c> is not an unsigned integer or is + outside the bounds of type <c>unsigned int</c></p></desc> + </func> + + <func><name><ret>int</ret><nametext>enif_get_ulong(ErlNifEnv* env, ERL_NIF_TERM term, unsigned long* ip)</nametext></name> + <fsummary>Read an unsigned integer term.</fsummary> + <desc><p>Set <c>*ip</c> to the unsigned long integer value of + <c>term</c> or return false if <c>term</c> is not an unsigned integer or is + outside the bounds of type <c>unsigned long</c></p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_inspect_binary(ErlNifEnv* env, ERL_NIF_TERM bin_term, ErlNifBinary* bin)</nametext></name> + <fsummary>Inspect the content of a binary</fsummary> + <desc><p>Initialize the structure pointed to by <c>bin</c> with + information about the binary term + <c>bin_term</c>. Return false if <c>bin_term</c> is not a binary.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_inspect_iolist_as_binary(ErlNifEnv* + env, ERL_NIF_TERM term, ErlNifBinary* bin) + </nametext></name> + <fsummary>Inspect the content of an iolist</fsummary> + <desc><p>Initialize the structure pointed to by <c>bin</c> with one + continuous buffer with the same byte content as <c>iolist</c>. As with + inspect_binary, the data pointed to by <c>bin</c> is transient and does + not need to be released. Return false if <c>iolist</c> is not an + iolist.</p> + </desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_atom(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is an atom</fsummary> + <desc><p>Return true if <c>term</c> is an atom.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_binary(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is a binary</fsummary> + <desc><p>Return true if <c>term</c> is a binary</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_empty_list(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is an empty list</fsummary> + <desc><p>Return true if <c>term</c> is an empty list.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_fun(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is a fun</fsummary> + <desc><p>Return true if <c>term</c> is a fun.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_identical(ErlNifEnv* env, ERL_NIF_TERM lhs, ERL_NIF_TERM rhs)</nametext></name> + <fsummary>Erlang operator =:=</fsummary> + <desc><p>Return true if the two terms are identical. Corresponds to the + Erlang operators <c>=:=</c> and + <c>=/=</c>.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_pid(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is a pid</fsummary> + <desc><p>Return true if <c>term</c> is a pid.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_is_port(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is a port</fsummary> + <desc><p>Return true if <c>term</c> is a port.</p></desc> + </func> + + <func><name><ret>int</ret><nametext>enif_is_ref(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name> + <fsummary>Determine if a term is a reference</fsummary> + <desc><p>Return true if <c>term</c> is a reference.</p></desc> </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_atom(ErlNifEnv* env, const char* name)</nametext></name> <fsummary>Create an atom term</fsummary> - <desc><p>Create an atom term from the C-string <c>name</c>. Atom + <desc><p>Create an atom term from the C-string <c>name</c>. Unlike other terms, atom terms may be saved and used between NIF calls.</p></desc> </func> - <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple(ErlNifEnv* env, unsigned cnt, ...)</nametext></name> - <fsummary>Create a tuple term.</fsummary> - <desc><p>Create a tuple term of arity <c>cnt</c>. Expects - <c>cnt</c> number of arguments (after <c>cnt</c>) of type ERL_NIF_TERM as the - elements of the tuple.</p></desc> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_badarg(ErlNifEnv* env)</nametext></name> + <fsummary>Make a badarg exception.</fsummary> + <desc><p>Make a badarg exception to be returned from a NIF.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_binary(ErlNifEnv* env, ErlNifBinary* bin)</nametext></name> + <fsummary>Make a binary term.</fsummary> + <desc><p>Make a binary term from <c>bin</c>. Any ownership of + the binary data will be transferred to the created term and + <c>bin</c> should be considered read-only for the rest of the NIF + call and then as released.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_double(ErlNifEnv* env, double d)</nametext></name> + <fsummary>Create an floating-point term</fsummary> + <desc><p>Create an floating-point term from a <c>double</c>.</p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_make_existing_atom(ErlNifEnv* env, const char* name, ERL_NIF_TERM* atom)</nametext></name> + <fsummary>Create an existing atom term</fsummary> + <desc><p>Try to create the term of an already existing atom from + the C-string <c>name</c>. If the atom already exist store the + term in <c>*atom</c> and return true, otherwise return + false.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_int(ErlNifEnv* env, int i)</nametext></name> + <fsummary>Create an integer term</fsummary> + <desc><p>Create an integer term.</p></desc> </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list(ErlNifEnv* env, unsigned cnt, ...)</nametext></name> <fsummary>Create a list term.</fsummary> @@ -333,19 +632,279 @@ typedef struct { <c>cnt</c> number of arguments (after <c>cnt</c>) of type ERL_NIF_TERM as the elements of the list. An empty list is returned if <c>cnt</c> is 0.</p></desc> </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list1(ErlNifEnv* env, ERL_NIF_TERM e1)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list2(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list3(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2, ERL_NIF_TERM e3)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list4(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e4)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list5(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e5)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list6(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e6)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list7(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e7)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list8(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e8)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9)</nametext></name> + <fsummary>Create a list term.</fsummary> + <desc><p>Create an ordinary list term with length indicated by the + function name. Prefer these functions (macros) over the variadic + <c>enif_make_list</c> to get compile time error if the number of + arguments does not match.</p></desc> + </func> <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list_cell(ErlNifEnv* env, ERL_NIF_TERM head, ERL_NIF_TERM tail)</nametext></name> <fsummary>Create a list cell.</fsummary> <desc><p>Create a list cell <c>[head | tail]</c>.</p></desc> </func> - <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_string(ErlNifEnv* env, const char* string)</nametext></name> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_list_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt)</nametext></name> + <fsummary>Create a list term from an array.</fsummary> + <desc><p>Create an ordinary list containing the elements of array <c>arr</c> + of length <c>cnt</c>. An empty list is returned if <c>cnt</c> is 0.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_long(ErlNifEnv* env, long int i)</nametext></name> + <fsummary>Create an integer term from a long int</fsummary> + <desc><p>Create an integer term from a <c>long int</c>.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_ref(ErlNifEnv* env)</nametext></name> + <fsummary>Create a reference.</fsummary> + <desc><p>Create a reference like <seealso marker="erlang#make_ref-0">erlang:make_ref/0</seealso>.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_resource(ErlNifEnv* env, void* obj)</nametext></name> + <fsummary>Create an opaque handle to a resource object</fsummary> + <desc><p>Create an opaque handle to a memory managed resource object + obtained by <seealso marker="#enif_alloc_resource">enif_alloc_resource</seealso>. + No ownership transfer is done, the resource object still needs to be released by + <seealso marker="#enif_release_resource">enif_release_resource</seealso>.</p> + <p>Note that the only defined behaviour when using of a resource term in + an Erlang program is to store it and send it between processes on the + same node. Other operations such as matching or <c>term_to_binary</c> + will have unpredictable (but harmless) results.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_string(ErlNifEnv* env, const char* string, ErlNifCharEncoding encoding)</nametext></name> <fsummary>Create a string.</fsummary> - <desc><p>Creates a list containing the characters of the - C-string <c>string</c>.</p></desc> + <desc><p>Create a list containing the characters of the + null-terminated string <c>string</c> with encoding <seealso marker="#ErlNifCharEncoding">encoding</seealso>.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_sub_binary(ErlNifEnv* + env, ERL_NIF_TERM bin_term, unsigned pos, unsigned size)</nametext></name> + <fsummary>Make a subbinary term.</fsummary> + <desc><p>Make a subbinary of binary <c>bin_term</c>, starting at + zero-based position <c>pos</c> with a length of <c>size</c> bytes. + <c>bin_term</c> must be a binary or bitstring and + <c>pos+size</c> must be less or equal to the number of whole + bytes in <c>bin_term</c>.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple(ErlNifEnv* env, unsigned cnt, ...)</nametext></name> + <fsummary>Create a tuple term.</fsummary> + <desc><p>Create a tuple term of arity <c>cnt</c>. Expects + <c>cnt</c> number of arguments (after <c>cnt</c>) of type ERL_NIF_TERM as the + elements of the tuple.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple1(ErlNifEnv* env, ERL_NIF_TERM e1)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple2(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple3(ErlNifEnv* env, ERL_NIF_TERM e1, ERL_NIF_TERM e2, ERL_NIF_TERM e3)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple4(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e4)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple5(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e5)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple6(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e6)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple7(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e7)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple8(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e8)</nametext></name> + <name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple9(ErlNifEnv* env, ERL_NIF_TERM e1, ..., ERL_NIF_TERM e9)</nametext></name> + <fsummary>Create a tuple term.</fsummary> + <desc><p>Create a tuple term with length indicated by the + function name. Prefer these functions (macros) over the variadic + <c>enif_make_tuple</c> to get compile time error if the number of + arguments does not match.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_tuple_from_array(ErlNifEnv* env, const ERL_NIF_TERM arr[], unsigned cnt)</nametext></name> + <fsummary>Create a tuple term from an array.</fsummary> + <desc><p>Create a tuple containing the elements of array <c>arr</c> + of length <c>cnt</c>.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_uint(ErlNifEnv* env, unsigned int i)</nametext></name> + <fsummary>Create an unsigned integer term</fsummary> + <desc><p>Create an integer term from an <c>unsigned int</c>.</p></desc> + </func> + <func><name><ret>ERL_NIF_TERM</ret><nametext>enif_make_ulong(ErlNifEnv* env, unsigned long i)</nametext></name> + <fsummary>Create an integer term from an unsigned long int</fsummary> + <desc><p>Create an integer term from an <c>unsigned long int</c>.</p></desc> + </func> + <func><name><ret>ErlNifMutex*</ret><nametext>enif_mutex_create(char *name)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_mutex_create">erl_drv_mutex_create()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_mutex_destroy(ErlNifMutex *mtx)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_mutex_destroy">erl_drv_mutex_destroy()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_mutex_lock(ErlNifMutex *mtx)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_mutex_lock">erl_drv_mutex_lock()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_mutex_trylock(ErlNifMutex *mtx)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_mutex_trylock">erl_drv_mutex_trylock()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_mutex_unlock(ErlNifMutex *mtx)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_mutex_unlock">erl_drv_mutex_unlock()</seealso>. + </p></desc> + </func> + <func><name><ret>ErlNifResourceType*</ret><nametext>enif_open_resource_type(ErlNifEnv* env, const char* name, + ErlNifResourceDtor* dtor, ErlNifResourceFlags flags, ErlNifResourceFlags* tried)</nametext></name> + <fsummary>Create or takeover a resource type</fsummary> + <desc><p>Create or takeover a resource type identified by the string + <c>name</c> and give it the destructor function pointed to by <seealso marker="#ErlNifResourceDtor">dtor</seealso>. + Argument <c>flags</c> can have the following values:</p> + <taglist> + <tag><c>ERL_NIF_RT_CREATE</c></tag> + <item>Create a new resource type that does not already exist.</item> + <tag><c>ERL_NIF_RT_TAKEOVER</c></tag> + <item>Open an existing resource type and take over ownership of all its instances. + The supplied destructor <c>dtor</c> will be called both for existing instances + as well as new instances not yet created by the calling NIF library.</item> + </taglist> + <p>The two flag values can be combined with bitwise-or. To avoid unintentionally + name clashes a good practice is to include the module name as part of the + type <c>name</c>. The <c>dtor</c> may be <c>NULL</c> in case no destructor + is needed.</p> + <p>On success, return a pointer to the resource type and <c>*tried</c> + will be set to either <c>ERL_NIF_RT_CREATE</c> or + <c>ERL_NIF_RT_TAKEOVER</c> to indicate what was actually done. + On failure, return <c>NULL</c> and set <c>*tried</c> to <c>flags</c>. + It is allowed to set <c>tried</c> to <c>NULL</c>.</p> + <p>Note that <c>enif_open_resource_type</c> is only allowed to be called in the three callbacks + <seealso marker="#load">load</seealso>, <seealso marker="#reload">reload</seealso> + and <seealso marker="#upgrade">upgrade</seealso>.</p> + </desc> + </func> + <func><name><ret>void*</ret><nametext>enif_priv_data(ErlNifEnv* env)</nametext></name> + <fsummary>Get the private data of a NIF library</fsummary> + <desc><p>Return the pointer to the private data that was set by <c>load</c>, + <c>reload</c> or <c>upgrade</c>.</p> + <p>Was previously named <c>enif_get_data</c>.</p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_realloc_binary(ErlNifEnv* env, ErlNifBinary* bin, unsigned size)</nametext></name> + <fsummary>Change the size of a binary.</fsummary> + <desc><p>Change the size of a binary <c>bin</c>. The source binary + may be read-only, in which case it will be left untouched and + a mutable copy is allocated and assigned to <c>*bin</c>.</p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_release_binary(ErlNifEnv* env, ErlNifBinary* bin)</nametext></name> + <fsummary>Release a binary.</fsummary> + <desc><p>Release a binary obtained + from <c>enif_alloc_binary</c>.</p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_release_resource(ErlNifEnv* env, void* obj)</nametext></name> + <fsummary>Release a resource object.</fsummary> + <desc><p>Release a resource objects obtained from <c>enif_alloc_resource</c>. + The object may still be alive if it is referred to by Erlang terms. Each call to + <c>enif_release_resource</c> must correspond to a previous call to <c>enif_alloc_resource</c>. + References made by <c>enif_make_resource</c> can only be released by the garbage collector.</p></desc> + </func> + <func><name><ret>ErlNifRWLock*</ret><nametext>enif_rwlock_create(char *name)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_create">erl_drv_rwlock_create()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_rwlock_destroy(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_destroy">erl_drv_rwlock_destroy()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_rwlock_rlock(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_rlock">erl_drv_rwlock_rlock()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_rwlock_runlock(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_runlock">erl_drv_rwlock_runlock()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_rwlock_rwlock(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_rwlock">erl_drv_rwlock_rwlock()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_rwlock_rwunlock(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_rwunlock">erl_drv_rwlock_rwunlock()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_rwlock_tryrlock(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_tryrlock">erl_drv_rwlock_tryrlock()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_rwlock_tryrwlock(ErlNifRWLock *rwlck)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_rwlock_tryrwlock">erl_drv_rwlock_tryrwlock()</seealso>. + </p></desc> + </func> + <func><name><ret>unsigned</ret><nametext>enif_sizeof_resource(ErlNifEnv* env, void* obj)</nametext></name> + <fsummary>Get the byte size of a resource object</fsummary> + <desc><p>Get the byte size of a resource object <c>obj</c> obtained by + <c>enif_alloc_resource</c>.</p></desc> + </func> + <func> + <name><ret>void</ret><nametext>enif_system_info(ErlNifSysInfo *sys_info_ptr, size_t size)</nametext></name> + <fsummary>Get information about the Erlang runtime system</fsummary> + <desc><p>Same as <seealso marker="erl_driver#driver_system_info">driver_system_info()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_thread_create(char *name,ErlNifTid *tid,void * (*func)(void *),void *args,ErlNifThreadOpts *opts)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_thread_create">erl_drv_thread_create()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_thread_exit(void *resp)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_thread_exit">erl_drv_thread_exit()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_thread_join(ErlNifTid, void **respp)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_thread_join">erl_drv_thread_join ()</seealso>. + </p></desc> + </func> + <func><name><ret>ErlNifThreadOpts*</ret><nametext>enif_thread_opts_create(char *name)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_thread_opts_create">erl_drv_thread_opts_create()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_thread_opts_destroy(ErlNifThreadOpts *opts)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_thread_opts_destroy">erl_drv_thread_opts_destroy()</seealso>. + </p></desc> + </func> + <func><name><ret>ErlNifTid</ret><nametext>enif_thread_self(void)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_thread_self">erl_drv_thread_self()</seealso>. + </p></desc> + </func> + <func><name><ret>int</ret><nametext>enif_tsd_key_create(char *name, ErlNifTSDKey *key)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_tsd_key_create">erl_drv_tsd_key_create()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_tsd_key_destroy(ErlNifTSDKey key)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_tsd_key_destroy">erl_drv_tsd_key_destroy()</seealso>. + </p></desc> + </func> + <func><name><ret>void*</ret><nametext>enif_tsd_get(ErlNifTSDKey key)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_tsd_get">erl_drv_tsd_get()</seealso>. + </p></desc> + </func> + <func><name><ret>void</ret><nametext>enif_tsd_set(ErlNifTSDKey key, void *data)</nametext></name> + <fsummary></fsummary> + <desc><p>Same as <seealso marker="erl_driver#erl_drv_tsd_set">erl_drv_tsd_set()</seealso>. + </p></desc> </func> </funcs> <section> <title>SEE ALSO</title> - <p><seealso marker="erlang#erlang:load_nif-2">load_nif(3)</seealso></p> + <p><seealso marker="erlang#load_nif-2">load_nif(3)</seealso></p> </section> </cref> diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index fd4447009a..46f8df4683 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erlang</title> @@ -342,8 +342,50 @@ iolist() = [char() | binary() | iolist()] <desc> <p>Returns an Erlang term which is the result of decoding the binary object <c>Binary</c>, which must be encoded - according to the Erlang external term format. See also - <seealso marker="#term_to_binary/1">term_to_binary/1</seealso>.</p> + according to the Erlang external term format.</p> + <warning> + <p>When decoding binaries from untrusted sources, consider using + <c>binary_to_term/2</c> to prevent denial of service attacks.</p> + </warning> + <p>See also + <seealso marker="#term_to_binary/1">term_to_binary/1</seealso> + and + <seealso marker="#binary_to_term/2">binary_to_term/2</seealso>.</p> + </desc> + </func> + <func> + <name>erlang:binary_to_term(Binary, Opts) -> term()</name> + <fsummary>Decode an Erlang external term format binary</fsummary> + <type> + <v>Opts = [safe]</v> + <v>Binary = ext_binary()</v> + </type> + <desc> + <p>As <c>binary_to_term/1</c>, but takes options that affect decoding + of the binary.</p> + <taglist> + <tag><c>safe</c></tag> + <item> + <p>Use this option when receiving binaries from an untrusted + source.</p> + <p>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.</p> + <p>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.</p> + </item> + </taglist> + <p>Failure: <c>badarg</c> if <c>safe</c> is specified and unsafe data + is decoded.</p> + <p>See also + <seealso marker="#term_to_binary/1">term_to_binary/1</seealso>, + <seealso marker="#binary_to_term/1">binary_to_term/1</seealso>, + and <seealso marker="#list_to_existing_atom/1"> + list_to_existing_atom/1</seealso>.</p> </desc> </func> <func> @@ -410,19 +452,19 @@ iolist() = [char() | binary() | iolist()] <desc> <p>Cancels a timer, where <c>TimerRef</c> was returned by either - <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso> + <seealso marker="#send_after/3">erlang:send_after/3</seealso> or - <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>. + <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>. If the timer is there to be removed, the function returns the time in milliseconds left until the timer would have expired, otherwise <c>false</c> (which means that <c>TimerRef</c> was never a timer, that it has already been cancelled, or that it has already delivered its message).</p> <p>See also - <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>, - <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>, + <seealso marker="#send_after/3">erlang:send_after/3</seealso>, + <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>, and - <seealso marker="#erlang:read_timer/1">erlang:read_timer/1</seealso>.</p> + <seealso marker="#read_timer/1">erlang:read_timer/1</seealso>.</p> <p>Note: Cancelling a timer does not guarantee that the message has not already been delivered to the message queue.</p> </desc> @@ -673,7 +715,7 @@ false</pre> <desc> <p>If <c>MonitorRef</c> is a reference which the calling process obtained by calling - <seealso marker="#erlang:monitor/2">erlang:monitor/2</seealso>, + <seealso marker="#monitor/2">erlang:monitor/2</seealso>, this monitoring is turned off. If the monitoring is already turned off, nothing happens.</p> <p>Once <c>erlang:demonitor(MonitorRef)</c> has returned it is @@ -684,7 +726,7 @@ false</pre> the call, though. Therefore, in most cases, it is advisable to remove such a <c>'DOWN'</c> message from the message queue after monitoring has been stopped. - <seealso marker="#erlang:demonitor/2">erlang:demonitor(MonitorRef, [flush])</seealso> can be used instead of + <seealso marker="#demonitor/2">erlang:demonitor(MonitorRef, [flush])</seealso> can be used instead of <c>erlang:demonitor(MonitorRef)</c> if this cleanup is wanted.</p> <note> <p>Prior to OTP release R11B (erts version 5.5) <c>erlang:demonitor/1</c> @@ -718,7 +760,7 @@ false</pre> of <c>OptionList</c>. </p> <p><c>erlang:demonitor(MonitorRef, [])</c> is equivalent to - <seealso marker="#erlang:demonitor/1">erlang:demonitor(MonitorRef)</seealso>.</p> + <seealso marker="#demonitor/1">erlang:demonitor(MonitorRef)</seealso>.</p> <p>Currently the following <c>Option</c>s are valid:</p> <taglist> <tag><c>flush</c></tag> @@ -732,10 +774,10 @@ false</pre> erlang:demonitor(MonitorRef), receive -\011{_, MonitorRef, _, _, _} -> -\011 true + {_, MonitorRef, _, _, _} -> + true after 0 -> -\011 true + true end</code> </item> <tag><c>info</c></tag> @@ -768,7 +810,7 @@ false</pre> </note> <p>Failure: <c>badarg</c> if <c>OptionList</c> is not a list, or if <c>Option</c> is not a valid option, or the same failure as for - <seealso marker="#erlang:demonitor/1">erlang:demonitor/1</seealso></p> + <seealso marker="#demonitor/1">erlang:demonitor/1</seealso></p> </desc> </func> <func> @@ -1087,7 +1129,7 @@ b</pre> <c>uniq</c>, and <c>pid</c>. For an external fun, the value of any of these items is always the atom <c>undefined</c>.</p> <p>See - <seealso marker="#erlang:fun_info/1">erlang:fun_info/1</seealso>.</p> + <seealso marker="#fun_info/1">erlang:fun_info/1</seealso>.</p> </desc> </func> <func> @@ -1233,8 +1275,8 @@ b</pre> returns, for example:</p> <p><c>{'EXIT',{badarg,Stacktrace}} = catch abs(x)</c></p> <p>See also - <seealso marker="#erlang:error/1">erlang:error/1</seealso> and - <seealso marker="#erlang:error/2">erlang:error/2</seealso>.</p> + <seealso marker="#error/1">erlang:error/1</seealso> and + <seealso marker="#error/2">erlang:error/2</seealso>.</p> </desc> </func> <func> @@ -1929,7 +1971,7 @@ os_prompt%</pre> </desc> </func> <func> - <name>erlang:load_nif(Path, LoadInfo) -> ok | {error, Reason, Text}</name> + <name>erlang:load_nif(Path, LoadInfo) -> ok | {error, {Reason, Text}}</name> <fsummary>Load NIF library</fsummary> <type> <v>Path = string()</v> @@ -1940,9 +1982,10 @@ os_prompt%</pre> </type> <desc> <warning> - <p>This BIF is currently introduced as an experimental - feature. The interface may be changed in any way in future - releases.</p> + <p>This BIF is still an experimental feature. The interface + may be changed in any way in future releases.</p><p>In + R13B03 the return value on failure was + <c>{error,Reason,Text}</c>.</p> </warning> <p>Loads and links a dynamic library containing native implemented functions (NIFs) for a module. <c>Path</c> is a @@ -1957,10 +2000,10 @@ os_prompt%</pre> <p>The call to <c>load_nif/2</c> must be made <em>directly</em> from the Erlang code of the module that the NIF library belongs to.</p> - <p>It returns either <c>ok</c>, or <c>{error,Reason,Text}</c> + <p>It returns either <c>ok</c>, or <c>{error,{Reason,Text}}</c> if loading fails. <c>Reason</c> is one of the atoms below, while <c>Text</c> is a human readable string that may give - some more information about the failure:</p> + some more information about the failure.</p> <taglist> <tag><c>load_failed</c></tag> <item> @@ -2282,13 +2325,13 @@ os_prompt%</pre> other. Values beginning with an uppercase letter is not part of the result.</p> <code type="none"> -\011total = processes + system -\011processes = processes_used + ProcessesNotUsed -\011system = atom + binary + code + ets + OtherSystem -\011atom = atom_used + AtomNotUsed + total = processes + system + processes = processes_used + ProcessesNotUsed + system = atom + binary + code + ets + OtherSystem + atom = atom_used + AtomNotUsed -\011RealTotal = processes + RealSystem -\011RealSystem = system + MissedSystem</code> + RealTotal = processes + RealSystem + RealSystem = system + MissedSystem</code> <p>More tuples in the returned list may be added in the future.</p> <note> <p>The <c>total</c> value is supposed to be the total amount @@ -2344,7 +2387,7 @@ os_prompt%</pre> <item> If <c>Type</c> is not one of the memory types listed in the documentation of - <seealso marker="#erlang:memory/0">erlang:memory/0</seealso>. + <seealso marker="#memory/0">erlang:memory/0</seealso>. </item> <tag><c>badarg</c></tag> <item> @@ -2358,7 +2401,7 @@ os_prompt%</pre> </item> </taglist> <p>See also - <seealso marker="#erlang:memory/0">erlang:memory/0</seealso>.</p> + <seealso marker="#memory/0">erlang:memory/0</seealso>.</p> </desc> </func> <func> @@ -2467,7 +2510,7 @@ os_prompt%</pre> </note> <p>The monitoring is turned off either when the <c>'DOWN'</c> message is sent, or when - <seealso marker="#erlang:demonitor/1">erlang:demonitor/1</seealso> + <seealso marker="#demonitor/1">erlang:demonitor/1</seealso> is called.</p> <p>If an attempt is made to monitor a process on an older node (where remote process monitoring is not implemented or one @@ -3336,7 +3379,7 @@ os_prompt%</pre> registered name, [] is returned.</p> <p>For valid values of <c>Item</c>, and corresponding values of <c>Info</c>, see - <seealso marker="#erlang:port_info/1">erlang:port_info/1</seealso>.</p> + <seealso marker="#port_info/1">erlang:port_info/1</seealso>.</p> <p>Failure: <c>badarg</c> if <c>Port</c> is not a local port.</p> </desc> </func> @@ -3426,9 +3469,13 @@ os_prompt%</pre> <p>This changes the minimum heap size for the calling process.</p> </item> - <tag><c>process_flag(priority, Level)</c></tag> + <tag><c>process_flag(min_bin_vheap_size, MinBinVHeapSize)</c></tag> + <item> + <p>This changes the minimum binary virtual heap size for the calling + process.</p> + </item> + <tag><marker id="process_flag_priority"><c>process_flag(priority, Level)</c></marker></tag> <item> - <marker id="process_flag_priority"></marker> <p>This sets the process priority. <c>Level</c> is an atom. There are currently four priority levels: <c>low</c>, <c>normal</c>, <c>high</c>, and <c>max</c>. The default @@ -3757,6 +3804,14 @@ os_prompt%</pre> <p><c>MessageQueue</c> is a list of the messages to the process, which have not yet been processed.</p> </item> + <tag><c>{min_heap_size, MinHeapSize}</c></tag> + <item> + <p><c>MinHeapSize</c> is the minimum heap size for the process.</p> + </item> + <tag><c>{min_bin_vheap_size, MinBinVHeapSize}</c></tag> + <item> + <p><c>MinBinVHeapSize</c> is the minimum binary virtual heap size for the process.</p> + </item> <tag><c>{monitored_by, Pids}</c></tag> <item> <p>A list of pids that are monitoring the process (with @@ -3812,9 +3867,9 @@ os_prompt%</pre> ActiveSuspendCount, OutstandingSuspendCount}</c> tuples. <c>Suspendee</c> is the pid of a process that have been or is to be suspended by the process identified by <c>Pid</c> via the - <seealso marker="#erlang:suspend_process/2">erlang:suspend_process/2</seealso> + <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso> BIF, or the - <seealso marker="#erlang:suspend_process/1">erlang:suspend_process/1</seealso> + <seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso> BIF. <c>ActiveSuspendCount</c> is the number of times the <c>Suspendee</c> has been suspended by <c>Pid</c>. <c>OutstandingSuspendCount</c> is the number of not yet @@ -3965,19 +4020,19 @@ os_prompt%</pre> </type> <desc> <p><c>TimerRef</c> is a timer reference returned by - <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso> + <seealso marker="#send_after/3">erlang:send_after/3</seealso> or - <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>. + <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>. If the timer is active, the function returns the time in milliseconds left until the timer will expire, otherwise <c>false</c> (which means that <c>TimerRef</c> was never a timer, that it has been cancelled, or that it has already delivered its message).</p> <p>See also - <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>, - <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>, + <seealso marker="#send_after/3">erlang:send_after/3</seealso>, + <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>, and - <seealso marker="#erlang:cancel_timer/1">erlang:cancel_timer/1</seealso>.</p> + <seealso marker="#cancel_timer/1">erlang:cancel_timer/1</seealso>.</p> </desc> </func> <func> @@ -4042,9 +4097,9 @@ true</pre> <p>Decreases the suspend count on the process identified by <c>Suspendee</c>. <c>Suspendee</c> should previously have been suspended via - <seealso marker="#erlang:suspend_process/2">erlang:suspend_process/2</seealso>, + <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>, or - <seealso marker="#erlang:suspend_process/1">erlang:suspend_process/1</seealso> + <seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso> by the process calling <c>erlang:resume_process(Suspendee)</c>. When the suspend count on <c>Suspendee</c> reach zero, <c>Suspendee</c> will be resumed, i.e., the state of the <c>Suspendee</c> is changed @@ -4130,9 +4185,9 @@ true</pre> <p>Sends a message and returns <c>ok</c>, or does not send the message but returns something else (see below). Otherwise the same as - <seealso marker="#erlang:send/2">erlang:send/2</seealso>. See + <seealso marker="#send/2">erlang:send/2</seealso>. See also - <seealso marker="#erlang:send_nosuspend/2">erlang:send_nosuspend/2,3</seealso>. + <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2,3</seealso>. for more detailed explanation and warnings.</p> <p>The possible options are:</p> <taglist> @@ -4178,10 +4233,10 @@ true</pre> erts version 5.4.11. Note that timers will not be automatically canceled when <c>Dest</c> is an atom.</p> <p>See also - <seealso marker="#erlang:start_timer/3">erlang:start_timer/3</seealso>, - <seealso marker="#erlang:cancel_timer/1">erlang:cancel_timer/1</seealso>, + <seealso marker="#start_timer/3">erlang:start_timer/3</seealso>, + <seealso marker="#cancel_timer/1">erlang:cancel_timer/1</seealso>, and - <seealso marker="#erlang:read_timer/1">erlang:read_timer/1</seealso>.</p> + <seealso marker="#read_timer/1">erlang:read_timer/1</seealso>.</p> <p>Failure: <c>badarg</c> if the arguments does not satisfy the requirements specified above.</p> </desc> @@ -4197,7 +4252,7 @@ true</pre> </type> <desc> <p>The same as - <seealso marker="#erlang:send/3">erlang:send(Dest, Msg, [nosuspend])</seealso>, but returns <c>true</c> if + <seealso marker="#send/3">erlang:send(Dest, Msg, [nosuspend])</seealso>, but returns <c>true</c> if the message was sent and <c>false</c> if the message was not sent because the sender would have had to be suspended.</p> <p>This function is intended for send operations towards an @@ -4249,10 +4304,10 @@ true</pre> </type> <desc> <p>The same as - <seealso marker="#erlang:send/3">erlang:send(Dest, Msg, [nosuspend | Options])</seealso>, + <seealso marker="#send/3">erlang:send(Dest, Msg, [nosuspend | Options])</seealso>, but with boolean return value.</p> <p>This function behaves like - <seealso marker="#erlang:send_nosuspend/2">erlang:send_nosuspend/2)</seealso>, + <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2)</seealso>, but takes a third parameter, a list of options. The only currently implemented option is <c>noconnect</c>. The option <c>noconnect</c> makes the function return <c>false</c> if @@ -4406,7 +4461,7 @@ true</pre> </desc> </func> <func> - <name>spawn_link(Node, Fun) -></name> + <name>spawn_link(Node, Fun) -> pid()</name> <fsummary>Create and link to a new process with a fun as entry point on a specified node</fsummary> <type> <v>Node = node()</v> @@ -4490,10 +4545,11 @@ true</pre> <fsummary>Create a new process with a fun as entry point</fsummary> <type> <v>Fun = fun()</v> - <v>Option = link | monitor | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}</v> + <v>Option = link | monitor | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size} | {min_bin_vheap_size, VSize}</v> <v> Level = low | normal | high</v> <v> Number = int()</v> <v> Size = int()</v> + <v> VSize = int()</v> </type> <desc> <p>Returns the pid of a new process started by the application @@ -4511,10 +4567,11 @@ true</pre> <type> <v>Node = node()</v> <v>Fun = fun()</v> - <v>Option = link | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}</v> + <v>Option = link | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size} | {min_bin_vheap_size, VSize}</v> <v> Level = low | normal | high</v> <v> Number = int()</v> <v> Size = int()</v> + <v> VSize = int()</v> </type> <desc> <p>Returns the pid of a new process started by the application @@ -4530,10 +4587,11 @@ true</pre> <type> <v>Module = Function = atom()</v> <v>Args = [term()]</v> - <v>Option = link | monitor | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}</v> + <v>Option = link | monitor | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size} | {min_bin_vheap_size, VSize}</v> <v> Level = low | normal | high</v> <v> Number = int()</v> <v> Size = int()</v> + <v> VSize = int()</v> </type> <desc> <p>Works exactly like @@ -4551,7 +4609,7 @@ true</pre> <tag><c>monitor</c></tag> <item> <p>Monitor the new process (just like - <seealso marker="#erlang:monitor/2">erlang:monitor/2</seealso> does).</p> + <seealso marker="#monitor/2">erlang:monitor/2</seealso> does).</p> </item> <tag><c>{priority, Level}</c></tag> <item> @@ -4594,7 +4652,7 @@ true</pre> and no virtual memory, one might want to preserve memory by setting <c>Number</c> to zero. (The value may be set globally, see - <seealso marker="#erlang:system_flag/2">erlang:system_flag/2</seealso>.)</p> + <seealso marker="#system_flag/2">erlang:system_flag/2</seealso>.)</p> </item> <tag><c>{min_heap_size, Size}</c></tag> <item> @@ -4613,6 +4671,23 @@ true</pre> fine-tuning an application and to measure the execution time with various <c>Size</c> values.</p> </item> + <tag><c>{min_bin_vheap_size, VSize}</c></tag> + <item> + <p>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. + </p> + <p>Gives a minimum binary virtual heap size in words. Setting this value + higher than the system default might 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 + fine-tuning an application and to measure the execution + time with various <c>VSize</c> values.</p> + </item> + </taglist> </desc> </func> @@ -4623,10 +4698,11 @@ true</pre> <v>Node = node()</v> <v>Module = Function = atom()</v> <v>Args = [term()]</v> - <v>Option = link | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}</v> + <v>Option = link | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size} | {min_bin_vheap_size, VSize}</v> <v> Level = low | normal | high</v> <v> Number = int()</v> <v> Size = int()</v> + <v> VSize = int()</v> </type> <desc> <p>Returns the pid of a new process started by the application @@ -4641,7 +4717,7 @@ true</pre> <fsummary>Split a binary into two</fsummary> <type> <v>Bin = Bin1 = Bin2 = binary()</v> - <v>Pos = 1..byte_size(Bin)</v> + <v>Pos = 0..byte_size(Bin)</v> </type> <desc> <p>Returns a tuple containing the binaries which are the result @@ -4687,10 +4763,10 @@ true</pre> erts version 5.4.11. Note that timers will not be automatically canceled when <c>Dest</c> is an atom.</p> <p>See also - <seealso marker="#erlang:send_after/3">erlang:send_after/3</seealso>, - <seealso marker="#erlang:cancel_timer/1">erlang:cancel_timer/1</seealso>, + <seealso marker="#send_after/3">erlang:send_after/3</seealso>, + <seealso marker="#cancel_timer/1">erlang:cancel_timer/1</seealso>, and - <seealso marker="#erlang:read_timer/1">erlang:read_timer/1</seealso>.</p> + <seealso marker="#read_timer/1">erlang:read_timer/1</seealso>.</p> <p>Failure: <c>badarg</c> if the arguments does not satisfy the requirements specified above.</p> </desc> @@ -4711,9 +4787,8 @@ true</pre> <c>ContextSwitches</c> is the total number of context switches since the system started.</p> </item> - <tag><c>exact_reductions</c></tag> + <tag><marker id="statistics_exact_reductions"><c>exact_reductions</c></marker></tag> <item> - <marker id="statistics_exact_reductions"></marker> <p>Returns <c>{Total_Exact_Reductions, Exact_Reductions_Since_Last_Call}</c>.</p> <p><em>NOTE:</em><c>statistics(exact_reductions)</c> is @@ -4733,9 +4808,8 @@ true</pre> through ports, and <c>Output</c> is the total number of bytes output to ports.</p> </item> - <tag><c>reductions</c></tag> + <tag><marker id="statistics_reductions"><c>reductions</c></marker></tag> <item> - <marker id="statistics_reductions"></marker> <p>Returns <c>{Total_Reductions, Reductions_Since_Last_Call}</c>.</p> <p><em>NOTE:</em> From erts version 5.5 (OTP release R11B) @@ -4795,7 +4869,7 @@ true</pre> process will not leave the suspended state until its suspend count reach zero. The suspend count of <c>Suspendee</c> is decreased when - <seealso marker="#erlang:resume_process/1">erlang:resume_process(Suspendee)</seealso> + <seealso marker="#resume_process/1">erlang:resume_process(Suspendee)</seealso> is called by the same process that called <c>erlang:suspend_process(Suspendee)</c>. All increased suspend counts on other processes acquired by a process will automatically be @@ -4884,7 +4958,7 @@ true</pre> <desc> <p>Suspends the process identified by <c>Suspendee</c>. The same as calling - <seealso marker="#erlang:suspend_process/2">erlang:suspend_process(Suspendee, [])</seealso>. For more information see the documentation of <seealso marker="#erlang:suspend_process/2">erlang:suspend_process/2</seealso>. + <seealso marker="#suspend_process/2">erlang:suspend_process(Suspendee, [])</seealso>. For more information see the documentation of <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>. </p> <warning> <p>This BIF is intended for debugging only.</p> @@ -4906,9 +4980,8 @@ true</pre> <p>Sets the maximum depth of call stack back-traces in the exit reason element of <c>'EXIT'</c> tuples.</p> </item> - <tag><c>erlang:system_flag(cpu_topology, CpuTopology)</c></tag> + <tag><marker id="system_flag_cpu_topology"><c>erlang:system_flag(cpu_topology, CpuTopology)</c></marker></tag> <item> - <marker id="system_flag_cpu_topology"></marker> <p>Sets the user defined <c>CpuTopology</c>. The user defined CPU topology will override any automatically detected CPU topology. By passing <c>undefined</c> as <c>CpuTopology</c> @@ -4959,9 +5032,19 @@ true</pre> <seealso marker="#spawn_opt/4">spawn_opt/N</seealso> or <seealso marker="#process_flag/2">process_flag/2</seealso>. </p> </item> - <tag><c>erlang:system_flag(multi_scheduling, BlockState)</c></tag> + <tag><c>erlang:system_flag(min_bin_vheap_size, MinBinVHeapSize)</c></tag> + <item> + <p>Sets the default minimum binary virtual heap size for processes. The + size is given in words. The new <c>min_bin_vhheap_size</c> only + effects processes spawned after the change of + <c>min_bin_vhheap_size</c> has been made. + The <c>min_bin_vheap_size</c> can be set for individual + processes by use of + <seealso marker="#spawn_opt/4">spawn_opt/N</seealso> or + <seealso marker="#process_flag/2">process_flag/2</seealso>. </p> + </item> + <tag><marker id="system_flag_multi_scheduling"><c>erlang:system_flag(multi_scheduling, BlockState)</c></marker></tag> <item> - <marker id="system_flag_multi_scheduling"></marker> <p><c>BlockState = block | unblock</c></p> <p>If multi-scheduling is enabled, more than one scheduler thread is used by the emulator. Multi-scheduling can be @@ -4995,9 +5078,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>, and <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>erlang:system_flag(scheduler_bind_type, How)</c></tag> + <tag><marker id="system_flag_scheduler_bind_type"><c>erlang:system_flag(scheduler_bind_type, How)</c></marker></tag> <item> - <marker id="system_flag_scheduler_bind_type"></marker> <p>Controls if and how schedulers are bound to logical processors.</p> <p>When <c>erlang:system_flag(scheduler_bind_type, How)</c> is @@ -5124,9 +5206,8 @@ true</pre> <seealso marker="#system_flag_cpu_topology">erlang:system_flag(cpu_topology, CpuTopology)</seealso>. </p> </item> - <tag><c>erlang:system_flag(schedulers_online, SchedulersOnline)</c></tag> + <tag><marker id="system_flag_schedulers_online"><c>erlang:system_flag(schedulers_online, SchedulersOnline)</c></marker></tag> <item> - <marker id="system_flag_schedulers_online"></marker> <p>Sets the amount of schedulers online. Valid range is <![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers)]]>. </p> @@ -5164,9 +5245,8 @@ true</pre> <p>Returns various information about the current system (emulator) as specified by <c>Type</c>:</p> <taglist> - <tag><c>allocated_areas</c></tag> + <tag><marker id="system_info_allocated_areas"><c>allocated_areas</c></marker></tag> <item> - <marker id="system_info_allocated_areas"></marker> <p>Returns a list of tuples with information about miscellaneous allocated memory areas.</p> <p>Each tuple contains an atom describing type of memory as @@ -5184,11 +5264,10 @@ true</pre> 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 <seealso marker="#erlang:memory/0">erlang:memory/0,1</seealso>.</p> + see <seealso marker="#memory/0">erlang:memory/0,1</seealso>.</p> </item> - <tag><c>allocator</c></tag> + <tag><marker id="system_info_allocator"><c>allocator</c></marker></tag> <item> - <marker id="system_info_allocator"></marker> <p>Returns <c>{Allocator, Version, Features, Settings}.</c></p> <p>Types:</p> <list type="bulleted"> @@ -5229,9 +5308,8 @@ true</pre> <p>See also "System Flags Effecting erts_alloc" in <seealso marker="erts:erts_alloc#flags">erts_alloc(3)</seealso>.</p> </item> - <tag><c>alloc_util_allocators</c></tag> + <tag><marker id="system_info_alloc_util_allocators"><c>alloc_util_allocators</c></marker></tag> <item> - <marker id="system_info_alloc_util_allocators"></marker> <p>Returns a list of the names of all allocators using the ERTS internal <c>alloc_util</c> framework as atoms. For more information see the @@ -5240,9 +5318,8 @@ true</pre> erts_alloc(3)</seealso> documentation. </p> </item> - <tag><c>{allocator, Alloc}</c></tag> + <tag><marker id="system_info_allocator_tuple"><c>{allocator, Alloc}</c></marker></tag> <item> - <marker id="system_info_allocator_tuple"></marker> <p>Returns information about the specified allocator. As of erts version 5.6.1 the return value is a list of <c>{instance, InstanceNo, InstanceInfo}</c> tuples @@ -5278,9 +5355,8 @@ true</pre> values. The first value is memory pool size and the second value used memory size.</p> </item> - <tag><c>{allocator_sizes, Alloc}</c></tag> + <tag><marker id="system_info_allocator_sizes"><c>{allocator_sizes, Alloc}</c></marker></tag> <item> - <marker id="system_info_allocator_sizes"></marker> <p>Returns various size information for the specified allocator. The information returned is a subset of the information returned by @@ -5314,9 +5390,8 @@ true</pre> line flag <c>+R</c>, see <seealso marker="erts:erl#compat_rel">erl(1)</seealso>.</p> </item> - <tag><c>cpu_topology</c></tag> + <tag><marker id="system_info_cpu_topology"><c>cpu_topology</c></marker></tag> <item> - <marker id="system_info_cpu_topology"></marker> <p>Returns the <c>CpuTopology</c> which currently is used by the emulator. The CPU topology is used when binding schedulers to logical processors. The CPU topology used is the user defined @@ -5499,7 +5574,7 @@ true</pre> <c>spawn</c> or <c>spawn_link</c> will use these garbage collection settings. The default settings can be changed by use of - <seealso marker="#erlang:system_flag/2">system_flag/2</seealso>. + <seealso marker="#system_flag/2">system_flag/2</seealso>. <seealso marker="#spawn_opt/4">spawn_opt/4</seealso> can spawn a process that does not use the default settings.</p> @@ -5570,6 +5645,16 @@ true</pre> <item> <p>Returns a string containing the Erlang machine name.</p> </item> + <tag><c>min_heap_size</c></tag> + <item> + <p>Returns <c>{min_heap_size, MinHeapSize}</c> where <c>MinHeapSize</c> is the current system wide + minimum heap size for spawned processes.</p> + </item> + <tag><c>min_bin_vheap_size</c></tag> + <item> + <p>Returns <c>{min_bin_vheap_size, MinBinVHeapSize}</c> where <c>MinBinVHeapSize</c> is the current system wide + minimum binary virtual heap size for spawned processes.</p> + </item> <tag><c>modified_timing_level</c></tag> <item> <p>Returns the modified timing level (an integer) if @@ -5579,9 +5664,8 @@ true</pre> <seealso marker="erts:erl#+T">erl(1)</seealso> command for more information on modified timing.</p> </item> - <tag><c>multi_scheduling</c></tag> + <tag><marker id="system_info_multi_scheduling"><c>multi_scheduling</c></marker></tag> <item> - <marker id="system_info_multi_scheduling"></marker> <p>Returns <c>disabled</c>, <c>blocked</c>, or <c>enabled</c>. A description of the return values:</p> <taglist> @@ -5610,9 +5694,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>, and <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>multi_scheduling_blockers</c></tag> + <tag><marker id="system_info_multi_scheduling_blockers"><c>multi_scheduling_blockers</c></marker></tag> <item> - <marker id="system_info_multi_scheduling_blockers"></marker> <p>Returns a list of <c>PID</c>s when multi-scheduling is blocked; otherwise, the empty list. The <c>PID</c>s in the list is <c>PID</c>s of the processes currently @@ -5623,9 +5706,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>, and <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>otp_release</c></tag> + <tag><marker id="system_info_otp_release"><c>otp_release</c></marker></tag> <item> - <marker id="system_info_otp_release"></marker> <p>Returns a string containing the OTP release number.</p> </item> <tag><c>process_count</c></tag> @@ -5649,9 +5731,8 @@ true</pre> information see the <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso> chapter in the ERTS User's Guide.</p> </item> - <tag><c>scheduler_bind_type</c></tag> + <tag><marker id="system_info_scheduler_bind_type"><c>scheduler_bind_type</c></marker></tag> <item> - <marker id="system_info_scheduler_bind_type"></marker> <p>Returns information on how user has requested schedulers to be bound or not bound.</p> <p><em>NOTE:</em> Even though user has requested @@ -5666,9 +5747,8 @@ true</pre> <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>. </p> </item> - <tag><c>scheduler_bindings</c></tag> + <tag><marker id="system_info_scheduler_bindings"><c>scheduler_bindings</c></marker></tag> <item> - <marker id="system_info_scheduler_bindings"></marker> <p>Returns information on currently used scheduler bindings.</p> <p>A tuple of a size equal to @@ -5690,18 +5770,16 @@ true</pre> <seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>. </p> </item> - <tag><c>scheduler_id</c></tag> + <tag><marker id="system_info_scheduler_id"><c>scheduler_id</c></marker></tag> <item> - <marker id="system_info_scheduler_id"></marker> <p>Returns the scheduler id (<c>SchedulerId</c>) of the scheduler thread that the calling process is executing on. <c>SchedulerId</c> is a positive integer; where <c><![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers)]]></c>. See also <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p> </item> - <tag><c>schedulers</c></tag> + <tag><marker id="system_info_schedulers"><c>schedulers</c></marker></tag> <item> - <marker id="system_info_schedulers"></marker> <p>Returns the number of scheduler threads used by the emulator. Scheduler threads online schedules Erlang processes and Erlang ports, and execute Erlang code @@ -5717,9 +5795,8 @@ true</pre> <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>, and and <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>.</p> </item> - <tag><c>schedulers_online</c></tag> + <tag><marker id="system_info_schedulers_online"><c>schedulers_online</c></marker></tag> <item> - <marker id="system_info_schedulers_online"></marker> <p>Returns the amount of schedulers online. The scheduler identifiers of schedulers online satisfy the following relationship: @@ -5752,9 +5829,8 @@ true</pre> with thread support; otherwise, <c>false</c> is returned.</p> </item> - <tag><c>thread_pool_size</c></tag> + <tag><marker id="system_info_thread_pool_size"><c>thread_pool_size</c></marker></tag> <item> - <marker id="system_info_thread_pool_size"></marker> <p>Returns the number of async threads in the async thread pool used for asynchronous driver calls (<seealso marker="erts:erl_driver#driver_async">driver_async()</seealso>) @@ -5767,9 +5843,8 @@ true</pre> <c>get_tcw</c> in "Match Specifications in Erlang", <seealso marker="erts:match_spec#get_tcw">ERTS User's Guide</seealso>.</p> </item> - <tag><c>version</c></tag> + <tag><marker id="system_info_version"><c>version</c></marker></tag> <item> - <marker id="system_info_version"></marker> <p>Returns a string containing the version number of the emulator.</p> </item> @@ -5802,7 +5877,7 @@ true</pre> </type> <desc> <p>Returns the current system monitoring settings set by - <seealso marker="#erlang:system_monitor/2">erlang:system_monitor/2</seealso> + <seealso marker="#system_monitor/2">erlang:system_monitor/2</seealso> as <c>{MonitorPid, Options}</c>, or <c>undefined</c> if there are no settings. The order of the options may be different from the one that was set.</p> @@ -5820,9 +5895,9 @@ true</pre> system performance monitoring settings are cleared.</p> <p>Calling the function with <c>{MonitorPid, Options}</c> as argument, is the same as calling - <seealso marker="#erlang:system_monitor/2">erlang:system_monitor(MonitorPid, Options)</seealso>.</p> + <seealso marker="#system_monitor/2">erlang:system_monitor(MonitorPid, Options)</seealso>.</p> <p>Returns the previous system monitor settings just like - <seealso marker="#erlang:system_monitor/0">erlang:system_monitor/0</seealso>.</p> + <seealso marker="#system_monitor/0">erlang:system_monitor/0</seealso>.</p> </desc> </func> @@ -5858,7 +5933,7 @@ true</pre> explained in the documentation of the <seealso marker="#gc_start">gc_start</seealso> trace message (see - <seealso marker="#erlang:trace/3">erlang:trace/3</seealso>). + <seealso marker="#trace/3">erlang:trace/3</seealso>). New tuples may be added, and the order of the tuples in the <c>Info</c> list may be changed at any time without prior notice. @@ -5900,7 +5975,7 @@ true</pre> </item> </taglist> <p>Returns the previous system monitor settings just like - <seealso marker="#erlang:system_monitor/0">erlang:system_monitor/0</seealso>.</p> + <seealso marker="#system_monitor/0">erlang:system_monitor/0</seealso>.</p> <note> <p>If a monitoring process gets so large that it itself starts to cause system monitor messages when garbage @@ -5924,7 +5999,7 @@ true</pre> </type> <desc> <p>Returns the current system profiling settings set by - <seealso marker="#erlang:system_profile/2">erlang:system_profile/2</seealso> + <seealso marker="#system_profile/2">erlang:system_profile/2</seealso> as <c>{ProfilerPid, Options}</c>, or <c>undefined</c> if there are no settings. The order of the options may be different from the one that was set.</p> @@ -6152,7 +6227,7 @@ true</pre> <item> <p>Trace certain function calls. Specify which function calls to trace by calling - <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern/3</seealso>.</p> + <seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p> <p>Message tags: <c>call</c>, <c>return_from</c>.</p> </item> <tag><c>silent</c></tag> @@ -6181,7 +6256,7 @@ true</pre> Trace the actual return from a traced function back to its caller. Only works for functions traced with the <c>local</c> option to - <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern/3</seealso>.</p> + <seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p> <p>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 @@ -6379,9 +6454,8 @@ true</pre> the current function cannot be determined, then the last element <c>Arity</c> is 0.</p> </item> - <tag><c>{trace, Pid, gc_start, Info}</c></tag> + <tag><marker id="gc_start"><c>{trace, Pid, gc_start, Info}</c></marker></tag> <item> - <marker id="gc_start"></marker> <p>Sent when garbage collection is about to be started. <c>Info</c> is a list of two-element tuples, where the first element is a key, and the second is the value. @@ -6406,6 +6480,19 @@ true</pre> <tag><c>mbuf_size</c></tag> <item>The combined size of message buffers associated with the process.</item> + + <tag><c>bin_vheap_size</c></tag> + <item>The total size of unique off-heap binaries referenced from the process heap.</item> + <tag><c>bin_vheap_block_size</c></tag> + <item>The total size of binaries, in words, allowed in the virtual + heap in the process before doing a garbage collection. </item> + <tag><c>bin_old_vheap_size</c></tag> + <item>The total size of unique off-heap binaries referenced from the process old heap.</item> + <tag><c>bin_vheap_block_size</c></tag> + <item>The total size of binaries, in words, allowed in the virtual + old heap in the process before doing a garbage collection. </item> + + </taglist> <p>All sizes are in words.</p> </item> @@ -6556,7 +6643,7 @@ true</pre> <c>true</c> for the pseudo function <c>on_load</c> if call count tracing is active. Return <c>false</c> otherwise. See also - <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern/3</seealso>.</p> + <seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p> </item> <tag><c>all</c></tag> <item> @@ -6579,7 +6666,7 @@ true</pre> <fsummary>Set trace patterns for global call tracing</fsummary> <desc> <p>The same as - <seealso marker="#erlang:trace_pattern/3">erlang:trace_pattern(MFA, MatchSpec, [])</seealso>, + <seealso marker="#trace_pattern/3">erlang:trace_pattern(MFA, MatchSpec, [])</seealso>, retained for backward compatibility.</p> </desc> </func> @@ -6592,7 +6679,7 @@ true</pre> <desc> <p>This BIF is used to enable or disable call tracing for exported functions. It must be combined with - <seealso marker="#erlang:trace/3">erlang:trace/3</seealso> + <seealso marker="#trace/3">erlang:trace/3</seealso> to set the <c>call</c> trace flag for one or more processes.</p> <p>Conceptually, call tracing works like this: Inside the Erlang virtual machine there is a set of processes to be @@ -6602,7 +6689,7 @@ true</pre> in the traced function set, the trace action will be taken. Otherwise, nothing will happen.</p> <p>Use - <seealso marker="#erlang:trace/3">erlang:trace/3</seealso> to + <seealso marker="#trace/3">erlang:trace/3</seealso> to add or remove one or more processes to the set of traced processes. Use <c>erlang:trace_pattern/2</c> to add or remove exported functions to the set of traced functions.</p> @@ -6719,7 +6806,7 @@ true</pre> counters can be restarted from zero with <c>MatchSpec == restart</c>.</p> <p>The counter value can be read with - <seealso marker="#erlang:trace_info/2">erlang:trace_info/2</seealso>.</p> + <seealso marker="#trace_info/2">erlang:trace_info/2</seealso>.</p> </item> </taglist> <p>The <c>global</c> and <c>local</c> options are mutually @@ -6739,7 +6826,7 @@ true</pre> 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 - <seealso marker="#erlang:trace_info/2">erlang:trace_info/2</seealso> + <seealso marker="#trace_info/2">erlang:trace_info/2</seealso> BIF to retrieve the existing match specification.</p> <p>Returns the number of exported functions that matched the <c>MFA</c> argument. This will be zero if none matched at @@ -6854,10 +6941,10 @@ true</pre> unlink(Id), receive -\011{'EXIT', Id, _} -> -\011 true + {'EXIT', Id, _} -> + true after 0 -> -\011 true + true end</code> <note> <p>Prior to OTP release R11B (erts version 5.5) <c>unlink/1</c> diff --git a/erts/doc/src/erlc.xml b/erts/doc/src/erlc.xml index 3859ac8365..1e8960c22c 100644 --- a/erts/doc/src/erlc.xml +++ b/erts/doc/src/erlc.xml @@ -4,7 +4,7 @@ <comref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erlc</title> @@ -104,6 +104,10 @@ must be quoted. Terms which contain spaces must be quoted on all platforms.</p> </item> + <tag>-W<em>error</em></tag> + <item> + <p>Makes all warnings into errors.</p> + </item> <tag>-W<em>number</em></tag> <item> <p>Sets warning level to <em>number</em>. Default is <c><![CDATA[1]]></c>. diff --git a/erts/doc/src/erlsrv.xml b/erts/doc/src/erlsrv.xml index 93db56fc7c..0dfad2a112 100644 --- a/erts/doc/src/erlsrv.xml +++ b/erts/doc/src/erlsrv.xml @@ -4,7 +4,7 @@ <comref> <header> <copyright> - <year>1998</year><year>2009</year> + <year>1998</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erlsrv</title> @@ -251,7 +251,7 @@ necessarily the same as the interactive users. The service runs as the local administrator. All arguments should be given together in one string, use double quotes (") to give an - argument string containing spaces and use quoted quotes (\\") + argument string containing spaces and use quoted quotes (\") to give an quote within the argument string if necessary.</item> <tag>-i[nternalservicename] [<internal name>]</tag> @@ -356,7 +356,7 @@ The environment of an Erlang machine started */ BOOL WINAPI service_aware_handler(DWORD ctrl){ if(ctrl == CTRL_LOGOFF_EVENT) -\011return TRUE; + return TRUE; return FALSE; } @@ -368,10 +368,10 @@ void initialize_handler(void){ */ if(GetEnvironmentVariable("ERLSRV_SERVICE_NAME",buffer, (DWORD) 2)){ -\011/* -\011** Actually set the control handler -\011*/ -\011SetConsoleCtrlHandler(&service_aware_handler, TRUE); + /* + ** Actually set the control handler + */ + SetConsoleCtrlHandler(&service_aware_handler, TRUE); } } ]]></code> </section> @@ -388,8 +388,8 @@ void initialize_handler(void){ the runtime system should not need to overwrite existing (and probably used) executables.</p> <p>To easily manipulate the Erlang services, put - the <c><![CDATA[<erlang_root>\\erts-<version>\\bin]]></c> directory in - the path instead of <c><![CDATA[<erlang_root>\\bin]]></c>. The erlsrv program + the <c><![CDATA[<erlang_root>\erts-<version>\bin]]></c> directory in + the path instead of <c><![CDATA[<erlang_root>\bin]]></c>. The erlsrv program can be found from inside Erlang by using the <c><![CDATA[os:find_executable/1]]></c> Erlang function.</p> <p>For release handling to work, use <c><![CDATA[start_erl]]></c> as the Erlang diff --git a/erts/doc/src/erts_alloc.xml b/erts/doc/src/erts_alloc.xml index d51e5b3ea4..51a4a2bca0 100644 --- a/erts/doc/src/erts_alloc.xml +++ b/erts/doc/src/erts_alloc.xml @@ -4,7 +4,7 @@ <cref> <header> <copyright> - <year>2002</year><year>2009</year> + <year>2002</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>erts_alloc</title> @@ -122,7 +122,7 @@ size (<seealso marker="#M_lmbcs">lmbcs</seealso>), the smallest multiblock carrier size (<seealso marker="#M_smbcs">smbcs</seealso>), and the multiblock carrier growth stages - (<seealso marker="#M_smbcs">mbcgs</seealso>) parameters. If + (<seealso marker="#M_mbcgs">mbcgs</seealso>) parameters. If <c>nc</c> is the current number of multiblock carriers (the main multiblock carrier excluded) managed by an allocator, the size of the next <c>mseg_alloc</c> multiblock carrier allocated by @@ -229,29 +229,25 @@ <p>The following flags are available for configuration of <c>mseg_alloc</c>:</p> <taglist> - <tag><c><![CDATA[+MMamcbf <size>]]></c></tag> - <item> <marker id="MMamcbf"></marker> - + <tag><marker id="MMamcbf"><c><![CDATA[+MMamcbf <size>]]></c></marker></tag> + <item> Absolute max cache bad fit (in kilobytes). A segment in the memory segment cache is not reused if its size exceeds the requested size with more than the value of this parameter. Default value is 4096. </item> - <tag><c><![CDATA[+MMrmcbf <ratio>]]></c></tag> - <item> <marker id="MMrmcbf"></marker> - + <tag><marker id="MMrmcbf"><c><![CDATA[+MMrmcbf <ratio>]]></c></marker></tag> + <item> Relative max cache bad fit (in percent). A segment in the memory segment cache is not reused if its size exceeds the requested size with more than relative max cache bad fit percent of the requested size. Default value is 20.</item> - <tag><c><![CDATA[+MMmcs <amount>]]></c></tag> - <item> <marker id="MMmcs"></marker> - + <tag><marker id="MMmcs"><c><![CDATA[+MMmcs <amount>]]></c></marker></tag> + <item> Max cached segments. The maximum number of memory segments stored in the memory segment cache. Valid range is 0-30. Default value is 5.</item> - <tag><c><![CDATA[+MMcci <time>]]></c></tag> - <item> <marker id="MMcci"></marker> - + <tag><marker id="MMcci"><c><![CDATA[+MMcci <time>]]></c></marker></tag> + <item> Cache check interval (in milliseconds). The memory segment cache is checked for segments to destroy at an interval determined by this parameter. Default value is 1000.</item> @@ -259,26 +255,23 @@ <p>The following flags are available for configuration of <c>fix_alloc</c>:</p> <taglist> - <tag><c>+MFe true</c></tag> - <item> <marker id="MFe"></marker> - + <tag><marker id="MFe"><c>+MFe true</c></marker></tag> + <item> Enable <c>fix_alloc</c>. Note: <c>fix_alloc</c> cannot be disabled.</item> </taglist> <p>The following flags are available for configuration of <c>sys_alloc</c>:</p> <taglist> - <tag><c>+MYe true</c></tag> - <item> <marker id="MYe"></marker> - + <tag><marker id="MYe"><c>+MYe true</c></marker></tag> + <item> Enable <c>sys_alloc</c>. Note: <c>sys_alloc</c> cannot be disabled.</item> - <tag><c>+MYm libc</c></tag> - <item> <marker id="MYm"></marker> -<c>malloc</c> library to use. Currently only + <tag><marker id="MYm"><c>+MYm libc</c></marker></tag> + <item> + <c>malloc</c> library to use. Currently only <c>libc</c> is available. <c>libc</c> enables the standard <c>libc</c> malloc implementation. By default <c>libc</c> is used.</item> - <tag><c><![CDATA[+MYtt <size>]]></c></tag> - <item> <marker id="MYtt"></marker> - + <tag><marker id="MYtt"><c><![CDATA[+MYtt <size>]]></c></marker></tag> + <item> Trim threshold size (in kilobytes). This is the maximum amount of free memory at the top of the heap (allocated by <c>sbrk</c>) that will be kept by <c>malloc</c> (not @@ -289,9 +282,8 @@ trim threshold is 128. <em>Note:</em> This flag will only have any effect when the emulator has been linked with the GNU C library, and uses its <c>malloc</c> implementation.</item> - <tag><c><![CDATA[+MYtp <size>]]></c></tag> - <item> <marker id="MYtp"></marker> - + <tag><marker id="MYtp"><c><![CDATA[+MYtp <size>]]></c></marker></tag> + <item> Top pad size (in kilobytes). This is the amount of extra memory that will be allocated by <c>malloc</c> when <c>sbrk</c> is called to get more memory from the operating @@ -308,43 +300,37 @@ subsystem identifier, only the specific allocator identified will be effected:</p> <taglist> - <tag><c><![CDATA[+M<S>as bf|aobf|gf|af]]></c></tag> - <item> <marker id="M_as"></marker> - + <tag><marker id="M_as"><c><![CDATA[+M<S>as bf|aobf|gf|af]]></c></marker></tag> + <item> Allocation strategy. Valid strategies are <c>bf</c> (best fit), <c>aobf</c> (address order best fit), <c>gf</c> (good fit), and <c>af</c> (a fit). See <seealso marker="#strategy">the description of allocation strategies</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>asbcst <size>]]></c></tag> - <item> <marker id="M_asbcst"></marker> - + <tag><marker id="M_asbcst"><c><![CDATA[+M<S>asbcst <size>]]></c></marker></tag> + <item> Absolute singleblock carrier shrink threshold (in kilobytes). When a block located in an <c>mseg_alloc</c> singleblock carrier is shrunk, the carrier will be left unchanged if the amount of unused memory is less than this threshold; otherwise, the carrier will be shrunk. See also <seealso marker="#M_rsbcst">rsbcst</seealso>.</item> - <tag><c><![CDATA[+M<S>e true|false]]></c></tag> - <item> <marker id="M_e"></marker> - + <tag><marker id="M_e"><c><![CDATA[+M<S>e true|false]]></c></marker></tag> + <item> Enable allocator <c><![CDATA[<S>]]></c>.</item> - <tag><c><![CDATA[+M<S>lmbcs <size>]]></c></tag> - <item> <marker id="M_lmbcs"></marker> - + <tag><marker id="M_lmbcs"><c><![CDATA[+M<S>lmbcs <size>]]></c></marker></tag> + <item> Largest (<c>mseg_alloc</c>) multiblock carrier size (in kilobytes). See <seealso marker="#mseg_mbc_sizes">the description on how sizes for mseg_alloc multiblock carriers are decided</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>mbcgs <ratio>]]></c></tag> - <item> <marker id="M_mbcgs"></marker> - + <tag><marker id="M_mbcgs"><c><![CDATA[+M<S>mbcgs <ratio>]]></c></marker></tag> + <item> (<c>mseg_alloc</c>) multiblock carrier growth stages. See <seealso marker="#mseg_mbc_sizes">the description on how sizes for mseg_alloc multiblock carriers are decided</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>mbsd <depth>]]></c></tag> - <item> <marker id="M_mbsd"></marker> - + <tag><marker id="M_mbsd"><c><![CDATA[+M<S>mbsd <depth>]]></c></marker></tag> + <item> Max block search depth. This flag has effect only if the good fit strategy has been selected for allocator <c><![CDATA[<S>]]></c>. When the good fit strategy is used, free @@ -353,47 +339,41 @@ search depth sets a limit on the maximum number of blocks to inspect in a free list during a search for suitable block satisfying the request.</item> - <tag><c><![CDATA[+M<S>mmbcs <size>]]></c></tag> - <item> <marker id="M_mmbcs"></marker> - + <tag><marker id="M_mmbcs"><c><![CDATA[+M<S>mmbcs <size>]]></c></marker></tag> + <item> Main multiblock carrier size. Sets the size of the main multiblock carrier for allocator <c><![CDATA[<S>]]></c>. The main multiblock carrier is allocated via <c><![CDATA[sys_alloc]]></c> and is never deallocated.</item> - <tag><c><![CDATA[+M<S>mmmbc <amount>]]></c></tag> - <item> <marker id="M_mmmbc"></marker> - + <tag><marker id="M_mmmbc"><c><![CDATA[+M<S>mmmbc <amount>]]></c></marker></tag> + <item> Max <c>mseg_alloc</c> multiblock carriers. Maximum number of multiblock carriers allocated via <c>mseg_alloc</c> by allocator <c><![CDATA[<S>]]></c>. When this limit has been reached, new multiblock carriers will be allocated via <c>sys_alloc</c>.</item> - <tag><c><![CDATA[+M<S>mmsbc <amount>]]></c></tag> - <item> <marker id="M_mmsbc"></marker> - + <tag><marker id="M_mmsbc"><c><![CDATA[+M<S>mmsbc <amount>]]></c></marker></tag> + <item> Max <c>mseg_alloc</c> singleblock carriers. Maximum number of singleblock carriers allocated via <c>mseg_alloc</c> by allocator <c><![CDATA[<S>]]></c>. When this limit has been reached, new singleblock carriers will be allocated via <c>sys_alloc</c>.</item> - <tag><c><![CDATA[+M<S>ramv <bool>]]></c></tag> - <item> <marker id="M_ramv"></marker> - + <tag><marker id="M_ramv"><c><![CDATA[+M<S>ramv <bool>]]></c></marker></tag> + <item> Realloc always moves. When enabled, reallocate operations will more or less be translated into an allocate, copy, free sequence. This often reduce memory fragmentation, but costs performance. </item> - <tag><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></tag> - <item> <marker id="M_rmbcmt"></marker> - + <tag><marker id="M_rmbcmt"><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></marker></tag> + <item> Relative multiblock carrier move threshold (in percent). When a block located in a multiblock carrier is shrunk, the block will be moved if the ratio of the size of the returned memory compared to the previous size is more than this threshold; otherwise, the block will be shrunk at current location.</item> - <tag><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></tag> - <item> <marker id="M_rsbcmt"></marker> - + <tag><marker id="M_rsbcmt"><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></marker></tag> + <item> Relative singleblock carrier move threshold (in percent). When a block located in a singleblock carrier is shrunk to a size smaller than the value of the @@ -401,32 +381,28 @@ the block will be left unchanged in the singleblock carrier if the ratio of unused memory is less than this threshold; otherwise, it will be moved into a multiblock carrier. </item> - <tag><c><![CDATA[+M<S>rsbcst <ratio>]]></c></tag> - <item> <marker id="M_rsbcst"></marker> - + <tag><marker id="M_rsbcst"><c><![CDATA[+M<S>rsbcst <ratio>]]></c></marker></tag> + <item> Relative singleblock carrier shrink threshold (in percent). When a block located in an <c>mseg_alloc</c> singleblock carrier is shrunk, the carrier will be left unchanged if the ratio of unused memory is less than this threshold; otherwise, the carrier will be shrunk. See also <seealso marker="#M_asbcst">asbcst</seealso>.</item> - <tag><c><![CDATA[+M<S>sbct <size>]]></c></tag> - <item> <marker id="M_sbct"></marker> - + <tag><marker id="M_sbct"><c><![CDATA[+M<S>sbct <size>]]></c></marker></tag> + <item> Singleblock carrier threshold. Blocks larger than this threshold will be placed in singleblock carriers. Blocks smaller than this threshold will be placed in multiblock carriers.</item> - <tag><c><![CDATA[+M<S>smbcs <size>]]></c></tag> - <item> <marker id="M_smbcs"></marker> - + <tag><marker id="M_smbcs"><c><![CDATA[+M<S>smbcs <size>]]></c></marker></tag> + <item> Smallest (<c>mseg_alloc</c>) multiblock carrier size (in kilobytes). See <seealso marker="#mseg_mbc_sizes">the description on how sizes for mseg_alloc multiblock carriers are decided</seealso> in "the <c>alloc_util</c> framework" section.</item> - <tag><c><![CDATA[+M<S>t true|false|<amount>]]></c></tag> - <item> <marker id="M_t"></marker> - + <tag><marker id="M_t"><c><![CDATA[+M<S>t true|false|<amount>]]></c></marker></tag> + <item> Multiple, thread specific instances of the allocator. This option will only have any effect on the runtime system with SMP support. Default behaviour on the runtime system with @@ -451,16 +427,15 @@ <c>alloc_util</c>, i.e. all allocators based on <c>alloc_util</c> will be effected:</p> <taglist> - <tag><c><![CDATA[+Muycs <size>]]></c></tag> - <item> <marker id="Muycs"></marker> -<c>sys_alloc</c> carrier size. Carriers allocated via + <tag><marker id="Muycs"><c><![CDATA[+Muycs <size>]]></c></marker></tag> + <item> + <c>sys_alloc</c> carrier size. Carriers allocated via <c>sys_alloc</c> will be allocated in sizes which are multiples of the <c>sys_alloc</c> carrier size. This is not true for main multiblock carriers and carriers allocated during a memory shortage, though.</item> - <tag><c><![CDATA[+Mummc <amount>]]></c></tag> - <item> <marker id="Mummc"></marker> - + <tag><marker id="Mummc"><c><![CDATA[+Mummc <amount>]]></c></marker></tag> + <item> Max <c>mseg_alloc</c> carriers. Maximum number of carriers placed in separate memory segments. When this limit has been reached, new carriers will be placed in memory retrieved from @@ -468,23 +443,20 @@ </taglist> <p>Instrumentation flags:</p> <taglist> - <tag><c>+Mim true|false</c></tag> - <item> <marker id="Mim"></marker> - + <tag><marker id="Mim"><c>+Mim true|false</c></marker></tag> + <item> A map over current allocations is kept by the emulator. The allocation map can be retrieved via the <c>instrument</c> module. <c>+Mim true</c> implies <c>+Mis true</c>. <c>+Mim true</c> is the same as <seealso marker="erl#instr">-instr</seealso>.</item> - <tag><c>+Mis true|false</c></tag> - <item> <marker id="Mis"></marker> - + <tag><marker id="Mis"><c>+Mis true|false</c></marker></tag> + <item> Status over allocated memory is kept by the emulator. The allocation status can be retrieved via the <c>instrument</c> module.</item> - <tag><c>+Mit X</c></tag> - <item> <marker id="Mit"></marker> - + <tag><marker id="Mit"><c>+Mit X</c></marker></tag> + <item> Reserved for future use. Do <em>not</em> use this flag.</item> </taglist> <note> @@ -493,8 +465,8 @@ </note> <p>Other flags:</p> <taglist> - <tag><c>+Mea min|max|r9c|r10b|r11b|config</c></tag> - <item> <marker id="Mea"></marker> + <tag><marker id="Mea"><c>+Mea min|max|r9c|r10b|r11b|config</c></marker></tag> + <item> <taglist> <tag><c>min</c></tag> <item> diff --git a/erts/doc/src/escript.xml b/erts/doc/src/escript.xml index 8df179b3e2..a89449df23 100644 --- a/erts/doc/src/escript.xml +++ b/erts/doc/src/escript.xml @@ -4,7 +4,7 @@ <comref> <header> <copyright> - <year>2007</year><year>2009</year> + <year>2007</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>escript</title> @@ -50,20 +50,18 @@ $ <input>cat factorial</input> %%! -smp enable -sname factorial -mnesia debug verbose main([String]) -> try -\011N = list_to_integer(String), -\011F = fac(N), -\011io:format("factorial ~w = ~w\ -", [N,F]) + N = list_to_integer(String), + F = fac(N), + io:format("factorial ~w = ~w\n", [N,F]) catch -\011_:_ -> -\011 usage() + _:_ -> + usage() end; main(_) -> usage(). usage() -> - io:format("usage: factorial integer\ -"), + io:format("usage: factorial integer\n"), halt(1). fac(0) -> 1; diff --git a/erts/doc/src/inet_cfg.xml b/erts/doc/src/inet_cfg.xml index 18cf65759a..2a033c037c 100644 --- a/erts/doc/src/inet_cfg.xml +++ b/erts/doc/src/inet_cfg.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Inet configuration</title> @@ -230,6 +230,13 @@ (use the Erlang DNS client <seealso marker="kernel:inet_res">inet_res</seealso> for nameserver queries).</p> + <p>The lookup method <c><![CDATA[string]]></c> tries to + parse the hostname as a IPv4 or IPv6 string and return + the resulting IP address. It is automatically tried + first when <c><![CDATA[native]]></c> is <em>not</em> + in the <c><![CDATA[Methods]]></c> list. To skip it in this case + the pseudo lookup method <c><![CDATA[nostring]]></c> can be + inserted anywhere in the <c><![CDATA[Methods]]></c> list.</p> <p></p> </item> <tag><em><c><![CDATA[{cache_size, Size}.]]></c></em></tag> diff --git a/erts/doc/src/match_spec.xml b/erts/doc/src/match_spec.xml index 26480473d2..b9f955e4db 100644 --- a/erts/doc/src/match_spec.xml +++ b/erts/doc/src/match_spec.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1999</year><year>2009</year> + <year>1999</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>Match specifications in Erlang</title> @@ -360,52 +360,52 @@ </p> <table> <row> - <cell align="left" valign="middle">Expression\011\011</cell> - <cell align="left" valign="middle">Variable bindings\011\011</cell> - <cell align="left" valign="middle">Result\011</cell> + <cell align="left" valign="middle">Expression </cell> + <cell align="left" valign="middle">Variable bindings </cell> + <cell align="left" valign="middle">Result </cell> </row> <row> - <cell align="left" valign="middle">{{'$1','$2'}}\011\011</cell> + <cell align="left" valign="middle">{{'$1','$2'}} </cell> <cell align="left" valign="middle">'$1' = a, '$2' = b</cell> <cell align="left" valign="middle">{a,b}</cell> </row> <row> - <cell align="left" valign="middle">{const, {'$1', '$2'}}\011</cell> + <cell align="left" valign="middle">{const, {'$1', '$2'}} </cell> <cell align="left" valign="middle">doesn't matter</cell> <cell align="left" valign="middle">{'$1', '$2'}</cell> </row> <row> - <cell align="left" valign="middle">a\011\011\011</cell> - <cell align="left" valign="middle">doesn't matter\011\011\011</cell> + <cell align="left" valign="middle">a </cell> + <cell align="left" valign="middle">doesn't matter </cell> <cell align="left" valign="middle">a</cell> </row> <row> - <cell align="left" valign="middle">'$1'\011\011\011</cell> - <cell align="left" valign="middle">'$1' = []\011\011\011</cell> + <cell align="left" valign="middle">'$1' </cell> + <cell align="left" valign="middle">'$1' = [] </cell> <cell align="left" valign="middle">[]</cell> </row> <row> - <cell align="left" valign="middle">['$1']\011\011\011</cell> - <cell align="left" valign="middle">'$1' = []\011\011\011</cell> + <cell align="left" valign="middle">['$1'] </cell> + <cell align="left" valign="middle">'$1' = [] </cell> <cell align="left" valign="middle">[[]]</cell> </row> <row> - <cell align="left" valign="middle">[{{a}}]\011\011\011</cell> + <cell align="left" valign="middle">[{{a}}] </cell> <cell align="left" valign="middle">doesn't matter</cell> <cell align="left" valign="middle">[{a}]</cell> </row> <row> - <cell align="left" valign="middle">42\011\011\011</cell> + <cell align="left" valign="middle">42 </cell> <cell align="left" valign="middle">doesn't matter</cell> <cell align="left" valign="middle">42</cell> </row> <row> - <cell align="left" valign="middle">"hello"\011\011\011</cell> + <cell align="left" valign="middle">"hello" </cell> <cell align="left" valign="middle">doesn't matter</cell> <cell align="left" valign="middle">"hello"</cell> </row> <row> - <cell align="left" valign="middle">$1\011\011\011</cell> + <cell align="left" valign="middle">$1 </cell> <cell align="left" valign="middle">doesn't matter</cell> <cell align="left" valign="middle">49 (the ASCII value for the character '1')</cell> </row> @@ -507,8 +507,8 @@ a list which in turn begins with the second argument times two (i. e. [{[4,x],y},2] or [{[8], y, z},4])</p> <code type="none"><![CDATA[ -[{['$1', '$2'],\011[{'=:=', {'*', 2, '$2'}, {hd, {element, 1, '$1'}}}], - []}]\011 +[{['$1', '$2'],[{'=:=', {'*', 2, '$2'}, {hd, {element, 1, '$1'}}}], + []}] ]]></code> <p>Match three arguments. When all three are equal and are numbers, append the process dump to the trace message, else diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml index 2252358e0d..8ff3f50348 100644 --- a/erts/doc/src/notes.xml +++ b/erts/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>ERTS Release Notes</title> @@ -30,6 +30,500 @@ </header> <p>This document describes the changes made to the ERTS application.</p> +<section><title>Erts 5.7.5.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + On Linux systems using heart (erl -heart) and a + HEAR_BEAT_TIMEOUT less than default, heart could fire + even though Erlang was running fine after approx 298 to + 497 days (depending on kernel config). This was due to + the behaviour of the times(2) system call. Usage of + times(2) is now replaced with clock_gettime(2) and the + CLOCK_MONOTONIC clock, resulting in a more stable + solution. The Erlang VM itself has used clock_gettime(2) + on linux since before R12B, so this only affects the + heart program.</p> + <p> + Own Id: OTP-10111 Aux Id: seq12075 </p> + </item> + </list> + </section> + +</section> + +<section><title>Erts 5.7.5.2</title> + + <section><title>Known Bugs and Problems</title> + <list> + <item> + <p> + Two bugs in gen_sctp has been corrected: getopts/setopts + hence also send could only be called from socket owner, + and options 'linger', 'rcvbuf' and 'sndbuf' was read from + wrong protocol layer hence read wrong values by getopts.</p> + <p> + Own Id: OTP-9544</p> + </item> + </list> + </section> + +</section> + +<section><title>Erts 5.7.5.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Driver threads, such as async threads, using <seealso + marker="erl_driver#ErlDrvPDL">port data locks</seealso> + peeked at the port status field without proper locking + when looking up the driver queue.</p> + <p> + Own Id: OTP-8475</p> + </item> + <item> + <p> + A call to the BIF <c>unregister(RegName)</c> when a port + had the name <c>RegName</c> registered in the runtime + system without SMP support caused a runtime system crash. + (Thanks to Per Hedeland for the bugfix and test case.)</p> + <p> + Own Id: OTP-8487</p> + </item> + <item> + <p> + Fix memory management bug causing crash of non-SMP + emulator with async threads enabled. The bug did first + appear in R13B03.</p> + <p> + Own Id: OTP-8591 Aux Id: seq11554 </p> + </item> + </list> + </section> + +</section> + +<section><title>Erts 5.7.5</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fix <c>binary_to_term</c> crash on compressed term with + corrupt size field.</p> + <p> + Own Id: OTP-8336</p> + </item> + <item> + <p> + Processes and/or ports could get stuck on a blocked + scheduler when <c>erlang:system_flag(multi_scheduling, + block)</c> was used.</p> + <p> + Processes and/or ports could get stuck on an offline + scheduler when schedulers online were reduced using + <c>erlang:system_flag(schedulers_online, + SchedulersOnline)</c>.</p> + <p> + Own Id: OTP-8342</p> + </item> + <item> + <p>Building on Windows will now work if the paths to + <c>mc.exe</c> and <c>rc.exe</c> contain spaces. The + README.win32 file has been updated with some information + about building using Visual Studio 2008. (Thanks to + Andrew Thompson.)</p> + <p> + Own Id: OTP-8345</p> + </item> + <item> + <p> + EPMD now correctly handles the extra data field which can + be given in the ALIVE2_REQ request and retrieved in the + PORT2_RESP response. (Thanks to Klas Johansson.)</p> + <p> + Own Id: OTP-8361</p> + </item> + <item> + <p> + The configure test for reliable floating point exceptions + has been update to work on modern versions of Mac OS X. + (Thanks to Trannie Carter.)</p> + <p> + Own Id: OTP-8368</p> + </item> + <item> + <p> + ERTS makefiles used to detect the use of a gcc C compiler + by checking if CC equaled gcc. That is, the makefiles + failed to detect gcc C compilers with other command line + names than gcc. `configure' now substitute GCC into the + makefiles. If CC is a gcc C compiler, GCC will have the + value yes. (Thanks to Jean-S�bastien P�dron)</p> + <p> + Own Id: OTP-8373</p> + </item> + <item> + <p> + ETS bug causing the <c>memory</c> counter from + <c>ets:info</c> for ordered_set's to sometimes get out of + synch and absurdly high.</p> + <p> + Own Id: OTP-8377 Aux Id: seq11442 </p> + </item> + <item> + <p> + Immediately repeated multi-scheduling block/unblock + cycles using <c>erlang:system_flag(multi_scheduling, + block | unblock)</c> could deadlock the runtime system.</p> + <p> + Own Id: OTP-8386</p> + </item> + <item> + <p>A number of bugs concerning re and unicode are + corrected:</p> + <p>re:compile no longer looses unicode option, which also + fixes bug in re:split.</p> + <p>re:replace now handles unicode charlist replacement + argument</p> + <p>re:replace now handles unicode RE charlist argument + correctly</p> + <p>re:replace now handles binary unicode output correctly + when nothing is replaced.</p> + <p>Most code, testcases and error isolation done by Rory + Byrne.</p> + <p> + Own Id: OTP-8394</p> + </item> + <item> + <p> + The loading of native code was not properly atomic in the + SMP emulator, which could cause crashes. Also a per-MFA + information table for the native code has now been + protected with a lock since it turns that it could be + accessed concurrently in the SMP emulator. (Thanks to + Mikael Pettersson.)</p> + <p> + Own Id: OTP-8397</p> + </item> + <item> + <p> + Fix processes in exiting status that are about to be + scheduled, to not be allowed to garbage collect.</p> + <p> + Own Id: OTP-8420</p> + </item> + <item> + <p>Removed bogus "\011" character sequence in + documentation.</p> + <p> + Own Id: OTP-8422</p> + </item> + <item> + <p> + The resolver routines failed to look up the own node name + as hostname, if the OS native resolver was erroneously + configured, bug reported by Yogish Baliga, now fixed.</p> + <p> + The resolver routines now tries to parse the hostname as + an IP string as most OS resolvers do, unless the native + resolver is used.</p> + <p> + The DNS resolver inet_res and file resolver inet_hosts + now do not read OS configuration files until they are + needed. Since the native resolver is default, in most + cases they are never needed.</p> + <p> + The DNS resolver's automatic updating of OS configuration + file data (/etc/resolv.conf) now uses the 'domain' + keyword as default search domain if there is no 'search' + keyword.</p> + <p> + Own Id: OTP-8426 Aux Id: OTP-8381 </p> + </item> + <item> + <p> + The re module: A regular expression with an option change + at the start of a pattern that had top-level alternatives + could cause overwriting and/or a crash. (Thanks to + Michael Santos.)</p> + <p> + Own Id: OTP-8438</p> + </item> + <item> + <p> + Harmless buffer overflow by one byte in asn1 and + ram_file_drv.</p> + <p> + Own Id: OTP-8451</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Improved GC performance after BIF/NIF call when a lot of + heap fragments was created. This will mainly benefit NIFs + that return large compound terms.</p> + <p> + Own Id: OTP-8240</p> + </item> + <item> + <p>Incompatible changes in the experimental NIF + feature.</p> <list><item> Changed the NIF function + prototypes in order to allow more than 3 function + arguments. </item><item> <c>enif_get_data</c> renamed as + <c>enif_priv_data</c>. </item><item> + <c>enif_make_string</c> got a third argument for + character encoding. </item><item> The return value of + <c>erlang:load_nif/2</c> on error changed. </item></list> + <p>Read more in the documentation of <c>erl_nif</c> and + <c>erlang:load_nif/2</c></p>. + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8304</p> + </item> + <item> + <p>Cross compilation improvements and other build system + improvements.</p> + <p>Most notable:</p> <list><item> Lots of cross + compilation improvements. The old cross compilation + support was more or less non-existing as well as broken. + Please, note that the cross compilation support should + still be considered as experimental. Also note that old + cross compilation configurations cannot be used without + modifications. For more information on cross compiling + Erlang/OTP see the <c>$ERL_TOP/INSTALL-CROSS.md</c> file. + </item><item> Support for staged install using <url + href="http://www.gnu.org/prep/standards/html_node/DESTDIR.html">DESTDIR</url>. + The old broken <c>INSTALL_PREFIX</c> has also been fixed. + For more information see the <c>$ERL_TOP/INSTALL.md</c> + file. </item><item> Documentation of the <c>release</c> + target of the top <c>Makefile</c>. For more information + see the <c>$ERL_TOP/INSTALL.md</c> file. </item><item> + <c>make install</c> now by default creates relative + symbolic links instead of absolute ones. For more + information see the <c>$ERL_TOP/INSTALL.md</c> file. + </item><item> <c>$ERL_TOP/configure --help=recursive</c> + now works and prints help for all applications with + <c>configure</c> scripts. </item><item> Doing <c>make + install</c>, or <c>make release</c> directly after + <c>make all</c> no longer triggers miscellaneous + rebuilds. </item><item> Existing bootstrap system is now + used when doing <c>make install</c>, or <c>make + release</c> without a preceding <c>make all</c>. + </item><item> The <c>crypto</c> and <c>ssl</c> + applications use the same runtime library path when + dynamically linking against <c>libssl.so</c> and + <c>libcrypto.so</c>. The runtime library search path has + also been extended. </item><item> The <c>configure</c> + scripts of <c>erl_interface</c> and <c>odbc</c> now + search for thread libraries and thread library quirks the + same way as <c>erts</c> do. </item><item> The + <c>configure</c> script of the <c>odbc</c> application + now also looks for odbc libraries in <c>lib64</c> and + <c>lib/64</c> directories when building on a 64-bit + system. </item><item> The <c>config.h.in</c> file in the + <c>erl_interface</c> application is now automatically + generated in instead of statically updated which reduces + the risk of <c>configure</c> tests without any effect. + </item></list> + <p>(Thanks to Henrik Riomar for suggestions and + testing)</p> + <p>(Thanks to Winston Smith for the AVR32-Linux cross + configuration and testing)</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8323</p> + </item> + <item> + <p>NIF improvements:</p> <list><item> Driver API for + multi-threading made available for NIFs. </item><item> + Support for mempory managed (garbage collected) resource + objects. A way to pass "pointers" to native data + structures between C and Erlang in a safe way. + </item><item> Support for references, floats and term + comparison. </item><item> Various new functions, like + <c>enif_inspect_iolist_as_binary</c>, + <c>enif_make_sub_binary</c>, <c>enif_get_string</c>, + <c>enif_get_atom</c>, <c>enif_make_tuple_from_array</c>, + <c>enif_make_list_from_array</c>, + <c>enif_make_existing_atom</c>. </item></list> + <p> + Own Id: OTP-8335</p> + </item> + <item> + <p> + Minor alignment adjustments of scheduler specific data.</p> + <p> + Own Id: OTP-8341</p> + </item> + <item> + <p>The documentation is now possible to build in an open + source environment after a number of bugs are fixed and + some features are added in the documentation build + process. </p> + <p>- The arity calculation is updated.</p> + <p>- The module prefix used in the function names for + bif's are removed in the generated links so the links + will look like + "http://www.erlang.org/doc/man/erlang.html#append_element-2" + instead of + "http://www.erlang.org/doc/man/erlang.html#erlang:append_element-2".</p> + <p>- Enhanced the menu positioning in the html + documentation when a new page is loaded.</p> + <p>- A number of corrections in the generation of man + pages (thanks to Sergei Golovan)</p> + <p>- The legal notice is taken from the xml book file so + OTP's build process can be used for non OTP + applications.</p> + <p> + Own Id: OTP-8343</p> + </item> + <item> + <p> + There is new <c>erlang:binary_to_term/2</c> BIF that + takes an option list. The option <c>safe</c> can be used + to prevent creation of resources that are not garbage + collected (such as atoms). (Thanks to Jayson Vantuyl.)</p> + <p> + Own Id: OTP-8367</p> + </item> + <item> + <p> + The default settings for garbage collection of binaries + has been adjusted to be less aggressive than in R13B03. + It is now also possible configure the settings for binary + GC. See the documentation for <c>spawn_opt/2-5</c>, + <c>erlang:system_info/1</c>, <c>erlang:system_flag/2</c>, + <c>process_flag/2-3</c>, <c>erlang:trace/3</c>, and the + documenation for <c>erl</c> for the new command line + options <c>+hms</c> and <c>+hmbs</c>.</p> + <p> + Own Id: OTP-8370</p> + </item> + <item> + <p> + A bug causing memory corruption in re:run() has been + corrected. (Thanks to Yamashina Hio.)</p> + <p> + Own Id: OTP-8375</p> + </item> + <item> + <p> + The <c>-Werror</c> option for <c>erlc</c> and the + compiler option <c>warnings_as_errors</c> will cause + warnings to be treated as errors. (Thanks to Christopher + Faulet.)</p> + <p> + Own Id: OTP-8382</p> + </item> + <item> + <p> + Explicit top directories in archive files are now + optional.</p> + <p> + For example, if an archive (app-vsn.ez) just contains an + app-vsn/ebin/mod.beam file, the file info for the app-vsn + and app-vsn/ebin directories are faked using the file + info from the archive file as origin. The virtual + direcories can also be listed. For short, the top + directories are virtual if they does not exist.</p> + <p> + Own Id: OTP-8387</p> + </item> + <item> + <p> + An unnecessary lock operation in os:timestamp/0 has been + eliminated, making it slightly more efficient. (Thanks to + Jonas Falkevik and Tuncer Ayaz.)</p> + <p> + Own Id: OTP-8390</p> + </item> + <item> + <p> + There is a new <c>+t</c> emulator option for changing the + maximum number of atoms. (Thanks to Julien Barbot.)</p> + <p> + Own Id: OTP-8405</p> + </item> + <item> + <p> + Fixed numerous compiler warnings generated by gcc 4.4.1 + and tile-cc 2.0.1.78377 when compiling the runtime + system.</p> + <p> + Own Id: OTP-8412</p> + </item> + <item> + <p> + <c>configure</c> learned the option + <c>--enable-m32-build</c> to force the building of a + 32-bit run-time on systems where the default C compiler + generates 64-bit executables by default.</p> + <p> + Own Id: OTP-8415</p> + </item> + <item> + <p> + HiPE now works in the 64-bit emulator on Mac OS X. + (Thanks to Geoff Cant.)</p> + <p> + Own Id: OTP-8416</p> + </item> + <item> + <p> + Improved handling of symbolic links to escripts</p> + <p> + Own Id: OTP-8417</p> + </item> + <item> + <p> + Add lock profiling tool.</p> + <p> + The Lock profiling tool, lcnt, can make use of the + internal lock statistics when the runtime system is built + with this feature enabled.</p> + <p> + This provides a mechanism to examine potential lock + bottlenecks within the runtime itself.</p> + <p> + - Add erts_debug:lock_counters({copy_save, bool()}). This + option enables or disables statistics saving for + destroyed processes and ets-tables. Enabling this might + consume a lot of memory.</p> + <p> + - Add id-numbering for lock classes which is otherwise + undefined.</p> + <p> + Own Id: OTP-8424</p> + </item> + <item> + <p> + Removed spurious options to the emulator from escript.</p> + <p> + Own Id: OTP-8427</p> + </item> + <item> + <p> + Minor documentation fixes. Mainly anchor adjustments.</p> + <p> + Own Id: OTP-8457</p> + </item> + </list> + </section> + +</section> + <section><title>Erts 5.7.4</title> <section><title>Fixed Bugs and Malfunctions</title> @@ -242,7 +736,7 @@ <item> <p> The <seealso - marker="erlang#erlang:port_command/3">erlang:port_command/3</seealso> + marker="erlang#port_command/3">erlang:port_command/3</seealso> BIF has been added. <c>erlang:port_command/3</c> is currently not auto imported, but it is planned to be auto imported in OTP R14. For more information see the @@ -4371,16 +4865,16 @@ following code might hang:</p> <code type="none"><![CDATA[ Mon = erlang:monitor(process, Pid), -\011 %% ... -\011 exit(Pid, bang), + %% ... + exit(Pid, bang), erlang:demonitor(Mon), -\011 receive -\011 {'DOWN', Mon , process, Pid, _} -> ok -\011 %% We were previously guaranteed to get a down message -\011 %% (since we exited the process ourself), so we could -\011 %% in this case leave out: -\011 %% after 0 -> ok -\011 end, + receive + {'DOWN', Mon , process, Pid, _} -> ok + %% We were previously guaranteed to get a down message + %% (since we exited the process ourself), so we could + %% in this case leave out: + %% after 0 -> ok + end, ]]></code> <p>*** POTENTIAL INCOMPATIBILITY ***</p> <p>Own Id: OTP-5772</p> @@ -5342,7 +5836,7 @@ <list type="bulleted"> <item> <p>If Erlang/OTP was installed in a short directory name, - such as <c><![CDATA[C:\\Program\\erl5.4.2]]></c>, the emulator would not + such as <c><![CDATA[C:\Program\erl5.4.2]]></c>, the emulator would not start.</p> <p>Own Id: OTP-5254</p> </item> diff --git a/erts/doc/src/tty.xml b/erts/doc/src/tty.xml index 23694e5965..7d662a2849 100644 --- a/erts/doc/src/tty.xml +++ b/erts/doc/src/tty.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>tty - A command line interface</title> @@ -47,7 +47,7 @@ <section> <title>Normal Mode</title> <p>In normal mode keystrokes from the user are collected and interpreted by <c><![CDATA[tty]]></c>. Most of the <em>emacs</em> line editing commands are supported. The following is a complete list of the supported line editing commands.<br></br></p> - <p><em>Note:</em>\011The notation <c><![CDATA[C-a]]></c> means pressing the control key and the letter <c><![CDATA[a]]></c> simultaneously. <c><![CDATA[M-f]]></c> means pressing the <c><![CDATA[ESC]]></c> key followed by the letter <c><![CDATA[f]]></c>. + <p><em>Note:</em> The notation <c><![CDATA[C-a]]></c> means pressing the control key and the letter <c><![CDATA[a]]></c> simultaneously. <c><![CDATA[M-f]]></c> means pressing the <c><![CDATA[ESC]]></c> key followed by the letter <c><![CDATA[f]]></c>. </p> <table> <row> diff --git a/erts/doc/src/zlib.xml b/erts/doc/src/zlib.xml index 9f39ac657a..b1e768bce9 100644 --- a/erts/doc/src/zlib.xml +++ b/erts/doc/src/zlib.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2005</year><year>2009</year> + <year>2005</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. - + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - + </legalnotice> <title>zlib</title> @@ -372,11 +372,11 @@ list_to_binary([B1,B2])</pre> <pre> unpack(Z, Compressed, Dict) -> case catch zlib:inflate(Z, Compressed) of -\011 {'EXIT',{{need_dictionary,DictID},_}} -> - \011 zlib:inflateSetDictionary(Z, Dict), -\011 Uncompressed = zlib:inflate(Z, []); -\011 Uncompressed -> -\011 Uncompressed + {'EXIT',{{need_dictionary,DictID},_}} -> + zlib:inflateSetDictionary(Z, Dict), + Uncompressed = zlib:inflate(Z, []); + Uncompressed -> + Uncompressed end.</pre> </desc> </func> @@ -466,8 +466,8 @@ unpack(Z, Compressed, Dict) -> the required initial value for the crc.</p> <pre> Crc = lists:foldl(fun(Bin,Crc0) -> -\011 zlib:crc32(Z, Crc0, Bin), -\011 end, zlib:crc32(Z,<< >>), Bins)</pre> + zlib:crc32(Z, Crc0, Bin), + end, zlib:crc32(Z,<< >>), Bins)</pre> </desc> </func> <func> @@ -517,8 +517,8 @@ Crc = lists:foldl(fun(Bin,Crc0) -> the required initial value for the checksum.</p> <pre> Crc = lists:foldl(fun(Bin,Crc0) -> -\011 zlib:adler32(Z, Crc0, Bin), -\011 end, zlib:adler32(Z,<< >>), Bins)</pre> + zlib:adler32(Z, Crc0, Bin), + end, zlib:adler32(Z,<< >>), Bins)</pre> </desc> </func> <func> |