diff options
Diffstat (limited to 'lib/kernel/doc')
30 files changed, 2131 insertions, 2545 deletions
diff --git a/lib/kernel/doc/specs/.gitignore b/lib/kernel/doc/specs/.gitignore new file mode 100644 index 0000000000..322eebcb06 --- /dev/null +++ b/lib/kernel/doc/specs/.gitignore @@ -0,0 +1 @@ +specs_*.xml diff --git a/lib/kernel/doc/src/Makefile b/lib/kernel/doc/src/Makefile index f8c1cac8b3..de10e31d36 100644 --- a/lib/kernel/doc/src/Makefile +++ b/lib/kernel/doc/src/Makefile @@ -1,19 +1,20 @@ -# ``The contents of this file are subject to the Erlang Public License, +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2011. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # 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 via the world wide web at http://www.erlang.org/. -# +# 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. -# -# The Initial Developer of the Original Code is Ericsson Utvecklings AB. -# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -# AB. All Rights Reserved.'' -# -# $Id$ +# +# %CopyrightEnd% # include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/make/$(TARGET)/otp.mk @@ -94,19 +95,24 @@ HTML_REF_MAN_FILE = $(HTMLDIR)/index.html TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf +SPECS_FILES = $(XML_REF3_FILES:%.xml=$(SPECDIR)/specs_%.xml) + +TOP_SPECS_FILE = specs.xml # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- XML_FLAGS += +SPECS_FLAGS = -I../../include + # ---------------------------------------------------- # Targets # ---------------------------------------------------- $(HTMLDIR)/%.gif: %.gif $(INSTALL_DATA) $< $@ -docs: pdf html man +docs: man pdf html $(TOP_PDF_FILE): $(XML_FILES) @@ -125,8 +131,22 @@ clean clean_docs: rm -f $(MAN4DIR)/* rm -f $(MAN6DIR)/* rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f $(SPECDIR)/* rm -f errs core *~ +$(SPECDIR)/specs_erl_prim_loader_stub.xml: + escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) \ + -o$(dir $@) -module erl_prim_loader_stub +$(SPECDIR)/specs_erlang_stub.xml: + escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) \ + -o$(dir $@) -module erlang_stub +$(SPECDIR)/specs_init_stub.xml: + escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) \ + -o$(dir $@) -module init_stub +$(SPECDIR)/specs_zlib_stub.xml: + escript $(SPECS_EXTRACTOR) $(SPECS_FLAGS) \ + -o$(dir $@) -module zlib_stub + # ---------------------------------------------------- # Release Target # ---------------------------------------------------- diff --git a/lib/kernel/doc/src/application.xml b/lib/kernel/doc/src/application.xml index 08ef0b1e52..51a3311ec2 100644 --- a/lib/kernel/doc/src/application.xml +++ b/lib/kernel/doc/src/application.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</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>application</title> @@ -50,20 +50,27 @@ <p>Refer to <seealso marker="doc/design_principles:des_princ">OTP Design Principles</seealso> for more information about applications and behaviours.</p> </description> + <datatypes> + <datatype> + <name name="start_type"/> + </datatype> + <datatype> + <name name="restart_type"/> + </datatype> + <datatype> + <!-- Parameterized opaque types are NYI: --> + <name><marker id="type-tuple_of">tuple_of(T)</marker></name> + <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc> + </datatype> + </datatypes> <funcs> <func> - <name>get_all_env() -> Env</name> - <name>get_all_env(Application) -> Env</name> + <name name="get_all_env" arity="0"/> + <name name="get_all_env" arity="1"/> <fsummary>Get the configuration parameters for an application</fsummary> - <type> - <v>Application = atom()</v> - <v>Env = [{Par,Val}]</v> - <v> Par = atom()</v> - <v> Val = term()</v> - </type> <desc> <p>Returns the configuration parameters and their values for - <c>Application</c>. If the argument is omitted, it defaults to + <c><anno>Application</anno></c>. If the argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, or if the process executing the call does not belong to any application, @@ -71,18 +78,12 @@ </desc> </func> <func> - <name>get_all_key() -> {ok, Keys} | []</name> - <name>get_all_key(Application) -> {ok, Keys} | undefined </name> + <name name="get_all_key" arity="0"/> + <name name="get_all_key" arity="1"/> <fsummary>Get the application specification keys</fsummary> - <type> - <v>Application = atom()</v> - <v>Keys = [{Key,Val}]</v> - <v> Key = atom()</v> - <v> Val = term()</v> - </type> <desc> <p>Returns the application specification keys and their values - for <c>Application</c>. If the argument is omitted, it + for <c><anno>Application</anno></c>. If the argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, the function returns <c>undefined</c>. If the process executing the call @@ -91,17 +92,12 @@ </desc> </func> <func> - <name>get_application() -> {ok, Application} | undefined</name> - <name>get_application(Pid | Module) -> {ok, Application} | undefined</name> + <name name="get_application" arity="0"/> + <name name="get_application" arity="1"/> <fsummary>Get the name of an application containing a certain process or module</fsummary> - <type> - <v>Pid = pid()</v> - <v>Module = atom()</v> - <v>Application = atom()</v> - </type> <desc> <p>Returns the name of the application to which the process - <c>Pid</c> or the module <c>Module</c> belongs. Providing no + <c><anno>Pid</anno></c> or the module <c><anno>Module</anno></c> belongs. Providing no argument is the same as calling <c>get_application(self())</c>.</p> <p>If the specified process does not belong to any application, @@ -110,17 +106,12 @@ </desc> </func> <func> - <name>get_env(Par) -> {ok, Val} | undefined</name> - <name>get_env(Application, Par) -> {ok, Val} | undefined</name> + <name name="get_env" arity="1"/> + <name name="get_env" arity="2"/> <fsummary>Get the value of a configuration parameter</fsummary> - <type> - <v>Application = atom()</v> - <v>Par = atom()</v> - <v>Val = term()</v> - </type> <desc> - <p>Returns the value of the configuration parameter <c>Par</c> - for <c>Application</c>. If the application argument is + <p>Returns the value of the configuration parameter <c><anno>Par</anno></c> + for <c><anno>Application</anno></c>. If the application argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, or @@ -130,17 +121,12 @@ </desc> </func> <func> - <name>get_key(Key) -> {ok, Val} | undefined</name> - <name>get_key(Application, Key) -> {ok, Val} | undefined</name> + <name name="get_key" arity="1"/> + <name name="get_key" arity="2"/> <fsummary>Get the value of an application specification key</fsummary> - <type> - <v>Application = atom()</v> - <v>Key = atom()</v> - <v>Val = term()</v> - </type> <desc> <p>Returns the value of the application specification key - <c>Key</c> for <c>Application</c>. If the application + <c><anno>Key</anno></c> for <c><anno>Application</anno></c>. If the application argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, or @@ -150,45 +136,35 @@ </desc> </func> <func> - <name>load(AppDescr) -> ok | {error, Reason}</name> - <name>load(AppDescr, Distributed) -> ok | {error, Reason}</name> + <name name="load" arity="1"/> + <name name="load" arity="2"/> <fsummary>Load an application</fsummary> - <type> - <v>AppDescr = Application | AppSpec</v> - <v> Application = atom()</v> - <v> AppSpec = {application,Application,AppSpecKeys}</v> - <v> AppSpec = [{Key,Val}]</v> - <v> Key = atom()</v> - <v> Val = term()</v> - <v>Distributed = {Application,Nodes} | {Application,Time,Nodes} | default</v> - <v> Nodes = [node() | {node(),..,node()}]</v> - <v> Time = integer() > 0</v> - <v>Reason = term()</v> - </type> + <type name="application_spec"/> + <type name="application_opt"/> <desc> <p>Loads the application specification for an application into the application controller. It will also load the application specifications for any included applications. Note that the function does not load the actual Erlang object code.</p> - <p>The application can be given by its name <c>Application</c>. + <p>The application can be given by its name <c><anno>Application</anno></c>. In this case the application controller will search the code - path for the application resource file <c>Application.app</c> + path for the application resource file <c><anno>Application</anno>.app</c> and load the specification it contains.</p> <p>The application specification can also be given directly as a - tuple <c>AppSpec</c>. This tuple should have the format and + tuple <c><anno>AppSpec</anno></c>. This tuple should have the format and contents as described in <c>app(4)</c>.</p> - <p>If <c>Distributed == {Application,[Time,]Nodes}</c>, + <p>If <c><anno>Distributed</anno> == {<anno>Application</anno>,[<anno>Time</anno>,]<anno>Nodes</anno>}</c>, the application will be distributed. The argument overrides the value for the application in the Kernel configuration - parameter <c>distributed</c>. <c>Application</c> must be + parameter <c>distributed</c>. <c><anno>Application</anno></c> must be the name of the application (same as in the first argument). - If a node crashes and <c>Time</c> has been specified, then - the application controller will wait for <c>Time</c> + If a node crashes and <c><anno>Time</anno></c> has been specified, then + the application controller will wait for <c><anno>Time</anno></c> milliseconds before attempting to restart the application on - another node. If <c>Time</c> is not specified, it will + another node. If <c><anno>Time</anno></c> is not specified, it will default to 0 and the application will be restarted immediately.</p> - <p><c>Nodes</c> is a list of node names where the application + <p><c><anno>Nodes</anno></c> is a list of node names where the application may run, in priority from left to right. Node names can be grouped using tuples to indicate that they have the same priority. Example:</p> @@ -204,32 +180,22 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>loaded_applications() -> [{Application, Description, Vsn}]</name> + <name name="loaded_applications" arity="0"/> <fsummary>Get the currently loaded applications</fsummary> - <type> - <v>Application = atom()</v> - <v>Description = string()</v> - <v>Vsn = string()</v> - </type> <desc> <p>Returns a list with information about the applications which have been loaded using <c>load/1,2</c>, also included - applications. <c>Application</c> is the application name. - <c>Description</c> and <c>Vsn</c> are the values of its + applications. <c><anno>Application</anno></c> is the application name. + <c><anno>Description</anno></c> and <c><anno>Vsn</anno></c> are the values of its <c>description</c> and <c>vsn</c> application specification keys, respectively.</p> </desc> </func> <func> - <name>permit(Application, Bool) -> ok | {error, Reason}</name> + <name name="permit" arity="2"/> <fsummary>Change an application's permission to run on a node.</fsummary> - <type> - <v>Application = atom()</v> - <v>Bool = bool()</v> - <v>Reason = term()</v> - </type> <desc> - <p>Changes the permission for <c>Application</c> to run at + <p>Changes the permission for <c><anno>Application</anno></c> to run at the current node. The application must have been loaded using <c>load/1,2</c> for the function to have effect.</p> <p>If the permission of a loaded, but not started, application @@ -258,20 +224,14 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>set_env(Application, Par, Val) -> ok</name> - <name>set_env(Application, Par, Val, Timeout) -> ok</name> + <name name="set_env" arity="3"/> + <name name="set_env" arity="4"/> <fsummary>Set the value of a configuration parameter</fsummary> - <type> - <v>Application = atom()</v> - <v>Par = atom()</v> - <v>Val = term()</v> - <v>Timeout = int() | infinity</v> - </type> <desc> - <p>Sets the value of the configuration parameter <c>Par</c> for - <c>Application</c>.</p> + <p>Sets the value of the configuration parameter <c><anno>Par</anno></c> for + <c><anno>Application</anno></c>.</p> <p><c>set_env/3</c> uses the standard <c>gen_server</c> timeout - value (5000 ms). A <c>Timeout</c> argument can be provided + value (5000 ms). A <c><anno>Timeout</anno></c> argument can be provided if another timeout value is useful, for example, in situations where the application controller is heavily loaded.</p> <warning> @@ -285,20 +245,15 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>start(Application) -> ok | {error, Reason}</name> - <name>start(Application, Type) -> ok | {error, Reason}</name> + <name name="start" arity="1"/> + <name name="start" arity="2"/> <fsummary>Load and start an application</fsummary> - <type> - <v>Application = atom()</v> - <v>Type = permanent | transient | temporary</v> - <v>Reason = term()</v> - </type> <desc> - <p>Starts <c>Application</c>. If it is not loaded, + <p>Starts <c><anno>Application</anno></c>. If it is not loaded, the application controller will first load it using <c>load/1</c>. It will make sure any included applications are loaded, but will not start them. That is assumed to be - taken care of in the code for <c>Application</c>.</p> + taken care of in the code for <c><anno>Application</anno></c>.</p> <p>The application controller checks the value of the application specification key <c>applications</c>, to ensure that all applications that should be started before @@ -310,7 +265,7 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> The application master starts the application by calling the application callback function <c>Module:start/2</c> as defined by the application specification key <c>mod</c>.</p> - <p>The <c>Type</c> argument specifies the type of + <p>The <c><anno>Type</anno></c> argument specifies the type of the application. If omitted, it defaults to <c>temporary</c>.</p> <list type="bulleted"> <item>If a permanent application terminates, all other @@ -331,19 +286,15 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>start_type() -> StartType | local | undefined</name> + <name name="start_type" arity="0"/> <fsummary>Get the start type of an ongoing application startup.</fsummary> - <type> - <v>StartType = normal | {takeover,Node} | {failover,Node}</v> - <v> Node = node()</v> - </type> <desc> <p>This function is intended to be called by a process belonging to an application, when the application is being started, to - determine the start type which is either <c>StartType</c> or + determine the start type which is either <c><anno>StartType</anno></c> or <c>local</c>.</p> - <p>See <c>Module:start/2</c> for a description of - <c>StartType</c>.</p> + <p>See <seealso marker="#start_type"><c>Module:start/2</c></seealso> for a description of + <c><anno>StartType</anno></c>.</p> <p><c>local</c> is returned if only parts of the application is being restarted (by a supervisor), or if the function is called outside a startup.</p> @@ -352,14 +303,10 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>stop(Application) -> ok | {error, Reason}</name> + <name name="stop" arity="1"/> <fsummary>Stop an application</fsummary> - <type> - <v>Application = atom()</v> - <v>Reason = term()</v> - </type> <desc> - <p>Stops <c>Application</c>. The application master calls + <p>Stops <c><anno>Application</anno></c>. The application master calls <c>Module:prep_stop/1</c>, if such a function is defined, and then tells the top supervisor of the application to shutdown (see <c>supervisor(3)</c>). This means that the entire @@ -384,16 +331,11 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>takeover(Application, Type) -> ok | {error, Reason}</name> + <name name="takeover" arity="2"/> <fsummary>Take over a distributed application</fsummary> - <type> - <v>Application = atom()</v> - <v>Type = permanent | transient | temporary</v> - <v>Reason = term()</v> - </type> <desc> <p>Performs a takeover of the distributed application - <c>Application</c>, which executes at another node + <c><anno>Application</anno></c>, which executes at another node <c>Node</c>. At the current node, the application is restarted by calling <c>Module:start({takeover,Node},StartArgs)</c>. <c>Module</c> @@ -413,14 +355,10 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>unload(Application) -> ok | {error, Reason}</name> + <name name="unload" arity="1"/> <fsummary>Unload an application</fsummary> - <type> - <v>Application = atom()</v> - <v>Reason = term()</v> - </type> <desc> - <p>Unloads the application specification for <c>Application</c> + <p>Unloads the application specification for <c><anno>Application</anno></c> from the application controller. It will also unload the application specifications for any included applications. Note that the function does not purge the actual Erlang @@ -428,19 +366,14 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>unset_env(Application, Par) -> ok</name> - <name>unset_env(Application, Par, Timeout) -> ok</name> + <name name="unset_env" arity="2"/> + <name name="unset_env" arity="3"/> <fsummary>Unset the value of a configuration parameter</fsummary> - <type> - <v>Application = atom()</v> - <v>Par = atom()</v> - <v>Timeout = int() | infinity</v> - </type> <desc> - <p>Removes the configuration parameter <c>Par</c> and its value - for <c>Application</c>.</p> + <p>Removes the configuration parameter <c><anno>Par</anno></c> and its value + for <c><anno>Application</anno></c>.</p> <p><c>unset_env/2</c> uses the standard <c>gen_server</c> - timeout value (5000 ms). A <c>Timeout</c> argument can be + timeout value (5000 ms). A <c><anno>Timeout</anno></c> argument can be provided if another timeout value is useful, for example, in situations where the application controller is heavily loaded.</p> <warning> @@ -454,23 +387,17 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> </desc> </func> <func> - <name>which_applications() -> [{Application, Description, Vsn}]</name> - <name>which_applications(Timeout) -> [{Application, Description, Vsn}]</name> + <name name="which_applications" arity="0"/> + <name name="which_applications" arity="1"/> <fsummary>Get the currently running applications</fsummary> - <type> - <v>Application = atom()</v> - <v>Description = string()</v> - <v>Vsn = string()</v> - <v>Timeout = int() | infinity</v> - </type> <desc> <p>Returns a list with information about the applications which - are currently running. <c>Application</c> is the application - name. <c>Description</c> and <c>Vsn</c> are the values of its + are currently running. <c><anno>Application</anno></c> is the application + name. <c><anno>Description</anno></c> and <c><anno>Vsn</anno></c> are the values of its <c>description</c> and <c>vsn</c> application specification keys, respectively.</p> <p><c>which_applications/0</c> uses the standard - <c>gen_server</c> timeout value (5000 ms). A <c>Timeout</c> + <c>gen_server</c> timeout value (5000 ms). A <c><anno>Timeout</anno></c> argument can be provided if another timeout value is useful, for example, in situations where the application controller is heavily loaded.</p> @@ -501,9 +428,9 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> structured according to the OTP design principles as a supervision tree, this means starting the top supervisor of the tree.</p> - <p><c>StartType</c> defines the type of start:</p> + <p><marker id="start_type"/><c>StartType</c> defines the type of start:</p> <list type="bulleted"> - <item><c>normal</c> if its a normal startup.</item> + <item><c>normal</c> if it's a normal startup.</item> <item><c>normal</c> also if the application is distributed and started at the current node due to a failover from another node, and the application specification key <c>start_phases == undefined</c>.</item> @@ -532,8 +459,7 @@ Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</code> <fsummary>Extended start of an application</fsummary> <type> <v>Phase = atom()</v> - <v>StartType = normal | {takeover,Node} | {failover,Node}</v> - <v> Node = node()</v> + <v>StartType = <seealso marker="#type-start_type">start_type()</seealso></v> <v>PhaseArgs = term()</v> <v>Pid = pid()</v> <v>State = state()</v> diff --git a/lib/kernel/doc/src/auth.xml b/lib/kernel/doc/src/auth.xml index f53fc8b29a..15d9ef0fe4 100644 --- a/lib/kernel/doc/src/auth.xml +++ b/lib/kernel/doc/src/auth.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -34,29 +34,28 @@ Cookie system, refer to <seealso marker="doc/reference_manual:distributed">Distributed Erlang</seealso> in the Erlang Reference Manual.</p> </description> + <datatypes> + <datatype> + <name name="cookie"/> + </datatype> + </datatypes> <funcs> <func> - <name>is_auth(Node) -> yes | no</name> + <name name="is_auth" arity="1"/> <fsummary>Status of communication authorization (deprecated)</fsummary> - <type> - <v>Node = node()</v> - </type> <desc> - <p>Returns <c>yes</c> if communication with <c>Node</c> is - authorized. Note that a connection to <c>Node</c> will - be established in this case. Returns <c>no</c> if <c>Node</c> + <p>Returns <c>yes</c> if communication with <c><anno>Node</anno></c> is + authorized. Note that a connection to <c><anno>Node</anno></c> will + be established in this case. Returns <c>no</c> if <c><anno>Node</anno></c> does not exist or communication is not authorized (it has another cookie than <c>auth</c> thinks it has).</p> - <p>Use <seealso marker="net_adm#ping/1">net_adm:ping(Node)</seealso> + <p>Use <seealso marker="net_adm#ping/1">net_adm:ping(<anno>Node</anno>)</seealso> instead.</p> </desc> </func> <func> - <name>cookie() -> Cookie</name> + <name name="cookie" arity="0"/> <fsummary>Magic cookie for local node (deprecated)</fsummary> - <type> - <v>Cookie = atom()</v> - </type> <desc> <p>Use <seealso marker="erts:erlang#erlang:get_cookie/0">erlang:get_cookie()</seealso> @@ -64,16 +63,14 @@ </desc> </func> <func> - <name>cookie(TheCookie) -> true</name> + <name name="cookie" arity="1"/> <fsummary>Set the magic for the local node (deprecated)</fsummary> - <type> - <v>TheCookie = Cookie | [Cookie]</v> - <d>The cookie may also be given as a list with a single atom element</d> - <v> Cookie = atom()</v> - </type> + <type_desc variable="TheCookie"> + The cookie may also be given as a list with a single atom element. + </type_desc> <desc> <p>Use - <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(node(), Cookie)</seealso> + <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(node(), <anno>Cookie</anno>)</seealso> instead.</p> </desc> </func> @@ -82,7 +79,7 @@ <fsummary>Set the magic cookie for a node and verify authorization (deprecated)</fsummary> <type> <v>Node = node()</v> - <v>Cookie = atom()</v> + <v>Cookie = <seealso marker="#type-cookie">cookie()</seealso></v> </type> <desc> <p>Equivalent to @@ -90,18 +87,14 @@ </desc> </func> <func> - <name>node_cookie(Node, Cookie) -> yes | no</name> + <name name="node_cookie" arity="2"/> <fsummary>Set the magic cookie for a node and verify authorization (deprecated)</fsummary> - <type> - <v>Node = node()</v> - <v>Cookie = atom()</v> - </type> <desc> - <p>Sets the magic cookie of <c>Node</c> to <c>Cookie</c>, and + <p>Sets the magic cookie of <c><anno>Node</anno></c> to <c><anno>Cookie</anno></c>, and verifies the status of the authorization. Equivalent to calling - <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(Node, Cookie)</seealso>, followed by - <seealso marker="#is_auth/1">auth:is_auth(Node)</seealso>.</p> + <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(<anno>Node</anno>, <anno>Cookie</anno>)</seealso>, followed by + <seealso marker="#is_auth/1">auth:is_auth(<anno>Node</anno>)</seealso>.</p> </desc> </func> </funcs> diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml index 19e1d3221c..6f85388c22 100644 --- a/lib/kernel/doc/src/code.xml +++ b/lib/kernel/doc/src/code.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -54,7 +54,7 @@ for and tries to load the module.</p> </item> </list> - <p>To prevent accidentaly reloading modules affecting the Erlang + <p>To prevent accidentally reloading modules affecting the Erlang runtime system itself, the <c>kernel</c>, <c>stdlib</c> and <c>compiler</c> directories are considered <em>sticky</em>. This means that the system issues a warning and rejects the request if @@ -286,6 +286,12 @@ given to <c>set_path/1</c>.</p> </section> + <datatypes> + <datatype> + <name name="load_error_rsn"/> + </datatype> + </datatypes> + <funcs> <func> <name>set_path(Path) -> true | {error, What}</name> diff --git a/lib/kernel/doc/src/disk_log.xml b/lib/kernel/doc/src/disk_log.xml index 07c1844485..9721907162 100644 --- a/lib/kernel/doc/src/disk_log.xml +++ b/lib/kernel/doc/src/disk_log.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1997</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> @@ -179,13 +179,48 @@ reopen the log simultaneously.</p> </note> </description> + <datatypes> + <datatype> + <name name="log"/> + </datatype> + <datatype> + <name name="dlog_size"/> + </datatype> + <datatype> + <name name="dlog_format"/> + </datatype> + <datatype> + <name name="dlog_head_opt"/> + </datatype> + <datatype> + <name name="dlog_byte"/> + </datatype> + <datatype> + <name name="dlog_mode"/> + </datatype> + <datatype> + <name name="dlog_type"/> + </datatype> + <datatype> + <name name="continuation"/> + <desc><p>Chunk continuation returned by + <c>chunk/2,3</c>, <c>bchunk/2,3</c>, or <c>chunk_step/3</c>.</p> + </desc> + </datatype> + <datatype> + <name name="bytes"/> + </datatype> + <datatype> + <name name="invalid_header"/> + </datatype> + <datatype> + <name name="file_error"/> + </datatype> + </datatypes> <funcs> <func> - <name>accessible_logs() -> {[LocalLog], [DistributedLog]}</name> + <name name="accessible_logs" arity="0"/> <fsummary>Return the accessible disk logs on the current node.</fsummary> - <type> - <v>LocalLog = DistributedLog = term()</v> - </type> <desc> <p>The <c>accessible_logs/0</c> function returns the names of the disk logs accessible on the current node. @@ -195,16 +230,13 @@ </desc> </func> <func> - <name>alog(Log, Term)</name> - <name>balog(Log, Bytes) -> ok | {error, Reason}</name> + <name name="alog" arity="2"/> + <name name="balog" arity="2"/> + <type variable="Log"/> + <type variable="Term" name_i="1"/> + <type variable="Bytes"/> + <type name="notify_ret"/> <fsummary>Asynchronously log an item onto a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Term = term()</v> - <v>Bytes = binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log</v> - </type> <desc> <p>The <c>alog/2</c> and <c>balog/2</c> functions asynchronously append an item to a disk log. The function <c>alog/2</c> is @@ -225,17 +257,13 @@ </desc> </func> <func> - <name>alog_terms(Log, TermList)</name> - <name>balog_terms(Log, BytesList) -> ok | {error, Reason}</name> + <name name="alog_terms" arity="2"/> + <name name="balog_terms" arity="2"/> <fsummary>Asynchronously log several items onto a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>TermList = [term()]</v> - <v>BytesList = [Bytes]</v> - <v>Bytes = binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log</v> - </type> + <type variable="Log"/> + <type variable="TermList" name_i="1"/> + <type variable="ByteList"/> + <type name="notify_ret"/> <desc> <p>The <c>alog_terms/2</c> and <c>balog_terms/2</c> functions asynchronously append a list of items to a disk log. @@ -257,14 +285,10 @@ </desc> </func> <func> - <name>block(Log)</name> - <name>block(Log, QueueLogRecords) -> ok | {error, Reason}</name> + <name name="block" arity="1"/> + <name name="block" arity="2"/> + <type name="block_error_rsn"/> <fsummary>Block a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>QueueLogRecords = bool()</v> - <v>Reason = no_such_log | nonode | {blocked_log, Log}</v> - </type> <desc> <p>With a call to <c>block/1,2</c> a process can block a log. If the blocking process is not an owner of the log, a temporary @@ -280,52 +304,32 @@ affected by the block. Any other attempt than those hitherto mentioned to update or read a blocked log suspends the calling process until the log is unblocked or returns an - error message <c>{blocked_log, Log}</c>, depending on - whether the value of <c>QueueLogRecords</c> is <c>true</c> - or <c>false</c>. The default value of <c>QueueLogRecords</c> + error message <c>{blocked_log, <anno>Log</anno>}</c>, depending on + whether the value of <c><anno>QueueLogRecords</anno></c> is <c>true</c> + or <c>false</c>. The default value of <c><anno>QueueLogRecords</anno></c> is <c>true</c>, which is used by <c>block/1</c>. </p> </desc> </func> <func> - <name>change_header(Log, Header) -> ok | {error, Reason}</name> + <name name="change_header" arity="2"/> <fsummary>Change the head or head_func option for an owner of a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Header = {head, Head} | {head_func, {M,F,A}}</v> - <v>Head = none | term() | binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {blocked_log, Log} | {badarg, head}</v> - </type> <desc> <p>The <c>change_header/2</c> function changes the value of the <c>head</c> or <c>head_func</c> option of a disk log.</p> </desc> </func> <func> - <name>change_notify(Log, Owner, Notify) -> ok | {error, Reason}</name> + <name name="change_notify" arity="3"/> <fsummary>Change the notify option for an owner of a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Owner = pid()</v> - <v>Notify = bool()</v> - <v>Reason = no_such_log | nonode | {blocked_log, Log} | {badarg, notify} | {not_owner, Owner}</v> - </type> <desc> <p>The <c>change_notify/3</c> function changes the value of the <c>notify</c> option for an owner of a disk log. </p> </desc> </func> <func> - <name>change_size(Log, Size) -> ok | {error, Reason}</name> + <name name="change_size" arity="2"/> <fsummary>Change the size of an open disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Size = integer() > 0 | infinity | {MaxNoBytes, MaxNoFiles}</v> - <v>MaxNoBytes = integer() > 0</v> - <v>MaxNoFiles = integer() > 0</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {blocked_log, Log} | {new_size_too_small, CurrentSize} | {badarg, size} | {file_error, FileName, FileError}</v> - </type> <desc> <p>The <c>change_size/2</c> function changes the size of an open log. For a halt log it is always possible to increase the size, @@ -363,21 +367,17 @@ </desc> </func> <func> - <name>chunk(Log, Continuation)</name> - <name>chunk(Log, Continuation, N) -> {Continuation2, Terms} | {Continuation2, Terms, Badbytes} | eof | {error, Reason}</name> - <name>bchunk(Log, Continuation)</name> - <name>bchunk(Log, Continuation, N) -> {Continuation2, Binaries} | {Continuation2, Binaries, Badbytes} | eof | {error, Reason}</name> + <name name="chunk" arity="2"/> + <name name="chunk" arity="3"/> + <name name="bchunk" arity="2"/> + <name name="bchunk" arity="3"/> <fsummary>Read a chunk of items written to a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Continuation = start | cont()</v> - <v>N = integer() > 0 | infinity</v> - <v>Continuation2 = cont()</v> - <v>Terms = [term()]</v> - <v>Badbytes = integer()</v> - <v>Reason = no_such_log | {format_external, Log} | {blocked_log, Log} | {badarg, continuation} | {not_internal_wrap, Log} | {corrupt_log_file, FileName} | {file_error, FileName, FileError}</v> - <v>Binaries = [binary()]</v> - </type> + <type variable="Log"/> + <type variable="Continuation"/> + <type variable="N"/> + <type name="chunk_ret"/> + <type name="bchunk_ret"/> + <type name="chunk_error_rsn"/> <desc> <p>The <c>chunk/2,3</c> and <c>bchunk/2,3</c> functions make it possible to efficiently read the terms which have been @@ -394,31 +394,31 @@ individual distributed log on some other node is chosen, if such a log exists. </p> - <p>When <c>chunk/3</c> is called, <c>N</c> controls the + <p>When <c>chunk/3</c> is called, <c><anno>N</anno></c> controls the maximum number of terms that are read from the log in each chunk. Default is <c>infinity</c>, which means that all the terms contained in the 64 kilobyte chunk are read. If less than - <c>N</c> terms are returned, this does not necessarily mean + <c><anno>N</anno></c> terms are returned, this does not necessarily mean that the end of the file has been reached. </p> <p>The <c>chunk</c> function returns a tuple - <c>{Continuation2, Terms}</c>, where <c>Terms</c> is a list - of terms found in the log. <c>Continuation2</c> is yet + <c>{<anno>Continuation2</anno>, <anno>Terms</anno>}</c>, where <c><anno>Terms</anno></c> is a list + of terms found in the log. <c><anno>Continuation2</anno></c> is yet another continuation which must be passed on to any subsequent calls to <c>chunk</c>. With a series of calls to <c>chunk</c> it is possible to extract all terms from a log. </p> <p>The <c>chunk</c> function returns a tuple - <c>{Continuation2, Terms, Badbytes}</c> if the log is opened - in read-only mode and the read chunk is corrupt. <c>Badbytes</c> + <c>{<anno>Continuation2</anno>, <anno>Terms</anno>, <anno>Badbytes</anno>}</c> if the log is opened + in read-only mode and the read chunk is corrupt. <c><anno>Badbytes</anno></c> is the number of bytes in the file which were found not to be Erlang terms in the chunk. Note also that the log is not repaired. When trying to read chunks from a log opened in read-write mode, - the tuple <c>{corrupt_log_file, FileName}</c> is returned if the + the tuple <c>{corrupt_log_file, <anno>FileName</anno>}</c> is returned if the read chunk is corrupt. </p> <p><c>chunk</c> returns <c>eof</c> when the end of the log is - reached, or <c>{error, Reason}</c> if an error occurs. Should + reached, or <c>{error, <anno>Reason</anno>}</c> if an error occurs. Should a wrap log file be missing, a message is output on the error log. </p> <p>When <c>chunk/2,3</c> is used with wrap logs, the returned @@ -431,12 +431,8 @@ </desc> </func> <func> - <name>chunk_info(Continuation) -> InfoList | {error, Reason}</name> + <name name="chunk_info" arity="1"/> <fsummary>Return information about a chunk continuation of a disk log.</fsummary> - <type> - <v>Continuation = cont()</v> - <v>Reason = {no_continuation, Continuation}</v> - </type> <desc> <p>The <c>chunk_info/1</c> function returns the following pair describing the chunk continuation returned by @@ -444,29 +440,22 @@ </p> <list type="bulleted"> <item> - <p><c>{node, Node}</c>. Terms are read from - the disk log running on <c>Node</c>.</p> + <p><c>{node, <anno>Node</anno>}</c>. Terms are read from + the disk log running on <c><anno>Node</anno></c>.</p> </item> </list> </desc> </func> <func> - <name>chunk_step(Log, Continuation, Step) -> {ok, Continuation2} | {error, Reason}</name> + <name name="chunk_step" arity="3"/> <fsummary>Step forward or backward among the wrap log files of a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Continuation = start | cont()</v> - <v>Step = integer()</v> - <v>Continuation2 = cont()</v> - <v>Reason = no_such_log | end_of_log | {format_external, Log} | {blocked_log, Log} | {badarg, continuation} | {file_error, FileName, FileError}</v> - </type> <desc> <p>The function <c>chunk_step</c> can be used in conjunction with <c>chunk/2,3</c> and <c>bchunk/2,3</c> to search through an internally formatted wrap log. It takes as argument a continuation as returned by <c>chunk/2,3</c>, <c>bchunk/2,3</c>, or <c>chunk_step/3</c>, and steps forward - (or backward) <c>Step</c> files in the wrap log. The + (or backward) <c><anno>Step</anno></c> files in the wrap log. The continuation returned points to the first log item in the new current file. </p> @@ -482,11 +471,9 @@ </desc> </func> <func> - <name>close(Log) -> ok | {error, Reason}</name> + <name name="close" arity="1"/> <fsummary>Close a disk log.</fsummary> - <type> - <v>Reason = no_such_log | nonode | {file_error, FileName, FileError}</v> - </type> + <type name="close_error_rsn"/> <desc> <p> <marker id="close_1"></marker> The function <c>close/1</c> closes a @@ -511,11 +498,8 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>format_error(Error) -> Chars</name> + <name name="format_error" arity="1"/> <fsummary>Return an English description of a disk log error reply.</fsummary> - <type> - <v>Chars = [char() | Chars]</v> - </type> <desc> <p>Given the error returned by any function in this module, the function <c>format_error</c> returns a descriptive string @@ -524,11 +508,10 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>inc_wrap_file(Log) -> ok | {error, Reason}</name> + <name name="inc_wrap_file" arity="1"/> <fsummary>Change to the next wrap log file of a disk log.</fsummary> - <type> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {blocked_log, Log} | {halt_log, Log} | {invalid_header, InvalidHeader} | {file_error, FileName, FileError}</v> - </type> + <type name="inc_wrap_error_rsn"/> + <type name="invalid_header"/> <desc> <p>The <c>inc_wrap_file/1</c> function forces the internally formatted disk log to start logging to the @@ -543,8 +526,9 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>info(Log) -> InfoList | {error, no_such_log}</name> + <name name="info" arity="1"/> <fsummary>Return information about a disk log.</fsummary> + <type name="dlog_info"/> <desc> <p>The <c>info/1</c> function returns a list of <c>{Tag, Value}</c> pairs describing the log. If there is a disk log process running @@ -556,55 +540,55 @@ The function <c>close/1</c> closes a </p> <list type="bulleted"> <item> - <p><c>{name, Log}</c>, where <c>Log</c> is the name of + <p><c>{name, <anno>Log</anno>}</c>, where <c><anno>Log</anno></c> is the name of the log as given by the <c>open/1</c> option <c>name</c>.</p> </item> <item> - <p><c>{file, File}</c>. For halt logs <c>File</c> is the - filename, and for wrap logs <c>File</c> is the base name.</p> + <p><c>{file, <anno>File</anno>}</c>. For halt logs <c><anno>File</anno></c> is the + filename, and for wrap logs <c><anno>File</anno></c> is the base name.</p> </item> <item> - <p><c>{type, Type}</c>, where <c>Type</c> is the type of + <p><c>{type, <anno>Type</anno>}</c>, where <c><anno>Type</anno></c> is the type of the log as given by the <c>open/1</c> option <c>type</c>.</p> </item> <item> - <p><c>{format, Format}</c>, where <c>Format</c> is the format + <p><c>{format, <anno>Format</anno>}</c>, where <c><anno>Format</anno></c> is the format of the log as given by the <c>open/1</c> option <c>format</c>.</p> </item> <item> - <p><c>{size, Size}</c>, where <c>Size</c> is the size + <p><c>{size, <anno>Size</anno>}</c>, where <c><anno>Size</anno></c> is the size of the log as given by the <c>open/1</c> option <c>size</c>, or the size set by <c>change_size/2</c>. The value set by <c>change_size/2</c> is reflected immediately.</p> </item> <item> - <p><c>{mode, Mode}</c>, where <c>Mode</c> is the mode + <p><c>{mode, <anno>Mode</anno>}</c>, where <c><anno>Mode</anno></c> is the mode of the log as given by the <c>open/1</c> option <c>mode</c>.</p> </item> <item> - <p><c>{owners, [{pid(), Notify}]}</c> where <c>Notify</c> + <p><c>{owners, [{pid(), <anno>Notify</anno>}]}</c> where <c><anno>Notify</anno></c> is the value set by the <c>open/1</c> option <c>notify</c> or the function <c>change_notify/3</c> for the owners of the log.</p> </item> <item> - <p><c>{users, Users}</c> where <c>Users</c> is the number + <p><c>{users, <anno>Users</anno>}</c> where <c><anno>Users</anno></c> is the number of anonymous users of the log, see the <c>open/1</c> option <seealso marker="#linkto">linkto</seealso>.</p> </item> <item> - <p><c>{status, Status}</c>, where <c>Status</c> is <c>ok</c> - or <c>{blocked, QueueLogRecords}</c> as set by the functions + <p><c>{status, <anno>Status</anno>}</c>, where <c><anno>Status</anno></c> is <c>ok</c> + or <c>{blocked, <anno>QueueLogRecords</anno>}</c> as set by the functions <c>block/1,2</c> and <c>unblock/1</c>.</p> </item> <item> - <p><c>{node, Node}</c>. The information returned by the + <p><c>{node, <anno>Node</anno>}</c>. The information returned by the current invocation of the <c>info/1</c> function has been - gathered from the disk log process running on <c>Node</c>.</p> + gathered from the disk log process running on <c><anno>Node</anno></c>.</p> </item> <item> - <p><c>{distributed, Dist}</c>. If the log is local on - the current node, then <c>Dist</c> has the value <c>local</c>, + <p><c>{distributed, <anno>Dist</anno>}</c>. If the log is local on + the current node, then <c><anno>Dist</anno></c> has the value <c>local</c>, otherwise all nodes where the log is distributed are returned as a list.</p> </item> @@ -614,16 +598,16 @@ The function <c>close/1</c> closes a </p> <list type="bulleted"> <item> - <p><c>{head, Head}</c>. Depending of the value of + <p><c>{head, <anno>Head</anno>}</c>. Depending of the value of the <c>open/1</c> options <c>head</c> and <c>head_func</c> or set by the function <c>change_header/2</c>, the value - of <c>Head</c> is <c>none</c> (default), + of <c><anno>Head</anno></c> is <c>none</c> (default), <c>{head, H}</c> (<c>head</c> option) or <c>{M,F,A}</c> (<c>head_func</c> option).</p> </item> <item> - <p><c>{no_written_items, NoWrittenItems}</c>, where - <c>NoWrittenItems</c> is the number of items + <p><c>{no_written_items, <anno>NoWrittenItems</anno>}</c>, where + <c><anno>NoWrittenItems</anno></c> is the number of items written to the log since the disk log process was created.</p> </item> </list> @@ -632,7 +616,7 @@ The function <c>close/1</c> closes a </p> <list type="bulleted"> <item> - <p><c>{full, Full}</c>, where <c>Full</c> is <c>true</c> or + <p><c>{full, <anno>Full</anno>}</c>, where <c><anno>Full</anno></c> is <c>true</c> or <c>false</c> depending on whether the halt log is full or not.</p> </item> </list> @@ -660,8 +644,8 @@ The function <c>close/1</c> closes a <c>size</c> or set by <c>change_size/2</c>.</p> </item> <item> - <p><c>{no_overflows, {SinceLogWasOpened, SinceLastInfo}}</c>, - where <c>SinceLogWasOpened</c> (<c>SinceLastInfo</c>) is + <p><c>{no_overflows, {<anno>SinceLogWasOpened</anno>, <anno>SinceLastInfo</anno>}}</c>, + where <c><anno>SinceLogWasOpened</anno></c> (<c><anno>SinceLastInfo</anno></c>) is the number of times a wrap log file has been filled up and a new one opened or <c>inc_wrap_file/1</c> has been called since the disk log was last opened (<c>info/1</c> @@ -677,21 +661,18 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>lclose(Log)</name> - <name>lclose(Log, Node) -> ok | {error, Reason}</name> + <name name="lclose" arity="1"/> + <name name="lclose" arity="2"/> + <type name="lclose_error_rsn"/> <fsummary>Close a disk log on one node.</fsummary> - <type> - <v>Node = node()</v> - <v>Reason = no_such_log | {file_error, FileName, FileError}</v> - </type> <desc> <p>The function <c>lclose/1</c> closes a local log or an individual distributed log on the current node. The function <c>lclose/2</c> closes an individual distributed log on the specified node if the node is not the current one. - <c>lclose(Log)</c> is equivalent to - <c>lclose(Log, node())</c>. + <c>lclose(<anno>Log</anno>)</c> is equivalent to + <c>lclose(<anno>Log</anno>, node())</c>. See also <seealso marker="#close_1">close/1</seealso>. </p> <p>If there is no log with the given name @@ -700,20 +681,17 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>log(Log, Term)</name> - <name>blog(Log, Bytes) -> ok | {error, Reason}</name> + <name name="log" arity="2"/> + <name name="blog" arity="2"/> <fsummary>Log an item onto a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Term = term()</v> - <v>Bytes = binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {format_external, Log} | {blocked_log, Log} | {full, Log} | {invalid_header, InvalidHeader} | {file_error, FileName, FileError}</v> - </type> + <type variable="Log"/> + <type variable="Term" name_i="1"/> + <type variable="Bytes"/> + <type name="log_error_rsn"/> <desc> <p>The <c>log/2</c> and <c>blog/2</c> functions synchronously append a term to a disk log. They return <c>ok</c> or - <c>{error, Reason}</c> when the term has been written to + <c>{error, <anno>Reason</anno>}</c> when the term has been written to disk. If the log is distributed, <c>ok</c> is always returned, unless all nodes are down. Terms are written by means of the ordinary <c>write()</c> function of the @@ -736,17 +714,13 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>log_terms(Log, TermList)</name> - <name>blog_terms(Log, BytesList) -> ok | {error, Reason}</name> + <name name="log_terms" arity="2"/> + <name name="blog_terms" arity="2"/> <fsummary>Log several items onto a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>TermList = [term()]</v> - <v>BytesList = [Bytes]</v> - <v>Bytes = binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {format_external, Log} | {blocked_log, Log} | {full, Log} | {invalid_header, InvalidHeader} | {file_error, FileName, FileError}</v> - </type> + <type variable="Log"/> + <type variable="TermList" name_i="1"/> + <type variable="BytesList"/> + <type name="log_error_rsn"/> <desc> <p>The <c>log_terms/2</c> and <c>blog_terms/2</c> functions synchronously append a list of items to the log. The benefit @@ -769,47 +743,33 @@ The function <c>close/1</c> closes a </desc> </func> <func> - <name>open(ArgL) -> OpenRet | DistOpenRet</name> + <name name="open" arity="1"/> + <type name="dlog_options"/> + <type name="dlog_option"/> + <type name="open_ret"/> + <type name="ret"/> + <type name="dist_open_ret"/> + <type name="dist_error_rsn"/> + <type name="open_error_rsn"/> + <type name="dlog_optattr"/> + <type name="dlog_size"/> <fsummary>Open a disk log file.</fsummary> - <type> - <v>ArgL = [Opt]</v> - <v>Opt = {name, term()} | {file, FileName}, {linkto, LinkTo} | {repair, Repair} | {type, Type} | {format, Format} | {size, Size} | {distributed, [Node]} | {notify, bool()} | {head, Head} | {head_func, {M,F,A}} | {mode, Mode}</v> - <v>FileName = string() | atom()</v> - <v>LinkTo = pid() | none</v> - <v>Repair = true | false | truncate</v> - <v>Type = halt | wrap</v> - <v>Format = internal | external</v> - <v>Size = integer() > 0 | infinity | {MaxNoBytes, MaxNoFiles}</v> - <v>MaxNoBytes = integer() > 0</v> - <v>MaxNoFiles = 0 < integer() < 65000</v> - <v>Rec = integer()</v> - <v>Bad = integer()</v> - <v>Head = none | term() | binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Mode = read_write | read_only</v> - <v>OpenRet = Ret | {error, Reason}</v> - <v>DistOpenRet = {[{Node, Ret}], [{BadNode, {error, DistReason}}]}</v> - <v>Node = BadNode = atom()</v> - <v>Ret = {ok, Log} | {repaired, Log, {recovered, Rec}, {badbytes, Bad}}</v> - <v>DistReason = nodedown | Reason</v> - <v>Reason = no_such_log | {badarg, Arg} | {size_mismatch, CurrentSize, NewSize} | {arg_mismatch, OptionName, CurrentValue, Value} | {name_already_open, Log} | {open_read_write, Log} | {open_read_only, Log} | {need_repair, Log} | {not_a_log_file, FileName} | {invalid_index_file, FileName} | {invalid_header, InvalidHeader} | {file_error, FileName, FileError} | {node_already_open, Log}</v> - </type> <desc> - <p>The <c>ArgL</c> parameter is a list of options which have + <p>The <c><anno>ArgL</anno></c> parameter is a list of options which have the following meanings:</p> <list type="bulleted"> <item> - <p><c>{name, Log}</c> specifies the name of the log. + <p><c>{name, <anno>Log</anno>}</c> specifies the name of the log. This is the name which must be passed on as a parameter in all subsequent logging operations. A name must always be supplied. </p> </item> <item> - <p><c>{file, FileName}</c> specifies the name of the + <p><c>{file, <anno>FileName</anno>}</c> specifies the name of the file which will be used for logged terms. If this value is omitted and the name of the log is either an atom or a string, - the file name will default to <c>lists:concat([Log, ".LOG"])</c> for halt logs. For wrap logs, this will be + the file name will default to <c>lists:concat([<anno>Log</anno>, ".LOG"])</c> for halt logs. For wrap logs, this will be the base name of the files. Each file in a wrap log will be called <c><![CDATA[<base_name>.N]]></c>, where <c>N</c> is an integer. Each wrap log will also have two files called @@ -817,22 +777,22 @@ The function <c>close/1</c> closes a </p> </item> <item> - <p><c>{linkto, LinkTo}</c>. <marker id="linkto"></marker> + <p><c>{linkto, <anno>LinkTo</anno>}</c>. <marker id="linkto"></marker> If - <c>LinkTo</c> is a pid, that pid becomes an owner of the - log. If <c>LinkTo</c> is <c>none</c> the log records + <c><anno>LinkTo</anno></c> is a pid, that pid becomes an owner of the + log. If <c><anno>LinkTo</anno></c> is <c>none</c> the log records that it is used anonymously by some process by incrementing the <c>users</c> counter. By default, the process which calls <c>open/1</c> owns the log. </p> </item> <item> - <p><c>{repair, Repair}</c>. If <c>Repair</c> is <c>true</c>, + <p><c>{repair, <anno>Repair</anno>}</c>. If <c><anno>Repair</anno></c> is <c>true</c>, the current log file will be repaired, if needed. As the restoration is initiated, a message is output on the error log. If <c>false</c> is given, no automatic repair will be attempted. Instead, the - tuple <c>{error, {need_repair, Log}}</c> is returned if an + tuple <c>{error, {need_repair, <anno>Log</anno>}}</c> is returned if an attempt is made to open a corrupt log file. If <c>truncate</c> is given, the log file will be truncated, creating an empty log. Default is @@ -841,41 +801,41 @@ If </p> </item> <item> - <p><c>{type, Type}</c> is the type of the log. Default + <p><c>{type, <anno>Type</anno>}</c> is the type of the log. Default is <c>halt</c>. </p> </item> <item> - <p><c>{format, Format}</c> specifies the format of the + <p><c>{format, <anno>Format</anno>}</c> specifies the format of the disk log. Default is <c>internal</c>. </p> </item> <item> - <p><c>{size, Size}</c> specifies the size of the log. + <p><c>{size, <anno>Size</anno>}</c> specifies the size of the log. When a halt log has reached its maximum size, all attempts to log more items are rejected. The default size is <c>infinity</c>, which for halt implies that there is no - maximum size. For wrap logs, the <c>Size</c> parameter + maximum size. For wrap logs, the <c><anno>Size</anno></c> parameter may be either a pair - <c>{MaxNoBytes, MaxNoFiles}</c> or <c>infinity</c>. In the + <c>{<anno>MaxNoBytes</anno>, <anno>MaxNoFiles</anno>}</c> or <c>infinity</c>. In the latter case, if the files of an already existing wrap log with the same name can be found, the size is read from the existing wrap log, otherwise an error is returned. - Wrap logs write at most <c>MaxNoBytes</c> bytes on each file - and use <c>MaxNoFiles</c> files before starting all over with - the first wrap log file. Regardless of <c>MaxNoBytes</c>, + Wrap logs write at most <c><anno>MaxNoBytes</anno></c> bytes on each file + and use <c><anno>MaxNoFiles</anno></c> files before starting all over with + the first wrap log file. Regardless of <c><anno>MaxNoBytes</anno></c>, at least the header (if there is one) and one item is written on each wrap log file before wrapping to the next file. When opening an existing wrap log, it is not necessary to supply a value for the option <c>Size</c>, but any supplied value must equal the current size of the log, otherwise - the tuple <c>{error, {size_mismatch, CurrentSize, NewSize}}</c> + the tuple <c>{error, {size_mismatch, <anno>CurrentSize</anno>, <anno>NewSize</anno>}}</c> is returned. </p> </item> <item> - <p><c>{distributed, Nodes}</c>. This option can be used for + <p><c>{distributed, <anno>Nodes</anno>}</c>. This option can be used for adding members to a distributed disk log. The default value is <c>[]</c>, which means that the log is local on the current node. @@ -946,10 +906,10 @@ If </list> </item> <item> - <p><c>{head, Head}</c> specifies a header to be + <p><c>{head, <anno>Head</anno>}</c> specifies a header to be written first on the log file. If the log is a wrap - log, the item <c>Head</c> is written first in each new file. - <c>Head</c> should be a term if the format is + log, the item <c><anno>Head</anno></c> is written first in each new file. + <c><anno>Head</anno></c> should be a term if the format is <c>internal</c>, and a deep list of bytes (or a binary) otherwise. Default is <c>none</c>, which means that no header is written first on the file. @@ -966,17 +926,17 @@ If </p> </item> <item> - <p><c>{mode, Mode}</c> specifies if the log is to be + <p><c>{mode, <anno>Mode</anno>}</c> specifies if the log is to be opened in read-only or read-write mode. It defaults to <c>read_write</c>. </p> </item> </list> - <p>The <c>open/1</c> function returns <c>{ok, Log}</c> if the + <p>The <c>open/1</c> function returns <c>{ok, <anno>Log</anno>}</c> if the log file was successfully opened. If the file was - successfully repaired, the tuple <c>{repaired, Log, {recovered, Rec}, {badbytes, Bad}}</c> is returned, where - <c>Rec</c> is the number of whole Erlang terms found in the - file and <c>Bad</c> is the number of bytes in the file which + successfully repaired, the tuple <c>{repaired, <anno>Log</anno>, {recovered, <anno>Rec</anno>}, {badbytes, <anno>Bad</anno>}}</c> is returned, where + <c><anno>Rec</anno></c> is the number of whole Erlang terms found in the + file and <c><anno>Bad</anno></c> is the number of bytes in the file which were non-Erlang terms. If the <c>distributed</c> parameter was given, <c>open/1</c> returns a list of successful replies and a list of erroneous replies. Each @@ -988,7 +948,7 @@ If position after the last logged item, and the logging of items will commence from there. If the format is <c>internal</c> and the existing file is not recognized as an internally - formatted log, a tuple <c>{error, {not_a_log_file, FileName}}</c> + formatted log, a tuple <c>{error, {not_a_log_file, <anno>FileName</anno>}}</c> is returned. </p> <p>The <c>open/1</c> function cannot be used for changing the @@ -1000,15 +960,15 @@ If or <c>change_size/2</c>. As a consequence, none of the options except <c>name</c> is mandatory. If some given value differs from the current value, a tuple - <c>{error, {arg_mismatch, OptionName, CurrentValue, Value}}</c> + <c>{error, {arg_mismatch, <anno>OptionName</anno>, <anno>CurrentValue</anno>, <anno>Value</anno>}}</c> is returned. Caution: an owner's attempt to open a log as owner once again is acknowledged with the return value - <c>{ok, Log}</c>, but the state of the disk log is not + <c>{ok, <anno>Log</anno>}</c>, but the state of the disk log is not affected in any way. </p> <p>If a log with a given name is local on some node, and one tries to open the log distributed on the same node, - then the tuple <c>{error, {node_already_open, Name}}</c> is + then the tuple <c>{error, {node_already_open, <anno>Log</anno>}}</c> is returned. The same tuple is returned if the log is distributed on some node, and one tries to open the log locally on the same node. Opening individual distributed disk logs for the first time @@ -1036,12 +996,8 @@ If </desc> </func> <func> - <name>pid2name(Pid) -> {ok, Log} | undefined</name> + <name name="pid2name" arity="1"/> <fsummary>Return the name of the disk log handled by a pid.</fsummary> - <type> - <v>Log = term()</v> - <v>Pid = pid()</v> - </type> <desc> <p>The <c>pid2name/1</c> function returns the name of the log given the pid of a disk log process on the current node, or @@ -1052,26 +1008,23 @@ If </desc> </func> <func> - <name>reopen(Log, File)</name> - <name>reopen(Log, File, Head)</name> - <name>breopen(Log, File, BHead) -> ok | {error, Reason}</name> + <name name="reopen" arity="2"/> + <name name="reopen" arity="3"/> + <name name="breopen" arity="3"/> <fsummary>Reopen a disk log and save the old log.</fsummary> - <type> - <v>Log = term()</v> - <v>File = string()</v> - <v>Head = term()</v> - <v>BHead = binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {blocked_log, Log} | {same_file_name, Log} | {invalid_index_file, FileName} | {invalid_header, InvalidHeader} | {file_error, FileName, FileError}</v> - </type> + <type variable="Log"/> + <type variable="File" name_i="1"/> + <type variable="Head" name_i="2"/> + <type variable="BHead"/> + <type name="reopen_error_rsn"/> <desc> <p>The <c>reopen</c> functions first rename the log file - to <c>File</c> and then re-create a new log file. - In case of a wrap log, <c>File</c> is used as the base name + to <c><anno>File</anno></c> and then re-create a new log file. + In case of a wrap log, <c><anno>File</anno></c> is used as the base name of the renamed files. By default the header given to <c>open/1</c> is written first in - the newly opened log file, but if the <c>Head</c> or the - <c>BHead</c> argument is given, this item is used instead. + the newly opened log file, but if the <c><anno>Head</anno></c> or the + <c><anno>BHead</anno></c> argument is given, this item is used instead. The header argument is used once only; next time a wrap log file is opened, the header given to <c>open/1</c> is used. </p> @@ -1089,12 +1042,9 @@ If </desc> </func> <func> - <name>sync(Log) -> ok | {error, Reason}</name> + <name name="sync" arity="1"/> + <type name="sync_error_rsn"/> <fsummary>Flush the contents of a disk log to the disk.</fsummary> - <type> - <v>Log = term()</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {blocked_log, Log} | {file_error, FileName, FileError}</v> - </type> <desc> <p>The <c>sync/1</c> function ensures that the contents of the log are actually written to the disk. @@ -1103,20 +1053,17 @@ If </desc> </func> <func> - <name>truncate(Log)</name> - <name>truncate(Log, Head)</name> - <name>btruncate(Log, BHead) -> ok | {error, Reason}</name> + <name name="truncate" arity="1"/> + <name name="truncate" arity="2"/> + <name name="btruncate" arity="2"/> <fsummary>Truncate a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Head = term()</v> - <v>BHead = binary() | [Byte]</v> - <v>Byte = [Byte] | 0 =< integer() =< 255</v> - <v>Reason = no_such_log | nonode | {read_only_mode, Log} | {blocked_log, Log} | {invalid_header, InvalidHeader} | {file_error, FileName, FileError}</v> - </type> + <type variable="Log"/> + <type variable="Head" name_i="2"/> + <type variable="BHead"/> + <type name="trunc_error_rsn"/> <desc> <p>The <c>truncate</c> functions remove all items from a disk log. - If the <c>Head</c> or the <c>BHead</c> argument is + If the <c><anno>Head</anno></c> or the <c><anno>BHead</anno></c> argument is given, this item is written first in the newly truncated log, otherwise the header given to <c>open/1</c> is used. The header argument is only used once; next time a wrap log file @@ -1138,12 +1085,9 @@ If </desc> </func> <func> - <name>unblock(Log) -> ok | {error, Reason}</name> + <name name="unblock" arity="1"/> + <type name="unblock_error_rsn"/> <fsummary>Unblock a disk log.</fsummary> - <type> - <v>Log = term()</v> - <v>Reason = no_such_log | nonode | {not_blocked, Log} | {not_blocked_by_pid, Log}</v> - </type> <desc> <p>The <c>unblock/1</c> function unblocks a log. A log can only be unblocked by the blocking process. @@ -1159,4 +1103,3 @@ If <seealso marker="wrap_log_reader">wrap_log_reader(3)</seealso></p> </section> </erlref> - diff --git a/lib/kernel/doc/src/erl_boot_server.xml b/lib/kernel/doc/src/erl_boot_server.xml index 4e7533810e..472671a80e 100644 --- a/lib/kernel/doc/src/erl_boot_server.xml +++ b/lib/kernel/doc/src/erl_boot_server.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -49,29 +49,17 @@ </description> <funcs> <func> - <name>start(Slaves) -> {ok, Pid} | {error, What}</name> + <name name="start" arity="1"/> <fsummary>Start the boot server</fsummary> - <type> - <v>Slaves = [Host]</v> - <v>Host = atom()</v> - <v>Pid = pid()</v> - <v>What = term()</v> - </type> <desc> - <p>Starts the boot server. <c>Slaves</c> is a list of IP + <p>Starts the boot server. <c><anno>Slaves</anno></c> is a list of IP addresses for hosts which are allowed to use this server as a boot server.</p> </desc> </func> <func> - <name>start_link(Slaves) -> {ok, Pid} | {error, What}</name> + <name name="start_link" arity="1"/> <fsummary>Start the boot server and links the caller</fsummary> - <type> - <v>Slaves = [Host]</v> - <v>Host = atom()</v> - <v>Pid = pid()</v> - <v>What = term()()</v> - </type> <desc> <p>Starts the boot server and links to the caller. This function is used to start the server if it is included in a supervision @@ -79,37 +67,23 @@ </desc> </func> <func> - <name>add_slave(Slave) -> ok | {error, What}</name> + <name name="add_slave" arity="1"/> <fsummary>Add a slave to the list of allowed slaves</fsummary> - <type> - <v>Slave = Host</v> - <v>Host = atom()</v> - <v>What = term()</v> - </type> <desc> - <p>Adds a <c>Slave</c> node to the list of allowed slave hosts.</p> + <p>Adds a <c><anno>Slave</anno></c> node to the list of allowed slave hosts.</p> </desc> </func> <func> - <name>delete_slave(Slave) -> ok | {error, What}</name> + <name name="delete_slave" arity="1"/> <fsummary>Delete a slave from the list of allowed slaves</fsummary> - <type> - <v>Slave = Host</v> - <v>Host = atom()</v> - <v>What = void()</v> - </type> <desc> - <p>Deletes a <c>Slave</c> node from the list of allowed slave + <p>Deletes a <c><anno>Slave</anno></c> node from the list of allowed slave hosts.</p> </desc> </func> <func> - <name>which_slaves() -> Slaves</name> + <name name="which_slaves" arity="0"/> <fsummary>Return the current list of allowed slave hosts</fsummary> - <type> - <v>Slaves = [Host]</v> - <v>Host = atom()</v> - </type> <desc> <p>Returns the current list of allowed slave hosts.</p> </desc> diff --git a/lib/kernel/doc/src/erl_ddll.xml b/lib/kernel/doc/src/erl_ddll.xml index 75dca8a85d..f9514dda2f 100644 --- a/lib/kernel/doc/src/erl_ddll.xml +++ b/lib/kernel/doc/src/erl_ddll.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</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_ddll</title> @@ -172,12 +172,20 @@ </item> </taglist> </description> + <datatypes> + <datatype> + <name name="driver"/> + </datatype> + <datatype> + <name name="path"/> + </datatype> + </datatypes> <funcs> <func> <name>demonitor(MonitorRef) -> ok</name> <fsummary>Remove a monitor for a driver</fsummary> <type> - <v>MonitorRef = ref()</v> + <v>MonitorRef = reference()</v> </type> <desc> <p>Removes a driver monitor in much the same way as @@ -185,41 +193,25 @@ monitors. See <seealso marker="#monitor/2">monitor/2</seealso>, <seealso marker="#try_load/3">try_load/3</seealso> and <seealso marker="#try_unload/2">try_unload/2</seealso> for details about how to create driver monitors.</p> <p>The function throws a <c>badarg</c> exception if the - parameter is not a ref(). </p> + parameter is not a reference(). </p> </desc> </func> <func> - <name>info() -> AllInfoList</name> + <name name="info" arity="0"/> <fsummary>Retrieve information about all drivers</fsummary> - <type> - <v>AllInfoList = [ DriverInfo ]</v> - <v>DriverInfo = {DriverName, InfoList}</v> - <v>DriverName = string()</v> - <v>InfoList = [ InfoItem ]</v> - <v>InfoItem = {Tag, Value}</v> - <v>Tag = atom()</v> - <v>Value = term()</v> - </type> <desc> - <p>Returns a list of tuples <c>{DriverName, InfoList}</c>, where - <c>InfoList</c> is the result of calling <seealso marker="#info/1">info/1</seealso> for that - <c>DriverName</c>. Only dynamically linked in drivers are + <p>Returns a list of tuples <c>{<anno>DriverName</anno>, <anno>InfoList</anno>}</c>, where + <c><anno>InfoList</anno></c> is the result of calling <seealso marker="#info/1">info/1</seealso> for that + <c><anno>DriverName</anno></c>. Only dynamically linked in drivers are included in the list.</p> </desc> </func> <func> - <name>info(Name) -> InfoList</name> + <name name="info" arity="1"/> <fsummary>Retrieve information about one driver</fsummary> - <type> - <v>Name = string() | atom()</v> - <v>InfoList = [ InfoItem ]</v> - <v>InfoItem = {Tag, Value}</v> - <v>Tag = atom()</v> - <v>Value = term()</v> - </type> <desc> - <p>Returns a list of tuples <c>{Tag, Value}</c>, where - <c>Tag</c> is the information item and <c>Value</c> is the result + <p>Returns a list of tuples <c>{<anno>Tag</anno>, <anno>Value</anno>}</c>, where + <c><anno>Tag</anno></c> is the information item and <c><anno>Value</anno></c> is the result of calling <seealso marker="#info/2">info/2</seealso> with this driver name and this tag. The result being a tuple list containing all information available about a driver. </p> @@ -305,22 +297,18 @@ </desc> </func> <func> - <name>load(Path, Name) -> ok | {error, ErrorDesc}</name> + <name name="load" arity="2"/> <fsummary>Load a driver</fsummary> - <type> - <v>Path = Name = string() | atom()</v> - <v>ErrorDesc = term()</v> - </type> <desc> - <p>Loads and links the dynamic driver <c>Name</c>. <c>Path</c> + <p>Loads and links the dynamic driver <c><anno>Name</anno></c>. <c><anno>Path</anno></c> is a file path to the directory containing the driver. - <c>Name</c> must be a sharable object/dynamic library. Two - drivers with different <c>Path</c> parameters cannot be - loaded under the same name. The <c>Name</c> is a string or + <c><anno>Name</anno></c> must be a sharable object/dynamic library. Two + drivers with different <c><anno>Path</anno></c> parameters cannot be + loaded under the same name. The <c><anno>Name</anno></c> is a string or atom containing at least one character.</p> - <p>The <c>Name</c> given should correspond to the filename + <p>The <c><anno>Name</anno></c> given should correspond to the filename of the actual dynamically loadable object file residing in - the directory given as <c>Path</c>, but <em>without</em> the + the directory given as <c><anno>Path</anno></c>, but <em>without</em> the extension (i.e. <c>.so</c>). The driver name provided in the driver initialization routine must correspond with the filename, in much the same way as erlang module names @@ -328,14 +316,14 @@ <p>If the driver has been previously unloaded, but is still present due to open ports against it, a call to <c>load/2</c> will stop the unloading and keep the driver - (as long as the <c>Path</c> is the same) and <c>ok</c> is + (as long as the <c><anno>Path</anno></c> is the same) and <c>ok</c> is returned. If one actually wants the object code to be reloaded, one uses <seealso marker="#reload/2">reload/2</seealso> or the low-level interface <seealso marker="#try_load/3">try_load/3</seealso> instead. Please refer to the description of <seealso marker="#scenarios">different scenarios</seealso> for loading/unloading in the introduction.</p> <p>If more than one process tries to load an already loaded - driver withe the same <c>Path</c>, or if the same process + driver withe the same <c><anno>Path</anno></c>, or if the same process tries to load it several times, the function will return <c>ok</c>. The emulator will keep track of the <c>load/2</c> calls, so that a corresponding number of @@ -349,16 +337,16 @@ several drivers with the same name but with different <c>Path</c> parameters.</p> <note> - <p>Note especially that the <c>Path</c> is interpreted + <p>Note especially that the <c><anno>Path</anno></c> is interpreted literally, so that all loaders of the same driver needs to - give the same <em>literal</em><c>Path</c> string, even + give the same <em>literal</em><c><anno>Path</anno></c> string, even though different paths might point out the same directory in the filesystem (due to use of relative paths and links).</p> </note> <p>On success, the function returns <c>ok</c>. On - failure, the return value is <c>{error,ErrorDesc}</c>, - where <c>ErrorDesc</c> is an opaque term to be + failure, the return value is <c>{error,<anno>ErrorDesc</anno>}</c>, + where <c><anno>ErrorDesc</anno></c> is an opaque term to be translated into human readable form by the <seealso marker="#format_error/1">format_error/1</seealso> function.</p> <p>For more control over the error handling, again use the @@ -369,20 +357,16 @@ </desc> </func> <func> - <name>load_driver(Path, Name) -> ok | {error, ErrorDesc}</name> + <name name="load_driver" arity="2"/> <fsummary>Load a driver</fsummary> - <type> - <v>Path = Name = string() | atom()</v> - <v>ErrorDesc = term()</v> - </type> <desc> <p>Works essentially as <c>load/2</c>, but will load the driver - with options other options. All ports that are using the + with other options. All ports that are using the driver will get killed with the reason <c>driver_unloaded</c> when the driver is to be unloaded.</p> <p>The number of loads and unloads by different <seealso marker="#users">users</seealso> influence the actual loading and unloading of a driver file. The port killing will - therefore only happen when the <em>last</em><seealso marker="#users">user</seealso> unloads the driver, or the + therefore only happen when the <em>last</em> <seealso marker="#users">user</seealso> unloads the driver, or the last process having loaded the driver exits.</p> <p>This interface (or at least the name of the functions) is kept for backward compatibility. Using <seealso marker="#try_load/3">try_load/3</seealso> with @@ -400,7 +384,7 @@ <v>Item = {Name, When}</v> <v>Name = atom() | string()</v> <v>When = loaded | unloaded | unloaded_only</v> - <v>MonitorRef = ref()</v> + <v>MonitorRef = reference()</v> </type> <desc> <p>This function creates a driver monitor and works in many @@ -449,7 +433,7 @@ eventually lead to one of the following messages being sent:</p> <taglist> - <tag><em>{'UP', ref(), driver, Name, loaded}</em></tag> + <tag><em>{'UP', reference(), driver, Name, loaded}</em></tag> <item> <p>This message is sent, either immediately if the driver is already loaded and no reloading is @@ -459,7 +443,7 @@ expected to know if reloading is demanded prior to creating a monitor for loading.</p> </item> - <tag><em>{'UP', ref(), driver, Name, permanent}</em></tag> + <tag><em>{'UP', reference(), driver, Name, permanent}</em></tag> <item> <p>This message will be sent if reloading was expected, but the (old) driver made itself @@ -467,7 +451,7 @@ sent if the driver was permanent or statically linked in when trying to create the monitor.</p> </item> - <tag><em>{'DOWN', ref(), driver, Name, load_cancelled}</em></tag> + <tag><em>{'DOWN', reference(), driver, Name, load_cancelled}</em></tag> <item> <p>This message will arrive if reloading was underway, but the <seealso marker="#users">user</seealso> having requested @@ -476,7 +460,7 @@ (or <c>unload/1</c>/<c>unload_driver/1</c>) again before it was reloaded.</p> </item> - <tag><em>{'DOWN', ref(), driver, Name, {load_failure, Failure}}</em></tag> + <tag><em>{'DOWN', reference(), driver, Name, {load_failure, Failure}}</em></tag> <item> <p>This message will arrive if reloading was underway but the loading for some reason @@ -500,7 +484,7 @@ <p>A driver monitor for unload will eventually result in one of the following messages being sent:</p> <taglist> - <tag><em>{'DOWN', ref(), driver, Name, unloaded}</em></tag> + <tag><em>{'DOWN', reference(), driver, Name, unloaded}</em></tag> <item> <p>The driver instance monitored is now unloaded. As the unload might have been due to a @@ -508,7 +492,7 @@ again have been loaded when this message arrives.</p> </item> - <tag><em>{'UP', ref(), driver, Name, unload_cancelled}</em></tag> + <tag><em>{'UP', reference(), driver, Name, unload_cancelled}</em></tag> <item> <p>This message will be sent if unloading was expected, but while the driver was waiting for @@ -525,7 +509,7 @@ similar to an <c>unloaded</c> monitor, but does never result in this message.</p> </item> - <tag><em>{'UP', ref(), driver, Name, permanent}</em></tag> + <tag><em>{'UP', reference(), driver, Name, permanent}</em></tag> <item> <p>This message will be sent if unloading was expected, but the driver made itself @@ -539,7 +523,7 @@ <item> <p>A monitor created as <c>unloaded_only</c> behaves exactly as one created as <c>unloaded</c> with the - exception that the <c>{'UP', ref(), driver, Name, unload_cancelled}</c> message will never be + exception that the <c>{'UP', reference(), driver, Name, unload_cancelled}</c> message will never be sent, but the monitor instead persists until the driver <em>really</em> gets unloaded.</p> </item> @@ -551,16 +535,11 @@ </desc> </func> <func> - <name>reload(Path, Name) -> ok | {error, ErrorDesc}</name> + <name name="reload" arity="2"/> <fsummary>Replace a driver</fsummary> - <type> - <v>Path = Name = string() | atom()</v> - <v>ErrorDesc = pending_process | OpaqueError</v> - <v>OpaqueError = term()</v> - </type> <desc> - <p>Reloads the driver named <c>Name</c> from a possibly - different <c>Path</c> than was previously used. This + <p>Reloads the driver named <c><anno>Name</anno></c> from a possibly + different <c><anno>Path</anno></c> than was previously used. This function is used in the code change <seealso marker="#scenarios">scenario</seealso> described in the introduction.</p> <p>If there are other <seealso marker="#users">users</seealso> @@ -574,7 +553,7 @@ <p>If one wants to avoid hanging on open ports, one should use the <seealso marker="#try_load/3">try_load/3</seealso> function instead.</p> - <p>The <c>Name</c> and <c>Path</c> parameters have exactly the + <p>The <c><anno>Name</anno></c> and <c><anno>Path</anno></c> parameters have exactly the same meaning as when calling the plain <seealso marker="#load/2">load/2</seealso> function.</p> <note> <p>Avoid mixing @@ -594,13 +573,8 @@ </desc> </func> <func> - <name>reload_driver(Path, Name) -> ok | {error, ErrorDesc}</name> + <name name="reload_driver" arity="2"/> <fsummary>Replace a driver</fsummary> - <type> - <v>Path = Name = string() | atom()</v> - <v>ErrorDesc = pending_process | OpaqueError</v> - <v>OpaqueError = term()</v> - </type> <desc> <p>Works exactly as <seealso marker="#reload/2">reload/2</seealso>, but for drivers loaded with the <seealso marker="#load_driver/2">load_driver/2</seealso> interface. </p> @@ -626,7 +600,7 @@ <v>ReloadOption = pending_driver | pending</v> <v>Status = loaded | already_loaded | PendingStatus </v> <v>PendingStatus = pending_driver | pending_process</v> - <v>Ref = ref()</v> + <v>Ref = reference()</v> <v>ErrorDesc = ErrorAtom | OpaqueError</v> <v>ErrorAtom = linked_in_driver | inconsistent | permanent | not_loaded_by_this_process | not_loaded | pending_reload | pending_process</v> </type> @@ -650,7 +624,7 @@ registered and a corresponding <c>try_unload</c> is expected sometime in the future.</p> </item> - <tag><em>{ok, pending_driver}</em>or <em>{ok, pending_driver, ref()}</em></tag> + <tag><em>{ok, pending_driver}</em>or <em>{ok, pending_driver, reference()}</em></tag> <item> <p>The load request is registered, but the loading is delayed due to the fact that an earlier instance of the @@ -665,7 +639,7 @@ set. In other words, this return value will always need to be handled!</p> </item> - <tag><em>{ok, pending_process}</em>or <em>{ok, pending_process, ref()}</em></tag> + <tag><em>{ok, pending_process}</em>or <em>{ok, pending_process, reference()}</em></tag> <item> <p>The load request is registered, but the loading is delayed due to the fact that an earlier instance of the @@ -683,7 +657,7 @@ about when the driver is <em>actually</em> loaded. This can be achieved by using the <c>{monitor, PendingOption}</c> option.</p> <p>When monitoring is requested, and a corresponding <c>{ok, pending_driver}</c> or <c>{ok, pending_process}</c> would be - returned, the function will instead return a tuple <c>{ok, PendingStatus, ref()}</c> and the process will, at a later + returned, the function will instead return a tuple <c>{ok, PendingStatus, reference()}</c> and the process will, at a later time when the driver actually gets loaded, get a monitor message. The monitor message one can expect is described in the <seealso marker="#monitor/2">monitor/2</seealso> @@ -730,7 +704,7 @@ extension suffix, i.e. <c>.so</c>). The name by which the driver identifies itself must also be consistent with this <c>Name</c> parameter, much as a beam-file's - module name much correspond to it's filename.</p> + module name much correspond to its filename.</p> </item> <tag><em>OptionList</em></tag> <item> @@ -742,8 +716,8 @@ <tag><em>{driver_options, DriverOptionsList}</em></tag> <item> <p>This option is to provide options that will change - it's general behavior and will "stick" to the driver - throughout it's lifespan.</p> + its general behavior and will "stick" to the driver + throughout its lifespan.</p> <p>The driver options for a given driver name need always to be consistent, <em>even when the driver is reloaded</em>, meaning that they are as much a part of the driver as the actual name.</p> @@ -760,7 +734,7 @@ <p>A <c>MonitorOption</c> tells <c>try_load/3</c> to trigger a driver monitor under certain conditions. When the monitor is triggered, the - function will return a three-tuple <c>{ok, PendingStatus, ref()}</c>, where the <c>ref()</c> is + function will return a three-tuple <c>{ok, PendingStatus, reference()}</c>, where the <c>reference()</c> is the monitor ref for the driver monitor.</p> <p>Only one <c>MonitorOption</c> can be specified and it is either the atom <c>pending</c>, which means @@ -891,7 +865,7 @@ <v>MonitorOption = pending_driver | pending</v> <v>Status = unloaded | PendingStatus </v> <v>PendingStatus = pending_driver | pending_process</v> - <v>Ref = ref()</v> + <v>Ref = reference()</v> <v>ErrorAtom = linked_in_driver | not_loaded | not_loaded_by_this_process | permanent</v> </type> <desc> @@ -943,7 +917,7 @@ ports using it and there are no more <seealso marker="#users">users</seealso> requiring it to be loaded.</p> </item> - <tag><em>{ok, pending_driver}</em>or <em>{ok, pending_driver, ref()}</em></tag> + <tag><em>{ok, pending_driver}</em>or <em>{ok, pending_driver, reference()}</em></tag> <item> <p>This return value indicates that this call removed the last <seealso marker="#users">user</seealso> from the @@ -957,7 +931,7 @@ in that case, however transient. Monitors are as always useful to detect when the driver is really unloaded.</p> </item> - <tag><em>{ok, pending_process}</em>or <em>{ok, pending_process, ref()}</em></tag> + <tag><em>{ok, pending_process}</em>or <em>{ok, pending_process, reference()}</em></tag> <item> <p>The unload request is registered, but there are still other <seealso marker="#users">users</seealso> holding @@ -1066,15 +1040,11 @@ </desc> </func> <func> - <name>unload(Name) -> ok | {error, ErrorDesc}</name> + <name name="unload" arity="1"/> <fsummary>Unload a driver</fsummary> - <type> - <v>Name = string() | atom()</v> - <v>ErrorDesc = term()</v> - </type> <desc> <p>Unloads, or at least dereferences the driver named - <c>Name</c>. If the caller is the last <seealso marker="#users">user</seealso> of the driver, and there + <c><anno>Name</anno></c>. If the caller is the last <seealso marker="#users">user</seealso> of the driver, and there are no more open ports using the driver, the driver will actually get unloaded. In all other cases, actual unloading will be delayed until all ports are closed and there are no @@ -1084,7 +1054,7 @@ is no longer considered a user of the driver. For usage scenarios, see the <seealso marker="#scenarios">description</seealso> in the beginning of this document. </p> - <p>The <c>ErrorDesc</c> returned is an opaque value to be + <p>The <c><anno>ErrorDesc</anno></c> returned is an opaque value to be passed further on to the <seealso marker="#format_error/1">format_error/1</seealso> function. For more control over the operation, use the <seealso marker="#try_unload/2">try_unload/2</seealso> @@ -1094,15 +1064,11 @@ </desc> </func> <func> - <name>unload_driver(Name) -> ok | {error, ErrorDesc}</name> + <name name="unload_driver" arity="1"/> <fsummary>Unload a driver</fsummary> - <type> - <v>Name = string() | atom()</v> - <v>ErrorDesc = term()</v> - </type> <desc> <p>Unloads, or at least dereferences the driver named - <c>Name</c>. If the caller is the last <seealso marker="#users">user</seealso> of the driver, all + <c><anno>Name</anno></c>. If the caller is the last <seealso marker="#users">user</seealso> of the driver, all remaining open ports using the driver will get killed with the reason <c>driver_unloaded</c> and the driver will eventually get unloaded.</p> @@ -1112,7 +1078,7 @@ <seealso marker="#users">user</seealso>. For usage scenarios, see the <seealso marker="#scenarios">description</seealso> in the beginning of this document.</p> - <p>The <c>ErrorDesc</c> returned is an opaque value to be + <p>The <c><anno>ErrorDesc</anno></c> returned is an opaque value to be passed further on to the <seealso marker="#format_error/1">format_error/1</seealso> function. For more control over the operation, use the <seealso marker="#try_unload/2">try_unload/2</seealso> @@ -1125,7 +1091,7 @@ <name>loaded_drivers() -> {ok, Drivers}</name> <fsummary>List loaded drivers</fsummary> <type> - <v>Drivers = [Driver()]</v> + <v>Drivers = [Driver]</v> <v>Driver = string()</v> </type> <desc> @@ -1138,13 +1104,10 @@ </desc> </func> <func> - <name>format_error(ErrorDesc) -> string()</name> + <name name="format_error" arity="1"/> <fsummary>Format an error descriptor</fsummary> - <type> - <v>ErrorDesc -- see below</v> - </type> <desc> - <p>Takes an <c>ErrorDesc</c> returned by load, unload or + <p>Takes an <c><anno>ErrorDesc</anno></c> returned by load, unload or reload functions and returns a string which describes the error or warning.</p> <note> diff --git a/lib/kernel/doc/src/error_handler.xml b/lib/kernel/doc/src/error_handler.xml index 94824688d1..acbf9a2c6e 100644 --- a/lib/kernel/doc/src/error_handler.xml +++ b/lib/kernel/doc/src/error_handler.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1996</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> @@ -37,48 +37,44 @@ </description> <funcs> <func> - <name>undefined_function(Module, Function, Args) -> term()</name> + <name name="undefined_function" arity="3"/> <fsummary>Called when an undefined function is encountered</fsummary> - <type> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <d>A (possibly empty) list of arguments <c>Arg1,..,ArgN</c></d> - </type> + <type_desc variable="Args"> + A (possibly empty) list of arguments <c>Arg1,..,ArgN</c> + </type_desc> <desc> <p>This function is evaluated if a call is made to - <c>Module:Function(Arg1,.., ArgN)</c> and - <c>Module:Function/N</c> is undefined. Note that + <c><anno>Module</anno>:<anno>Function</anno>(Arg1,.., ArgN)</c> and + <c><anno>Module</anno>:<anno>Function</anno>/N</c> is undefined. Note that <c>undefined_function/3</c> is evaluated inside the process making the original call.</p> - <p>If <c>Module</c> is interpreted, the interpreter is invoked + <p>If <c><anno>Module</anno></c> is interpreted, the interpreter is invoked and the return value of the interpreted - <c>Function(Arg1,.., ArgN)</c> call is returned.</p> + <c><anno>Function</anno>(Arg1,.., ArgN)</c> call is returned.</p> <p>Otherwise, it returns, if possible, the value of - <c>apply(Module, Function, Args)</c> after an attempt has been - made to autoload <c>Module</c>. If this is not possible, the - call to <c>Module:Function(Arg1,.., ArgN)</c> fails with + <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> after an attempt has been + made to autoload <c><anno>Module</anno></c>. If this is not possible, the + call to <c><anno>Module</anno>:<anno>Function</anno>(Arg1,.., ArgN)</c> fails with exit reason <c>undef</c>.</p> </desc> </func> <func> - <name>undefined_lambda(Module, Fun, Args) -> term()</name> + <name name="undefined_lambda" arity="3"/> <fsummary>Called when an undefined lambda (fun) is encountered</fsummary> - <type> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <d>A (possibly empty) list of arguments <c>Arg1,..,ArgN</c></d> - </type> + <type_desc variable="Args"> + A (possibly empty) list of arguments <c>Arg1,..,ArgN</c> + </type_desc> <desc> <p>This function is evaluated if a call is made to - <c>Fun(Arg1,.., ArgN)</c> when the module defining the fun is + <c><anno>Fun</anno>(Arg1,.., ArgN)</c> when the module defining the fun is not loaded. The function is evaluated inside the process making the original call.</p> - <p>If <c>Module</c> is interpreted, the interpreter is invoked + <p>If <c><anno>Module</anno></c> is interpreted, the interpreter is invoked and the return value of the interpreted - <c>Fun(Arg1,.., ArgN)</c> call is returned.</p> + <c><anno>Fun</anno>(Arg1,.., ArgN)</c> call is returned.</p> <p>Otherwise, it returns, if possible, the value of - <c>apply(Fun, Args)</c> after an attempt has been made to - autoload <c>Module</c>. If this is not possible, the call + <c>apply(<anno>Fun</anno>, <anno>Args</anno>)</c> after an attempt has been made to + autoload <c><anno>Module</anno></c>. If this is not possible, the call fails with exit reason <c>undef</c>.</p> </desc> </func> diff --git a/lib/kernel/doc/src/error_logger.xml b/lib/kernel/doc/src/error_logger.xml index e107d9b746..2d95f96ac7 100644 --- a/lib/kernel/doc/src/error_logger.xml +++ b/lib/kernel/doc/src/error_logger.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -65,19 +65,20 @@ be tagged as warnings or info. Tagging them as warnings may require rewriting existing user defined event handlers.</p> </description> + <datatypes> + <datatype> + <name name="report"/> + </datatype> + </datatypes> <funcs> <func> - <name>error_msg(Format) -> ok</name> - <name>error_msg(Format, Data) -> ok</name> - <name>format(Format, Data) -> ok</name> + <name name="error_msg" arity="1"/> + <name name="error_msg" arity="2"/> + <name name="format" arity="2"/> <fsummary>Send an standard error event to the error logger</fsummary> - <type> - <v>Format = string()</v> - <v>Data = [term()]</v> - </type> <desc> <p>Sends a standard error event to the error logger. - The <c>Format</c> and <c>Data</c> arguments are the same as + The <c><anno>Format</anno></c> and <c><anno>Data</anno></c> arguments are the same as the arguments of <c>io:format/2</c>. The event is handled by the standard event handler.</p> <pre> @@ -94,12 +95,8 @@ ok</pre> </desc> </func> <func> - <name>error_report(Report) -> ok</name> + <name name="error_report" arity="1"/> <fsummary>Send a standard error report event to the error logger</fsummary> - <type> - <v>Report = [{Tag, Data} | term()] | string() | term()</v> - <v> Tag = Data = term()</v> - </type> <desc> <p>Sends a standard error report event to the error logger. The event is handled by the standard event handler.</p> @@ -119,18 +116,13 @@ ok</pre> </desc> </func> <func> - <name>error_report(Type, Report) -> ok</name> + <name name="error_report" arity="2"/> <fsummary>Send a user defined error report event to the error logger</fsummary> - <type> - <v>Type = term()</v> - <v>Report = [{Tag, Data} | term()] | string() | term()</v> - <v> Tag = Data = term()</v> - </type> <desc> <p>Sends a user defined error report event to the error logger. An event handler to handle the event is supposed to have been added. The event is ignored by the standard event handler.</p> - <p>It is recommended that <c>Report</c> follows the same + <p>It is recommended that <c><anno>Report</anno></c> follows the same structure as for <c>error_report/1</c>.</p> </desc> </func> @@ -174,16 +166,12 @@ ok</pre> </desc> </func> <func> - <name>warning_msg(Format) -> ok</name> - <name>warning_msg(Format, Data) -> ok</name> + <name name="warning_msg" arity="1"/> + <name name="warning_msg" arity="2"/> <fsummary>Send a standard warning event to the error logger</fsummary> - <type> - <v>Format = string()</v> - <v>Data = [term()]</v> - </type> <desc> <p>Sends a standard warning event to the error logger. - The <c>Format</c> and <c>Data</c> arguments are the same as + The <c><anno>Format</anno></c> and <c><anno>Data</anno></c> arguments are the same as the arguments of <c>io:format/2</c>. The event is handled by the standard event handler. It is tagged either as an error, warning or info, see @@ -196,12 +184,8 @@ ok</pre> </desc> </func> <func> - <name>warning_report(Report) -> ok</name> + <name name="warning_report" arity="1"/> <fsummary>Send a standard warning report event to the error logger</fsummary> - <type> - <v>Report = [{Tag, Data} | term()] | string() | term()</v> - <v> Tag = Data = term()</v> - </type> <desc> <p>Sends a standard warning report event to the error logger. The event is handled by the standard event handler. It is @@ -210,13 +194,8 @@ ok</pre> </desc> </func> <func> - <name>warning_report(Type, Report) -> ok</name> + <name name="warning_report" arity="2"/> <fsummary>Send a user defined warning report event to the error logger</fsummary> - <type> - <v>Type = term()</v> - <v>Report = [{Tag, Data} | term()] | string() | term()</v> - <v> Tag = Data = term()</v> - </type> <desc> <p>Sends a user defined warning report event to the error logger. An event handler to handle the event is supposed to @@ -227,16 +206,12 @@ ok</pre> </desc> </func> <func> - <name>info_msg(Format) -> ok</name> - <name>info_msg(Format, Data) -> ok</name> + <name name="info_msg" arity="1"/> + <name name="info_msg" arity="2"/> <fsummary>Send a standard information event to the error logger</fsummary> - <type> - <v>Format = string()</v> - <v>Data = [term()]</v> - </type> <desc> <p>Sends a standard information event to the error logger. - The <c>Format</c> and <c>Data</c> arguments are the same as + The <c><anno>Format</anno></c> and <c><anno>Data</anno></c> arguments are the same as the arguments of <c>io:format/2</c>. The event is handled by the standard event handler.</p> <pre> @@ -253,12 +228,8 @@ ok</pre> </desc> </func> <func> - <name>info_report(Report) -> ok</name> + <name name="info_report" arity="1"/> <fsummary>Send a standard information report event to the error logger</fsummary> - <type> - <v>Report = [{Tag, Data} | term()] | string() | term()</v> - <v> Tag = Data = term()</v> - </type> <desc> <p>Sends a standard information report event to the error logger. The event is handled by the standard event handler.</p> @@ -278,63 +249,49 @@ ok</pre> </desc> </func> <func> - <name>info_report(Type, Report) -> ok</name> + <name name="info_report" arity="2"/> <fsummary>Send a user defined information report event to the error logger</fsummary> - <type> - <v>Type = term()</v> - <v>Report = [{Tag, Data} | term()] | string() | term()</v> - <v> Tag = Data = term()</v> - </type> <desc> <p>Sends a user defined information report event to the error logger. An event handler to handle the event is supposed to have been added. The event is ignored by the standard event handler.</p> - <p>It is recommended that <c>Report</c> follows the same + <p>It is recommended that <c><anno>Report</anno></c> follows the same structure as for <c>info_report/1</c>.</p> </desc> </func> <func> - <name>add_report_handler(Handler) -> Result</name> - <name>add_report_handler(Handler, Args) -> Result</name> + <name name="add_report_handler" arity="1"/> + <name name="add_report_handler" arity="2"/> <fsummary>Add an event handler to the error logger</fsummary> - <type> - <v>Handler, Args, Result -- see gen_event:add_handler/3</v> - </type> <desc> <p>Adds a new event handler to the error logger. The event handler must be implemented as a <c>gen_event</c> callback module, see <seealso marker="stdlib:gen_event">gen_event(3)</seealso>.</p> - <p><c>Handler</c> is typically the name of the callback module - and <c>Args</c> is an optional term (defaults to []) passed - to the initialization callback function <c>Module:init/1</c>. + <p><c><anno>Handler</anno></c> is typically the name of the callback module + and <c><anno>Args</anno></c> is an optional term (defaults to []) passed + to the initialization callback function <c><anno>Handler</anno>:init/1</c>. The function returns <c>ok</c> if successful.</p> <p>The event handler must be able to handle the <seealso marker="#events">events</seealso> described below.</p> </desc> </func> <func> - <name>delete_report_handler(Handler) -> Result</name> + <name name="delete_report_handler" arity="1"/> <fsummary>Delete an event handler from the error logger</fsummary> - <type> - <v>Handler, Result -- see gen_event:delete_handler/3</v> - </type> <desc> <p>Deletes an event handler from the error logger by calling - <c>gen_event:delete_handler(error_logger, Handler, [])</c>, + <c>gen_event:delete_handler(error_logger, <anno>Handler</anno>, [])</c>, see <seealso marker="stdlib:gen_event">gen_event(3)</seealso>.</p> </desc> </func> <func> - <name>tty(Flag) -> ok</name> + <name name="tty" arity="1"/> <fsummary>Enable or disable printouts to the tty</fsummary> - <type> - <v>Flag = bool()</v> - </type> <desc> - <p>Enables (<c>Flag == true</c>) or disables - (<c>Flag == false</c>) printout of standard events to the tty.</p> + <p>Enables (<c><anno>Flag</anno> == true</c>) or disables + (<c><anno>Flag</anno> == false</c>) printout of standard events to the tty.</p> <p>This is done by adding or deleting the standard event handler for output to tty, thus calling this function overrides the value of the Kernel <c>error_logger</c> configuration @@ -342,13 +299,15 @@ ok</pre> </desc> </func> <func> - <name>logfile(Request) -> ok | Filename | {error, What}</name> + <name name="logfile" arity="1" clause_i="1"/> + <name name="logfile" arity="1" clause_i="2"/> + <name name="logfile" arity="1" clause_i="3"/> + <type variable="Filename"/> + <type variable="OpenReason" name_i="1"/> + <type variable="CloseReason" name_i="2"/> + <type variable="FilenameReason" name_i="3"/> + <type name="open_error"/> <fsummary>Enable or disable error printouts to a file</fsummary> - <type> - <v>Request = {open, Filename} | close | filename</v> - <v> Filename = atom() | string()</v> - <v>What = allready_have_logfile | no_log_file | term()</v> - </type> <desc> <p>Enables or disables printout of standard events to a file.</p> <p>This is done by adding or deleting the standard event handler @@ -361,22 +320,22 @@ ok</pre> There can only be one active log file at a time.</p> <p><c>Request</c> is one of:</p> <taglist> - <tag><c>{open, Filename}</c></tag> + <tag><c>{open, <anno>Filename</anno>}</c></tag> <item> - <p>Opens the log file <c>Filename</c>. Returns <c>ok</c> if + <p>Opens the log file <c><anno>Filename</anno></c>. Returns <c>ok</c> if successful, or <c>{error, allready_have_logfile}</c> if logging to file is already enabled, or an error tuple if - another error occurred. For example, if <c>Filename</c> + another error occurred. For example, if <c><anno>Filename</anno></c> could not be opened.</p> </item> <tag><c>close</c></tag> <item> <p>Closes the current log file. Returns <c>ok</c>, or - <c>{error, What}</c>.</p> + <c>{error, module_not_found}</c>.</p> </item> <tag><c>filename</c></tag> <item> - <p>Returns the name of the log file <c>Filename</c>, or + <p>Returns the name of the log file <c><anno>Filename</anno></c>, or <c>{error, no_log_file}</c> if logging to file is not enabled.</p> </item> diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index f9f5443f68..e0feaf6ee7 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</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>file</title> @@ -36,106 +36,193 @@ other Erlang processes to continue executing in parallel with the file operations. See the command line flag <c>+A</c> in <seealso marker="erts:erl">erl(1)</seealso>.</p> - </description> - <section> - <title>DATA TYPES</title> - <code type="none"> -iodata() = iolist() | binary() - iolist() = [char() | binary() | iolist()] + <p>The Erlang VM supports file names in Unicode to a limited + extent. Depending on how the VM is started (with the parameter + <c>+fnu</c> or <c>+fnl</c>), file names given can contain + characters > 255 and the VM system will convert file names + back and forth to the native file name encoding.</p> -io_device() - as returned by file:open/2, a process handling IO protocols + <p>The default behavior for Unicode character translation depends + on to what extent the underlying OS/filesystem enforces consistent + naming. On OSes where all file names are ensured to be in one or + another encoding, Unicode is the default (currently this holds for + Windows and MacOSX). On OSes with completely transparent file + naming (i.e. all Unixes except MacOSX), ISO-latin-1 file naming is + the default. The reason for the ISO-latin-1 default is that + file names are not guaranteed to be possible to interpret according to + the Unicode encoding expected (i.e. UTF-8), and file names that + cannot be decoded will only be accessible by using "raw + file names", in other word file names given as binaries.</p> + + <p>As file names are traditionally not binaries in Erlang, + applications that need to handle raw file names need to be + converted, why the Unicode mode for file names is not default on + systems having completely transparent file naming.</p> -name() = string() | atom() | DeepList - DeepList = [char() | atom() | DeepList] + <note>As of R14B01, the most basic file handling modules + (<c>file</c>, <c>prim_file</c>, <c>filelib</c> and + <c>filename</c>) accept raw file names, but the rest of OTP is not + guaranteed to handle them, why Unicode file naming on systems + where it is not default is still considered experimental.</note> -posix() - an atom which is named from the POSIX error codes used in - Unix, and in the runtime libraries of most C compilers + <p>Raw file names is a new feature in OTP R14B01, which allows the + user to supply completely uninterpreted file names to the + underlying OS/filesystem. They are supplied as binaries, where it + is up to the user to supply a correct encoding for the + environment. The function <c>file:native_name_encoding()</c> can + be used to check what encoding the VM is working in. If the + function returns <c>latin1</c> file names are not in any way + converted to Unicode, if it is <c>utf8</c>, raw file names should + be encoded as UTF-8 if they are to follow the convention of the VM + (and usually the convention of the OS as well). Using raw + file names is useful if you have a filesystem with inconsistent + file naming, where some files are named in UTF-8 encoding while + others are not. A file:list_dir on such mixed file name systems + when the VM is in Unicode file name mode might return file names as + raw binaries as they cannot be interpreted as Unicode + file names. Raw file names can also be used to give UTF-8 encoded + file names even though the VM is not started in Unicode file name + translation mode.</p> -ext_posix() = posix() | badarg + <p>Note that on Windows, <c>file:native_name_encoding()</c> + returns <c>utf8</c> per default, which is the format for raw + file names even on Windows, although the underlying OS specific + code works in a limited version of little endian UTF16. As far as + the Erlang programmer is concerned, Windows native Unicode format + is UTF-8...</p> + </description> + + <datatypes> + <datatype> + <name name="bindings"/> + </datatype> + <datatype> + <name name="deep_list"/> + </datatype> + <datatype> + <name name="fd"/> + </datatype> + <datatype> + <name name="filename"/> + </datatype> + <datatype> + <name name="io_device"/> + <desc> + <p>As returned by + <seealso marker="#open/2">file:open/2</seealso>, + a process handling IO protocols.</p> + </desc> + </datatype> + <datatype> + <name name="name"/> + <desc> + <p>If VM is in Unicode filename mode, <c>string()</c> and <c>char()</c> + are allowed to be > 255. + <c><anno>RawFilename</anno></c> is a filename not subject to + Unicode translation, + meaning that it can contain characters not conforming to + the Unicode encoding expected from the filesystem + (i.e. non-UTF-8 characters although the VM is started + in Unicode filename mode). + </p> + </desc> + </datatype> + <datatype> + <name name="posix"/> + <desc> + <p>An atom which is named from the POSIX error codes used in + Unix, and in the runtime libraries of most C compilers.</p> + </desc> + </datatype> + <datatype> + <name name="date"/> + </datatype> + <datatype> + <name name="time"/> + </datatype> + <datatype> + <name name="date_time"/> + <desc> + <p>Must denote a valid date and time.</p> + </desc> + </datatype> + <datatype> + <name name="file_info"/> + </datatype> + <datatype> + <name name="location"/> + </datatype> + <datatype> + <name name="mode"/> + </datatype> + </datatypes> -time() = {{Year, Month, Day}, {Hour, Minute, Second}} - Year = Month = Day = Hour = Minute = Second = int() - Must denote a valid date and time</code> - </section> <funcs> <func> - <name>change_group(Filename, Gid) -> ok | {error, Reason}</name> + <name name="advise" arity="4"/> + <fsummary>Predeclare an access pattern for file data</fsummary> + <type name="posix_file_advise"/> + <desc> + <p><c>advise/4</c> can be used to announce an intention to access file + data in a specific pattern in the future, thus allowing the + operating system to perform appropriate optimizations.</p> + <p>On some platforms, this function might have no effect.</p> + </desc> + </func> + <func> + <name name="change_group" arity="2"/> <fsummary>Change group of a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Gid = int()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Changes group of a file. See <seealso marker="#write_file_info/2">write_file_info/2</seealso>.</p> </desc> </func> <func> - <name>change_owner(Filename, Uid) -> ok | {error, Reason}</name> + <name name="change_mode" arity="2"/> + <fsummary>Change permissions of a file</fsummary> + <desc> + <p>Changes permissions of a file. See + <seealso marker="#write_file_info/2">write_file_info/2</seealso>.</p> + </desc> + </func> + <func> + <name name="change_owner" arity="2"/> <fsummary>Change owner of a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Uid = int()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Changes owner of a file. See <seealso marker="#write_file_info/2">write_file_info/2</seealso>.</p> </desc> </func> <func> - <name>change_owner(Filename, Uid, Gid) -> ok | {error, Reason}</name> + <name name="change_owner" arity="3"/> <fsummary>Change owner and group of a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Uid = int()</v> - <v>Gid = int()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Changes owner and group of a file. See <seealso marker="#write_file_info/2">write_file_info/2</seealso>.</p> </desc> </func> <func> - <name>change_time(Filename, Mtime) -> ok | {error, Reason}</name> + <name name="change_time" arity="2"/> <fsummary>Change the modification time of a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Mtime = time()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Changes the modification and access times of a file. See <seealso marker="#write_file_info/2">write_file_info/2</seealso>.</p> </desc> </func> <func> - <name>change_time(Filename, Mtime, Atime) -> ok | {error, Reason}</name> + <name name="change_time" arity="3"/> <fsummary>Change the modification and last access time of a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Mtime = Atime = time()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Changes the modification and last access times of a file. See <seealso marker="#write_file_info/2">write_file_info/2</seealso>.</p> </desc> </func> <func> - <name>close(IoDevice) -> ok | {error, Reason}</name> + <name name="close" arity="1"/> <fsummary>Close a file</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> - <p>Closes the file referenced by <c>IoDevice</c>. It mostly + <p>Closes the file referenced by <c><anno>IoDevice</anno></c>. It mostly returns <c>ok</c>, expect for some severe errors such as out of memory.</p> <p>Note that if the option <c>delayed_write</c> was @@ -145,20 +232,13 @@ time() = {{Year, Month, Day}, {Hour, Minute, Second}} </desc> </func> <func> - <name>consult(Filename) -> {ok, Terms} | {error, Reason}</name> + <name name="consult" arity="1"/> <fsummary>Read Erlang terms from a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Terms = [term()]</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> - <p>Reads Erlang terms, separated by '.', from <c>Filename</c>. - Returns one of the following:</p> + <p>Reads Erlang terms, separated by '.', from + <c><anno>Filename</anno></c>. Returns one of the following:</p> <taglist> - <tag><c>{ok, Terms}</c></tag> + <tag><c>{ok, <anno>Terms</anno>}</c></tag> <item> <p>The file was successfully read.</p> </item> @@ -168,7 +248,8 @@ time() = {{Year, Month, Day}, {Hour, Minute, Second}} See <seealso marker="#open/2">open/2</seealso> for a list of typical error codes.</p> </item> - <tag><c>{error, {Line, Mod, Term}}</c></tag> + <tag><c>{error, {<anno>Line</anno>, <anno>Mod</anno>, + <anno>Term</anno>}}</c></tag> <item> <p>An error occurred when interpreting the Erlang terms in the file. Use <c>format_error/1</c> to convert @@ -186,53 +267,46 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>copy(Source, Destination) -></name> - <name>copy(Source, Destination, ByteCount) -> {ok, BytesCopied} | {error, Reason}</name> + <name name="copy" arity="2"/> + <name name="copy" arity="3"/> <fsummary>Copy file contents</fsummary> - <type> - <v>Source = Destination = io_device() | Filename | {Filename, Modes}</v> - <v> Filename = name()</v> - <v> Modes = [Mode] -- see open/2</v> - <v>ByteCount = int() >= 0 | infinity</v> - <v>BytesCopied = int()</v> - </type> <desc> - <p>Copies <c>ByteCount</c> bytes from <c>Source</c> to - <c>Destination</c>. <c>Source</c> and <c>Destination</c> refer + <p>Copies <c><anno>ByteCount</anno></c> bytes from + <c><anno>Source</anno></c> to <c><anno>Destination</anno></c>. + <c><anno>Source</anno></c> and <c><anno>Destination</anno></c> refer to either filenames or IO devices from e.g. <c>open/2</c>. - <c>ByteCount</c> defaults <c>infinity</c>, denoting an + <c><anno>ByteCount</anno></c> defaults to <c>infinity</c>, denoting an infinite number of bytes.</p> - <p>The argument <c>Modes</c> is a list of possible modes, see - <seealso marker="#open/2">open/2</seealso>, and defaults to + <p>The argument <c><anno>Modes</anno></c> is a list of possible modes, + see <seealso marker="#open/2">open/2</seealso>, and defaults to [].</p> - <p>If both <c>Source</c> and <c>Destination</c> refer to + <p>If both <c><anno>Source</anno></c> and + <c><anno>Destination</anno></c> refer to filenames, the files are opened with <c>[read, binary]</c> and <c>[write, binary]</c> prepended to their mode lists, respectively, to optimize the copy.</p> - <p>If <c>Source</c> refers to a filename, it is opened with + <p>If <c><anno>Source</anno></c> refers to a filename, it is opened with <c>read</c> mode prepended to the mode list before the copy, and closed when done.</p> - <p>If <c>Destination</c> refers to a filename, it is opened + <p>If <c><anno>Destination</anno></c> refers to a filename, it is opened with <c>write</c> mode prepended to the mode list before the copy, and closed when done.</p> - <p>Returns <c>{ok, BytesCopied}</c> where <c>BytesCopied</c> is + <p>Returns <c>{ok, <anno>BytesCopied</anno>}</c> where + <c><anno>BytesCopied</anno></c> is the number of bytes that actually was copied, which may be - less than <c>ByteCount</c> if end of file was encountered on - the source. If the operation fails, <c>{error, Reason}</c> is - returned.</p> + less than <c><anno>ByteCount</anno></c> if end of file was + encountered on the source. If the operation fails, + <c>{error, <anno>Reason</anno>}</c> is returned.</p> <p>Typical error reasons: As for <c>open/2</c> if a file had to be opened, and as for <c>read/2</c> and <c>write/2</c>.</p> </desc> </func> <func> - <name>del_dir(Dir) -> ok | {error, Reason}</name> + <name name="del_dir" arity="1"/> <fsummary>Delete a directory</fsummary> - <type> - <v>Dir = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>Tries to delete the directory <c>Dir</c>. The directory must + <p>Tries to delete the directory <c><anno>Dir</anno></c>. + The directory must be empty before it can be deleted. Returns <c>ok</c> if successful.</p> <p>Typical error reasons are:</p> @@ -240,7 +314,7 @@ f.txt: {person, "kalle", 25}. <tag><c>eacces</c></tag> <item> <p>Missing search or write permissions for the parent - directories of <c>Dir</c>.</p> + directories of <c><anno>Dir</anno></c>.</p> </item> <tag><c>eexist</c></tag> <item> @@ -252,8 +326,8 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>enotdir</c></tag> <item> - <p>A component of <c>Dir</c> is not a directory. On some - platforms, <c>enoent</c> is returned instead.</p> + <p>A component of <c><anno>Dir</anno></c> is not a directory. + On some platforms, <c>enoent</c> is returned instead.</p> </item> <tag><c>einval</c></tag> <item> @@ -264,15 +338,11 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>delete(Filename) -> ok | {error, Reason}</name> + <name name="delete" arity="1"/> <fsummary>Delete a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>Tries to delete the file <c>Filename</c>. Returns <c>ok</c> - if successful.</p> + <p>Tries to delete the file <c><anno>Filename</anno></c>. + Returns <c>ok</c> if successful.</p> <p>Typical error reasons are:</p> <taglist> <tag><c>enoent</c></tag> @@ -294,30 +364,25 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>einval</c></tag> <item> - <p><c>Filename</c> had an improper type, such as tuple.</p> + <p><c><anno>Filename</anno></c> had an improper type, such as tuple.</p> </item> </taglist> <warning> - <p>In a future release, a bad type for the <c>Filename</c> - argument will probably generate an exception.</p> + <p>In a future release, a bad type for the + <c><anno>Filename</anno></c> argument will probably generate + an exception.</p> <p></p> </warning> </desc> </func> <func> - <name>eval(Filename) -> ok | {error, Reason}</name> + <name name="eval" arity="1"/> <fsummary>Evaluate Erlang expressions in a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> <p>Reads and evaluates Erlang expressions, separated by '.' (or ',', a sequence of expressions is also an expression), from - <c>Filename</c>. The actual result of the evaluation is not - returned; any expression sequence in the file must be there + <c><anno>Filename</anno></c>. The actual result of the evaluation + is not returned; any expression sequence in the file must be there for its side effect. Returns one of the following:</p> <taglist> <tag><c>ok</c></tag> @@ -329,7 +394,8 @@ f.txt: {person, "kalle", 25}. <p>An error occurred when opening the file or reading it. See <c>open/2</c> for a list of typical error codes.</p> </item> - <tag><c>{error, {Line, Mod, Term}}</c></tag> + <tag><c>{error, {<anno>Line</anno>, <anno>Mod</anno>, + <anno>Term</anno>}}</c></tag> <item> <p>An error occurred when interpreting the Erlang expressions in the file. Use <c>format_error/1</c> to @@ -340,18 +406,11 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>eval(Filename, Bindings) -> ok | {error, Reason}</name> + <name name="eval" arity="2"/> <fsummary>Evaluate Erlang expressions in a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Bindings -- see erl_eval(3)</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see eval/1</v> - </type> <desc> <p>The same as <c>eval/1</c> but the variable bindings - <c>Bindings</c> are used in the evaluation. See + <c><anno>Bindings</anno></c> are used in the evaluation. See <seealso marker="stdlib:erl_eval">erl_eval(3)</seealso> about variable bindings.</p> </desc> @@ -365,27 +424,19 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>format_error(Reason) -> Chars</name> + <name name="format_error" arity="1"/> <fsummary>Return a descriptive string for an error reason</fsummary> - <type> - <v>Reason = atom() | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see eval/1</v> - <v>Chars = [char() | Chars]</v> - </type> <desc> <p>Given the error reason returned by any function in this module, returns a descriptive string of the error in English.</p> </desc> </func> <func> - <name>get_cwd() -> {ok, Dir} | {error, Reason}</name> + <name name="get_cwd" arity="0"/> <fsummary>Get the current working directory</fsummary> - <type> - <v>Dir = string()</v> - <v>Reason = posix()</v> - </type> <desc> - <p>Returns <c>{ok, Dir}</c>, where <c>Dir</c> is the current + <p>Returns <c>{ok, <anno>Dir</anno>}</c>, where <c><anno>Dir</anno></c> + is the current working directory of the file server.</p> <note> <p>In rare circumstances, this function can fail on Unix. @@ -403,17 +454,14 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>get_cwd(Drive) -> {ok, Dir} | {error, Reason}</name> + <name name="get_cwd" arity="1"/> <fsummary>Get the current working directory for the drive specified</fsummary> - <type> - <v>Drive = string() -- see below</v> - <v>Dir = string()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p><c>Drive</c> should be of the form "<c>Letter</c><c>:</c>", - for example "c:". Returns <c>{ok, Dir}</c> or - <c>{error, Reason}</c>, where <c>Dir</c> is the current + <p><c><anno>Drive</anno></c> should be of the form + "<c>Letter</c><c>:</c>", + for example "c:". Returns <c>{ok, <anno>Dir</anno>}</c> or + <c>{error, <anno>Reason</anno>}</c>, where <c><anno>Dir</anno></c> + is the current working directory of the drive specified.</p> <p>This function returns <c>{error, enotsup}</c> on platforms which have no concept of current drive (Unix, for example).</p> @@ -421,7 +469,7 @@ f.txt: {person, "kalle", 25}. <taglist> <tag><c>enotsup</c></tag> <item> - <p>The operating system have no concept of drives.</p> + <p>The operating system has no concept of drives.</p> </item> <tag><c>eacces</c></tag> <item> @@ -429,32 +477,27 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>einval</c></tag> <item> - <p>The format of <c>Drive</c> is invalid.</p> + <p>The format of <c><anno>Drive</anno></c> is invalid.</p> </item> </taglist> </desc> </func> <func> - <name>list_dir(Dir) -> {ok, Filenames} | {error, Reason}</name> + <name name="list_dir" arity="1"/> <fsummary>List files in a directory</fsummary> - <type> - <v>Dir = name()</v> - <v>Filenames = [Filename]</v> - <v> Filename = string()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Lists all the files in a directory. Returns - <c>{ok, Filenames}</c> if successful. Otherwise, it returns - <c>{error, Reason}</c>. <c>Filenames</c> is a list of + <c>{ok, <anno>Filenames</anno>}</c> if successful. + Otherwise, it returns <c>{error, <anno>Reason</anno>}</c>. + <c><anno>Filenames</anno></c> is a list of the names of all the files in the directory. The names are not sorted.</p> <p>Typical error reasons are:</p> <taglist> <tag><c>eacces</c></tag> <item> - <p>Missing search or write permissions for <c>Dir</c> or - one of its parent directories.</p> + <p>Missing search or write permissions for <c><anno>Dir</anno></c> + or one of its parent directories.</p> </item> <tag><c>enoent</c></tag> <item> @@ -464,14 +507,10 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>make_dir(Dir) -> ok | {error, Reason}</name> + <name name="make_dir" arity="1"/> <fsummary>Make a directory</fsummary> - <type> - <v>Dir = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>Tries to create the directory <c>Dir</c>. Missing parent + <p>Tries to create the directory <c><anno>Dir</anno></c>. Missing parent directories are <em>not</em> created. Returns <c>ok</c> if successful.</p> <p>Typical error reasons are:</p> @@ -479,15 +518,15 @@ f.txt: {person, "kalle", 25}. <tag><c>eacces</c></tag> <item> <p>Missing search or write permissions for the parent - directories of <c>Dir</c>.</p> + directories of <c><anno>Dir</anno></c>.</p> </item> <tag><c>eexist</c></tag> <item> - <p>There is already a file or directory named <c>Dir</c>.</p> + <p>There is already a file or directory named <c><anno>Dir</anno></c>.</p> </item> <tag><c>enoent</c></tag> <item> - <p>A component of <c>Dir</c> does not exist.</p> + <p>A component of <c><anno>Dir</anno></c> does not exist.</p> </item> <tag><c>enospc</c></tag> <item> @@ -495,35 +534,33 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>enotdir</c></tag> <item> - <p>A component of <c>Dir</c> is not a directory. On some - platforms, <c>enoent</c> is returned instead.</p> + <p>A component of <c><anno>Dir</anno></c> is not a directory. + On some platforms, <c>enoent</c> is returned instead.</p> </item> </taglist> </desc> </func> <func> - <name>make_link(Existing, New) -> ok | {error, Reason}</name> + <name name="make_link" arity="2"/> <fsummary>Make a hard link to a file</fsummary> - <type> - <v>Existing = New = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>Makes a hard link from <c>Existing</c> to <c>New</c>, on + <p>Makes a hard link from <c><anno>Existing</anno></c> to + <c><anno>New</anno></c>, on platforms that support links (Unix). This function returns <c>ok</c> if the link was successfully created, or - <c>{error, Reason}</c>. On platforms that do not support + <c>{error, <anno>Reason</anno>}</c>. On platforms that do not support links, <c>{error,enotsup}</c> is returned.</p> <p>Typical error reasons:</p> <taglist> <tag><c>eacces</c></tag> <item> <p>Missing read or write permissions for the parent - directories of <c>Existing</c> or <c>New</c>.</p> + directories of <c><anno>Existing</anno></c> or + <c><anno>New</anno></c>.</p> </item> <tag><c>eexist</c></tag> <item> - <p><c>New</c> already exists.</p> + <p><c><anno>New</anno></c> already exists.</p> </item> <tag><c>enotsup</c></tag> <item> @@ -533,30 +570,28 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>make_symlink(Name1, Name2) -> ok | {error, Reason}</name> + <name name="make_symlink" arity="2"/> <fsummary>Make a symbolic link to a file or directory</fsummary> - <type> - <v>Name1 = Name2 = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>This function creates a symbolic link <c>Name2</c> to - the file or directory <c>Name1</c>, on platforms that support - symbolic links (most Unix systems). <c>Name1</c> need not + <p>This function creates a symbolic link <c><anno>Name2</anno></c> to + the file or directory <c><anno>Name1</anno></c>, on platforms that + support + symbolic links (most Unix systems). <c><anno>Name1</anno></c> need not exist. This function returns <c>ok</c> if the link was - successfully created, or <c>{error, Reason}</c>. On platforms + successfully created, or <c>{error, <anno>Reason</anno>}</c>. + On platforms that do not support symbolic links, <c>{error, enotsup}</c> is returned.</p> <p>Typical error reasons:</p> <taglist> <tag><c>eacces</c></tag> <item> - <p>Missing read or write permissions for the parent - directories of <c>Name1</c> or <c>Name2</c>.</p> + <p>Missing read or write permissions for the parent directories + of <c><anno>Name1</anno></c> or <c><anno>Name2</anno></c>.</p> </item> <tag><c>eexist</c></tag> <item> - <p><c>Name2</c> already exists.</p> + <p><c><anno>Name2</anno></c> already exists.</p> </item> <tag><c>enotsup</c></tag> <item> @@ -566,20 +601,21 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>open(Filename, Modes) -> {ok, IoDevice} | {error, Reason}</name> + <name>native_name_encoding() -> latin1 | utf8</name> + <fsummary>Return the VM's configured filename encoding.</fsummary> + <desc> + <p>This function returns the configured default file name encoding to use for raw file names. Generally an application supplying file names raw (as binaries), should obey the character encoding returned by this function.</p> + <p>By default, the VM uses ISO-latin-1 file name encoding on filesystems and/or OSes that use completely transparent file naming. This includes all Unix versions except MacOSX, where the vfs layer enforces UTF-8 file naming. By giving the experimental option <c>+fnu</c> when starting Erlang, UTF-8 translation of file names can be turned on even for those systems. If Unicode file name translation is in effect, the system behaves as usual as long as file names conform to the encoding, but will return file names that are not properly encoded in UTF-8 as raw file names (i.e. binaries).</p> + <p>On Windows, this function also returns <c>utf8</c> by default. The OS uses a pure Unicode naming scheme and file names are always possible to interpret as valid Unicode. The fact that the underlying Windows OS actually encodes file names using little endian UTF-16 can be ignored by the Erlang programmer. Windows and MacOSX are the only operating systems where the VM operates in Unicode file name mode by default.</p> + </desc> + </func> + <func> + <name name="open" arity="2"/> <fsummary>Open a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Modes = [Mode]</v> - <v> Mode = read | write | append | raw | binary | {delayed_write, Size, Delay} | delayed_write | {read_ahead, Size} | read_ahead | compressed</v> - <v> Size = Delay = int()</v> - <v>IoDevice = io_device()</v> - <v>Reason = ext_posix() | system_limit</v> - </type> <desc> - <p>Opens the file <c>Filename</c> in the mode determined by - <c>Modes</c>, which may contain one or more of the following - items:</p> + <p>Opens the file <c><anno>Filename</anno></c> in the mode determined + by <c><anno>Modes</anno></c>, which may contain one or more of the + following items:</p> <taglist> <tag><c>read</c></tag> <item> @@ -598,6 +634,17 @@ f.txt: {person, "kalle", 25}. file opened with <c>append</c> will take place at the end of the file.</p> </item> + <tag><c>exclusive</c></tag> + <item> + <p>The file, when opened for writing, is created if it + does not exist. If the file exists, open will return + <c>{error, eexist}</c>.</p> + <warning><p>This option does not guarantee exclusiveness on + file systems that do not support O_EXCL properly, + such as NFS. Do not depend on this option unless you + know that the file system supports it (in general, local + file systems should be safe).</p></warning> + </item> <tag><c>raw</c></tag> <item> <p>The <c>raw</c> option allows faster access to a file, @@ -726,23 +773,23 @@ f.txt: {person, "kalle", 25}. </taglist> <p>Returns:</p> <taglist> - <tag><c>{ok, IoDevice}</c></tag> + <tag><c>{ok, <anno>IoDevice</anno>}</c></tag> <item> <p>The file has been opened in the requested mode. - <c>IoDevice</c> is a reference to the file.</p> + <c><anno>IoDevice</anno></c> is a reference to the file.</p> </item> - <tag><c>{error, Reason}</c></tag> + <tag><c>{error, <anno>Reason</anno>}</c></tag> <item> <p>The file could not be opened.</p> </item> </taglist> - <p><c>IoDevice</c> is really the pid of the process which + <p><c><anno>IoDevice</anno></c> is really the pid of the process which handles the file. This process is linked to the process which originally opened the file. If any process to which - the <c>IoDevice</c> is linked terminates, the file will be - closed and the process itself will be terminated. - An <c>IoDevice</c> returned from this call can be used as an - argument to the IO functions (see + the <c><anno>IoDevice</anno></c> is linked terminates, the file will + be closed and the process itself will be terminated. + An <c><anno>IoDevice</anno></c> returned from this call can be used + as an argument to the IO functions (see <seealso marker="stdlib:io">io(3)</seealso>).</p> <note> <p>In previous versions of <c>file</c>, modes were given @@ -782,34 +829,25 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>path_consult(Path, Filename) -> {ok, Terms, FullName} | {error, Reason}</name> + <name name="path_consult" arity="2"/> <fsummary>Read Erlang terms from a file</fsummary> - <type> - <v>Path = [Dir]</v> - <v> Dir = name()</v> - <v>Filename = name()</v> - <v>Terms = [term()]</v> - <v>FullName = string()</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> - <p>Searches the path <c>Path</c> (a list of directory names) - until the file <c>Filename</c> is found. If <c>Filename</c> - is an absolute filename, <c>Path</c> is ignored. + <p>Searches the path <c><anno>Path</anno></c> (a list of directory + names) until the file <c><anno>Filename</anno></c> is found. + If <c><anno>Filename</anno></c> + is an absolute filename, <c><anno>Path</anno></c> is ignored. Then reads Erlang terms, separated by '.', from the file. Returns one of the following:</p> <taglist> - <tag><c>{ok, Terms, FullName}</c></tag> + <tag><c>{ok, <anno>Terms</anno>, <anno>FullName</anno>}</c></tag> <item> - <p>The file was successfully read. <c>FullName</c> is + <p>The file was successfully read. <c><anno>FullName</anno></c> is the full name of the file.</p> </item> <tag><c>{error, enoent}</c></tag> <item> <p>The file could not be found in any of the directories in - <c>Path</c>.</p> + <c><anno>Path</anno></c>.</p> </item> <tag><c>{error, atom()}</c></tag> <item> @@ -817,7 +855,8 @@ f.txt: {person, "kalle", 25}. See <seealso marker="#open/2">open/2</seealso> for a list of typical error codes.</p> </item> - <tag><c>{error, {Line, Mod, Term}}</c></tag> + <tag><c>{error, {<anno>Line</anno>, <anno>Mod</anno>, + <anno>Term</anno>}}</c></tag> <item> <p>An error occurred when interpreting the Erlang terms in the file. Use <c>format_error/1</c> to convert @@ -828,36 +867,28 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>path_eval(Path, Filename) -> {ok, FullName} | {error, Reason}</name> + <name name="path_eval" arity="2"/> <fsummary>Evaluate Erlang expressions in a file</fsummary> - <type> - <v>Path = [Dir]</v> - <v> Dir = name()</v> - <v>Filename = name()</v> - <v>FullName = string()</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> - <p>Searches the path <c>Path</c> (a list of directory names) - until the file <c>Filename</c> is found. If <c>Filename</c> - is an absolute file name, <c>Path</c> is ignored. Then reads + <p>Searches the path <c><anno>Path</anno></c> (a list of directory + names) until the file <c><anno>Filename</anno></c> is found. + If <c><anno>Filename</anno></c> is an absolute file name, + <c><anno>Path</anno></c> is ignored. Then reads and evaluates Erlang expressions, separated by '.' (or ',', a sequence of expressions is also an expression), from the file. The actual result of evaluation is not returned; any expression sequence in the file must be there for its side effect. Returns one of the following:</p> <taglist> - <tag><c>{ok, FullName}</c></tag> + <tag><c>{ok, <anno>FullName</anno>}</c></tag> <item> - <p>The file was read and evaluated. <c>FullName</c> is + <p>The file was read and evaluated. <c><anno>FullName</anno></c> is the full name of the file.</p> </item> <tag><c>{error, enoent}</c></tag> <item> <p>The file could not be found in any of the directories in - <c>Path</c>.</p> + <c><anno>Path</anno></c>.</p> </item> <tag><c>{error, atom()}</c></tag> <item> @@ -865,7 +896,8 @@ f.txt: {person, "kalle", 25}. See <seealso marker="#open/2">open/2</seealso> for a list of typical error codes.</p> </item> - <tag><c>{error, {Line, Mod, Term}}</c></tag> + <tag><c>{error, {<anno>Line</anno>, <anno>Mod</anno>, + <anno>Term</anno>}}</c></tag> <item> <p>An error occurred when interpreting the Erlang expressions in the file. Use <c>format_error/1</c> to @@ -876,34 +908,26 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>path_open(Path, Filename, Modes) -> {ok, IoDevice, FullName} | {error, Reason}</name> + <name name="path_open" arity="3"/> <fsummary>Open a file</fsummary> - <type> - <v>Path = [Dir]</v> - <v> Dir = name()</v> - <v>Filename = name()</v> - <v>Modes = [Mode] -- see open/2</v> - <v>IoDevice = io_device()</v> - <v>FullName = string()</v> - <v>Reason = ext_posix() | system_limit</v> - </type> <desc> - <p>Searches the path <c>Path</c> (a list of directory names) - until the file <c>Filename</c> is found. If <c>Filename</c> - is an absolute file name, <c>Path</c> is ignored. - Then opens the file in the mode determined by <c>Modes</c>. + <p>Searches the path <c><anno>Path</anno></c> (a list of directory + names) until the file <c><anno>Filename</anno></c> is found. + If <c><anno>Filename</anno></c> + is an absolute file name, <c><anno>Path</anno></c> is ignored. + Then opens the file in the mode determined by <c><anno>Modes</anno></c>. Returns one of the following:</p> <taglist> - <tag><c>{ok, IoDevice, FullName}</c></tag> + <tag><c>{ok, <anno>IoDevice</anno>, <anno>FullName</anno>}</c></tag> <item> <p>The file has been opened in the requested mode. - <c>IoDevice</c> is a reference to the file and - <c>FullName</c> is the full name of the file.</p> + <c><anno>IoDevice</anno></c> is a reference to the file and + <c><anno>FullName</anno></c> is the full name of the file.</p> </item> <tag><c>{error, enoent}</c></tag> <item> <p>The file could not be found in any of the directories in - <c>Path</c>.</p> + <c><anno>Path</anno></c>.</p> </item> <tag><c>{error, atom()}</c></tag> <item> @@ -913,36 +937,27 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>path_script(Path, Filename) -> {ok, Value, FullName} | {error, Reason}</name> + <name name="path_script" arity="2"/> <fsummary>Evaluate and return the value of Erlang expressions in a file</fsummary> - <type> - <v>Path = [Dir]</v> - <v> Dir = name()</v> - <v>Filename = name()</v> - <v>Value = term()</v> - <v>FullName = string()</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> - <p>Searches the path <c>Path</c> (a list of directory names) - until the file <c>Filename</c> is found. If <c>Filename</c> - is an absolute file name, <c>Path</c> is ignored. Then reads + <p>Searches the path <c><anno>Path</anno></c> (a list of directory + names) until the file <c><anno>Filename</anno></c> is found. + If <c><anno>Filename</anno></c> is an absolute file name, + <c><anno>Path</anno></c> is ignored. Then reads and evaluates Erlang expressions, separated by '.' (or ',', a sequence of expressions is also an expression), from the file. Returns one of the following:</p> <taglist> - <tag><c>{ok, Value, FullName}</c></tag> + <tag><c>{ok, <anno>Value</anno>, <anno>FullName</anno>}</c></tag> <item> - <p>The file was read and evaluated. <c>FullName</c> is - the full name of the file and <c>Value</c> the value of + <p>The file was read and evaluated. <c><anno>FullName</anno></c> is + the full name of the file and <c><anno>Value</anno></c> the value of the last expression.</p> </item> <tag><c>{error, enoent}</c></tag> <item> <p>The file could not be found in any of the directories in - <c>Path</c>.</p> + <c><anno>Path</anno></c>.</p> </item> <tag><c>{error, atom()}</c></tag> <item> @@ -950,7 +965,8 @@ f.txt: {person, "kalle", 25}. See <seealso marker="#open/2">open/2</seealso> for a list of typical error codes.</p> </item> - <tag><c>{error, {Line, Mod, Term}}</c></tag> + <tag><c>{error, {<anno>Line</anno>, <anno>Mod</anno>, + <anno>Term</anno>}}</c></tag> <item> <p>An error occurred when interpreting the Erlang expressions in the file. Use <c>format_error/1</c> to @@ -961,42 +977,28 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>path_script(Path, Filename, Bindings) -> {ok, Value, FullName} | {error, Reason}</name> + <name name="path_script" arity="3"/> <fsummary>Evaluate and return the value of Erlang expressions in a file</fsummary> - <type> - <v>Path = [Dir]</v> - <v> Dir = name()</v> - <v>Filename = name()</v> - <v>Bindings -- see erl_eval(3)</v> - <v>Value = term()</v> - <v>FullName = string()</v> - <v>Reason = posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see path_script/2</v> - </type> <desc> <p>The same as <c>path_script/2</c> but the variable bindings - <c>Bindings</c> are used in the evaluation. See + <c><anno>Bindings</anno></c> are used in the evaluation. See <seealso marker="stdlib:erl_eval">erl_eval(3)</seealso> about variable bindings.</p> </desc> </func> <func> - <name>pid2name(Pid) -> string() | undefined</name> + <name name="pid2name" arity="1"/> <fsummary>Return the name of the file handled by a pid</fsummary> - <type> - <v>Pid = pid()</v> - </type> <desc> - <p>If <c>Pid</c> is an IO device, that is, a pid returned from + <p>If <c><anno>Pid</anno></c> is an IO device, that is, a pid returned from <c>open/2</c>, this function returns the filename, or rather:</p> <taglist> - <tag><c>{ok, Filename}</c></tag> + <tag><c>{ok, <anno>Filename</anno>}</c></tag> <item> <p>If this node's file server is not a slave, the file was opened by this node's file server, (this implies that - <c>Pid</c> must be a local pid) and the file is not - closed. <c>Filename</c> is the filename in flat string + <c><anno>Pid</anno></c> must be a local pid) and the file is not + closed. <c><anno>Filename</anno></c> is the filename in flat string format.</p> </item> <tag><c>undefined</c></tag> @@ -1010,21 +1012,15 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>position(IoDevice, Location) -> {ok, NewPosition} | {error, Reason}</name> + <name name="position" arity="2"/> <fsummary>Set position in a file</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Location = Offset | {bof, Offset} | {cur, Offset} | {eof, Offset} | bof | cur | eof</v> - <v> Offset = int()</v> - <v>NewPosition = int()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> - <p>Sets the position of the file referenced by <c>IoDevice</c> - to <c>Location</c>. Returns <c>{ok, NewPosition}</c> (as + <p>Sets the position of the file referenced by <c><anno>IoDevice</anno></c> + to <c><anno>Location</anno></c>. Returns + <c>{ok, <anno>NewPosition</anno>}</c> (as absolute offset) if successful, otherwise - <c>{error, Reason}</c>. <c>Location</c> is one of - the following:</p> + <c>{error, <anno>Reason</anno>}</c>. <c><anno>Location</anno></c> is + one of the following:</p> <taglist> <tag><c>Offset</c></tag> <item> @@ -1052,7 +1048,8 @@ f.txt: {person, "kalle", 25}. <taglist> <tag><c>einval</c></tag> <item> - <p>Either <c>Location</c> was illegal, or it evaluated to a + <p>Either <c><anno>Location</anno></c> was illegal, or it + evaluated to a negative offset in the file. Note that if the resulting position is a negative value, the result is an error, and after the call the file position is undefined.</p> @@ -1061,22 +1058,14 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>pread(IoDevice, LocNums) -> {ok, DataL} | eof | {error, Reason}</name> + <name name="pread" arity="2"/> <fsummary>Read from a file at certain positions</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>LocNums = [{Location, Number}]</v> - <v> Location -- see position/2</v> - <v> Number = int()</v> - <v>DataL = [Data]</v> - <v> Data = [char()] | binary()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> <p>Performs a sequence of <c>pread/3</c> in one operation, which is more efficient than calling them one at a time. - Returns <c>{ok, [Data, ...]}</c> or <c>{error, Reason}</c>, - where each <c>Data</c>, the result of the corresponding + Returns <c>{ok, [<anno>Data</anno>, ...]}</c> or + <c>{error, <anno>Reason</anno>}</c>, + where each <c><anno>Data</anno></c>, the result of the corresponding <c>pread</c>, is either a list or a binary depending on the mode of the file, or <c>eof</c> if the requested position was beyond end of file.</p> @@ -1084,76 +1073,53 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>pread(IoDevice, Location, Number) -> {ok, Data} | eof | {error, Reason}</name> + <name name="pread" arity="3"/> <fsummary>Read from a file at a certain position</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Location -- see position/2</v> - <v>Number = int()</v> - <v>Data = [char()] | binary()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> <p>Combines <c>position/2</c> and <c>read/2</c> in one operation, which is more efficient than calling them one at a - time. If <c>IoDevice</c> has been opened in raw mode, some - restrictions apply: <c>Location</c> is only allowed to be an + time. If <c><anno>IoDevice</anno></c> has been opened in raw mode, + some restrictions apply: <c><anno>Location</anno></c> is only allowed + to be an integer; and the current position of the file is undefined after the operation.</p> <p>As the position is given as a byte-offset, special caution has to be taken when working with files where <c>encoding</c> is set to something else than <c>latin1</c>, as not every byte position will be a valid character boundary on such a file.</p> </desc> </func> <func> - <name>pwrite(IoDevice, LocBytes) -> ok | {error, {N, Reason}}</name> + <name name="pwrite" arity="2"/> <fsummary>Write to a file at certain positions</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>LocBytes = [{Location, Bytes}]</v> - <v> Location -- see position/2</v> - <v> Bytes = iodata()</v> - <v>N = int()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> <p>Performs a sequence of <c>pwrite/3</c> in one operation, which is more efficient than calling them one at a time. - Returns <c>ok</c> or <c>{error, {N, Reason}}</c>, where - <c>N</c> is the number of successful writes that was done + Returns <c>ok</c> or <c>{error, {<anno>N</anno>, + <anno>Reason</anno>}}</c>, where + <c><anno>N</anno></c> is the number of successful writes that was done before the failure.</p> <p>When positioning in a file with other <c>encoding</c> than <c>latin1</c>, caution must be taken to set the position on a correct character boundary, see <seealso marker="#position/2">position/2</seealso> for details.</p> </desc> </func> <func> - <name>pwrite(IoDevice, Location, Bytes) -> ok | {error, Reason}</name> + <name name="pwrite" arity="3"/> <fsummary>Write to a file at a certain position</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Location -- see position/2</v> - <v>Bytes = iodata()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> <p>Combines <c>position/2</c> and <c>write/2</c> in one operation, which is more efficient than calling them one at a - time. If <c>IoDevice</c> has been opened in raw mode, some - restrictions apply: <c>Location</c> is only allowed to be an + time. If <c><anno>IoDevice</anno></c> has been opened in raw mode, + some restrictions apply: <c><anno>Location</anno></c> is only allowed + to be an integer; and the current position of the file is undefined after the operation.</p> <p>When positioning in a file with other <c>encoding</c> than <c>latin1</c>, caution must be taken to set the position on a correct character boundary, see <seealso marker="#position/2">position/2</seealso> for details.</p> </desc> </func> <func> - <name>read(IoDevice, Number) -> {ok, Data} | eof | {error, Reason}</name> + <name name="read" arity="2"/> <fsummary>Read from a file</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Number = int()</v> - <v>Data = [char()] | binary()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> - <p>Reads <c>Number</c> bytes/characters from the file referenced by - <c>IoDevice</c>. The functions <c>read/2</c>, <c>pread/3</c> + <p>Reads <c><anno>Number</anno></c> bytes/characters from the file + referenced by <c><anno>IoDevice</anno></c>. The functions + <c>read/2</c>, <c>pread/3</c> and <c>read_line/1</c> are the only ways to read from a file opened in raw mode (although they work for normally opened files, too).</p> @@ -1161,7 +1127,7 @@ f.txt: {person, "kalle", 25}. <p>Also if <c>encoding</c> is set to something else than <c>latin1</c>, the <c>read/3</c> call will fail if the data contains characters larger than 255, why the <seealso marker="stdlib:io">io(3)</seealso> module is to be preferred when reading such a file.</p> <p>The function returns:</p> <taglist> - <tag><c>{ok, Data}</c></tag> + <tag><c>{ok, <anno>Data</anno>}</c></tag> <item> <p>If the file was opened in binary mode, the read bytes are returned in a binary, otherwise in a list. The list or @@ -1170,10 +1136,10 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>eof</c></tag> <item> - <p>Returned if <c>Number>0</c> and end of file was reached - before anything at all could be read.</p> + <p>Returned if <c><anno>Number</anno>>0</c> and end of file was + reached before anything at all could be read.</p> </item> - <tag><c>{error, Reason}</c></tag> + <tag><c>{error, <anno>Reason</anno>}</c></tag> <item> <p>An error occurred.</p> </item> @@ -1186,23 +1152,20 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>{no_translation, unicode, latin1}</c></tag> <item> - <p>The file is was opened with another <c>encoding</c> than <c>latin1</c> and the data on the file can not be translated to the byte-oriented data that this function returns.</p> + <p>The file was opened with another <c>encoding</c> than <c>latin1</c> and the data in the file can not be translated to the byte-oriented data that this function returns.</p> </item> </taglist> </desc> </func> <func> - <name>read_file(Filename) -> {ok, Binary} | {error, Reason}</name> + <name name="read_file" arity="1"/> <fsummary>Read a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Binary = binary()</v> - <v>Reason = ext_posix() | terminated | system_limit</v> - </type> <desc> - <p>Returns <c>{ok, Binary}</c>, where <c>Binary</c> is a binary - data object that contains the contents of <c>Filename</c>, or - <c>{error, Reason}</c> if an error occurs.</p> + <p>Returns <c>{ok, <anno>Binary</anno>}</c>, where + <c><anno>Binary</anno></c> is a binary + data object that contains the contents of + <c><anno>Filename</anno></c>, or + <c>{error, <anno>Reason</anno>}</c> if an error occurs.</p> <p>Typical error reasons:</p> <taglist> <tag><c>enoent</c></tag> @@ -1231,17 +1194,13 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>read_file_info(Filename) -> {ok, FileInfo} | {error, Reason}</name> + <name name="read_file_info" arity="1"/> <fsummary>Get information about a file</fsummary> - <type> - <v>Filename = name()</v> - <v>FileInfo = #file_info{}</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Retrieves information about a file. Returns - <c>{ok, FileInfo}</c> if successful, otherwise - <c>{error, Reason}</c>. <c>FileInfo</c> is a record + <c>{ok, <anno>FileInfo</anno>}</c> if successful, otherwise + <c>{error, <anno>Reason</anno>}</c>. <c><anno>FileInfo</anno></c> + is a record <c>file_info</c>, defined in the Kernel include file <c>file.hrl</c>. Include the following directive in the module from which the function is called:</p> @@ -1249,7 +1208,7 @@ f.txt: {person, "kalle", 25}. -include_lib("kernel/include/file.hrl").</code> <p>The record <c>file_info</c> contains the following fields.</p> <taglist> - <tag><c>size = int()</c></tag> + <tag><c>size = integer()</c></tag> <item> <p>Size of file in bytes.</p> </item> @@ -1276,7 +1235,7 @@ f.txt: {person, "kalle", 25}. the file or the inode was changed. In Windows, it is the create time.</p> </item> - <tag><c>mode = int()</c></tag> + <tag><c>mode = integer()</c></tag> <item> <p>The file permissions as the sum of the following bit values:</p> @@ -1307,33 +1266,33 @@ f.txt: {person, "kalle", 25}. <p>On Unix platforms, other bits than those listed above may be set.</p> </item> - <tag><c>links = int()</c></tag> + <tag><c>links = integer()</c></tag> <item> <p>Number of links to the file (this will always be 1 for file systems which have no concept of links).</p> </item> - <tag><c>major_device = int()</c></tag> + <tag><c>major_device = integer()</c></tag> <item> <p>Identifies the file system where the file is located. In Windows, the number indicates a drive as follows: 0 means A:, 1 means B:, and so on.</p> </item> - <tag><c>minor_device = int()</c></tag> + <tag><c>minor_device = integer()</c></tag> <item> <p>Only valid for character devices on Unix. In all other cases, this field is zero.</p> </item> - <tag><c>inode = int()</c></tag> + <tag><c>inode = integer()</c></tag> <item> <p>Gives the <c>inode</c> number. On non-Unix file systems, this field will be zero.</p> </item> - <tag><c>uid = int()</c></tag> + <tag><c>uid = integer()</c></tag> <item> <p>Indicates the owner of the file. Will be zero for non-Unix file systems.</p> </item> - <tag><c>gid = int()</c></tag> + <tag><c>gid = integer()</c></tag> <item> <p>Gives the group that the owner of the file belongs to. Will be zero for non-Unix file systems.</p> @@ -1359,21 +1318,16 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>read_line(IoDevice) -> {ok, Data} | eof | {error, Reason}</name> + <name name="read_line" arity="1"/> <fsummary>Read a line from a file</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Data = [char()] | binary()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> <p>Reads a line of bytes/characters from the file referenced by - <c>IoDevice</c>. Lines are defined to be delimited by the linefeed (LF, <c>\n</c>) character, but any carriage return (CR, <c>\r</c>) followed by a newline is also treated as a single LF character (the carriage return is silently ignored). The line is returned <em>including</em> the LF, but excluding any CR immediately followed by a LF. This behaviour is consistent with the behaviour of <seealso marker="stdlib:io#get_line/2">io:get_line/2</seealso>. If end of file is reached without any LF ending the last line, a line with no trailing LF is returned.</p> + <c><anno>IoDevice</anno></c>. Lines are defined to be delimited by the linefeed (LF, <c>\n</c>) character, but any carriage return (CR, <c>\r</c>) followed by a newline is also treated as a single LF character (the carriage return is silently ignored). The line is returned <em>including</em> the LF, but excluding any CR immediately followed by a LF. This behaviour is consistent with the behaviour of <seealso marker="stdlib:io#get_line/2">io:get_line/2</seealso>. If end of file is reached without any LF ending the last line, a line with no trailing LF is returned.</p> <p>The function can be used on files opened in <c>raw</c> mode. It is however inefficient to use it on <c>raw</c> files if the file is not opened with the option <c>{read_ahead, Size}</c> specified, why combining <c>raw</c> and <c>{read_ahead, Size}</c> is highly recommended when opening a text file for raw line oriented reading.</p> <p>If <c>encoding</c> is set to something else than <c>latin1</c>, the <c>read_line/1</c> call will fail if the data contains characters larger than 255, why the <seealso marker="stdlib:io">io(3)</seealso> module is to be preferred when reading such a file.</p> <p>The function returns:</p> <taglist> - <tag><c>{ok, Data}</c></tag> + <tag><c>{ok, <anno>Data</anno>}</c></tag> <item> <p>One line from the file is returned, including the trailing LF, but with CRLF sequences replaced by a single LF (see above).</p> <p>If the file was opened in binary mode, the read bytes are @@ -1384,7 +1338,7 @@ f.txt: {person, "kalle", 25}. <p>Returned if end of file was reached before anything at all could be read.</p> </item> - <tag><c>{error, Reason}</c></tag> + <tag><c>{error, <anno>Reason</anno>}</c></tag> <item> <p>An error occurred.</p> </item> @@ -1403,23 +1357,19 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>read_link(Name) -> {ok, Filename} | {error, Reason}</name> + <name name="read_link" arity="1"/> <fsummary>See what a link is pointing to</fsummary> - <type> - <v>Name = name()</v> - <v>Filename = string()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>This function returns <c>{ok, Filename}</c> if <c>Name</c> - refers to a symbolic link or <c>{error, Reason}</c> otherwise. + <p>This function returns <c>{ok, <anno>Filename</anno>}</c> if + <c><anno>Name</anno></c> refers to a symbolic link or + <c>{error, <anno>Reason</anno>}</c> otherwise. On platforms that do not support symbolic links, the return value will be <c>{error,enotsup}</c>.</p> <p>Typical error reasons:</p> <taglist> <tag><c>einval</c></tag> <item> - <p><c>Linkname</c> does not refer to a symbolic link.</p> + <p><c><anno>Name</anno></c> does not refer to a symbolic link.</p> </item> <tag><c>enoent</c></tag> <item> @@ -1433,34 +1383,26 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>read_link_info(Name) -> {ok, FileInfo} | {error, Reason}</name> + <name name="read_link_info" arity="1"/> <fsummary>Get information about a link or file</fsummary> - <type> - <v>Name = name()</v> - <v>FileInfo = #file_info{}, see read_file_info/1</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>This function works like <c>read_file_info/1</c>, except that - if <c>Name</c> is a symbolic link, information about the link - will be returned in the <c>file_info</c> record and + if <c><anno>Name</anno></c> is a symbolic link, information about + the link will be returned in the <c>file_info</c> record and the <c>type</c> field of the record will be set to <c>symlink</c>.</p> - <p>If <c>Name</c> is not a symbolic link, this function returns + <p>If <c><anno>Name</anno></c> is not a symbolic link, this function returns exactly the same result as <c>read_file_info/1</c>. On platforms that do not support symbolic links, this function is always equivalent to <c>read_file_info/1</c>.</p> </desc> </func> <func> - <name>rename(Source, Destination) -> ok | {error, Reason}</name> + <name name="rename" arity="2"/> <fsummary>Rename a file</fsummary> - <type> - <v>Source = Destination = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> - <p>Tries to rename the file <c>Source</c> to <c>Destination</c>. + <p>Tries to rename the file <c><anno>Source</anno></c> to + <c><anno>Destination</anno></c>. It can be used to move files (and directories) between directories, but it is not sufficient to specify the destination only. The destination file name must also be @@ -1478,25 +1420,28 @@ f.txt: {person, "kalle", 25}. <tag><c>eacces</c></tag> <item> <p>Missing read or write permissions for the parent - directories of <c>Source</c> or <c>Destination</c>. On + directories of <c><anno>Source</anno></c> or + <c><anno>Destination</anno></c>. On some platforms, this error is given if either - <c>Source</c> or <c>Destination</c> is open.</p> + <c><anno>Source</anno></c> or <c><anno>Destination</anno></c> + is open.</p> </item> <tag><c>eexist</c></tag> <item> - <p><c>Destination</c> is not an empty directory. On some - platforms, also given when <c>Source</c> and - <c>Destination</c> are not of the same type.</p> + <p><c><anno>Destination</anno></c> is not an empty directory. + On some platforms, also given when <c><anno>Source</anno></c> and + <c><anno>Destination</anno></c> are not of the same type.</p> </item> <tag><c>einval</c></tag> <item> - <p><c>Source</c> is a root directory, or <c>Destination</c> - is a sub-directory of <c>Source</c>.</p> + <p><c><anno>Source</anno></c> is a root directory, or + <c><anno>Destination</anno></c> + is a sub-directory of <c><anno>Source</anno></c>.</p> </item> <tag><c>eisdir</c></tag> <item> - <p><c>Destination</c> is a directory, but <c>Source</c> is - not.</p> + <p><c><anno>Destination</anno></c> is a directory, but + <c><anno>Source</anno></c> is not.</p> </item> <tag><c>enoent</c></tag> <item> @@ -1504,35 +1449,28 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>enotdir</c></tag> <item> - <p><c>Source</c> is a directory, but <c>Destination</c> is - not.</p> + <p><c><anno>Source</anno></c> is a directory, but + <c><anno>Destination</anno></c> is not.</p> </item> <tag><c>exdev</c></tag> <item> - <p><c>Source</c> and <c>Destination</c> are on different - file systems.</p> + <p><c><anno>Source</anno></c> and <c><anno>Destination</anno></c> + are on different file systems.</p> </item> </taglist> </desc> </func> <func> - <name>script(Filename) -> {ok, Value} | {error, Reason}</name> + <name name="script" arity="1"/> <fsummary>Evaluate and return the value of Erlang expressions in a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Value = term()</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> <p>Reads and evaluates Erlang expressions, separated by '.' (or ',', a sequence of expressions is also an expression), from the file. Returns one of the following:</p> <taglist> - <tag><c>{ok, Value}</c></tag> + <tag><c>{ok, <anno>Value</anno>}</c></tag> <item> - <p>The file was read and evaluated. <c>Value</c> is + <p>The file was read and evaluated. <c><anno>Value</anno></c> is the value of the last expression.</p> </item> <tag><c>{error, atom()}</c></tag> @@ -1541,7 +1479,8 @@ f.txt: {person, "kalle", 25}. See <seealso marker="#open/2">open/2</seealso> for a list of typical error codes.</p> </item> - <tag><c>{error, {Line, Mod, Term}}</c></tag> + <tag><c>{error, {<anno>Line</anno>, <anno>Mod</anno>, + <anno>Term</anno>}}</c></tag> <item> <p>An error occurred when interpreting the Erlang expressions in the file. Use <c>format_error/1</c> to @@ -1552,33 +1491,21 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>script(Filename, Bindings) -> {ok, Value} | {error, Reason}</name> + <name name="script" arity="2"/> <fsummary>Evaluate and return the value of Erlang expressions in a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Bindings -- see erl_eval(3)</v> - <v>Value = term()</v> - <v>Reason = ext_posix() | terminated | system_limit - | {Line, Mod, Term}</v> - <v> Line, Mod, Term -- see below</v> - </type> <desc> <p>The same as <c>script/1</c> but the variable bindings - <c>Bindings</c> are used in the evaluation. See + <c><anno>Bindings</anno></c> are used in the evaluation. See <seealso marker="stdlib:erl_eval">erl_eval(3)</seealso> about variable bindings.</p> </desc> </func> <func> - <name>set_cwd(Dir) -> ok | {error,Reason}</name> + <name name="set_cwd" arity="1"/> <fsummary>Set the current working directory</fsummary> - <type> - <v>Dir = name()</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Sets the current working directory of the file server to - <c>Dir</c>. Returns <c>ok</c> if successful.</p> + <c><anno>Dir</anno></c>. Returns <c>ok</c> if successful.</p> <p>Typical error reasons are:</p> <taglist> <tag><c>enoent</c></tag> @@ -1587,8 +1514,8 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>enotdir</c></tag> <item> - <p>A component of <c>Dir</c> is not a directory. On some - platforms, <c>enoent</c> is returned.</p> + <p>A component of <c><anno>Dir</anno></c> is not a directory. + On some platforms, <c>enoent</c> is returned.</p> </item> <tag><c>eacces</c></tag> <item> @@ -1597,23 +1524,21 @@ f.txt: {person, "kalle", 25}. </item> <tag><c>badarg</c></tag> <item> - <p><c>Filename</c> had an improper type, such as tuple.</p> + <p><c><anno>Dir</anno></c> had an improper type, + such as tuple.</p> </item> </taglist> <warning> - <p>In a future release, a bad type for the <c>Filename</c> + <p>In a future release, a bad type for the + <c><anno>Dir</anno></c> argument will probably generate an exception.</p> <p></p> </warning> </desc> </func> <func> - <name>sync(IoDevice) -> ok | {error, Reason}</name> + <name name="sync" arity="1"/> <fsummary>Synchronizes the in-memory state of a file with that on the physical medium</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> <p>Makes sure that any buffers kept by the operating system (not by the Erlang runtime system) are written to disk. On @@ -1628,32 +1553,46 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>truncate(IoDevice) -> ok | {error, Reason}</name> + <name name="datasync" arity="1"/> + <fsummary>Synchronizes the in-memory data of a file, ignoring most of its metadata, with that on the physical medium</fsummary> + <desc> + <p>Makes sure that any buffers kept by the operating system + (not by the Erlang runtime system) are written to disk. In + many ways it's resembles fsync but it not requires to update + some of file's metadata such as the access time. On + some platforms, this function might have no effect.</p> + <p>Applications that access databases or log files often write + a tiny data fragment (e.g., one line in a log file) and then + call fsync() immediately in order to ensure that the written + data is physically stored on the harddisk. Unfortunately, fsync() + will always initiate two write operations: one for the newly + written data and another one in order to update the modification + time stored in the inode. If the modification time is not a part + of the transaction concept fdatasync() can be used to avoid + unnecessary inode disk write operations.</p> + <p>Available only in some POSIX systems. This call results in a + call to fsync(), or has no effect, in systems not implementing + the fdatasync syscall.</p> + </desc> + </func> + <func> + <name name="truncate" arity="1"/> <fsummary>Truncate a file</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> - <p>Truncates the file referenced by <c>IoDevice</c> at + <p>Truncates the file referenced by <c><anno>IoDevice</anno></c> at the current position. Returns <c>ok</c> if successful, - otherwise <c>{error, Reason}</c>.</p> + otherwise <c>{error, <anno>Reason</anno>}</c>.</p> </desc> </func> <func> - <name>write(IoDevice, Bytes) -> ok | {error, Reason}</name> + <name name="write" arity="2"/> <fsummary>Write to a file</fsummary> - <type> - <v>IoDevice = io_device()</v> - <v>Bytes = iodata()</v> - <v>Reason = ext_posix() | terminated</v> - </type> <desc> - <p>Writes <c>Bytes</c> to the file referenced by - <c>IoDevice</c>. This function is the only way to write to a + <p>Writes <c><anno>Bytes</anno></c> to the file referenced by + <c><anno>IoDevice</anno></c>. This function is the only way to write to a file opened in raw mode (although it works for normally opened files, too). Returns <c>ok</c> if successful, and - <c>{error, Reason}</c> otherwise.</p> + <c>{error, <anno>Reason</anno>}</c> otherwise.</p> <p>If the file is opened with <c>encoding</c> set to something else than <c>latin1</c>, each byte written might result in several bytes actually being written to the file, as the byte range 0..255 might represent anything between one and four bytes depending on value and UTF encoding type.</p> <p>Typical error reasons are:</p> <taglist> @@ -1669,18 +1608,14 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>write_file(Filename, Bytes) -> ok | {error, Reason}</name> + <name name="write_file" arity="2"/> <fsummary>Write a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Bytes = iodata()</v> - <v>Reason = ext_posix() | terminated | system_limit</v> - </type> <desc> - <p>Writes the contents of the iodata term <c>Bytes</c> to the - file <c>Filename</c>. The file is created if it does not + <p>Writes the contents of the iodata term <c><anno>Bytes</anno></c> + to the file <c><anno>Filename</anno></c>. + The file is created if it does not exist. If it exists, the previous contents are - overwritten. Returns <c>ok</c>, or <c>{error, Reason}</c>.</p> + overwritten. Returns <c>ok</c>, or <c>{error, <anno>Reason</anno>}</c>.</p> <p>Typical error reasons are:</p> <taglist> <tag><c>enoent</c></tag> @@ -1709,33 +1644,23 @@ f.txt: {person, "kalle", 25}. </desc> </func> <func> - <name>write_file(Filename, Bytes, Modes) -> ok | {error, Reason}</name> + <name name="write_file" arity="3"/> <fsummary>Write a file</fsummary> - <type> - <v>Filename = name()</v> - <v>Bytes = iodata()</v> - <v>Modes = [Mode] -- see open/2</v> - <v>Reason = ext_posix() | terminated | system_limit</v> - </type> <desc> <p>Same as <c>write_file/2</c>, but takes a third argument - <c>Modes</c>, a list of possible modes, see + <c><anno>Modes</anno></c>, a list of possible modes, see <seealso marker="#open/2">open/2</seealso>. The mode flags <c>binary</c> and <c>write</c> are implicit, so they should not be used.</p> </desc> </func> <func> - <name>write_file_info(Filename, FileInfo) -> ok | {error, Reason}</name> + <name name="write_file_info" arity="2"/> <fsummary>Change information about a file</fsummary> - <type> - <v>Filename = name()</v> - <v>FileInfo = #file_info{} -- see also read_file_info/1</v> - <v>Reason = ext_posix()</v> - </type> <desc> <p>Change file information. Returns <c>ok</c> if successful, - otherwise <c>{error, Reason}</c>. <c>FileInfo</c> is a record + otherwise <c>{error, <anno>Reason</anno>}</c>. + <c><anno>FileInfo</anno></c> is a record <c>file_info</c>, defined in the Kernel include file <c>file.hrl</c>. Include the following directive in the module from which the function is called:</p> @@ -1759,7 +1684,7 @@ f.txt: {person, "kalle", 25}. time). On Windows, this field is the new creation time to set for the file.</p> </item> - <tag><c>mode = int()</c></tag> + <tag><c>mode = integer()</c></tag> <item> <p>The file permissions as the sum of the following bit values:</p> @@ -1790,12 +1715,12 @@ f.txt: {person, "kalle", 25}. <p>On Unix platforms, other bits than those listed above may be set.</p> </item> - <tag><c>uid = int()</c></tag> + <tag><c>uid = integer()</c></tag> <item> <p>Indicates the owner of the file. Ignored for non-Unix file systems.</p> </item> - <tag><c>gid = int()</c></tag> + <tag><c>gid = integer()</c></tag> <item> <p>Gives the group that the owner of the file belongs to. Ignored non-Unix file systems.</p> diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml index 3a8011e28b..5ceb82ae41 100644 --- a/lib/kernel/doc/src/gen_sctp.xml +++ b/lib/kernel/doc/src/gen_sctp.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2007</year><year>2010</year> + <year>2007</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -65,77 +65,71 @@ <item><seealso marker="#seealso">SEE ALSO</seealso></item> <item><seealso marker="#authors">AUTHORS</seealso></item> </list> + <marker id="types"></marker> </section> - <section> - <marker id="types"></marker> - <title>DATA TYPES</title> - <marker id="type-assoc_id"></marker> - <taglist> - <tag><c>assoc_id()</c></tag> - <item> + <datatypes> + <datatype> + <name name="assoc_id"/> + <desc> <p>An opaque term returned in for example #sctp_paddr_change{} that identifies an association for an SCTP socket. The term is opaque except for the special value <c>0</c> that has a - meaning such as "the whole endpoint" or "all future associations".</p> - <marker id="type-charlist"></marker> - </item> - <tag><c>charlist() = [char()]</c></tag> - <item> <marker id="type-iolist"></marker> -</item> - <tag><c>iolist() = [char() | binary()]</c></tag> - <item> <marker id="type-ip_address"></marker> -</item> - <tag><c>ip_address()</c></tag> - <item> + meaning such as "the whole endpoint" or "all future associations". + </p> + </desc> + </datatype> + <datatype> + <name name="hostname"/> + </datatype> + <datatype> + <name name="ip_address"/> + <desc> <p>Represents an address of an SCTP socket. It is a tuple as explained in <seealso marker="inet">inet(3)</seealso>.</p> - <marker id="type-port_number"></marker> - </item> - <tag><c>port_number() = 0 .. 65535</c></tag> - <item> <marker id="type-posix"></marker> -</item> - <tag><c>posix()</c></tag> - <item> - <p>See - <seealso marker="inet#error_codes">inet(3); POSIX Error Codes.</seealso></p> - <marker id="type-sctp_option"></marker> - </item> - <tag><c>sctp_option()</c></tag> - <item> + </desc> + </datatype> + <datatype> + <name name="port_number"/> + </datatype> + <datatype> + <name name="posix"/> + <desc> + <p>See <seealso marker="inet#error_codes"> + inet(3); POSIX Error Codes</seealso>.</p> + </desc> + </datatype> + <datatype> + <name name="sctp_option"/> + <desc> <p>One of the <seealso marker="#options">SCTP Socket Options.</seealso></p> <marker id="type-sctp_socket"></marker> - </item> - <tag><c>sctp_socket()</c></tag> - <item> + </desc> + </datatype> + <datatype> + <name name="sctp_socket"/> + <desc> <p>Socket identifier returned from <c>open/*</c>.</p> - <marker id="type-timeout"></marker> - </item> - <tag><c>timeout() = int() | infinity</c></tag> - <item> - <p>Timeout used in SCTP connect and receive calls.</p> - </item> - </taglist> - <marker id="exports"></marker> - </section> + <marker id="exports"></marker> + </desc> + </datatype> + </datatypes> + <funcs> <func> - <name>abort(sctp_socket(), Assoc) -> ok | {error, posix()}</name> + <name name="abort" arity="2"/> <fsummary>Abnormally terminate the association given by Assoc, without flushing of unsent data</fsummary> - <type> - <v>Assoc = #sctp_assoc_change{}</v> - </type> <desc> - <p>Abnormally terminates the association given by <c>Assoc</c>, without + <p>Abnormally terminates the association given by <c><anno>Assoc</anno></c>, without flushing of unsent data. The socket itself remains open. Other associations opened on this socket are still valid, and it can be used in new associations.</p> </desc> </func> <func> - <name>close(sctp_socket()) -> ok | {error, posix()}</name> + <name name="close" arity="1"/> <fsummary>Completely close the socket and all associations on it</fsummary> <desc> <p>Completely closes the socket and all associations on it. The unsent @@ -148,35 +142,26 @@ </desc> </func> <func> - <name>connect(Socket, Addr, Port, Opts) -> {ok,Assoc} | {error, posix()}</name> + <name name="connect" arity="4"/> <fsummary>Same as <c>connect(Socket, Addr, Port, Opts, infinity)</c>.</fsummary> <desc> - <p>Same as <c>connect(Socket, Addr, Port, Opts, infinity)</c>.</p> + <p>Same as <c>connect(<anno>Socket</anno>, <anno>Addr</anno>, <anno>Port</anno>, <anno>Opts</anno>, infinity)</c>.</p> </desc> </func> <func> - <name>connect(Socket, Addr, Port, [Opt], Timeout) -> {ok, Assoc} | {error, posix()}</name> + <name name="connect" arity="5"/> <fsummary>Establish a new association for the socket <c>Socket</c>, with a peer (SCTP server socket)</fsummary> - <type> - <v>Socket = sctp_socket()</v> - <v>Addr = ip_address() | Host</v> - <v>Port = port_number()</v> - <v>Opt = sctp_option()</v> - <v>Timeout = timeout()</v> - <v>Host = atom() | string()</v> - <v>Assoc = #sctp_assoc_change{}</v> - </type> <desc> - <p>Establishes a new association for the socket <c>Socket</c>, + <p>Establishes a new association for the socket <c><anno>Socket</anno></c>, with the peer (SCTP server socket) given by - <c>Addr</c> and <c>Port</c>. The <c>Timeout</c>, + <c><anno>Addr</anno></c> and <c><anno>Port</anno></c>. The <c><anno>Timeout</anno></c>, is expressed in milliseconds. A socket can be associated with multiple peers.</p> - <p><b>WARNING:</b>Using a value of <c>Timeout</c> less than + <p><b>WARNING:</b>Using a value of <c><anno>Timeout</anno></c> less than the maximum time taken by the OS to establish an association (around 4.5 minutes if the default values from RFC 4960 are used) can result in inconsistent or incorrect return values. This is especially - relevant for associations sharing the same <c>Socket</c> + relevant for associations sharing the same <c><anno>Socket</anno></c> (i.e. source address and port) since the controlling process blocks until <c>connect/*</c> returns. <seealso marker="#connect_init/4">connect_init/*</seealso> @@ -185,7 +170,7 @@ <p><marker id="record-sctp_assoc_change"></marker> The result of <c>connect/*</c> is an <c>#sctp_assoc_change{}</c> event which contains, in particular, the new - <seealso marker="#type-assoc_id">Association ID:</seealso></p> + <seealso marker="#type-assoc_id">Association ID</seealso>.</p> <pre> #sctp_assoc_change{ state = atom(), @@ -198,13 +183,13 @@ giving an <c>sctp_initmsg</c> option to <c>connect</c> as in:</p> <pre> - connect(Socket, Ip, Port, + connect(<anno>Socket</anno>, Ip, <anno>Port</anno>, [{sctp_initmsg,#sctp_initmsg{num_ostreams=OutStreams, max_instreams=MaxInStreams}}]) </pre> - <p>All options <c>Opt</c> are set on the socket before the + <p>All options <c><anno>Opt</anno></c> are set on the socket before the association is attempted. If an option record has got undefined field values, the options record is first read from the socket - for those values. In effect, <c>Opt</c> option records only + for those values. In effect, <c><anno>Opt</anno></c> option records only define field values to change before connecting.</p> <p>The returned <c>outbound_streams</c> and <c>inbound_streams</c> are the actual stream numbers on the socket, which may be different @@ -242,27 +227,19 @@ </desc> </func> <func> - <name>connect_init(Socket, Addr, Port, Opts) -> ok | {error, posix()}</name> + <name name="connect_init" arity="4"/> <fsummary>Same as <c>connect_init(Socket, Addr, Port, Opts, infinity)</c>.</fsummary> <desc> - <p>Same as <c>connect_init(Socket, Addr, Port, Opts, infinity)</c>.</p> + <p>Same as <c>connect_init(<anno>Socket</anno>, <anno>Addr</anno>, <anno>Port</anno>, <anno>Opts</anno>, infinity)</c>.</p> </desc> </func> <func> - <name>connect_init(Socket, Addr, Port, [Opt], Timeout) -> ok | {error, posix()}</name> + <name name="connect_init" arity="5"/> <fsummary>Initiate a new association for the socket <c>Socket</c>, with a peer (SCTP server socket)</fsummary> - <type> - <v>Socket = sctp_socket()</v> - <v>Addr = ip_address() | Host</v> - <v>Port = port_number()</v> - <v>Opt = sctp_option()</v> - <v>Timeout = timeout()</v> - <v>Host = atom() | string()</v> - </type> <desc> - <p>Initiates a new association for the socket <c>Socket</c>, + <p>Initiates a new association for the socket <c><anno>Socket</anno></c>, with the peer (SCTP server socket) given by - <c>Addr</c> and <c>Port</c>.</p> + <c><anno>Addr</anno></c> and <c><anno>Port</anno></c>.</p> <p>The fundamental difference between this API and <c>connect/*</c> is that the return value is that of the underlying OS connect(2) system call. If <c>ok</c> is returned @@ -275,64 +252,52 @@ active option.</p> <p>The parameters are as described in <seealso marker="#connect/5">connect/*</seealso>, with the - exception of the <c>Timeout</c> value.</p> - <p>The timer associated with <c>Timeout</c> only supervises - IP resolution of <c>Addr</c></p> + exception of the <c><anno>Timeout</anno></c> value.</p> + <p>The timer associated with <c><anno>Timeout</anno></c> only supervises + IP resolution of <c><anno>Addr</anno></c></p> </desc> </func> <func> - <name>controlling_process(sctp_socket(), pid()) -> ok</name> + <name name="controlling_process" arity="2"/> <fsummary>Assign a new controlling process pid to the socket</fsummary> <desc> - <p>Assigns a new controlling process Pid to Socket. Same implementation + <p>Assigns a new controlling process <c><anno>Pid</anno></c> to <c><anno>Socket</anno></c>. Same implementation as <c>gen_udp:controlling_process/2</c>.</p> </desc> </func> <func> - <name>eof(Socket, Assoc) -> ok | {error, Reason}</name> + <name name="eof" arity="2"/> <fsummary>Gracefully terminate the association given by Assoc, with flushing of all unsent data</fsummary> - <type> - <v>Socket = sctp_socket()</v> - <v>Assoc = #sctp_assoc_change{}</v> - </type> <desc> - <p>Gracefully terminates the association given by <c>Assoc</c>, with + <p>Gracefully terminates the association given by <c><anno>Assoc</anno></c>, with flushing of all unsent data. The socket itself remains open. Other associations opened on this socket are still valid, and it can be used in new associations.</p> </desc> </func> <func> - <name>listen(Socket, IsServer) -> ok | {error, Reason}</name> + <name name="listen" arity="2"/> <fsummary>Set up a socket to listen.</fsummary> - <type> - <v>Socket = sctp_socket()</v> - <v>IsServer = bool()</v> - </type> <desc> <p>Sets up a socket to listen on the IP address and port number - it is bound to. IsServer must be 'true' or 'false'. + it is bound to. <c><anno>IsServer</anno></c> must be <c>true</c> + or <c>false</c>. In the contrast to TCP, in SCTP there is no listening queue length. - If IsServer is 'true' the socket accepts new associations, i.e. + If <c><anno>IsServer</anno></c> is <c>true</c> the socket accepts new associations, i.e. it will become an SCTP server socket.</p> </desc> </func> <func> - <name>open() -> {ok, Socket} | {error, posix()}</name> - <name>open(Port) -> {ok, Socket} | {error, posix()}</name> - <name>open([Opt]) -> {ok, Socket} | {error, posix()}</name> - <name>open(Port, [Opt]) -> {ok, Socket} | {error, posix()}</name> + <name name="open" arity="0"/> + <name name="open" arity="1" clause_i="1"/> + <name name="open" arity="1" clause_i="2"/> + <name name="open" arity="2"/> <fsummary>Create an SCTP socket and bind it to local addresses</fsummary> - <type> - <v>Opt = {ip,IP} | {ifaddr,IP} | {port,Port} | sctp_option()</v> - <v>IP = ip_address() | any | loopback</v> - <v>Port = port_number()</v> - </type> <desc> <p>Creates an SCTP socket and binds it to the local addresses - specified by all <c>{ip,IP}</c> (or synonymously <c>{ifaddr,IP}</c>) + specified by all <c>{ip,<anno>IP</anno>}</c> (or synonymously <c>{ifaddr,<anno>IP</anno>}</c>) options (this feature is called SCTP multi-homing). - The default <c>IP</c> and <c>Port</c> are <c>any</c> + The default <c><anno>IP</anno></c> and <c><anno>Port</anno></c> are <c>any</c> and <c>0</c>, meaning bind to all local addresses on any one free port.</p> <p>A default set of socket <seealso marker="#options">options</seealso> @@ -345,27 +310,16 @@ </desc> </func> <func> - <name>recv(sctp_socket()) -> {ok, {FromIP, FromPort, AncData, BinMsg}} | {error, Reason}</name> - <name>recv(sctp_socket(), timeout()) -> {ok, {FromIP, FromPort, AncData, Data}} | {error, Reason}</name> + <name name="recv" arity="1"/> + <name name="recv" arity="2"/> <fsummary>Receive a message from a socket</fsummary> - <type> - <v>FromIP = ip_address()</v> - <v>FromPort = port_number()</v> - <v>AncData = [#sctp_sndrcvinfo{}]</v> - <v>Data = binary() | charlist() | #sctp_sndrcvinfo{} | - #sctp_assoc_change{} | #sctp_paddr_change{} | - #sctp_adaptation_event{} </v> - <v>Reason = posix() | #sctp_send_failed{} | #scpt_paddr_change{} | - #sctp_pdapi_event{} | #sctp_remote_error{} | - #sctp_shutdown_event{}</v> - </type> <desc> - <p>Receives the <c>Data</c> message from any association of the socket. + <p>Receives the <c><anno>Data</anno></c> message from any association of the socket. If the receive times out <c>{error,timeout</c> is returned. The default timeout is <c>infinity</c>. - <c>FromIP</c> and <c>FromPort</c> indicate the sender's address.</p> - <p><c>AncData</c> is a list of Ancillary Data items which - may be received along with the main <c>Data</c>. + <c><anno>FromIP</anno></c> and <c><anno>FromPort</anno></c> indicate the sender's address.</p> + <p><c><anno>AncData</anno></c> is a list of Ancillary Data items which + may be received along with the main <c><anno>Data</anno></c>. This list can be empty, or contain a single <seealso marker="#record-sctp_sndrcvinfo">#sctp_sndrcvinfo{}</seealso> record, if receiving of such ancillary data is enabled @@ -375,10 +329,10 @@ provide an easy way of determining the association and stream over which the message has been received. (An alternative way would be to get the Association ID from the - <c>FromIP</c> and <c>FromPort</c> using the + <c><anno>FromIP</anno></c> and <c><anno>FromPort</anno></c> using the <seealso marker="#option-sctp_get_peer_addr_info">sctp_get_peer_addr_info</seealso> socket option, but this would still not produce the Stream number).</p> - <p>The actual <c>Data</c> received may be a <c>binary()</c>, + <p>The actual <c><anno>Data</anno></c> received may be a <c>binary()</c>, or <c>list()</c> of bytes (integers in the range 0 through 255) depending on the socket mode, or an SCTP Event. <marker id="sctp_events"></marker> @@ -476,15 +430,10 @@ </desc> </func> <func> - <name>send(Socket, SndRcvInfo, Data) -> ok | {error, Reason}</name> + <name name="send" arity="3"/> <fsummary>Send a message using an <c>#sctp_sndrcvinfo{}</c>record</fsummary> - <type> - <v>Socket = sctp_socket()</v> - <v>SndRcvInfo = #sctp_sndrcvinfo{}</v> - <v>Data = binary() | iolist()</v> - </type> <desc> - <p>Sends the <c>Data</c> message with all sending parameters from a + <p>Sends the <c><anno>Data</anno></c> message with all sending parameters from a <seealso marker="#record-sctp_sndrcvinfo">#sctp_sndrcvinfo{}</seealso> record. This way, the user can specify the PPID (passed to the remote end) and Context (passed to the local SCTP layer) which can be used @@ -494,21 +443,15 @@ </desc> </func> <func> - <name>send(Socket, Assoc, Stream, Data) -> ok | {error, Reason}</name> + <name name="send" arity="4"/> <fsummary>Send a message over an existing association and given stream</fsummary> - <type> - <v>Socket = sctp_socket()</v> - <v>Assoc = #sctp_assoc_change{} | assoc_id()</v> - <v>Stream = integer()</v> - <v>Data = binary() | iolist()</v> - </type> <desc> - <p>Sends <c>Data</c> message over an existing association and given + <p>Sends <c><anno>Data</anno></c> message over an existing association and given stream.</p> </desc> </func> <func> - <name>error_string(integer()) -> ok | string() | undefined</name> + <name name="error_string" arity="1"/> <fsummary>Translate an SCTP error number into a string</fsummary> <desc> <p>Translates an SCTP error number from for example @@ -1173,7 +1116,7 @@ client_loop(S, Peer1, Port1, AssocId1, Peer2, Port2, AssocId2) -> <title>SEE ALSO</title> <p><seealso marker="inet">inet(3)</seealso>, <seealso marker="gen_tcp">gen_tcp(3)</seealso>, - <seealso marker="gen_udp">gen_upd(3)</seealso>, + <seealso marker="gen_udp">gen_udp(3)</seealso>, <url href="http://www.rfc-archive.org/getrfc.php?rfc=2960">RFC2960</url> (Stream Control Transmission Protocol), <url href="http://tools.ietf.org/html/draft-ietf-tsvwg-sctpsocket-13">Sockets API Extensions for SCTP.</url></p> <marker id="authors"></marker> diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 032dcc5251..f1d42d9faa 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -63,35 +63,45 @@ do_recv(Sock, Bs) -> <p>For more examples, see the <seealso marker="#examples">examples</seealso> section.</p> </description> - <section> - <title>DATA TYPES</title> - <code type="none"> -ip_address() - see inet(3) - -posix() - see inet(3) + <datatypes> + <datatype> + <name name="hostname"/> + </datatype> + <datatype> + <name name="ip_address"/> + <desc> + <p>Represents an address of a TCP socket. + It is a tuple as explained in + <seealso marker="inet">inet(3)</seealso>.</p> + </desc> + </datatype> + <datatype> + <name name="port_number"/> + </datatype> + <datatype> + <name name="posix"/> + <desc> + <p>See <seealso marker="inet#error_codes"> + inet(3); POSIX Error Codes</seealso>.</p> + </desc> + </datatype> + <datatype> + <name><marker id="type-socket">socket()</marker></name> + <desc> + <p>As returned by accept/1,2 and connect/3,4.</p> + <marker id="connect"></marker> + </desc> + </datatype> + </datatypes> -socket() - as returned by accept/1,2 and connect/3,4</code> - </section> <funcs> <func> - <name>connect(Address, Port, Options) -> {ok, Socket} | {error, Reason}</name> - <name>connect(Address, Port, Options, Timeout) -> {ok, Socket} | {error, Reason}</name> + <name name="connect" arity="3"/> + <name name="connect" arity="4"/> <fsummary>Connect to a TCP port</fsummary> - <type> - <v>Address = string() | atom() | ip_address()</v> - <v>Port = 0..65535</v> - <v>Options = [Opt]</v> - <v> Opt -- see below</v> - <v>Timeout = int() | infinity</v> - <v>Socket = socket()</v> - <v>Reason = posix()</v> - </type> <desc> - <p>Connects to a server on TCP port <c>Port</c> on the host - with IP address <c>Address</c>. The <c>Address</c> argument + <p>Connects to a server on TCP port <c><anno>Port</anno></c> on the host + with IP address <c><anno>Address</anno></c>. The <c><anno>Address</anno></c> argument can be either a hostname, or an IP address.</p> <p>The available options are:</p> <taglist> @@ -126,13 +136,13 @@ socket() <item> <p>Set up the socket for IPv4.</p> </item> - <tag>Opt</tag> + <tag><c>Opt</c></tag> <item> <p>See <seealso marker="inet#setopts/2">inet:setopts/2</seealso>.</p> </item> </taglist> - <p>Packets can be sent to the returned socket <c>Socket</c> + <p>Packets can be sent to the returned socket <c><anno>Socket</anno></c> using <c>send/2</c>. Packets sent from the peer are delivered as messages:</p> <code type="none"> @@ -147,7 +157,7 @@ socket() <p>unless <c>{active, false}</c> is specified in the option list for the socket, in which case packets are retrieved by calling <c>recv/2</c>.</p> - <p>The optional <c>Timeout</c> parameter specifies a timeout in + <p>The optional <c><anno>Timeout</anno></c> parameter specifies a timeout in milliseconds. The default value is <c>infinity</c>.</p> <note> <p>The default values for options given to <c>connect</c> can @@ -158,19 +168,12 @@ socket() </desc> </func> <func> - <name>listen(Port, Options) -> {ok, ListenSocket} | {error, Reason}</name> + <name name="listen" arity="2"/> <fsummary>Set up a socket to listen on a port</fsummary> - <type> - <v>Port = 0..65535</v> - <v>Options = [Opt]</v> - <v> Opt -- see below</v> - <v>ListenSocket -- see below</v> - <v>Reason = posix()</v> - </type> <desc> - <p>Sets up a socket to listen on the port <c>Port</c> on + <p>Sets up a socket to listen on the port <c><anno>Port</anno></c> on the local host.</p> - <p>If <c>Port == 0</c>, the underlying OS assigns an available + <p>If <c><anno>Port</anno> == 0</c>, the underlying OS assigns an available port number, use <c>inet:port/1</c> to retrieve it.</p> <p>The available options are:</p> <taglist> @@ -213,7 +216,7 @@ socket() <seealso marker="inet#setopts/2">inet:setopts/2</seealso>.</p> </item> </taglist> - <p>The returned socket <c>ListenSocket</c> can only be used in + <p>The returned socket <c><anno>ListenSocket</anno></c> can only be used in calls to <c>accept/1,2</c>.</p> <note> <p>The default values for options given to <c>listen</c> can @@ -224,27 +227,23 @@ socket() </desc> </func> <func> - <name>accept(ListenSocket) -> {ok, Socket} | {error, Reason}</name> - <name>accept(ListenSocket, Timeout) -> {ok, Socket} | {error, Reason}</name> + <name name="accept" arity="1"/> + <name name="accept" arity="2"/> <fsummary>Accept an incoming connection request on a listen socket</fsummary> - <type> - <v>ListenSocket -- see listen/2</v> - <v>Timeout = int() | infinity</v> - <v>Socket = socket()</v> - <v>Reason = closed | timeout | posix()</v> - </type> + <type_desc variable="ListenSocket">Returned by <c>listen/2</c>. + </type_desc> <desc> <p>Accepts an incoming connection request on a listen socket. - <c>Socket</c> must be a socket returned from <c>listen/2</c>. - <c>Timeout</c> specifies a timeout value in ms, defaults to + <c><anno>Socket</anno></c> must be a socket returned from <c>listen/2</c>. + <c><anno>Timeout</anno></c> specifies a timeout value in ms, defaults to <c>infinity</c>.</p> - <p>Returns <c>{ok, Socket}</c> if a connection is established, - or <c>{error, closed}</c> if <c>ListenSocket</c> is closed, + <p>Returns <c>{ok, <anno>Socket</anno>}</c> if a connection is established, + or <c>{error, closed}</c> if <c><anno>ListenSocket</anno></c> is closed, or <c>{error, timeout}</c> if no connection is established within the specified time. May also return a POSIX error value if something else goes wrong, see inet(3) for possible error values.</p> - <p>Packets can be sent to the returned socket <c>Socket</c> + <p>Packets can be sent to the returned socket <c><anno>Socket</anno></c> using <c>send/2</c>. Packets sent from the peer are delivered as messages:</p> <code type="none"> @@ -263,13 +262,8 @@ socket() </desc> </func> <func> - <name>send(Socket, Packet) -> ok | {error, Reason}</name> + <name name="send" arity="2"/> <fsummary>Send a packet</fsummary> - <type> - <v>Socket = socket()</v> - <v>Packet = [char()] | binary()</v> - <v>Reason = posix()</v> - </type> <desc> <p>Sends a packet on a socket. </p> <p>There is no <c>send</c> call with timeout option, you use the @@ -278,69 +272,52 @@ socket() </desc> </func> <func> - <name>recv(Socket, Length) -> {ok, Packet} | {error, Reason}</name> - <name>recv(Socket, Length, Timeout) -> {ok, Packet} | {error, Reason}</name> + <name name="recv" arity="2"/> + <name name="recv" arity="3"/> <fsummary>Receive a packet from a passive socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Length = int()</v> - <v>Packet = [char()] | binary()</v> - <v>Timeout = int() | infinity</v> - <v>Reason = closed | posix()</v> - </type> + <type_desc variable="HttpPacket">See the description of + <c>HttpPacket</c> in <seealso marker="erts:erlang#decode_packet/3"> + erlang:decode_packet/3</seealso>. + </type_desc> <desc> <p>This function receives a packet from a socket in passive mode. A closed socket is indicated by a return value <c>{error, closed}</c>.</p> - <p>The <c>Length</c> argument is only meaningful when + <p>The <c><anno>Length</anno></c> argument is only meaningful when the socket is in <c>raw</c> mode and denotes the number of - bytes to read. If <c>Length</c> = 0, all available bytes are - returned. If <c>Length</c> > 0, exactly <c>Length</c> + bytes to read. If <c><anno>Length</anno></c> = 0, all available bytes are + returned. If <c><anno>Length</anno></c> > 0, exactly <c><anno>Length</anno></c> bytes are returned, or an error; possibly discarding less - than <c>Length</c> bytes of data when the socket gets closed + than <c><anno>Length</anno></c> bytes of data when the socket gets closed from the other side.</p> - <p>The optional <c>Timeout</c> parameter specifies a timeout in + <p>The optional <c><anno>Timeout</anno></c> parameter specifies a timeout in milliseconds. The default value is <c>infinity</c>.</p> </desc> </func> <func> - <name>controlling_process(Socket, Pid) -> ok | {error, Reason}</name> + <name name="controlling_process" arity="2"/> <fsummary>Change controlling process of a socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Pid = pid()</v> - <v>Reason = closed | not_owner | posix()</v> - </type> <desc> - <p>Assigns a new controlling process <c>Pid</c> to - <c>Socket</c>. The controlling process is the process which + <p>Assigns a new controlling process <c><anno>Pid</anno></c> to + <c><anno>Socket</anno></c>. The controlling process is the process which receives messages from the socket. If called by any other process than the current controlling process, <c>{error, eperm}</c> is returned.</p> </desc> </func> <func> - <name>close(Socket) -> ok | {error, Reason}</name> + <name name="close" arity="1"/> <fsummary>Close a TCP socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Reason = posix()</v> - </type> <desc> <p>Closes a TCP socket.</p> </desc> </func> <func> - <name>shutdown(Socket, How) -> ok | {error, Reason}</name> + <name name="shutdown" arity="2"/> <fsummary>Immediately close a socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>How = read | write | read_write</v> - <v>Reason = posix()</v> - </type> <desc> <p>Immediately close a socket in one or two directions.</p> - <p><c>How == write</c> means closing the socket for writing, + <p><c><anno>How</anno> == write</c> means closing the socket for writing, reading from it is still possible.</p> <p>To be able to handle that the peer has done a shutdown on the write side, the <c>{exit_on_close, false}</c> option diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml index 71f2e9bd83..c0e783f508 100644 --- a/lib/kernel/doc/src/gen_udp.xml +++ b/lib/kernel/doc/src/gen_udp.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -34,32 +34,43 @@ with sockets using the UDP protocol.</p> </description> - <section> - <title>DATA TYPES</title> - <code type="none"> -ip_address() - see inet(3) - -posix() - see inet(3) + <datatypes> + <datatype> + <name name="hostname"/> + </datatype> + <datatype> + <name name="ip_address"/> + <desc> + <p>Represents an address of a TCP socket. + It is a tuple as explained in + <seealso marker="inet">inet(3)</seealso>.</p> + </desc> + </datatype> + <datatype> + <name name="port_number"/> + </datatype> + <datatype> + <name name="posix"/> + <desc> + <p>See <seealso marker="inet#error_codes"> + inet(3); POSIX Error Codes</seealso>.</p> + </desc> + </datatype> + <datatype> + <name><marker id="type-socket">socket()</marker></name> + <desc> + <p>As returned by open/1,2.</p> + </desc> + </datatype> + </datatypes> -socket() - as returned by open/1,2</code> - </section> <funcs> <func> - <name>open(Port) -> {ok, Socket} | {error, Reason}</name> - <name>open(Port, Options) -> {ok, Socket} | {error, Reason}</name> + <name name="open" arity="1"/> + <name name="open" arity="2"/> <fsummary>Associate a UDP port number with the process calling it</fsummary> - <type> - <v>Port = 0..65535</v> - <v>Options = [Opt]</v> - <v> Opt -- see below</v> - <v>Socket = socket()</v> - <v>Reason = posix()</v> - </type> <desc> - <p>Associates a UDP port number (<c>Port</c>) with the calling + <p>Associates a UDP port number (<c><anno>Port</anno></c>) with the calling process.</p> <p>The available options are:</p> <taglist> @@ -96,7 +107,7 @@ socket() <seealso marker="inet#setopts/2">inet:setopts/2</seealso>.</p> </item> </taglist> - <p>The returned socket <c>Socket</c> is used to send packets + <p>The returned socket <c><anno>Socket</anno></c> is used to send packets from this port with <c>send/4</c>. When UDP packets arrive at the opened port, they are delivered as messages:</p> <code type="none"> @@ -110,66 +121,42 @@ socket() binary if the option <c>binary</c> was specified.</p> <p>Default value for the receive buffer option is <c>{recbuf, 8192}</c>.</p> - <p>If <c>Port == 0</c>, the underlying OS assigns a free UDP + <p>If <c><anno>Port</anno> == 0</c>, the underlying OS assigns a free UDP port, use <c>inet:port/1</c> to retrieve it.</p> </desc> </func> <func> - <name>send(Socket, Address, Port, Packet) -> ok | {error, Reason}</name> + <name name="send" arity="4"/> <fsummary>Send a packet</fsummary> - <type> - <v>Socket = socket()</v> - <v>Address = string() | atom() | ip_address()</v> - <v>Port = 0..65535</v> - <v>Packet = [char()] | binary()</v> - <v>Reason = not_owner | posix()</v> - </type> <desc> <p>Sends a packet to the specified address and port. - The <c>Address</c> argument can be either a hostname, or an + The <c><anno>Address</anno></c> argument can be either a hostname, or an IP address.</p> </desc> </func> <func> - <name>recv(Socket, Length) -> {ok, {Address, Port, Packet}} | {error, Reason}</name> - <name>recv(Socket, Length, Timeout) -> {ok, {Address, Port, Packet}} | {error, Reason}</name> + <name name="recv" arity="2"/> + <name name="recv" arity="3"/> <fsummary>Receive a packet from a passive socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Length = int()</v> - <v>Address = ip_address()</v> - <v>Port = 0..65535</v> - <v>Packet = [char()] | binary()</v> - <v>Timeout = int() | infinity</v> - <v>Reason = not_owner | posix()</v> - </type> <desc> <p>This function receives a packet from a socket in passive mode.</p> - <p>The optional <c>Timeout</c> parameter specifies a timeout in + <p>The optional <c><anno>Timeout</anno></c> parameter specifies a timeout in milliseconds. The default value is <c>infinity</c>.</p> </desc> </func> <func> - <name>controlling_process(Socket, Pid) -> ok</name> + <name name="controlling_process" arity="2"/> <fsummary>Change controlling process of a socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Pid = pid()</v> - </type> <desc> - <p>Assigns a new controlling process <c>Pid</c> to - <c>Socket</c>. The controlling process is the process which + <p>Assigns a new controlling process <c><anno>Pid</anno></c> to + <c><anno>Socket</anno></c>. The controlling process is the process which receives messages from the socket.</p> </desc> </func> <func> - <name>close(Socket) -> ok | {error, Reason}</name> + <name name="close" arity="1"/> <fsummary>Close a UDP socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Reason = not_owner | posix()</v> - </type> <desc> <p>Closes a UDP socket.</p> </desc> diff --git a/lib/kernel/doc/src/global.xml b/lib/kernel/doc/src/global.xml index 077109d6c9..304a9b1d88 100644 --- a/lib/kernel/doc/src/global.xml +++ b/lib/kernel/doc/src/global.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -106,45 +106,37 @@ </description> + <datatypes> + <datatype> + <name name="id"/> + </datatype> + </datatypes> + <funcs> <func> - <name>del_lock(Id)</name> - <name>del_lock(Id, Nodes) -> void()</name> + <name name="del_lock" arity="1"/> + <name name="del_lock" arity="2"/> <fsummary>Delete a lock</fsummary> - <type> - <v>Id = {ResourceId, LockRequesterId}</v> - <v> ResourceId = term()</v> - <v> LockRequesterId = term()</v> - <v>Nodes = [node()]</v> - </type> <desc> - <p>Deletes the lock <c>Id</c> synchronously.</p> + <p>Deletes the lock <c><anno>Id</anno></c> synchronously.</p> </desc> </func> <func> - <name>notify_all_name(Name, Pid1, Pid2) -> none</name> + <name name="notify_all_name" arity="3"/> <fsummary>Name resolving function that notifies both pids</fsummary> - <type> - <v>Name = term()</v> - <v>Pid1 = Pid2 = pid()</v> - </type> <desc> <p>This function can be used as a name resolving function for <c>register_name/3</c> and <c>re_register_name/3</c>. It unregisters both pids, and sends the message - <c>{global_name_conflict, Name, OtherPid}</c> to both + <c>{global_name_conflict, <anno>Name</anno>, OtherPid}</c> to both processes.</p> </desc> </func> <func> - <name>random_exit_name(Name, Pid1, Pid2) -> Pid1 | Pid2</name> + <name name="random_exit_name" arity="3"/> <fsummary>Name resolving function that kills one pid</fsummary> - <type> - <v>Name = term()</v> - <v>Pid1 = Pid2 = pid()</v> - </type> <desc> <p>This function can be used as a name resolving function for <c>register_name/3</c> and <c>re_register_name/3</c>. It @@ -154,33 +146,27 @@ </func> <func> - <name>random_notify_name(Name, Pid1, Pid2) -> Pid1 | Pid2</name> + <name name="random_notify_name" arity="3"/> <fsummary>Name resolving function that notifies one pid</fsummary> - <type> - <v>Name = term()</v> - <v>Pid1 = Pid2 = pid()</v> - </type> <desc> <p>This function can be used as a name resolving function for <c>register_name/3</c> and <c>re_register_name/3</c>. It randomly chooses one of the pids for registration, and sends - the message <c>{global_name_conflict, Name}</c> to the other + the message <c>{global_name_conflict, <anno>Name</anno>}</c> to the other pid.</p> </desc> </func> <func> - <name>register_name(Name, Pid)</name> - <name>register_name(Name, Pid, Resolve) -> yes | no</name> + <name name="register_name" arity="2"/> + <name name="register_name" arity="3"/> <fsummary>Globally register a name for a pid</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Resolve = fun() or {Module, Function} where</v> - <v> Resolve(Name, Pid, Pid2) -> Pid | Pid2 | none</v> - </type> + <type name="method"/> + <type_desc name="method">{<c>Module</c>, <c>Function</c>} + is also allowed + </type_desc> <desc> - <p>Globally associates the name <c>Name</c> with a pid, that is, + <p>Globally associates the name <c><anno>Name</anno></c> with a pid, that is, Globally notifies all nodes of a new global name in a network of Erlang nodes.</p> @@ -188,7 +174,7 @@ of the globally registered names that already exist. The network is also informed of any global names in newly connected nodes. If any name clashes are discovered, - the <c>Resolve</c> function is called. Its purpose is to + the <c><anno>Resolve</anno></c> function is called. Its purpose is to decide which pid is correct. If the function crashes, or returns anything other than one of the pids, the name is unregistered. This function is called once for each name @@ -196,7 +182,7 @@ <p>There are three pre-defined resolve functions: <c>random_exit_name/3</c>, <c>random_notify_name/3</c>, and - <c>notify_all_name/3</c>. If no <c>Resolve</c> function is + <c>notify_all_name/3</c>. If no <c><anno>Resolve</anno></c> function is defined, <c>random_exit_name</c> is used. This means that one of the two registered processes will be selected as correct while the other is killed.</p> @@ -225,78 +211,63 @@ </func> <func> - <name>registered_names() -> [Name]</name> + <name name="registered_names" arity="0"/> <fsummary>All globally registered names</fsummary> - <type> - <v>Name = term()</v> - </type> <desc> <p>Returns a lists of all globally registered names.</p> </desc> </func> <func> - <name>re_register_name(Name, Pid)</name> - <name>re_register_name(Name, Pid, Resolve) -> void()</name> + <name name="re_register_name" arity="2"/> + <name name="re_register_name" arity="3"/> <fsummary>Atomically re-register a name</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Resolve = fun() or {Module, Function} where</v> - <v> Resolve(Name, Pid, Pid2) -> Pid | Pid2 | none</v> - </type> + <type name="method"/> + <type_desc name="method">{<c>Module</c>, <c>Function</c>} + is also allowed + </type_desc> <desc> - <p>Atomically changes the registered name <c>Name</c> on all - nodes to refer to <c>Pid</c>.</p> + <p>Atomically changes the registered name <c><anno>Name</anno></c> on all + nodes to refer to <c><anno>Pid</anno></c>.</p> - <p>The <c>Resolve</c> function has the same behavior as in + <p>The <c><anno>Resolve</anno></c> function has the same behavior as in <c>register_name/2,3</c>.</p> </desc> </func> <func> - <name>send(Name, Msg) -> Pid</name> + <name name="send" arity="2"/> <fsummary>Send a message to a globally registered pid</fsummary> - <type> - <v>Name = term()</v> - <v>Msg = term()</v> - <v>Pid = pid()</v> - </type> <desc> - <p>Sends the message <c>Msg</c> to the pid globally registered - as <c>Name</c>.</p> + <p>Sends the message <c><anno>Msg</anno></c> to the pid globally registered + as <c><anno>Name</anno></c>.</p> - <p>Failure: If <c>Name</c> is not a globally registered + <p>Failure: If <c><anno>Name</anno></c> is not a globally registered name, the calling function will exit with reason - <c>{badarg, {Name, Msg}}</c>.</p> + <c>{badarg, {<anno>Name</anno>, <anno>Msg</anno>}}</c>.</p> </desc> </func> <func> - <name>set_lock(Id)</name> - <name>set_lock(Id, Nodes)</name> - <name>set_lock(Id, Nodes, Retries) -> boolean()</name> + <name name="set_lock" arity="1"/> + <name name="set_lock" arity="2"/> + <name name="set_lock" arity="3"/> <fsummary>Set a lock on the specified nodes</fsummary> - <type> - <v>Id = {ResourceId, LockRequesterId}</v> - <v> ResourceId = term()</v> - <v> LockRequesterId = term()</v> - <v>Nodes = [node()]</v> - <v>Retries = int() >= 0 | infinity</v> - </type> + <type name="id"/> + <type name="retries"/> <desc> <p>Sets a lock on the specified nodes (or on all nodes if none - are specified) on <c>ResourceId</c> for - <c>LockRequesterId</c>. If a lock already exists on - <c>ResourceId</c> for another requester than - <c>LockRequesterId</c>, and <c>Retries</c> is not equal to 0, + are specified) on <c><anno>ResourceId</anno></c> for + <c><anno>LockRequesterId</anno></c>. If a lock already exists on + <c><anno>ResourceId</anno></c> for another requester than + <c><anno>LockRequesterId</anno></c>, and <c><anno>Retries</anno></c> is not equal to 0, the process sleeps for a while and will try to execute - the action later. When <c>Retries</c> attempts have been made, + the action later. When <c><anno>Retries</anno></c> attempts have been made, <c>false</c> is returned, otherwise <c>true</c>. If - <c>Retries</c> is <c>infinity</c>, <c>true</c> is eventually + <c><anno>Retries</anno></c> is <c>infinity</c>, <c>true</c> is eventually returned (unless the lock is never released).</p> - <p>If no value for <c>Retries</c> is given, <c>infinity</c> is + <p>If no value for <c><anno>Retries</anno></c> is given, <c>infinity</c> is used.</p> <p>This function is completely synchronous.</p> @@ -315,7 +286,7 @@ application to detect and rectify a deadlock.</p> <note> - <p>Some values of <c>ResourceId</c> should be avoided or + <p>Some values of <c><anno>ResourceId</anno></c> should be avoided or Erlang/OTP will not work properly. A list of resources to avoid: <c>global</c>, <c>dist_ac</c>, <c>mnesia_table_lock</c>, <c>mnesia_adjust_log_writes</c>, @@ -326,7 +297,7 @@ </func> <func> - <name>sync() -> void()</name> + <name name="sync" arity="0"/> <fsummary>Synchronize the global name server</fsummary> <desc> <p>Synchronizes the global name server with all nodes known to @@ -335,56 +306,45 @@ the global name server will receive global information from all nodes. This function can be called when new nodes are added to the network.</p> + <p>The only possible error reason <c>Reason</c> is + <c>{"global_groups definition error", Error}</c>.</p> </desc> </func> <func> - <name>trans(Id, Fun)</name> - <name>trans(Id, Fun, Nodes)</name> - <name>trans(Id, Fun, Nodes, Retries) -> Res | aborted</name> + <name name="trans" arity="2"/> + <name name="trans" arity="3"/> + <name name="trans" arity="4"/> <fsummary>Micro transaction facility</fsummary> - <type> - <v>Id = {ResourceId, LockRequesterId}</v> - <v> ResourceId = term()</v> - <v> LockRequesterId = term()</v> - <v>Fun = fun() | {M, F}</v> - <v>Nodes = [node()]</v> - <v>Retries = int() >= 0 | infinity</v> - <v>Res = term()</v> - </type> + <type name="retries"/> + <type name="trans_fun"/> <desc> - <p>Sets a lock on <c>Id</c> (using <c>set_lock/3</c>). If this - succeeds, <c>Fun()</c> is evaluated and the result <c>Res</c> + <p>Sets a lock on <c><anno>Id</anno></c> (using <c>set_lock/3</c>). If this + succeeds, <c><anno>Fun</anno>()</c> is evaluated and the result <c><anno>Res</anno></c> is returned. Returns <c>aborted</c> if the lock attempt - failed. If <c>Retries</c> is set to <c>infinity</c>, + failed. If <c><anno>Retries</anno></c> is set to <c>infinity</c>, the transaction will not abort.</p> <p><c>infinity</c> is the default setting and will be used if - no value is given for <c>Retries</c>.</p> + no value is given for <c><anno>Retries</anno></c>.</p> </desc> </func> <func> - <name>unregister_name(Name) -> void()</name> + <name name="unregister_name" arity="1"/> <fsummary>Remove a globally registered name for a pid</fsummary> - <type> - <v>Name = term()</v> - </type> <desc> - <p>Removes the globally registered name <c>Name</c> from + <p>Removes the globally registered name <c><anno>Name</anno></c> from the network of Erlang nodes.</p> </desc> </func> <func> - <name>whereis_name(Name) -> pid() | undefined</name> + <name name="whereis_name" arity="1"/> <fsummary>Get the pid with a given globally registered name</fsummary> - <type> - <v>Name = term()</v> - </type> <desc> <p>Returns the pid with the globally registered name - <c>Name</c>. Returns <c>undefined</c> if the name is not + <c><anno>Name</anno></c>. Returns <c>undefined</c> if the name is not globally registered.</p> </desc> </func> diff --git a/lib/kernel/doc/src/global_group.xml b/lib/kernel/doc/src/global_group.xml index 4facf4a4aa..abf6178fc4 100644 --- a/lib/kernel/doc/src/global_group.xml +++ b/lib/kernel/doc/src/global_group.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1998</year><year>2009</year> + <year>1998</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -42,26 +42,7 @@ <seealso marker="kernel_app">kernel(6)</seealso>, <seealso marker="config">config(4)</seealso>:</p> <code type="none"> -{global_groups, [GroupTuple]}</code> - <p>Types:</p> - <list type="bulleted"> - <item><c>GroupTuple = {GroupName, [Node]} | {GroupName, PublishType, [Node]}</c></item> - <item><c>GroupName = atom()</c> (naming a global group)</item> - <item><c>PublishType = normal | hidden</c></item> - <item><c>Node = atom()</c> (naming a node)</item> - </list> - <p>A <c>GroupTuple</c> without <c>PublishType</c> is the same as a - <c>GroupTuple</c> with <c>PublishType == normal</c>.</p> - <p>A node started with the command line flag <c>-hidden</c>, see - <seealso marker="erts:erl">erl(1)</seealso>, is said to be a - <em>hidden</em> node. A hidden node will establish hidden - connections to nodes not part of the same global group, but - normal (visible) connections to nodes part of the same global - group.</p> - <p>A global group defined with <c>PublishType == hidden</c>, is - said to be a hidden global group. All nodes in a hidden global - group are hidden nodes, regardless if they are started with - the <c>-hidden</c> command line flag or not.</p> +{global_groups, [GroupTuple :: group_tuple()]}</code> <p>For the processes and nodes to run smoothly using the global group functionality, the following criteria must be met:</p> <list type="bulleted"> @@ -82,14 +63,44 @@ <p>In the following description, a <em>group node</em> is a node belonging to the same global group as the local node.</p> </description> + <datatypes> + <datatype> + <name name="group_tuple"/> + <desc> + <p>A <c>GroupTuple</c> without <c>PublishType</c> is the same as a + <c>GroupTuple</c> with <c>PublishType == normal</c>.</p> + </desc> + </datatype> + <datatype> + <name name="group_name"/> + </datatype> + <datatype> + <name name="publish_type"/> + <desc> + <p>A node started with the command line flag <c>-hidden</c>, see + <seealso marker="erts:erl">erl(1)</seealso>, is said to be a + <em>hidden</em> node. A hidden node will establish hidden + connections to nodes not part of the same global group, but + normal (visible) connections to nodes part of the same global + group.</p> + <p>A global group defined with <c>PublishType == hidden</c>, is + said to be a hidden global group. All nodes in a hidden global + group are hidden nodes, regardless if they are started with + the <c>-hidden</c> command line flag or not.</p> + </desc> + </datatype> + <datatype> + <name name="name"/> + <desc><p>A registered name.</p></desc> + </datatype> + <datatype> + <name name="where"/> + </datatype> + </datatypes> <funcs> <func> - <name>global_groups() -> {GroupName, GroupNames} | undefined</name> + <name name="global_groups" arity="0"/> <fsummary>Return the global group names</fsummary> - <type> - <v>GroupName = atom()</v> - <v>GroupNames = [GroupName]</v> - </type> <desc> <p>Returns a tuple containing the name of the global group the local node belongs to, and the list of all other known @@ -98,53 +109,52 @@ </desc> </func> <func> - <name>info() -> [{Item, Info}]</name> + <name name="info" arity="0"/> <fsummary>Information about global groups</fsummary> - <type> - <v>Item, Info -- see below</v> - </type> + <type name="info_item"/> + <type name="sync_state"/> <desc> <p>Returns a list containing information about the global groups. Each element of the list is a tuple. The order of the tuples is not defined.</p> <taglist> - <tag><c>{state, State}</c></tag> + <tag><c>{state, <anno>State</anno>}</c></tag> <item> <p>If the local node is part of a global group, - <c>State == synced</c>. If no global groups are defined, - <c>State == no_conf</c>.</p> + <c><anno>State</anno> == synced</c>. If no global groups are defined, + <c><anno>State</anno> == no_conf</c>.</p> </item> - <tag><c>{own_group_name, GroupName}</c></tag> + <tag><c>{own_group_name, <anno>GroupName</anno>}</c></tag> <item> <p>The name (atom) of the group that the local node belongs to.</p> </item> - <tag><c>{own_group_nodes, Nodes}</c></tag> + <tag><c>{own_group_nodes, <anno>Nodes</anno>}</c></tag> <item> <p>A list of node names (atoms), the group nodes.</p> </item> - <tag><c>{synced_nodes, Nodes}</c></tag> + <tag><c>{synced_nodes, <anno>Nodes</anno>}</c></tag> <item> <p>A list of node names, the group nodes currently synchronized with the local node.</p> </item> - <tag><c>{sync_error, Nodes}</c></tag> + <tag><c>{sync_error, <anno>Nodes</anno>}</c></tag> <item> <p>A list of node names, the group nodes with which the local node has failed to synchronize.</p> </item> - <tag><c>{no_contact, Nodes}</c></tag> + <tag><c>{no_contact, <anno>Nodes</anno>}</c></tag> <item> <p>A list of node names, the group nodes to which there are currently no connections.</p> </item> - <tag><c>{other_groups, Groups}</c></tag> + <tag><c>{other_groups, <anno>Groups</anno>}</c></tag> <item> - <p><c>Groups</c> is a list of tuples - <c>{GroupName, Nodes}</c>, specifying the name and nodes + <p><c><anno>Groups</anno></c> is a list of tuples + <c>{<anno>GroupName</anno>, <anno>Nodes</anno>}</c>, specifying the name and nodes of the other global groups.</p> </item> - <tag><c>{monitoring, Pids}</c></tag> + <tag><c>{monitoring, <anno>Pids</anno>}</c></tag> <item> <p>A list of pids, specifying the processes which have subscribed to <c>nodeup</c> and <c>nodedown</c> messages.</p> @@ -153,73 +163,52 @@ </desc> </func> <func> - <name>monitor_nodes(Flag) -> ok </name> + <name name="monitor_nodes" arity="1"/> <fsummary>Subscribe to node status changes</fsummary> - <type> - <v>Flag = bool()</v> - </type> <desc> - <p>Depending on <c>Flag</c>, the calling process starts - subscribing (<c>Flag == true</c>) or stops subscribing - (<c>Flag == false</c>) to node status change messages.</p> + <p>Depending on <c><anno>Flag</anno></c>, the calling process starts + subscribing (<c><anno>Flag</anno> == true</c>) or stops subscribing + (<c><anno>Flag</anno> == false</c>) to node status change messages.</p> <p>A process which has subscribed will receive the messages <c>{nodeup, Node}</c> and <c>{nodedown, Node}</c> when a group node connects or disconnects, respectively.</p> </desc> </func> <func> - <name>own_nodes() -> Nodes</name> + <name name="own_nodes" arity="0"/> <fsummary>Return the group nodes</fsummary> - <type> - <v>Nodes = [Node]</v> - <v> Node = node()</v> - </type> <desc> <p>Returns the names of all group nodes, regardless of their current status.</p> </desc> </func> <func> - <name>registered_names(Where) -> Names</name> + <name name="registered_names" arity="1"/> <fsummary>Return globally registered names</fsummary> - <type> - <v>Where = {node, Node} | {group, GroupName}</v> - <v> Node = node()</v> - <v> GroupName = atom()</v> - <v>Names = [Name]</v> - <v> Name = atom()</v> - </type> <desc> <p>Returns a list of all names which are globally registered on the specified node or in the specified global group.</p> </desc> </func> <func> - <name>send(Name, Msg) -> pid() | {badarg, {Name, Msg}}</name> - <name>send(Where, Name, Msg) -> pid() | {badarg, {Name, Msg}}</name> + <name name="send" arity="2"/> + <name name="send" arity="3"/> <fsummary>Send a message to a globally registered pid</fsummary> - <type> - <v>Where = {node, Node} | {group, GroupName}</v> - <v> Node = node()</v> - <v> GroupName = atom()</v> - <v>Name = atom()</v> - <v>Msg = term()</v> - </type> <desc> - <p>Searches for <c>Name</c>, globally registered on + <p>Searches for <c><anno>Name</anno></c>, globally registered on the specified node or in the specified global group, or -- - if the <c>Where</c> argument is not provided -- in any global + if the <c><anno>Where</anno></c> argument is not provided -- in any global group. The global groups are searched in the order in which they appear in the value of the <c>global_groups</c> configuration parameter.</p> - <p>If <c>Name</c> is found, the message <c>Msg</c> is sent to + <p>If <c><anno>Name</anno></c> is found, the message <c><anno>Msg</anno></c> is sent to the corresponding pid. The pid is also the return value of the function. If the name is not found, the function returns - <c>{badarg, {Name, Msg}}</c>.</p> + <c>{badarg, {<anno>Name</anno>, <anno>Msg</anno>}}</c>.</p> </desc> </func> <func> - <name>sync() -> ok</name> + <name name="sync" arity="0"/> <fsummary>Synchronize the group nodes</fsummary> <desc> <p>Synchronizes the group nodes, that is, the global name @@ -235,23 +224,17 @@ </desc> </func> <func> - <name>whereis_name(Name) -> pid() | undefined</name> - <name>whereis_name(Where, Name) -> pid() | undefined</name> + <name name="whereis_name" arity="1"/> + <name name="whereis_name" arity="2"/> <fsummary>Get the pid with a given globally registered name</fsummary> - <type> - <v>Where = {node, Node} | {group, GroupName}</v> - <v> Node = node()</v> - <v> GroupName = atom()</v> - <v>Name = atom()</v> - </type> <desc> - <p>Searches for <c>Name</c>, globally registered on + <p>Searches for <c><anno>Name</anno></c>, globally registered on the specified node or in the specified global group, or -- if - the <c>Where</c> argument is not provided -- in any global + the <c><anno>Where</anno></c> argument is not provided -- in any global group. The global groups are searched in the order in which they appear in the value of the <c>global_groups</c> configuration parameter.</p> - <p>If <c>Name</c> is found, the corresponding pid is returned. + <p>If <c><anno>Name</anno></c> is found, the corresponding pid is returned. If the name is not found, the function returns <c>undefined</c>.</p> </desc> diff --git a/lib/kernel/doc/src/heart.xml b/lib/kernel/doc/src/heart.xml index 0df699572d..e2dbcbe63d 100644 --- a/lib/kernel/doc/src/heart.xml +++ b/lib/kernel/doc/src/heart.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -76,11 +76,8 @@ </description> <funcs> <func> - <name>set_cmd(Cmd) -> ok | {error, {bad_cmd, Cmd}}</name> + <name name="set_cmd" arity="1"/> <fsummary>Set a temporary reboot command</fsummary> - <type> - <v>Cmd = string()</v> - </type> <desc> <p>Sets a temporary reboot command. This command is used if a <c>HEART_COMMAND</c> other than the one specified with @@ -88,12 +85,12 @@ the system. The new Erlang runtime system will (if it misbehaves) use the environment variable <c>HEART_COMMAND</c> to reboot.</p> - <p>Limitations: The length of the <c>Cmd</c> command string + <p>Limitations: The length of the <c><anno>Cmd</anno></c> command string must be less than 2047 characters.</p> </desc> </func> <func> - <name>clear_cmd() -> ok</name> + <name name="clear_cmd" arity="0"/> <fsummary>Clear the temporary boot command</fsummary> <desc> <p>Clears the temporary boot command. If the system terminates, @@ -101,11 +98,8 @@ </desc> </func> <func> - <name>get_cmd() -> {ok, Cmd}</name> + <name name="get_cmd" arity="0"/> <fsummary>Get the temporary reboot command</fsummary> - <type> - <v>Cmd = string()</v> - </type> <desc> <p>Get the temporary reboot command. If the command is cleared, the empty string will be returned.</p> diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index f502b30c8d..fd843b00d9 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</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</title> @@ -54,33 +54,6 @@ $ <input>erl -sname test -kernel \</input> <input>inet_default_listen_options '[{delay_send,true}]'</input></pre> <p>Note that the default option <c>{active, true}</c> currently cannot be changed, for internal reasons.</p> - </description> - - <section> - <title>DATA TYPES</title> - <code type="none"> -#hostent{h_addr_list = [ip_address()] % list of addresses for this host - h_addrtype = inet | inet6 - h_aliases = [hostname()] % list of aliases - h_length = int() % length of address in bytes - h_name = hostname() % official name for host - The record is defined in the Kernel include file "inet.hrl" - Add the following directive to the module: - -include_lib("kernel/include/inet.hrl"). - -hostname() = atom() | string() - -ip_address() = {N1,N2,N3,N4} % IPv4 - | {K1,K2,K3,K4,K5,K6,K7,K8} % IPv6 - Ni = 0..255 - Ki = 0..65535 - -posix() - an atom which is named from the Posix error codes used in - Unix, and in the runtime libraries of most C compilers - -socket() - see gen_tcp(3), gen_udp(3)</code> <p>Addresses as inputs to functions can be either a string or a tuple. For instance, the IP address 150.236.20.73 can be passed to <c>gethostbyaddr/1</c> either as the string "150.236.20.73" @@ -109,24 +82,58 @@ fe80::204:acff:fe17:bf38 {ok,{192,168,42,2}} 2> <input>inet_parse:address("FFFF::192.168.42.2").</input> {ok,{65535,0,0,0,0,0,49320,10754}}</pre> - </section> + </description> + + <datatypes> + <datatype> + <name name="hostent"/> + <desc> + <p>The record is defined in the Kernel include file "inet.hrl". + Add the following directive to the module:</p> +<code>-include_lib("kernel/include/inet.hrl").</code></desc> + </datatype> + <datatype> + <name name="hostname"/> + </datatype> + <datatype> + <name name="ip_address"/> + </datatype> + <datatype> + <name name="ip4_address"/> + </datatype> + <datatype> + <name name="ip6_address"/> + </datatype> + <datatype> + <name name="posix"/> + <desc><p>An atom which is named from the Posix error codes + used in Unix, and in the runtime libraries of most + C compilers. See + <seealso marker="#error_codes">POSIX Error Codes</seealso>.</p> + </desc> + </datatype> + <datatype> + <name><marker id="type-socket">socket()</marker></name> + <desc><p>See <seealso marker="gen_tcp#type-socket">gen_tcp(3)</seealso> + and <seealso marker="gen_udp#type-socket">gen_udp(3)</seealso>.</p> + </desc> + </datatype> + <datatype> + <name name="family_option"/> + </datatype> + </datatypes> + <funcs> <func> - <name>close(Socket) -> ok</name> + <name name="close" arity="1"/> <fsummary>Close a socket of any type</fsummary> - <type> - <v>Socket = socket()</v> - </type> <desc> <p>Closes a socket of any type.</p> </desc> </func> <func> - <name>get_rc() -> [{Par, Val}]</name> + <name name="get_rc" arity="0"/> <fsummary>Return a list of IP configuration parameters</fsummary> - <type> - <v>Par, Val -- see below</v> - </type> <desc> <p>Returns the state of the Inet configuration database in form of a list of recorded configuration parameters. (See the @@ -135,106 +142,129 @@ fe80::204:acff:fe17:bf38 </desc> </func> <func> - <name>format_error(Posix) -> string()</name> + <name name="format_error" arity="1"/> <fsummary>Return a descriptive string for an error reason</fsummary> - <type> - <v>Posix = posix()</v> - </type> <desc> <p>Returns a diagnostic error string. See the section below - for possible <c>Posix</c> values and the corresponding + for possible <c><anno>Posix</anno></c> values and the corresponding strings.</p> </desc> </func> <func> - <name>getaddr(Host, Family) -> {ok, Address} | {error, posix()}</name> + <name name="getaddr" arity="2"/> <fsummary>Return the IP-address for a host</fsummary> - <type> - <v>Host = ip_address() | string() | atom()</v> - <v>Family = inet | inet6</v> - <v>Address = ip_address()</v> - <v>posix() = term()</v> - </type> <desc> - <p>Returns the IP-address for <c>Host</c> as a tuple of - integers. <c>Host</c> can be an IP-address, a single hostname + <p>Returns the IP-address for <c><anno>Host</anno></c> as a tuple of + integers. <c><anno>Host</anno></c> can be an IP-address, a single hostname or a fully qualified hostname.</p> </desc> </func> <func> - <name>getaddrs(Host, Family) -> {ok, Addresses} | {error, posix()}</name> + <name name="getaddrs" arity="2"/> <fsummary>Return the IP-addresses for a host</fsummary> - <type> - <v>Host = ip_address() | string() | atom()</v> - <v>Addresses = [ip_address()]</v> - <v>Family = inet | inet6</v> - </type> <desc> - <p>Returns a list of all IP-addresses for <c>Host</c>. - <c>Host</c> can be an IP-address, a single hostname or a fully + <p>Returns a list of all IP-addresses for <c><anno>Host</anno></c>. + <c><anno>Host</anno></c> can be an IP-address, a single hostname or a fully qualified hostname.</p> </desc> </func> <func> - <name>gethostbyaddr(Address) -> {ok, Hostent} | {error, posix()}</name> + <name name="gethostbyaddr" arity="1"/> <fsummary>Return a hostent record for the host with the given address</fsummary> - <type> - <v>Address = string() | ip_address()</v> - <v>Hostent = #hostent{}</v> - </type> <desc> <p>Returns a <c>hostent</c> record given an address.</p> </desc> </func> <func> - <name>gethostbyname(Name) -> {ok, Hostent} | {error, posix()}</name> + <name name="gethostbyname" arity="1"/> <fsummary>Return a hostent record for the host with the given name</fsummary> - <type> - <v>Hostname = hostname()</v> - <v>Hostent = #hostent{}</v> - </type> <desc> <p>Returns a <c>hostent</c> record given a hostname.</p> </desc> </func> <func> - <name>gethostbyname(Name, Family) -> {ok, Hostent} | {error, posix()}</name> + <name name="gethostbyname" arity="2"/> <fsummary>Return a hostent record for the host with the given name</fsummary> - <type> - <v>Hostname = hostname()</v> - <v>Family = inet | inet6</v> - <v>Hostent = #hostent{}</v> - </type> <desc> <p>Returns a <c>hostent</c> record given a hostname, restricted to the given address family.</p> </desc> </func> <func> - <name>gethostname() -> {ok, Hostname}</name> + <name name="gethostname" arity="0"/> <fsummary>Return the local hostname</fsummary> - <type> - <v>Hostname = string()</v> - </type> <desc> <p>Returns the local hostname. Will never fail.</p> </desc> </func> + + <func> + <name name="getifaddrs" arity="0"/> + <fsummary>Return a list of interfaces and their addresses</fsummary> + <desc> + <p> + Returns a list of 2-tuples containing interface names and the + interface's addresses. <c><anno>Ifname</anno></c> is a Unicode string. + <c><anno>Hwaddr</anno></c> is hardware dependent, e.g on Ethernet interfaces + it is the 6-byte Ethernet address (MAC address (EUI-48 address)). + </p> + <p> + The <c>{addr,<anno>Addr</anno>}</c>, <c>{netmask,_}</c> and <c>{broadaddr,_}</c> + tuples are repeated in the result list iff the interface has multiple + addresses. If you come across an interface that has + multiple <c>{flag,_}</c> or <c>{hwaddr,_}</c> tuples you have + a really strange interface or possibly a bug in this function. + The <c>{flag,_}</c> tuple is mandatory, all other optional. + </p> + <p> + Do not rely too much on the order of <c><anno>Flag</anno></c> atoms or + <c><anno>Ifopt</anno></c> tuples. There are some rules, though: + <list> + <item> + Immediately after <c>{addr,_}</c> follows <c>{netmask,_}</c> + </item> + <item> + Immediately thereafter follows <c>{broadaddr,_}</c> if + the <c>broadcast</c> flag is <em>not</em> set and the + <c>pointtopoint</c> flag <em>is</em> set. + </item> + <item> + Any <c>{netmask,_}</c>, <c>{broadaddr,_}</c> or + <c>{dstaddr,_}</c> tuples that follow an <c>{addr,_}</c> + tuple concerns that address. + </item> + </list> + </p> + <p> + The <c>{hwaddr,_}</c> tuple is not returned on Solaris since the + hardware address historically belongs to the link layer and only + the superuser can read such addresses. + </p> + <p> + On Windows, the data is fetched from quite different OS API + functions, so the <c><anno>Netmask</anno></c> and <c><anno>Broadaddr</anno></c> + values may be calculated, just as some <c><anno>Flag</anno></c> values. + You have been warned. Report flagrant bugs. + </p> + </desc> + </func> + <func> - <name>getopts(Socket, Options) -> OptionValues | {error, posix()}</name> + <name>getopts(Socket, Options) -> {ok, OptionValues} | {error, posix()}</name> <fsummary>Get one or more options for a socket</fsummary> <type> <v>Socket = term()</v> <v>Options = [Opt | RawOptReq]</v> <v>Opt = atom()</v> <v>RawOptReq = {raw, Protocol, OptionNum, ValueSpec}</v> - <v>Protocol = int()</v> - <v>OptionNum = int()</v> + <v>Protocol = integer()</v> + <v>OptionNum = integer()</v> <v>ValueSpec = ValueSize | ValueBin</v> - <v>ValueSize = int()</v> + <v>ValueSize = integer()</v> <v>ValueBin = binary()</v> <v>OptionValues = [{Opt, Val} | {raw, Protocol, OptionNum, ValueBin}]</v> </type> + <type name="socket_getopt"/> <desc> <p>Gets one or more options for a socket. See <seealso marker="#setopts/2">setopts/2</seealso> @@ -356,37 +386,27 @@ fe80::204:acff:fe17:bf38 </func> <func> - <name>peername(Socket) -> {ok, {Address, Port}} | {error, posix()}</name> + <name name="peername" arity="1"/> <fsummary>Return the address and port for the other end of a connection</fsummary> - <type> - <v>Socket = socket()</v> - <v>Address = ip_address()</v> - <v>Port = int()</v> - </type> <desc> <p>Returns the address and port for the other end of a connection.</p> </desc> </func> <func> - <name>port(Socket) -> {ok, Port}</name> + <name>port(Socket) -> {ok, Port} | {error, any()}</name> <fsummary>Return the local port number for a socket</fsummary> <type> <v>Socket = socket()</v> - <v>Port = int()</v> + <v>Port = integer()</v> </type> <desc> <p>Returns the local port number for a socket.</p> </desc> </func> <func> - <name>sockname(Socket) -> {ok, {Address, Port}} | {error, posix()}</name> + <name name="sockname" arity="1"/> <fsummary>Return the local address and port number for a socket</fsummary> - <type> - <v>Socket = socket()</v> - <v>Address = ip_address()</v> - <v>Port = int()</v> - </type> <desc> <p>Returns the local address and port number for a socket.</p> </desc> @@ -397,8 +417,8 @@ fe80::204:acff:fe17:bf38 <type> <v>Socket = term()</v> <v>Options = [{Opt, Val} | {raw, Protocol, Option, ValueBin}]</v> - <v>Protocol = int()</v> - <v>OptionNum = int()</v> + <v>Protocol = integer()</v> + <v>OptionNum = integer()</v> <v>ValueBin = binary()</v> <v> Opt, Val -- see below</v> </type> diff --git a/lib/kernel/doc/src/inet_res.xml b/lib/kernel/doc/src/inet_res.xml index d8fe23544b..bf73ccf13d 100644 --- a/lib/kernel/doc/src/inet_res.xml +++ b/lib/kernel/doc/src/inet_res.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2009</year><year>2009</year> + <year>2009</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -76,64 +76,38 @@ query is tried for the <c>alt_nameservers</c>.</p> </section> - - - - <section> - <title>DATA TYPES</title> - <p>As defined in the module - <seealso marker="kernel:inet">inet</seealso>:</p> - <code type="none"> -hostent() = #hostent{} -posix() = some atom()s -ip_address() = tuple of integers of arity 4 or 8</code> - + <datatypes> <p>Resolver types:</p> - <code type="none">These correspond to resolver options: - -res_option() = - [ {alt_nameservers, [ nameserver() ]} - | {edns, 0 | false} % Use EDNS - | {inet6, bool()} % Return IPv6 addresses - | {nameservers, [ nameserver() ]} % List of nameservers - | {recurse, bool()} % Request server recursion - | {retry, integer()} % UDP retries - | {timeout, integer()} % UDP query timeout - | {udp_payload_size, integer()} % EDNS payload size - | {usevc, bool()} ] % Use TCP (Virtual Circuit) - -nameserver() = {ip_address(),Port} - Port = integer(1..65535) - -res_error() = - formerr | - qfmterror | - servfail | - nxdomain | - notimp | - refused | - badvers | - timeout -</code> - - <p>DNS types:</p> - <marker id="dns_types"/> - <code type="none">dns_name() = string() with no adjacent dots - -rr_type() = a | aaaa | cname | gid | hinfo | ns | mb | md | mg | mf - | minfo | mx | naptr | null | ptr | soa | spf | srv | txt - | uid | uinfo | unspec | wks - -query_type() = axfr | mailb | maila | any | rr_type() - -dns_class() = in | chaos | hs | any - + <datatype> + <name name="res_option"/> + </datatype> + <datatype> + <name name="nameserver"/> + </datatype> + <datatype> + <name name="res_error"/> + </datatype> + + <p><marker id="dns_types"/>DNS types:</p> + <datatype> + <name name="dns_name"/> + <desc><p>A string with no adjacent dots.</p></desc> + </datatype> + <datatype> + <name name="rr_type"/> + </datatype> + <datatype> + <name name="dns_class"/> + </datatype> + <datatype> + <name name="dns_msg"/> + <desc> + <p>This is the start of a hiearchy of opaque data structures + that can be examined with access functions in inet_dns that + return lists of {Field,Value} tuples. The arity 2 functions + just return the value for a given field. +<pre> dns_msg() = DnsMsg - This is the start of a hiearchy of opaque data structures - that can be examined with access functions in inet_dns - that return lists of {Field,Value} tuples. The arity 2 - functions just return the value for a given field. - inet_dns:msg(DnsMsg) -> [ {header, dns_header()} | {qdlist, dns_query()} @@ -143,19 +117,21 @@ dns_msg() = DnsMsg inet_dns:msg(DnsMsg, header) -> dns_header() % for example inet_dns:msg(DnsMsg, Field) -> Value -dhs_header() = DnsHeader +dns_header() = DnsHeader inet_dns:header(DnsHeader) -> [ {id, integer()} - | {qr, bool()} + | {qr, boolean()} | {opcode, 'query' | iquery | status | integer()} - | {aa, bool()} - | {tc, bool()} - | {rd, bool()} - | {ra, bool()} - | {pr, bool()} + | {aa, boolean()} + | {tc, boolean()} + | {rd, boolean()} + | {ra, boolean()} + | {pr, boolean()} | {rcode, integer(0..16)} ] inet_dns:header(DnsHeader, Field) -> Value +query_type() = axfr | mailb | maila | any | rr_type() + dns_query() = DnsQuery inet_dns:dns_query(DnsQuery) -> [ {domain, dns_name()} @@ -179,32 +155,6 @@ dns_rr() = DnsRr | {data, dns_data()} ] inet_dns:rr(DnsRr, Field) -> Value -dns_data() = % for dns_type() - [ dns_name() % ns, md, mf, cname, mb, mg, mr, ptr - | ip_address(v4) % a - | ip_address(v6) % aaaa - | {MName,RName,Serial,Refresh,Retry,Expiry,Minimum} % soa - | {ip_address(v4),Proto,BitMap} % wks - | {CpuString,OsString} % hinfo - | {RM,EM} % minfo - | {Prio,dns_name()} % mx - | {Prio,Weight,Port,dns_name()} % srv - | {Order,Preference,Flags,Services,Regexp,dns_name()} % naptr - | [ string() ] % txt, spf - | binary() ] % null, integer() -MName, RName = dns_name() -Serial, Refresh, Retry, Expiry, Minimum = integer(), -Proto = integer() -BitMap = binary() -CpuString, OsString = string() -RM = EM = dns_name() -Prio, Weight, Port = integer() -Order, Preference = integer() -Flags, Services = string(), -Regexp = string(utf8) - - - There is an info function for the types above: inet_dns:record_type(dns_msg()) -> msg; @@ -214,26 +164,25 @@ inet_dns:record_type(dns_rr()) -> rr; inet_dns:record_type(_) -> undefined. So; inet_dns:(inet_dns:record_type(X))(X) will convert -any of these data structures into a {Field,Value} list.</code> - </section> - +any of these data structures into a {Field,Value} list.</pre></p> + </desc> + </datatype> + <datatype> + <name name="dns_data"/> + <desc><p><c><anno>Regexp</anno></c> is a string with characters encoded in the + UTF-8 coding standard.</p> + </desc> + </datatype> + </datatypes> <funcs> <func> - <name>getbyname(Name, Type) -> {ok,hostent()} | {error,Reason}</name> - <name>getbyname(Name, Type, Timeout) -> - {ok,hostent()} | {error,Reason} - </name> + <name name="getbyname" arity="2"/> + <name name="getbyname" arity="3"/> <fsummary>Resolve a DNS record of the given type for the given host </fsummary> - <type> - <v>Name = dns_name()</v> - <v>Type = rr_type()</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Reason = posix() | res_error()</v> - </type> <desc> <p>Resolve a DNS record of the given type for the given host, of class <c>in</c>. On success returns a <c>hostent()</c> record with @@ -252,17 +201,10 @@ any of these data structures into a {Field,Value} list.</code> </func> <func> - <name>gethostbyaddr(Address) -> {ok,hostent()} | {error,Reason}</name> - <name>gethostbyaddr(Address, Timeout) -> - {ok,hostent()} | {error,Reason} - </name> + <name name="gethostbyaddr" arity="1"/> + <name name="gethostbyaddr" arity="2"/> <fsummary>Return a hostent record for the host with the given address </fsummary> - <type> - <v>Address = ip_address()</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Reason = posix() | res_error()</v> - </type> <desc> <p>Backend functions used by <seealso marker="kernel:inet#gethostbyaddr/1"> @@ -273,20 +215,11 @@ any of these data structures into a {Field,Value} list.</code> </func> <func> - <name>gethostbyname(Name) -> {ok,hostent()} | Reason}</name> - <name>gethostbyname(Name, Family) -> - {ok,hostent()} | {error,Reason}} - </name> - <name>gethostbyname(Name, Family, Timeout) -> - {ok,hostent()} | {error,Reason} - </name> + <name name="gethostbyname" arity="1"/> + <name name="gethostbyname" arity="2"/> + <name name="gethostbyname" arity="3"/> <fsummary>Return a hostent record for the host with the given name </fsummary> - <type> - <v>Name = dns_name()</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Reason = posix() | res_error()</v> - </type> <desc> <p>Backend functions used by <seealso marker="kernel:inet#gethostbyname/1"> @@ -305,26 +238,16 @@ any of these data structures into a {Field,Value} list.</code> </func> <func> - <name>lookup(Name, Class, Type) -> [ dns_data() ] - </name> - <name>lookup(Name, Class, Type, Opts) -> [ dns_data() ] - </name> - <name>lookup(Name, Class, Type, Opts, Timeout) -> [ dns_data() ] - </name> + <name name="lookup" arity="3"/> + <name name="lookup" arity="4"/> + <name name="lookup" arity="5"/> <fsummary>Resolve the DNS data for the record of the given type and class for the given name </fsummary> - <type> - <v>Name = dns_name() | ip_address()</v> - <v>Type = rr_type()</v> - <v>Opts = res_option() | verbose</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Reason = posix() | res_error()</v> - </type> <desc> <p>Resolve the DNS data for the record of the given type and class for the given name. On success filters out the answer records - with the correct <c>Class</c> and <c>Type</c> and returns + with the correct <c><anno>Class</anno></c> and <c><anno>Type</anno></c> and returns a list of their data fields. So a lookup for type <c>any</c> will give an empty answer since the answer records have specific types that are not <c>any</c>. An empty answer @@ -332,44 +255,33 @@ any of these data structures into a {Field,Value} list.</code> </p><p> Calls <seealso marker="#resolve/3">resolve/2..4</seealso> with the same arguments and filters the result, so - <c>Opts</c> is explained there. + <c><anno>Opts</anno></c> is explained there. </p> </desc> </func> <func> - <name>resolve(Name, Class, Type) -> {ok,dns_msg()} | Error - </name> - <name>resolve(Name, Class, Type, Opts) -> {ok,dns_msg()} | Error - </name> - <name>resolve(Name, Class, Type, Opts, Timeout) -> {ok,dns_msg()} | Error - </name> + <name name="resolve" arity="3"/> + <name name="resolve" arity="4"/> + <name name="resolve" arity="5"/> <fsummary>Resolve a DNS record of the given type and class for the given name </fsummary> - <type> - <v>Name = dns_name() | ip_address()</v> - <v>Type = rr_type()</v> - <v>Opts = res_option() | verbose | atom()</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Error = {error,Reason} | {error,{Reason,dns_msg()}}</v> - <v>Reason = posix() | res_error()</v> - </type> <desc> <p>Resolve a DNS record of the given type and class for the given name. The returned <c>dns_msg()</c> can be examined using access functions in <c>inet_db</c> as described in <seealso marker="#dns_types">DNS types</seealso>. </p><p> - If <c>Name</c> is an <c>ip_address()</c>, the domain name + If <c><anno>Name</anno></c> is an <c>ip_address()</c>, the domain name to query for is generated as the standard reverse ".IN-ADDR.ARPA." name for an IPv4 address, or the ".IP6.ARPA." name for an IPv6 address. In this case you most probably want to use - <c>Class = in</c> and <c>Type = ptr</c> but it + <c><anno>Class</anno> = in</c> and <c><anno>Type</anno> = ptr</c> but it is not done automatically. </p><p> - <c>Opts</c> override the corresponding resolver options. + <c><anno>Opts</anno></c> override the corresponding resolver options. If the option <c>nameservers</c> is given, it is also assumed that it is the complete list of nameserves, so the resolver option <c>alt_nameserves</c> is ignored. @@ -382,14 +294,14 @@ any of these data structures into a {Field,Value} list.</code> of queries, replies retransmissions, etc, similar to from utilities like <c>dig</c>, <c>nslookup</c> et.al. </p><p> - If <c>Opt</c> is an arbitrary atom it is interpreted - as <c>{Opt,true}</c> unless the atom string starts with - <c>"no"</c> making the interpretation <c>{Opt,false}</c>. + If <c><anno>Opt</anno></c> is an arbitrary atom it is interpreted + as <c>{<anno>Opt</anno>,true}</c> unless the atom string starts with + <c>"no"</c> making the interpretation <c>{<anno>Opt</anno>,false}</c>. For example: <c>usevc</c> is an alias for <c>{usevc,true}</c>, and <c>nousevc</c> an alias for <c>{usevc,false}</c>. </p><p> The <c>inet6</c> option currently has no effect on this function. - You probably want to use <c>Type = a | aaaa</c> instead. + You probably want to use <c><anno>Type</anno> = a | aaaa</c> instead. </p> </desc> </func> @@ -430,24 +342,18 @@ any of these data structures into a {Field,Value} list.</code> <funcs> <func> - <name>nslookup(Name, Class, Type) -> {ok,dns_msg()} | {error,Reason} - </name> - <name>nslookup(Name, Class, Type, Timeout) -> - {ok,dns_msg()} | {error,Reason} - </name> - <name>nslookup(Name, Class, Type, Nameservers) -> - {ok,dns_msg()} | {error,Reason} - </name> + <name name="nslookup" arity="3"/> + <name name="nslookup" arity="4" clause_i="1"/> + <name name="nslookup" arity="4" clause_i="2"/> <fsummary>Resolve a DNS record of the given type and class for the given name </fsummary> - <type> - <v>Name = dns_name() | ip_address()</v> - <v>Type = rr_type()</v> - <v>Nameservers = [ nameserver() ]</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Reason = posix() | res_error()</v> - </type> + <type variable="Name"/> + <type variable="Class"/> + <type variable="Type"/> + <type variable="Timeout" name_i="2"/> + <type variable="Nameservers"/> + <type variable="Reason"/> <desc> <p>Resolve a DNS record of the given type and class for the given name. </p> @@ -455,22 +361,11 @@ any of these data structures into a {Field,Value} list.</code> </func> <func> - <name>nnslookup(Name, Class, Type, Nameservers) -> - {ok,dns_msg()} | {error,posix()} - </name> - <name>nnslookup(Name, Class, Type, Nameservers, Timeout) -> - {ok,dns_msg()} | {error,posix()} - </name> + <name name="nnslookup" arity="4"/> + <name name="nnslookup" arity="5"/> <fsummary>Resolve a DNS record of the given type and class for the given name </fsummary> - <type> - <v>Name = dns_name() | ip_address()</v> - <v>Type = rr_type()</v> - <v>Nameservers = [ nameserver() ]</v> - <v>Timeout = integer() >= 0 | infinity</v> - <v>Reason = posix() | res_error()</v> - </type> <desc> <p>Resolve a DNS record of the given type and class for the given name. </p> diff --git a/lib/kernel/doc/src/net_adm.xml b/lib/kernel/doc/src/net_adm.xml index 7ec4f7f0e7..f2aac9282c 100644 --- a/lib/kernel/doc/src/net_adm.xml +++ b/lib/kernel/doc/src/net_adm.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -34,94 +34,70 @@ </description> <funcs> <func> - <name>dns_hostname(Host) -> {ok, Name} | {error, Host}</name> + <name name="dns_hostname" arity="1"/> <fsummary>Official name of a host</fsummary> - <type> - <v>Host = atom() | string()</v> - <v>Name = string()</v> - </type> <desc> - <p>Returns the official name of <c>Host</c>, or - <c>{error, Host}</c> if no such name is found. See also + <p>Returns the official name of <c><anno>Host</anno></c>, or + <c>{error, <anno>Host</anno>}</c> if no such name is found. See also <c>inet(3)</c>.</p> </desc> </func> <func> - <name>host_file() -> Hosts | {error, Reason}</name> + <name name="host_file" arity="0"/> <fsummary>Read the <c>.hosts.erlang</c>file</fsummary> - <type> - <v>Hosts = [Host]</v> - <v> Host = atom()</v> - <v>Reason = term()</v> - </type> <desc> <p>Reads the <c>.hosts.erlang</c> file, see the section <em>Files</em> below. Returns the hosts in this file as a - list, or returns <c>{error, Reason}</c> if the file could not - be read. See <c>file(3)</c> for possible values of - <c>Reason</c>.</p> + list, or returns <c>{error, <anno>Reason</anno>}</c> if the file could not + be read or the Erlang terms on the file could not be interpreted.</p> </desc> </func> <func> - <name>localhost() -> Name</name> + <name name="localhost" arity="0"/> <fsummary>Name of the local host</fsummary> - <type> - <v>Name = string()</v> - </type> <desc> <p>Returns the name of the local host. If Erlang was started - with the <c>-name</c> command line flag, <c>Name</c> is + with the <c>-name</c> command line flag, <c><anno>Name</anno></c> is the fully qualified name.</p> </desc> </func> <func> - <name>names() -> {ok, [{Name, Port}]} | {error, Reason}</name> - <name>names(Host) -> {ok, [{Name, Port}]} | {error, Reason}</name> + <name name="names" arity="0"/> + <name name="names" arity="1"/> <fsummary>Names of Erlang nodes at a host</fsummary> - <type> - <v>Name = string()</v> - <v>Port = int()</v> - <v>Reason = address | term()</v> - </type> <desc> <p>Similar to <c>epmd -names</c>, see <c>epmd(1)</c>. - <c>Host</c> defaults to the local host. Returns the names and + <c><anno>Host</anno></c> defaults to the local host. Returns the names and associated port numbers of the Erlang nodes that <c>epmd</c> at the specified host has registered.</p> <p>Returns <c>{error, address}</c> if <c>epmd</c> is not - running. See <c>inet(3)</c> for other possible values of - <c>Reason</c>.</p> + running.</p> <pre> (arne@dunn)1> <input>net_adm:names().</input> {ok,[{"arne",40262}]}</pre> </desc> </func> <func> - <name>ping(Node) -> pong | pang</name> + <name name="ping" arity="1"/> <fsummary>Set up a connection to a node</fsummary> - <type> - <v>Node = node()</v> - </type> <desc> - <p>Tries to set up a connection to <c>Node</c>. Returns + <p>Tries to set up a connection to <c><anno>Node</anno></c>. Returns <c>pang</c> if it fails, or <c>pong</c> if it is successful.</p> </desc> </func> <func> - <name>world() -> [node()]</name> - <name>world(Arg) -> [node()]</name> + <name name="world" arity="0"/> + <name name="world" arity="1"/> + <type name="verbosity"/> <fsummary>Lookup and connect to all nodes at all hosts in <c>.hosts.erlang</c></fsummary> - <type> - <v>Arg = silent | verbose</v> - </type> <desc> <p>This function calls <c>names(Host)</c> for all hosts which are specified in the Erlang host file <c>.hosts.erlang</c>, collects the replies and then evaluates <c>ping(Node)</c> on all those nodes. Returns the list of all nodes that were, successfully pinged.</p> - <p><c>Arg</c> defaults to <c>silent</c>. - If <c>Arg == verbose</c>, the function writes information about which + <p><c><anno>Arg</anno></c> defaults to <c>silent</c>. + If <c><anno>Arg</anno> == verbose</c>, the function writes information about which nodes it is pinging to stdout.</p> <p>This function can be useful when a node is started, and the names of the other nodes in the network are not initially @@ -131,14 +107,10 @@ </desc> </func> <func> - <name>world_list(Hosts) -> [node()]</name> - <name>world_list(Hosts, Arg) -> [node()]</name> + <name name="world_list" arity="1"/> + <name name="world_list" arity="2"/> + <type name="verbosity"/> <fsummary>Lookup and connect to all nodes at specified hosts</fsummary> - <type> - <v>Hosts = [Host]</v> - <v> Host = atom()</v> - <v>Arg = silent | verbose</v> - </type> <desc> <p>As <c>world/0,1</c>, but the hosts are given as argument instead of being read from <c>.hosts.erlang</c>.</p> diff --git a/lib/kernel/doc/src/net_kernel.xml b/lib/kernel/doc/src/net_kernel.xml index a18226e779..96e2aa665d 100644 --- a/lib/kernel/doc/src/net_kernel.xml +++ b/lib/kernel/doc/src/net_kernel.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -64,50 +64,38 @@ $ <input>erl -sname foobar</input></pre> </description> <funcs> <func> - <name>allow(Nodes) -> ok | error</name> + <name name="allow" arity="1"/> <fsummary>Limit access to a specified set of nodes</fsummary> - <type> - <v>Nodes = [node()]</v> - </type> <desc> <p>Limits access to the specified set of nodes. Any access - attempts made from (or to) nodes not in <c>Nodes</c> will be + attempts made from (or to) nodes not in <c><anno>Nodes</anno></c> will be rejected.</p> - <p>Returns <c>error</c> if any element in <c>Nodes</c> is not + <p>Returns <c>error</c> if any element in <c><anno>Nodes</anno></c> is not an atom.</p> </desc> </func> <func> - <name>connect_node(Node) -> true | false | ignored</name> + <name name="connect_node" arity="1"/> <fsummary>Establish a connection to a node</fsummary> - <type> - <v>Node = node()</v> - </type> <desc> - <p>Establishes a connection to <c>Node</c>. Returns <c>true</c> + <p>Establishes a connection to <c><anno>Node</anno></c>. Returns <c>true</c> if successful, <c>false</c> if not, and <c>ignored</c> if the local node is not alive.</p> </desc> </func> <func> - <name>monitor_nodes(Flag) -> ok | Error</name> - <name>monitor_nodes(Flag, Options) -> ok | Error</name> + <name name="monitor_nodes" arity="1"/> + <name name="monitor_nodes" arity="2"/> <fsummary>Subscribe to node status change messages</fsummary> - <type> - <v>Flag = true | false</v> - <v>Options = [Option]</v> - <v> Option -- see below</v> - <v>Error = error | {error, term()}</v> - </type> <desc> <p>The calling process subscribes or unsubscribes to node status change messages. A <c>nodeup</c> message is delivered to all subscribing process when a new node is connected, and a <c>nodedown</c> message is delivered when a node is disconnected.</p> - <p>If <c>Flag</c> is <c>true</c>, a new subscription is started. - If <c>Flag</c> is <c>false</c>, all previous subscriptions -- - started with the same <c>Options</c> -- are stopped. Two + <p>If <c><anno>Flag</anno></c> is <c>true</c>, a new subscription is started. + If <c><anno>Flag</anno></c> is <c>false</c>, all previous subscriptions -- + started with the same <c><anno>Options</anno></c> -- are stopped. Two option lists are considered the same if they contain the same set of options.</p> <p>As of <c>kernel</c> version 2.11.4, and <c>erts</c> version @@ -139,23 +127,23 @@ $ <input>erl -sname foobar</input></pre> <p>Note, that this is <em>not</em> guaranteed for <c>kernel</c> versions before 2.13.</p> <p>The format of the node status change messages depends on - <c>Options</c>. If <c>Options</c> is [], which is the default, + <c><anno>Options</anno></c>. If <c><anno>Options</anno></c> is [], which is the default, the format is:</p> <code type="none"> {nodeup, Node} | {nodedown, Node} Node = node()</code> - <p>If <c>Options /= []</c>, the format is:</p> + <p>If <c><anno>Options</anno> /= []</c>, the format is:</p> <code type="none"> {nodeup, Node, InfoList} | {nodedown, Node, InfoList} Node = node() InfoList = [{Tag, Val}]</code> <p><c>InfoList</c> is a list of tuples. Its contents depends on - <c>Options</c>, see below.</p> + <c><anno>Options</anno></c>, see below.</p> <p>Also, when <c>OptionList == []</c> only visible nodes, that is, nodes that appear in the result of <seealso marker="erts:erlang#nodes/0">nodes/0</seealso>, are monitored.</p> - <p><c>Option</c> can be any of the following:</p> + <p><c><anno>Option</anno></c> can be any of the following:</p> <taglist> <tag><c>{node_type, NodeType}</c></tag> <item> @@ -209,61 +197,51 @@ $ <input>erl -sname foobar</input></pre> </desc> </func> <func> - <name>get_net_ticktime() -> Res</name> + <name name="get_net_ticktime" arity="0"/> <fsummary>Get <c>net_ticktime</c></fsummary> - <type> - <v>Res = NetTicktime | {ongoing_change_to, NetTicktime}</v> - <v> NetTicktime = int()</v> - </type> <desc> <p>Gets <c>net_ticktime</c> (see <seealso marker="kernel_app">kernel(6)</seealso>).</p> - <p>Currently defined return values (<c>Res</c>):</p> + <p>Currently defined return values (<c><anno>Res</anno></c>):</p> <taglist> - <tag><c>NetTicktime</c></tag> + <tag><c><anno>NetTicktime</anno></c></tag> <item> - <p><c>net_ticktime</c> is <c>NetTicktime</c> seconds.</p> + <p><c>net_ticktime</c> is <c><anno>NetTicktime</anno></c> seconds.</p> </item> - <tag><c>{ongoing_change_to, NetTicktime}</c></tag> + <tag><c>{ongoing_change_to, <anno>NetTicktime</anno>}</c></tag> <item> <p><c>net_kernel</c> is currently changing - <c>net_ticktime</c> to <c>NetTicktime</c> seconds.</p> + <c>net_ticktime</c> to <c><anno>NetTicktime</anno></c> seconds.</p> </item> </taglist> </desc> </func> <func> - <name>set_net_ticktime(NetTicktime) -> Res</name> - <name>set_net_ticktime(NetTicktime, TransitionPeriod) -> Res</name> + <name name="set_net_ticktime" arity="1"/> + <name name="set_net_ticktime" arity="2"/> <fsummary>Set <c>net_ticktime</c></fsummary> - <type> - <v>NetTicktime = int() > 0</v> - <v>TransitionPeriod = int() >= 0</v> - <v>Res = unchanged | change_initiated | {ongoing_change_to, NewNetTicktime}</v> - <v> NewNetTicktime = int() > 0</v> - </type> <desc> <p>Sets <c>net_ticktime</c> (see <seealso marker="kernel_app">kernel(6)</seealso>) to - <c>NetTicktime</c> seconds. <c>TransitionPeriod</c> defaults + <c><anno>NetTicktime</anno></c> seconds. <c><anno>TransitionPeriod</anno></c> defaults to 60.</p> <p>Some definitions:</p> <p></p> <taglist> <tag>The minimum transition traffic interval (<c>MTTI</c>)</tag> <item> - <p><c>minimum(NetTicktime, PreviousNetTicktime)*1000 div 4</c> milliseconds.</p> + <p><c>minimum(<anno>NetTicktime</anno>, PreviousNetTicktime)*1000 div 4</c> milliseconds.</p> </item> <tag>The transition period</tag> <item> <p>The time of the least number of consecutive <c>MTTI</c>s - to cover <c>TransitionPeriod</c> seconds following + to cover <c><anno>TransitionPeriod</anno></c> seconds following the call to <c>set_net_ticktime/2</c> (i.e. - ((<c>TransitionPeriod*1000 - 1) div MTTI + 1)*MTTI</c> + ((<c><anno>TransitionPeriod</anno>*1000 - 1) div MTTI + 1)*MTTI</c> milliseconds).</p> </item> </taglist> - <p>If <c><![CDATA[NetTicktime < PreviousNetTicktime]]></c>, the actual + <p>If <c><![CDATA[<anno>NetTicktime</anno> < PreviousNetTicktime]]></c>, the actual <c>net_ticktime</c> change will be done at the end of the transition period; otherwise, at the beginning. During the transition period, <c>net_kernel</c> will ensure that @@ -271,7 +249,7 @@ $ <input>erl -sname foobar</input></pre> every <c>MTTI</c> millisecond.</p> <note> <p>The <c>net_ticktime</c> changes have to be initiated on all - nodes in the network (with the same <c>NetTicktime</c>) + nodes in the network (with the same <c><anno>NetTicktime</anno></c>) before the end of any transition period on any node; otherwise, connections may erroneously be disconnected.</p> </note> @@ -280,18 +258,18 @@ $ <input>erl -sname foobar</input></pre> <tag><c>unchanged</c></tag> <item> <p><c>net_ticktime</c> already had the value of - <c>NetTicktime</c> and was left unchanged.</p> + <c><anno>NetTicktime</anno></c> and was left unchanged.</p> </item> <tag><c>change_initiated</c></tag> <item> <p><c>net_kernel</c> has initiated the change of - <c>net_ticktime</c> to <c>NetTicktime</c> seconds.</p> + <c>net_ticktime</c> to <c><anno>NetTicktime</anno></c> seconds.</p> </item> - <tag><c>{ongoing_change_to, NewNetTicktime}</c></tag> + <tag><c>{ongoing_change_to, <anno>NewNetTicktime</anno>}</c></tag> <item> <p>The request was <em>ignored</em>; because, <c>net_kernel</c> was busy changing <c>net_ticktime</c> to - <c>NewTicktime</c> seconds.</p> + <c><anno>NewNetTicktime</anno></c> seconds.</p> </item> </taglist> </desc> @@ -315,7 +293,7 @@ $ <input>erl -sname foobar</input></pre> </desc> </func> <func> - <name>stop() -> ok | {error, not_allowed | not_found}</name> + <name name="stop" arity="0"/> <fsummary>Turn a node into a non-distributed Erlang runtime system</fsummary> <desc> <p>Turns a distributed node into a non-distributed node. For diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml index 5467cd8cde..e325443f6c 100644 --- a/lib/kernel/doc/src/notes.xml +++ b/lib/kernel/doc/src/notes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2004</year><year>2010</year> + <year>2004</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -30,11 +30,218 @@ </header> <p>This document describes the changes made to the Kernel application.</p> -<section><title>Kernel 2.13.5.4</title> +<section><title>Kernel 2.14.4</title> <section><title>Fixed Bugs and Malfunctions</title> <list> <item> + <p> + The send_timeout option in gen_tcp did not work properly + in active mode or with {active,once} options. This is now + corrected.</p> + <p> + Own Id: OTP-9145</p> + </item> + <item> + <p> + Fixed various typos across the documentation (Thanks to + Tuncer Ayaz)</p> + <p> + Own Id: OTP-9154</p> + </item> + <item> + <p> + Fix typo in doc of rpc:pmap/3 (Thanks to Ricardo + Catalinas Jim�nez)</p> + <p> + Own Id: OTP-9168</p> + </item> + <item> + <p> + A bug in inet_res, the specialized DNS resolver, has been + corrected. A late answer with unfortunate timing could + cause a runtime exception. Some code cleanup and + improvements also tagged along. Thanks to Evegeniy + Khramtsov for a pinpointing bug report and bug fix + testing.</p> + <p> + Own Id: OTP-9221 Aux Id: OTP-8712 </p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> Types and specifications have been added. </p> + <p> + Own Id: OTP-9268</p> + </item> + <item> + <p> Erlang types and specifications are used for + documentation. </p> + <p> + Own Id: OTP-9272</p> + </item> + <item> + <p> Two opaque types that could cause warnings when + running Dialyzer have been modified. </p> + <p> + Own Id: OTP-9337</p> + </item> + </list> + </section> + +</section> + +<section><title>Kernel 2.14.3</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + <c>os:find_executable/{1,2}</c> will no longer return the + path of a directory that happens to be in the PATH.</p> + <p> + Own Id: OTP-8983 Aux Id: seq11749 </p> + </item> + <item> + <p> + Fix -spec for file:write_file/3</p> + <p> + Change type for second parameter from binary() to + iodata(), since the function explicitly takes steps to + accept lists as well as binaries. (thanks to Magnus + Henoch).</p> + <p> + Own Id: OTP-9067</p> + </item> + <item> + <p> + Sanitize the specs of the code module</p> + <p> + After the addition of unicode_binary() to the + file:filename() type, dialyzer started complaining about + erroneous or incomplete specs in some functions of the + 'code' module. The culprit was hard-coded information in + erl_bif_types for functions of this module, which were + not updated. Since these functions have proper specs + these days and code duplication (pun intended) is never a + good idea, their type information was removed from + erl_bif_types.</p> + <p> + While doing this, some erroneous comments were fixed in + the code module and also made sure that the code now runs + without dialyzer warnings even when the + -Wunmatched_returns option is used.</p> + <p> + Some cleanups were applied to erl_bif_types too.</p> + <p> + Own Id: OTP-9100</p> + </item> + <item> + <p> + - Add spec for function that does not return - Strenghen + spec - Introduce types to avoid duplication in specs - + Add specs for functions that do not return - Add specs + for behaviour callbacks - Simplify two specs</p> + <p> + Own Id: OTP-9127</p> + </item> + </list> + </section> + +</section> + +<section><title>Kernel 2.14.2</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The Erlang VM now supports Unicode filenames. The feature + is turned on by default on systems where Unicode + filenames are mandatory (Windows and MacOSX), but can be + enabled on other systems with the '+fnu' emulator option. + Enabling the Unicode filename feature on systems where it + is not default is however considered experimental and not + to be used for production. Together with the Unicode file + name support, the concept of "raw filenames" is + introduced, which means filenames provided without + implicit unicode encoding translation. Raw filenames are + provided as binaries, not lists. For further information, + see stdlib users guide and the chapter about using + Unicode in Erlang. Also see the file module manual page.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8887</p> + </item> + <item> + <p> + There is now a new function inet:getifaddrs/0 modeled + after C library function getifaddrs() on BSD and LInux + that reports existing interfaces and their addresses on + the host. This replaces the undocumented and unsupported + inet:getiflist/0 and inet:ifget/2.</p> + <p> + Own Id: OTP-8926</p> + </item> + </list> + </section> + +</section> + +<section><title>Kernel 2.14.1.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>In embedded mode, on_load handlers that called + <c>code:priv_dir/1</c> or other functions in <c>code</c> + would hang the system. Since the <c>crypto</c> + application now contains an on_loader handler that calls + <c>code:priv_dir/1</c>, including the <c>crypto</c> + application in the boot file would prevent the system + from starting.</p> + <p>Also extended the <c>-init_debug</c> option to print + information about on_load handlers being run to + facilitate debugging.</p> + <p> + Own Id: OTP-8902 Aux Id: seq11703 </p> + </item> + </list> + </section> + +</section> + +<section><title>Kernel 2.14.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Fixed: inet:setopts(S, [{linger,{true,2}}]) returned + {error,einval} for SCTP sockets. The inet_drv had a bug + when checking the option size.</p> + <p> + Own Id: OTP-8726 Aux Id: seq11617 </p> + </item> + <item> + <p> + gen_udp:connect/3 was broken for SCTP enabled builds. It + did not detect remote end errors as it should.</p> + <p> + Own Id: OTP-8729</p> + </item> + <item> + <p>reference() has been substituted for ref() in the + documentation.</p> + <p> + Own Id: OTP-8733</p> + </item> + <item> <p>A bug introduced in kernel-2.13.5.3 has been fixed. If running <c>net_kernel:set_net_ticktime/1</c> twice within the <c>TransitionPerod</c> the second call caused the @@ -42,6 +249,150 @@ <p> Own Id: OTP-8787 Aux Id: seq11657, OTP-8643 </p> </item> + <item> + <p> + inet:getsockopt for SCTP sctp_default_send_param had a + bug to not initialize required feilds causing random + answers. It is now corrected.</p> + <p> + Own Id: OTP-8795 Aux Id: seq11655 </p> + </item> + <item> + <p>For a socket in the HTTP packet mode, the return value + from <c>gen_tcp:recv/2,3</c> if there is an error in the + header will be <c>{ok,{http_error,String}}</c> instead of + <c>{error,{http_error,String}}</c> to be consistent with + <c>ssl:recv/2,3</c>.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-8831</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Even when configuring erlang with --enable-native-libs, + the native code for modules loaded very early (such as + lists) would not get loaded. This has been corrected. + (Thanks to Paul Guyot.)</p> + <p> + Own Id: OTP-8750</p> + </item> + <item> + <p> + The undocumented function inet:ifget/2 has been improved + to return interface hardware address (MAC) on platforms + supporting getaddrinfo() (such as BSD unixes). Note it + still does not work on all platforms for example not + Windows nor Solaris, so the function is still + undocumented.</p> + <p> + Buffer overflow and field init bugs for inet:ifget/2 and + inet:getservbyname/2 has also been fixed.</p> + <p> + Thanks to Michael Santos.</p> + <p> + Own Id: OTP-8816</p> + </item> + <item> + <p> + As a usability improvement the 'inet6' option to + functions gen_tcp:listen/2, gen_tcp:connect/3-4, + gen_udp:open/2 and gen_sctp:open/1-2 is now implicit if + the address argument or the 'ip' option contain an IPv6 + address (8-tuple).</p> + <p> + Own Id: OTP-8822</p> + </item> + </list> + </section> + +</section> + +<section><title>Kernel 2.14</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + os:find_executable can now be fed with the complete name + of the executable on Windows and still find it. I.e + os:find_executable("werl.exe") will work as + os:find_executable("werl").</p> + <p> + Own Id: OTP-3626</p> + </item> + <item> + <p> + The shell's line editing has been improved to more + resemble the behaviour of readline and other shells. + (Thanks to Dave Peticolas)</p> + <p> + Own Id: OTP-8635</p> + </item> + <item> + <p>Under certain circumstances the net kernel could hang. + (Thanks to Scott Lystig Fritchie.)</p> + <p> + Own Id: OTP-8643 Aux Id: seq11584 </p> + </item> + <item> + <p> + The kernel DNS resolver was leaking one or two ports if + the DNS reply could not be parsed or if the resolver(s) + caused noconnection type errors. Bug now fixed. A DNS + specification borderline truncated reply triggering the + port leakage bug has also been fixed.</p> + <p> + Own Id: OTP-8652</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>As of this version, the global name server no longer + supports nodes running Erlang/OTP R11B.</p> + <p> + Own Id: OTP-8527</p> + </item> + <item> + <p> + The file module's functions write,read and read_line now + handles named io_servers like 'standard_io' and + 'standard_error' correctly.</p> + <p> + Own Id: OTP-8611</p> + </item> + <item> + <p> + The functions file:advise/4 and file:datasync/1 have been + added. (Thanks to Filipe David Manana.)</p> + <p> + Own Id: OTP-8637</p> + </item> + <item> + <p>When exchanging groups between nodes <c>pg2</c> did + not remove duplicated members. This bug was introduced in + R13B03 (kernel-2.13.4).</p> + <p> + Own Id: OTP-8653</p> + </item> + <item> + <p> + There is a new option 'exclusive' to file:open/2 that + uses the OS O_EXCL flag where supported to open the file + in exclusive mode.</p> + <p> + Own Id: OTP-8670</p> + </item> </list> </section> diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml index 2c9cc33eb7..56fc1834ec 100644 --- a/lib/kernel/doc/src/os.xml +++ b/lib/kernel/doc/src/os.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -38,13 +38,10 @@ </description> <funcs> <func> - <name>cmd(Command) -> string()</name> + <name name="cmd" arity="1"/> <fsummary>Execute a command in a shell of the target OS</fsummary> - <type> - <v>Command = string() | atom()</v> - </type> <desc> - <p>Executes <c>Command</c> in a command shell of the target OS, + <p>Executes <c><anno>Command</anno></c> in a command shell of the target OS, captures the standard output of the command and returns this result as a string. This function is a replacement of the previous <c>unix:cmd/1</c>; on a Unix platform they are @@ -60,23 +57,18 @@ DirOut = os:cmd("dir"), % on Win32 platform</code> </desc> </func> <func> - <name>find_executable(Name) -> Filename | false</name> - <name>find_executable(Name, Path) -> Filename | false</name> + <name name="find_executable" arity="1"/> + <name name="find_executable" arity="2"/> <fsummary>Absolute filename of a program</fsummary> - <type> - <v>Name = string()</v> - <v>Path = string()</v> - <v>Filename = string()</v> - </type> <desc> <p>These two functions look up an executable program given its name and a search path, in the same way as the underlying operating system. <c>find_executable/1</c> uses the current execution path (that is, the environment variable PATH on Unix and Windows).</p> - <p><c>Path</c>, if given, should conform to the syntax of + <p><c><anno>Path</anno></c>, if given, should conform to the syntax of execution paths on the operating system. The absolute - filename of the executable program <c>Name</c> is returned, + filename of the executable program <c><anno>Name</anno></c> is returned, or <c>false</c> if the program was not found.</p> </desc> </func> @@ -137,7 +129,7 @@ DirOut = os:cmd("dir"), % on Win32 platform</code> <name>timestamp() -> {MegaSecs, Secs, MicroSecs}</name> <fsummary>Returna a timestamp from the OS in the erlang:now/0 format</fsummary> <type> - <v>MegaSecs = Secs = MicroSecs = int()</v> + <v>MegaSecs = Secs = MicroSecs = integer() >= 0</v> </type> <desc> <p>Returns a tuple in the same format as <seealso marker="erts:erlang#now/0">erlang:now/0</seealso>. The difference is that this function returns what the operating system thinks (a.k.a. the wall clock time) without any attempts at time correction. The result of two different calls to this function is <em>not</em> guaranteed to be different.</p> @@ -165,19 +157,15 @@ format_utc_timestamp() -> </desc> </func> <func> - <name>type() -> {Osfamily, Osname} | Osfamily</name> + <name name="type" arity="0"/> <fsummary>Return the OS family and, in some cases, OS name of the current operating system</fsummary> - <type> - <v>Osfamily = win32 | unix | vxworks</v> - <v>Osname = atom()</v> - </type> <desc> - <p>Returns the <c>Osfamily</c> and, in some cases, <c>Osname</c> + <p>Returns the <c><anno>Osfamily</anno></c> and, in some cases, <c><anno>Osname</anno></c> of the current operating system.</p> - <p>On Unix, <c>Osname</c> will have same value as + <p>On Unix, <c><anno>Osname</anno></c> will have same value as <c>uname -s</c> returns, but in lower case. For example, on Solaris 1 and 2, it will be <c>sunos</c>.</p> - <p>In Windows, <c>Osname</c> will be either <c>nt</c> (on + <p>In Windows, <c><anno>Osname</anno></c> will be either <c>nt</c> (on Windows NT), or <c>windows</c> (on Windows 95).</p> <p>On VxWorks the OS family alone is returned, that is <c>vxworks</c>.</p> @@ -185,17 +173,13 @@ format_utc_timestamp() -> <p>Think twice before using this function. Use the <c>filename</c> module if you want to inspect or build file names in a portable way. - Avoid matching on the <c>Osname</c> atom.</p> + Avoid matching on the <c><anno>Osname</anno></c> atom.</p> </note> </desc> </func> <func> - <name>version() -> {Major, Minor, Release} | VersionString</name> + <name name="version" arity="0"/> <fsummary>Return the Operating System version</fsummary> - <type> - <v>Major = Minor = Release = integer()</v> - <v>VersionString = string()</v> - </type> <desc> <p>Returns the operating system version. On most systems, this function returns a tuple, but a string diff --git a/lib/kernel/doc/src/part_notes_history.xml b/lib/kernel/doc/src/part_notes_history.xml index 07c7e4abea..a73cc911b8 100644 --- a/lib/kernel/doc/src/part_notes_history.xml +++ b/lib/kernel/doc/src/part_notes_history.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2006</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/pg2.xml b/lib/kernel/doc/src/pg2.xml index 7463fd10f5..d26ff0fc6b 100644 --- a/lib/kernel/doc/src/pg2.xml +++ b/lib/kernel/doc/src/pg2.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -60,13 +60,16 @@ to avoid name clashes.</p> </warning> </description> + <datatypes> + <datatype> + <name name="name"/> + <desc><p>The name of a process group.</p></desc> + </datatype> + </datatypes> <funcs> <func> - <name>create(Name) -> void()</name> + <name name="create" arity="1"/> <fsummary>Create a new, empty process group</fsummary> - <type> - <v>Name = term()</v> - </type> <desc> <p>Creates a new, empty process group. The group is globally visible on all nodes. If the group exists, nothing happens. @@ -74,24 +77,16 @@ </desc> </func> <func> - <name>delete(Name) -> void()</name> + <name name="delete" arity="1"/> <fsummary>Delete a process group</fsummary> - <type> - <v>Name = term()</v> - </type> <desc> <p>Deletes a process group. </p> </desc> </func> <func> - <name>get_closest_pid(Name) -> Pid | {error, Reason}</name> + <name name="get_closest_pid" arity="1"/> <fsummary>Common dispatch function</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Reason = {no_process, Name} | {no_such_group, Name}</v> - </type> <desc> <p>This is a useful dispatch function which can be used from client functions. It returns a process on the local node, if @@ -100,13 +95,8 @@ </desc> </func> <func> - <name>get_members(Name) -> [Pid] | {error, Reason}</name> + <name name="get_members" arity="1"/> <fsummary>Return all processes in a group</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Reason = {no_such_group, Name}</v> - </type> <desc> <p>Returns all processes in the group <c>Name</c>. This function should be used from within a client function that @@ -115,13 +105,8 @@ </desc> </func> <func> - <name>get_local_members(Name) -> [Pid] | {error, Reason}</name> + <name name="get_local_members" arity="1"/> <fsummary>Return all local processes in a group</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Reason = {no_such_group, Name}</v> - </type> <desc> <p>Returns all processes running on the local node in the group <c>Name</c>. This function should to be used from @@ -131,13 +116,8 @@ </desc> </func> <func> - <name>join(Name, Pid) -> ok | {error, Reason}</name> + <name name="join" arity="2"/> <fsummary>Join a process to a group</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Reason = {no_such_group, Name}</v> - </type> <desc> <p>Joins the process <c>Pid</c> to the group <c>Name</c>. A process can join a group several times; it must then @@ -146,13 +126,8 @@ </desc> </func> <func> - <name>leave(Name, Pid) -> ok | {error, Reason}</name> + <name name="leave" arity="2"/> <fsummary>Make a process leave a group</fsummary> - <type> - <v>Name = term()</v> - <v>Pid = pid()</v> - <v>Reason = {no_such_group, Name}</v> - </type> <desc> <p>Makes the process <c>Pid</c> leave the group <c>Name</c>. If the process is not a member of the group, <c>ok</c> is @@ -161,24 +136,17 @@ </desc> </func> <func> - <name>which_groups() -> [Name]</name> + <name name="which_groups" arity="0"/> <fsummary>Return a list of all known groups</fsummary> - <type> - <v>Name = term()</v> - </type> <desc> <p>Returns a list of all known groups. </p> </desc> </func> <func> - <name>start()</name> - <name>start_link() -> {ok, Pid} | {error, Reason}</name> + <name name="start" arity="0"/> + <name name="start_link" arity="0"/> <fsummary>Start the pg2 server</fsummary> - <type> - <v>Pid = pid()</v> - <v>Reason = term()</v> - </type> <desc> <p>Starts the pg2 server. Normally, the server does not need to be started explicitly, as it is started dynamically if it diff --git a/lib/kernel/doc/src/rpc.xml b/lib/kernel/doc/src/rpc.xml index 86c6ea9178..b01ff16c85 100644 --- a/lib/kernel/doc/src/rpc.xml +++ b/lib/kernel/doc/src/rpc.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2009</year> + <year>1996</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -37,40 +37,34 @@ for collecting information on a remote node, or for running a function with some specific side effects on the remote node.</p> </description> + <datatypes> + <datatype> + <name name="key"/> + <desc> + <p>As returned by <seealso marker="#async_call/4"> + <c>async_call/4</c>.</seealso></p> + </desc> + </datatype> + </datatypes> <funcs> <func> - <name>call(Node, Module, Function, Args) -> Res | {badrpc, Reason}</name> + <name name="call" arity="4"/> <fsummary>Evaluate a function call on a node</fsummary> - <type> - <v>Node = node()</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Res = term()</v> - <v>Reason = term()</v> - </type> <desc> - <p>Evaluates <c>apply(Module, Function, Args)</c> on the node - <c>Node</c> and returns the corresponding value <c>Res</c>, or - <c>{badrpc, Reason}</c> if the call fails.</p> + <p>Evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on the node + <c><anno>Node</anno></c> and returns the corresponding value <c><anno>Res</anno></c>, or + <c>{badrpc, <anno>Reason</anno>}</c> if the call fails.</p> </desc> </func> <func> - <name>call(Node, Module, Function, Args, Timeout) -> Res | {badrpc, Reason}</name> + <name name="call" arity="5"/> <fsummary>Evaluate a function call on a node</fsummary> - <type> - <v>Node = node()</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Res = term()</v> - <v>Reason = timeout | term()</v> - <v>Timeout = int() | infinity</v> - </type> <desc> - <p>Evaluates <c>apply(Module, Function, Args)</c> on the node - <c>Node</c> and returns the corresponding value <c>Res</c>, or - <c>{badrpc, Reason}</c> if the call fails. <c>Timeout</c> is + <p>Evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on the node + <c><anno>Node</anno></c> and returns the corresponding value <c><anno>Res</anno></c>, or + <c>{badrpc, <anno>Reason</anno>}</c> if the call fails. <c><anno>Timeout</anno></c> is a timeout value in milliseconds. If the call times out, - <c>Reason</c> is <c>timeout</c>.</p> + <c><anno>Reason</anno></c> is <c>timeout</c>.</p> <p>If the reply arrives after the call times out, no message will contaminate the caller's message queue, since this function spawns off a middleman process to act as (a void) @@ -80,17 +74,10 @@ </desc> </func> <func> - <name>block_call(Node, Module, Function, Args) -> Res | {badrpc, Reason}</name> + <name name="block_call" arity="4"/> <fsummary>Evaluate a function call on a node in the RPC server's context</fsummary> - <type> - <v>Node = node()</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Res = term()</v> - <v>Reason = term()</v> - </type> <desc> - <p>Like <c>call/4</c>, but the RPC server at <c>Node</c> does + <p>Like <c>call/4</c>, but the RPC server at <c><anno>Node</anno></c> does not create a separate process to handle the call. Thus, this function can be used if the intention of the call is to block the RPC server from any other incoming requests until @@ -101,50 +88,31 @@ </desc> </func> <func> - <name>block_call(Node, Module, Function, Args, Timeout) -> Res | {badrpc, Reason}</name> + <name name="block_call" arity="5"/> <fsummary>Evaluate a function call on a node in the RPC server's context</fsummary> - <type> - <v>Node = node()</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Timeout = int() | infinity</v> - <v>Res = term()</v> - <v>Reason = term()</v> - </type> <desc> <p>Like <c>block_call/4</c>, but with a timeout value in the same manner as <c>call/5</c>.</p> </desc> </func> <func> - <name>async_call(Node, Module, Function, Args) -> Key</name> + <name name="async_call" arity="4"/> <fsummary>Evaluate a function call on a node, asynchronous version</fsummary> - <type> - <v>Node = node()</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Key -- see below</v> - </type> <desc> <p>Implements <em>call streams with promises</em>, a type of RPC which does not suspend the caller until the result is finished. Instead, a key is returned which can be used at a later stage to collect the value. The key can be viewed as a promise to deliver the answer.</p> - <p>In this case, the key <c>Key</c> is returned, which can be + <p>In this case, the key <c><anno>Key</anno></c> is returned, which can be used in a subsequent call to <c>yield/1</c> or <c>nb_yield/1,2</c> to retrieve the value of evaluating - <c>apply(Module, Function, Args)</c> on the node <c>Node</c>.</p> + <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on the node <c><anno>Node</anno></c>.</p> </desc> </func> <func> - <name>yield(Key) -> Res | {badrpc, Reason}</name> + <name name="yield" arity="1"/> <fsummary>Deliver the result of evaluating a function call on a node (blocking)</fsummary> - <type> - <v>Key -- see async_call/4</v> - <v>Res = term()</v> - <v>Reason = term()</v> - </type> <desc> <p>Returns the promised answer from a previous <c>async_call/4</c>. If the answer is available, it is @@ -153,87 +121,46 @@ </desc> </func> <func> - <name>nb_yield(Key) -> {value, Val} | timeout</name> + <name name="nb_yield" arity="1"/> <fsummary>Deliver the result of evaluating a function call on a node (non-blocking)</fsummary> - <type> - <v>Key -- see async_call/4</v> - <v>Val = Res | {badrpc, Reason}</v> - <v> Res = term()</v> - <v> Reason = term()</v> - </type> <desc> - <p>Equivalent to <c>nb_yield(Key, 0)</c>.</p> + <p>Equivalent to <c>nb_yield(<anno>Key</anno>, 0)</c>.</p> </desc> </func> <func> - <name>nb_yield(Key, Timeout) -> {value, Val} | timeout</name> + <name name="nb_yield" arity="2"/> <fsummary>Deliver the result of evaluating a function call on a node (non-blocking)</fsummary> - <type> - <v>Key -- see async_call/4</v> - <v>Timeout = int() | infinity</v> - <v>Val = Res | {badrpc, Reason}</v> - <v> Res = term()</v> - <v> Reason = term()</v> - </type> <desc> <p>This is a non-blocking version of <c>yield/1</c>. It returns - the tuple <c>{value, Val}</c> when the computation has - finished, or <c>timeout</c> when <c>Timeout</c> milliseconds + the tuple <c>{value, <anno>Val</anno>}</c> when the computation has + finished, or <c>timeout</c> when <c><anno>Timeout</anno></c> milliseconds has elapsed.</p> </desc> </func> <func> - <name>multicall(Module, Function, Args) -> {ResL, BadNodes}</name> + <name name="multicall" arity="3"/> <fsummary>Evaluate a function call on a number of nodes</fsummary> - <type> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>ResL = [term()]</v> - <v>BadNodes = [node()]</v> - </type> <desc> - <p>Equivalent to <c>multicall([node()|nodes()], Module, Function, Args, infinity)</c>.</p> + <p>Equivalent to <c>multicall([node()|nodes()], <anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>, infinity)</c>.</p> </desc> </func> <func> - <name>multicall(Nodes, Module, Function, Args) -> {ResL, BadNodes}</name> + <name name="multicall" arity="4" clause_i="1"/> <fsummary>Evaluate a function call on a number of nodes</fsummary> - <type> - <v>Nodes = [node()]</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>ResL = [term()]</v> - <v>BadNodes = [node()]</v> - </type> <desc> - <p>Equivalent to <c>multicall(Nodes, Module, Function, Args, infinity)</c>.</p> + <p>Equivalent to <c>multicall(<anno>Nodes</anno>, <anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>, infinity)</c>.</p> </desc> </func> <func> - <name>multicall(Module, Function, Args, Timeout) -> {ResL, BadNodes}</name> + <name name="multicall" arity="4" clause_i="2"/> <fsummary>Evaluate a function call on a number of nodes</fsummary> - <type> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Timeout = int() | infinity</v> - <v>ResL = [term()]</v> - <v>BadNodes = [node()]</v> - </type> <desc> - <p>Equivalent to <c>multicall([node()|nodes()], Module, Function, Args, Timeout)</c>.</p> + <p>Equivalent to <c>multicall([node()|nodes()], <anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>, <anno>Timeout</anno>)</c>.</p> </desc> </func> <func> - <name>multicall(Nodes, Module, Function, Args, Timeout) -> {ResL, BadNodes}</name> + <name name="multicall" arity="5"/> <fsummary>Evaluate a function call on a number of nodes</fsummary> - <type> - <v>Nodes = [node()]</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - <v>Timeout = int() | infinity</v> - <v>ResL = [term()]</v> - <v>BadNodes = [node()]</v> - </type> <desc> <p>In contrast to an RPC, a multicall is an RPC which is sent concurrently from one client to multiple servers. This is @@ -243,12 +170,12 @@ making a series of RPCs on all the nodes, but the multicall is faster as all the requests are sent at the same time and are collected one by one as they come back.</p> - <p>The function evaluates <c>apply(Module, Function, Args)</c> + <p>The function evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on the specified nodes and collects the answers. It returns - <c>{ResL, Badnodes}</c>, where <c>Badnodes</c> is a list + <c>{<anno>ResL</anno>, <anno>BadNodes</anno>}</c>, where <c><anno>BadNodes</anno></c> is a list of the nodes that terminated or timed out during computation, - and <c>ResL</c> is a list of the return values. - <c>Timeout</c> is a time (integer) in milliseconds, or + and <c><anno>ResL</anno></c> is a list of the return values. + <c><anno>Timeout</anno></c> is a time (integer) in milliseconds, or <c>infinity</c>.</p> <p>The following example is useful when new object code is to be loaded on all nodes in the network, and also indicates @@ -264,93 +191,60 @@ </desc> </func> <func> - <name>cast(Node, Module, Function, Args) -> void()</name> + <name name="cast" arity="4"/> <fsummary>Run a function on a node ignoring the result</fsummary> - <type> - <v>Node = node()</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - </type> <desc> - <p>Evaluates <c>apply(Module, Function, Args)</c> on the node - <c>Node</c>. No response is delivered and the calling + <p>Evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on the node + <c><anno>Node</anno></c>. No response is delivered and the calling process is not suspended until the evaluation is complete, as is the case with <c>call/4,5</c>.</p> </desc> </func> <func> - <name>eval_everywhere(Module, Funtion, Args) -> void()</name> + <name name="eval_everywhere" arity="3"/> <fsummary>Run a function on all nodes, ignoring the result</fsummary> - <type> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - </type> <desc> - <p>Equivalent to <c>eval_everywhere([node()|nodes()], Module, Function, Args)</c>.</p> + <p>Equivalent to <c>eval_everywhere([node()|nodes()], <anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c>.</p> </desc> </func> <func> - <name>eval_everywhere(Nodes, Module, Function, Args) -> void()</name> + <name name="eval_everywhere" arity="4"/> <fsummary>Run a function on specific nodes, ignoring the result</fsummary> - <type> - <v>Nodes = [node()]</v> - <v>Module = Function = atom()</v> - <v>Args = [term()]</v> - </type> <desc> - <p>Evaluates <c>apply(Module, Function, Args)</c> on + <p>Evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on the specified nodes. No answers are collected.</p> </desc> </func> <func> - <name>abcast(Name, Msg) -> void()</name> + <name name="abcast" arity="2"/> <fsummary>Broadcast a message asynchronously to a registered process on all nodes</fsummary> - <type> - <v>Name = atom()</v> - <v>Msg = term()</v> - </type> <desc> - <p>Equivalent to <c>abcast([node()|nodes()], Name, Msg)</c>.</p> + <p>Equivalent to <c>abcast([node()|nodes()], <anno>Name</anno>, <anno>Msg</anno>)</c>.</p> </desc> </func> <func> - <name>abcast(Nodes, Name, Msg) -> void()</name> + <name name="abcast" arity="3"/> <fsummary>Broadcast a message asynchronously to a registered process on specific nodes</fsummary> - <type> - <v>Nodes = [node()]</v> - <v>Name = atom()</v> - <v>Msg = term()</v> - </type> <desc> - <p>Broadcasts the message <c>Msg</c> asynchronously to - the registered process <c>Name</c> on the specified nodes.</p> + <p>Broadcasts the message <c><anno>Msg</anno></c> asynchronously to + the registered process <c><anno>Name</anno></c> on the specified nodes.</p> </desc> </func> <func> - <name>sbcast(Name, Msg) -> {GoodNodes, BadNodes}</name> + <name name="sbcast" arity="2"/> <fsummary>Broadcast a message synchronously to a registered process on all nodes</fsummary> - <type> - <v>Name = atom()</v> - <v>Msg = term()</v> - <v>GoodNodes = BadNodes = [node()]</v> - </type> <desc> - <p>Equivalent to <c>sbcast([node()|nodes()], Name, Msg)</c>.</p> + <p>Equivalent to <c>sbcast([node()|nodes()], <anno>Name</anno>, <anno>Msg</anno>)</c>.</p> </desc> </func> <func> - <name>sbcast(Nodes, Name, Msg) -> {GoodNodes, BadNodes}</name> + <name name="sbcast" arity="3"/> <fsummary>Broadcast a message synchronously to a registered process on specific nodes</fsummary> - <type> - <v>Name = atom()</v> - <v>Msg = term()</v> - <v>Nodes = GoodNodes = BadNodes = [node()]</v> - </type> <desc> - <p>Broadcasts the message <c>Msg</c> synchronously to - the registered process <c>Name</c> on the specified nodes.</p> - <p>Returns <c>{GoodNodes, BadNodes}</c>, where <c>GoodNodes</c> - is the list of nodes which have <c>Name</c> as a registered + <p>Broadcasts the message <c><anno>Msg</anno></c> synchronously to + the registered process <c><anno>Name</anno></c> on the specified nodes.</p> + <p>Returns <c>{<anno>GoodNodes</anno>, <anno>BadNodes</anno>}</c>, where <c><anno>GoodNodes</anno></c> + is the list of nodes which have <c><anno>Name</anno></c> as a registered process.</p> <p>The function is synchronous in the sense that it is known that all servers have received the message when the call @@ -362,67 +256,46 @@ </desc> </func> <func> - <name>server_call(Node, Name, ReplyWrapper, Msg) -> Reply | {error, Reason}</name> + <name name="server_call" arity="4"/> <fsummary>Interact with a server on a node</fsummary> - <type> - <v>Node = node()</v> - <v>Name = atom()</v> - <v>ReplyWrapper = Msg = Reply = term()</v> - <v>Reason = term()</v> - </type> <desc> <p>This function can be used when interacting with a server - called <c>Name</c> at node <c>Node</c>. It is assumed that + called <c><anno>Name</anno></c> at node <c><anno>Node</anno></c>. It is assumed that the server receives messages in the format - <c>{From, Msg}</c> and replies using <c>From ! {ReplyWrapper, Node, Reply}</c>. This function makes such + <c>{From, <anno>Msg</anno>}</c> and replies using <c>From ! {<anno>ReplyWrapper</anno>, <anno>Node</anno>, <anno>Reply</anno>}</c>. This function makes such a server call and ensures that the entire call is packed into an atomic transaction which either succeeds or fails. It never hangs, unless the server itself hangs.</p> - <p>The function returns the answer <c>Reply</c> as produced by - the server <c>Name</c>, or <c>{error, Reason}</c>.</p> + <p>The function returns the answer <c><anno>Reply</anno></c> as produced by + the server <c><anno>Name</anno></c>, or <c>{error, <anno>Reason</anno>}</c>.</p> </desc> </func> <func> - <name>multi_server_call(Name, Msg) -> {Replies, BadNodes}</name> + <name name="multi_server_call" arity="2"/> <fsummary>Interact with the servers on a number of nodes</fsummary> - <type> - <v>Name = atom()</v> - <v>Msg = term()</v> - <v>Replies = [Reply]</v> - <v> Reply = term()</v> - <v>BadNodes = [node()]</v> - </type> <desc> - <p>Equivalent to <c>multi_server_call([node()|nodes()], Name, Msg)</c>.</p> + <p>Equivalent to <c>multi_server_call([node()|nodes()], <anno>Name</anno>, <anno>Msg</anno>)</c>.</p> </desc> </func> <func> - <name>multi_server_call(Nodes, Name, Msg) -> {Replies, BadNodes}</name> + <name name="multi_server_call" arity="3"/> <fsummary>Interact with the servers on a number of nodes</fsummary> - <type> - <v>Nodes = [node()]</v> - <v>Name = atom()</v> - <v>Msg = term()</v> - <v>Replies = [Reply]</v> - <v> Reply = term()</v> - <v>BadNodes = [node()]</v> - </type> <desc> <p>This function can be used when interacting with servers - called <c>Name</c> on the specified nodes. It is assumed that - the servers receive messages in the format <c>{From, Msg}</c> - and reply using <c>From ! {Name, Node, Reply}</c>, where + called <c><anno>Name</anno></c> on the specified nodes. It is assumed that + the servers receive messages in the format <c>{From, <anno>Msg</anno>}</c> + and reply using <c>From ! {<anno>Name</anno>, Node, <anno>Reply</anno>}</c>, where <c>Node</c> is the name of the node where the server is - located. The function returns <c>{Replies, Badnodes}</c>, - where <c>Replies</c> is a list of all <c>Reply</c> values and - <c>BadNodes</c> is a list of the nodes which did not exist, or + located. The function returns <c>{<anno>Replies</anno>, <anno>BadNodes</anno>}</c>, + where <c><anno>Replies</anno></c> is a list of all <c><anno>Reply</anno></c> values and + <c><anno>BadNodes</anno></c> is a list of the nodes which did not exist, or where the server did not exist, or where the server terminated before sending any reply.</p> </desc> </func> <func> - <name>safe_multi_server_call(Name, Msg) -> {Replies, BadNodes}</name> - <name>safe_multi_server_call(Nodes, Name, Msg) -> {Replies, BadNodes}</name> + <name name="safe_multi_server_call" arity="2"/> + <name name="safe_multi_server_call" arity="3"/> <fsummary>Interact with the servers on a number of nodes (deprecated)</fsummary> <desc> <warning> @@ -432,66 +305,47 @@ <p>In Erlang/OTP R6B and earlier releases, <c>multi_server_call/2,3</c> could not handle the case where the remote node exists, but there is no server called - <c>Name</c>. Instead this function had to be used. In + <c><anno>Name</anno></c>. Instead this function had to be used. In Erlang/OTP R7B and later releases, however, the functions are equivalent, except for this function being slightly slower.</p> </desc> </func> <func> - <name>parallel_eval(FuncCalls) -> ResL</name> + <name name="parallel_eval" arity="1"/> <fsummary>Evaluate several function calls on all nodes in parallel</fsummary> - <type> - <v>FuncCalls = [{Module, Function, Args}]</v> - <v> Module = Function = atom()</v> - <v> Args = [term()]</v> - <v>ResL = [term()]</v> - </type> <desc> - <p>For every tuple in <c>FuncCalls</c>, evaluates - <c>apply(Module, Function, Args)</c> on some node in + <p>For every tuple in <c><anno>FuncCalls</anno></c>, evaluates + <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> on some node in the network. Returns the list of return values, in the same - order as in <c>FuncCalls</c>.</p> + order as in <c><anno>FuncCalls</anno></c>.</p> </desc> </func> <func> - <name>pmap({Module, Function}, ExtraArgs, List2) -> List1</name> + <name name="pmap" arity="3"/> <fsummary>Parallell evaluation of mapping a function over a list </fsummary> - <type> - <v>Module = Function = atom()</v> - <v>ExtraArgs = [term()]</v> - <v>List1 = [Elem]</v> - <v> Elem = term()</v> - <v>List2 = [term()]</v> - </type> <desc> - <p>Evaluates <c>apply(Module, Function, [Elem|ExtraArgs])</c>, - for every element <c>Elem</c> in <c>List1</c>, in parallel. + <p>Evaluates <c>apply(<anno>Module</anno>, <anno>Function</anno>, [<anno>Elem</anno>|<anno>ExtraArgs</anno>])</c>, + for every element <c><anno>Elem</anno></c> in <c><anno>List1</anno></c>, in parallel. Returns the list of return values, in the same order as in - <c>List1</c>.</p> + <c><anno>List1</anno></c>.</p> </desc> </func> <func> - <name>pinfo(Pid) -> [{Item, Info}] | undefined</name> + <name name="pinfo" arity="1"/> <fsummary>Information about a process</fsummary> - <type> - <v>Pid = pid()</v> - <v>Item, Info -- see erlang:process_info/1</v> - </type> <desc> <p>Location transparent version of the BIF - <c>process_info/1</c>.</p> + <seealso marker="erts:erlang#process_info/1"> + <c>process_info/1</c></seealso>.</p> </desc> </func> <func> - <name>pinfo(Pid, Item) -> {Item, Info} | undefined | []</name> + <name name="pinfo" arity="2"/> <fsummary>Information about a process</fsummary> - <type> - <v>Pid = pid()</v> - <v>Item, Info -- see erlang:process_info/1</v> - </type> <desc> <p>Location transparent version of the BIF - <c>process_info/2</c>.</p> + <seealso marker="erts:erlang#process_info/2"> + <c>process_info/2</c></seealso>.</p> </desc> </func> </funcs> diff --git a/lib/kernel/doc/src/seq_trace.xml b/lib/kernel/doc/src/seq_trace.xml index 6c043dd767..1ab955bd8a 100644 --- a/lib/kernel/doc/src/seq_trace.xml +++ b/lib/kernel/doc/src/seq_trace.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1998</year><year>2009</year> + <year>1998</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -47,17 +47,22 @@ from users.</p> </note> </description> + <datatypes> + <datatype> + <name name="token"/> + <desc> + <p>An opaque term (a tuple) representing a trace token.</p> + </desc> + </datatype> + </datatypes> <funcs> <func> - <name>set_token(Token) -> PreviousToken</name> + <name name="set_token" arity="1"/> <fsummary>Set the trace token</fsummary> - <type> - <v>Token = PreviousToken = term() | []</v> - </type> <desc> - <p>Sets the trace token for the calling process to <c>Token</c>. - If <c>Token == []</c> then tracing is disabled, otherwise - <c>Token</c> should be an Erlang term returned from + <p>Sets the trace token for the calling process to <c><anno>Token</anno></c>. + If <c><anno>Token</anno> == []</c> then tracing is disabled, otherwise + <c><anno>Token</anno></c> should be an Erlang term returned from <c>get_token/0</c> or <c>set_token/1</c>. <c>set_token/1</c> can be used to temporarily exclude message passing from the trace by setting the trace token to empty like this:</p> @@ -72,18 +77,16 @@ seq_trace:set_token(OldToken), % activate the trace token again </desc> </func> <func> - <name>set_token(Component, Val) -> {Component, OldVal}</name> + <name name="set_token" arity="2"/> <fsummary>Set a component of the trace token</fsummary> - <type> - <v>Component = label | serial | Flag</v> - <v> Flag = send | 'receive' | print | timestamp </v> - <v>Val = OldVal -- see below</v> - </type> + <type name="component"/> + <type name="flag"/> + <type name="value"/> <desc> - <p>Sets the individual <c>Component</c> of the trace token to - <c>Val</c>. Returns the previous value of the component.</p> + <p>Sets the individual <c><anno>Component</anno></c> of the trace token to + <c><anno>Val</anno></c>. Returns the previous value of the component.</p> <taglist> - <tag><c>set_token(label, Int)</c></tag> + <tag><c>set_token(label, <anno>Integer</anno>)</c></tag> <item> <p>The <c>label</c> component is an integer which identifies all events belonging to the same sequential @@ -93,31 +96,31 @@ seq_trace:set_token(OldToken), % activate the trace token again </item> <tag><c>set_token(serial, SerialValue)</c></tag> <item> - <p><c>SerialValue = {Previous, Current}</c>. + <p><c>SerialValue = {<anno>Previous</anno>, <anno>Current</anno>}</c>. The <c>serial</c> component contains counters which enables the traced messages to be sorted, should never be set explicitly by the user as these counters are updated automatically. Default is <c>{0, 0}</c>.</p> </item> - <tag><c>set_token(send, Bool)</c></tag> + <tag><c>set_token(send, <anno>Bool</anno>)</c></tag> <item> <p>A trace token flag (<c>true | false</c>) which enables/disables tracing on message sending. Default is <c>false</c>.</p> </item> - <tag><c>set_token('receive', Bool)</c></tag> + <tag><c>set_token('receive', <anno>Bool</anno>)</c></tag> <item> <p>A trace token flag (<c>true | false</c>) which enables/disables tracing on message reception. Default is <c>false</c>.</p> </item> - <tag><c>set_token(print, Bool)</c></tag> + <tag><c>set_token(print, <anno>Bool</anno>)</c></tag> <item> <p>A trace token flag (<c>true | false</c>) which enables/disables tracing on explicit calls to <c>seq_trace:print/1</c>. Default is <c>false</c>.</p> </item> - <tag><c>set_token(timestamp, Bool)</c></tag> + <tag><c>set_token(timestamp, <anno>Bool</anno>)</c></tag> <item> <p>A trace token flag (<c>true | false</c>) which enables/disables a timestamp to be generated for each @@ -127,11 +130,8 @@ seq_trace:set_token(OldToken), % activate the trace token again </desc> </func> <func> - <name>get_token() -> TraceToken</name> + <name name="get_token" arity="0"/> <fsummary>Return the value of the trace token</fsummary> - <type> - <v>TraceToken = term() | []</v> - </type> <desc> <p>Returns the value of the trace token for the calling process. If <c>[]</c> is returned, it means that tracing is not active. @@ -141,13 +141,11 @@ seq_trace:set_token(OldToken), % activate the trace token again </desc> </func> <func> - <name>get_token(Component) -> {Component, Val}</name> + <name name="get_token" arity="1"/> <fsummary>Return the value of a trace token component</fsummary> - <type> - <v>Component = label | serial | Flag</v> - <v> Flag = send | 'receive' | print | timestamp </v> - <v>Val -- see set_token/2</v> - </type> + <type name="component"/> + <type name="flag"/> + <type name="value"/> <desc> <p>Returns the value of the trace token component <c>Component</c>. See @@ -156,33 +154,26 @@ seq_trace:set_token(OldToken), % activate the trace token again </desc> </func> <func> - <name>print(TraceInfo) -> void()</name> + <name name="print" arity="1"/> <fsummary>Put the Erlang term <c>TraceInfo</c>into the sequential trace output</fsummary> - <type> - <v>TraceInfo = term()</v> - </type> <desc> - <p>Puts the Erlang term <c>TraceInfo</c> into the sequential + <p>Puts the Erlang term <c><anno>TraceInfo</anno></c> into the sequential trace output if the calling process currently is executing within a sequential trace and the <c>print</c> flag of the trace token is set.</p> </desc> </func> <func> - <name>print(Label, TraceInfo) -> void()</name> + <name name="print" arity="2"/> <fsummary>Put the Erlang term <c>TraceInfo</c>into the sequential trace output</fsummary> - <type> - <v>Label = int()</v> - <v>TraceInfo = term()</v> - </type> <desc> <p>Same as <c>print/1</c> with the additional condition that - <c>TraceInfo</c> is output only if <c>Label</c> is equal to + <c><anno>TraceInfo</anno></c> is output only if <c>Label</c> is equal to the label component of the trace token.</p> </desc> </func> <func> - <name>reset_trace() -> void()</name> + <name name="reset_trace" arity="0"/> <fsummary>Stop all sequential tracing on the local node</fsummary> <desc> <p>Sets the trace token to empty for all processes on the @@ -194,26 +185,22 @@ seq_trace:set_token(OldToken), % activate the trace token again </desc> </func> <func> - <name>set_system_tracer(Tracer) -> OldTracer</name> + <name name="set_system_tracer" arity="1"/> <fsummary>Set the system tracer</fsummary> - <type> - <v>Tracer = OldTracer = pid() | port() | false</v> - </type> + <type name="tracer"/> <desc> <p>Sets the system tracer. The system tracer can be either a - process or port denoted by <c>Tracer</c>. Returns the previous + process or port denoted by <c><anno>Tracer</anno></c>. Returns the previous value (which can be <c>false</c> if no system tracer is active).</p> - <p>Failure: <c>{badarg, Info}}</c> if <c>Pid</c> is not an + <p>Failure: <c>{badarg, Info}}</c> if <c><anno>Pid</anno></c> is not an existing local pid.</p> </desc> </func> <func> - <name>get_system_tracer() -> Tracer</name> + <name name="get_system_tracer" arity="0"/> <fsummary>Return the pid() or port() of the current system tracer.</fsummary> - <type> - <v>Tracer = pid() | port() | false</v> - </type> + <type name="tracer"/> <desc> <p>Returns the pid or port identifier of the current system tracer or <c>false</c> if no system tracer is activated.</p> diff --git a/lib/kernel/doc/src/specs.xml b/lib/kernel/doc/src/specs.xml new file mode 100644 index 0000000000..b41addaa0c --- /dev/null +++ b/lib/kernel/doc/src/specs.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="latin1" ?> +<specs xmlns:xi="http://www.w3.org/2001/XInclude"> + <xi:include href="../specs/specs_application.xml"/> + <xi:include href="../specs/specs_auth.xml"/> + <xi:include href="../specs/specs_code.xml"/> + <xi:include href="../specs/specs_disk_log.xml"/> + <xi:include href="../specs/specs_erl_boot_server.xml"/> + <xi:include href="../specs/specs_erl_ddll.xml"/> + <xi:include href="../specs/specs_erl_prim_loader_stub.xml"/> + <xi:include href="../specs/specs_erlang_stub.xml"/> + <xi:include href="../specs/specs_error_handler.xml"/> + <xi:include href="../specs/specs_error_logger.xml"/> + <xi:include href="../specs/specs_file.xml"/> + <xi:include href="../specs/specs_gen_tcp.xml"/> + <xi:include href="../specs/specs_gen_udp.xml"/> + <xi:include href="../specs/specs_gen_sctp.xml"/> + <xi:include href="../specs/specs_global.xml"/> + <xi:include href="../specs/specs_global_group.xml"/> + <xi:include href="../specs/specs_heart.xml"/> + <xi:include href="../specs/specs_inet.xml"/> + <xi:include href="../specs/specs_inet_res.xml"/> + <xi:include href="../specs/specs_init_stub.xml"/> + <xi:include href="../specs/specs_net_adm.xml"/> + <xi:include href="../specs/specs_net_kernel.xml"/> + <xi:include href="../specs/specs_os.xml"/> + <xi:include href="../specs/specs_pg2.xml"/> + <xi:include href="../specs/specs_rpc.xml"/> + <xi:include href="../specs/specs_seq_trace.xml"/> + <xi:include href="../specs/specs_user.xml"/> + <xi:include href="../specs/specs_wrap_log_reader.xml"/> + <xi:include href="../specs/specs_zlib_stub.xml"/> + <xi:include href="../specs/specs_packages.xml"/> +</specs> diff --git a/lib/kernel/doc/src/user.xml b/lib/kernel/doc/src/user.xml index d9de2f4b04..4d0f044321 100644 --- a/lib/kernel/doc/src/user.xml +++ b/lib/kernel/doc/src/user.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1996</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/wrap_log_reader.xml b/lib/kernel/doc/src/wrap_log_reader.xml index 18664a029f..6cf480b532 100644 --- a/lib/kernel/doc/src/wrap_log_reader.xml +++ b/lib/kernel/doc/src/wrap_log_reader.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1998</year><year>2009</year> + <year>1998</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -50,18 +50,20 @@ the called node, it is entirely up to the user to be sure that all items are read. </p> </description> + <datatypes> + <datatype> + <name name="continuation"/> + <desc><p>Continuation returned by + <c>open/1,2</c> or <c>chunk/1,2</c>.</p> + </desc> + </datatype> + </datatypes> <funcs> <func> - <name>chunk(Continuation)</name> - <name>chunk(Continuation, N) -> {Continuation2, Terms} | {Continuation2, Terms, Badbytes} | {Continuation2, eof} | {error, Reason}</name> + <name name="chunk" arity="1"/> + <name name="chunk" arity="2"/> <fsummary>Read a chunk of objects written to a wrap log.</fsummary> - <type> - <v>Continuation = continuation()</v> - <v>N = int() > 0 | infinity</v> - <v>Continuation2 = continuation()</v> - <v>Terms= [term()]</v> - <v>Badbytes = integer()</v> - </type> + <type name="chunk_ret"/> <desc> <p>This function makes it possible to efficiently read the terms which have been appended to a log. It minimises disk @@ -70,29 +72,29 @@ <p>The first time <c>chunk</c> is called an initial continuation returned from the <c>open/1</c>, <c>open/2</c> must be provided. </p> - <p>When <c>chunk/3</c> is called, <c>N</c> controls the + <p>When <c>chunk/3</c> is called, <c><anno>N</anno></c> controls the maximum number of terms that are read from the log in each chunk. Default is <c>infinity</c>, which means that all the terms contained in the 8K chunk are read. If less than - <c>N</c> terms are returned, this does not necessarily mean + <c><anno>N</anno></c> terms are returned, this does not necessarily mean that end of file is reached. </p> <p>The <c>chunk</c> function returns a tuple - <c>{Continuation2, Terms}</c>, where <c>Terms</c> is a list - of terms found in the log. <c>Continuation2</c> is yet + <c>{<anno>Continuation2</anno>, <anno>Terms</anno>}</c>, where <c><anno>Terms</anno></c> is a list + of terms found in the log. <c><anno>Continuation2</anno></c> is yet another continuation which must be passed on into any subsequent calls to <c>chunk</c>. With a series of calls to <c>chunk</c> it is then possible to extract all terms from a log. </p> <p>The <c>chunk</c> function returns a tuple - <c>{Continuation2, Terms, Badbytes}</c> if the log is opened - in read only mode and the read chunk is corrupt. <c>Badbytes</c> + <c>{<anno>Continuation2</anno>, <anno>Terms</anno>, <anno>Badbytes</anno>}</c> if the log is opened + in read only mode and the read chunk is corrupt. <c><anno>Badbytes</anno></c> indicates the number of non-Erlang terms found in the chunk. Note also that the log is not repaired. </p> - <p><c>chunk</c> returns <c>{Continuation2, eof}</c> when the end of the log is - reached, and <c>{error, Reason}</c> if an error occurs. + <p><c>chunk</c> returns <c>{<anno>Continuation2</anno>, eof}</c> when the end of the log is + reached, and <c>{error, <anno>Reason</anno>}</c> if an error occurs. </p> <p>The returned continuation may or may not be valid in the next call to <c>chunk</c>. This is because the log may wrap and delete @@ -103,37 +105,29 @@ </desc> </func> <func> - <name>close(Continuation) -> ok </name> + <name name="close" arity="1"/> <fsummary>Close a log</fsummary> - <type> - <v>Continuation = continuation()</v> - </type> <desc> <p>This function closes a log file properly. </p> </desc> </func> <func> - <name>open(Filename) -> OpenRet</name> - <name>open(Filename, N) -> OpenRet</name> + <name name="open" arity="1"/> + <name name="open" arity="2"/> <fsummary>Open a log file</fsummary> - <type> - <v>File = string() | atom()</v> - <v>N = integer()</v> - <v>OpenRet = {ok, Continuation} | {error, Reason} </v> - <v>Continuation = continuation()</v> - </type> + <type name="open_ret"/> <desc> - <p><c>Filename</c> specifies the name of the file which is to be read. </p> - <p><c>N</c> specifies the index of the file which is to be read. - If <c>N</c> is omitted the whole wrap log file will be read; if it + <p><c><anno>Filename</anno></c> specifies the name of the file which is to be read. </p> + <p><c><anno>N</anno></c> specifies the index of the file which is to be read. + If <c><anno>N</anno></c> is omitted the whole wrap log file will be read; if it is specified only the specified index file will be read. </p> - <p>The <c>open</c> function returns <c>{ok, Continuation}</c> if the - log/index file was successfully opened. The <c>Continuation</c> + <p>The <c>open</c> function returns <c>{ok, <anno>Continuation</anno>}</c> if the + log/index file was successfully opened. The <c><anno>Continuation</anno></c> is to be used when chunking or closing the file. </p> - <p>The function returns <c>{error, Reason}</c> for all errors. + <p>The function returns <c>{error, <anno>Reason</anno>}</c> for all errors. </p> </desc> </func> |