aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2011-06-20 16:33:46 +0200
committerHans Bolinder <[email protected]>2011-06-20 16:33:46 +0200
commitb9d8ae5aa52774ed0ce12c9d21ad7f3670c2dca1 (patch)
tree66d6fe3c4dcb15d447944c2054059c423a0d88b7 /lib
parent9b9dc0d0c6aa9dc002c6581eb76b891e707a492a (diff)
parent4bd8ab6298961d564c34172c0a4d74cd08a08249 (diff)
downloadotp-b9d8ae5aa52774ed0ce12c9d21ad7f3670c2dca1.tar.gz
otp-b9d8ae5aa52774ed0ce12c9d21ad7f3670c2dca1.tar.bz2
otp-b9d8ae5aa52774ed0ce12c9d21ad7f3670c2dca1.zip
Merge branch 'hb/specs_and_types/OTP-9356' into dev
* hb/specs_and_types/OTP-9356: Add more specs and types
Diffstat (limited to 'lib')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl12
-rw-r--r--lib/kernel/doc/src/Makefile2
-rw-r--r--lib/kernel/doc/src/code.xml339
-rw-r--r--lib/kernel/doc/src/file.xml21
-rw-r--r--lib/kernel/doc/src/os.xml3
-rw-r--r--lib/kernel/src/auth.erl2
-rw-r--r--lib/kernel/src/code.erl135
-rw-r--r--lib/kernel/src/file.erl18
-rw-r--r--lib/kernel/src/inet_config.erl52
-rw-r--r--lib/kernel/src/rpc.erl5
-rw-r--r--lib/stdlib/doc/src/calendar.xml15
-rw-r--r--lib/stdlib/doc/src/io.xml2
-rw-r--r--lib/stdlib/src/calendar.erl78
-rw-r--r--lib/stdlib/src/timer.erl4
14 files changed, 288 insertions, 400 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index 0b47c7b6e1..f1be658054 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -702,7 +702,7 @@ type(erlang, demonitor, 1, Xs) ->
type(erlang, demonitor, 2, Xs) ->
strict(arg_types(erlang, demonitor, 2), Xs, fun (_) -> t_boolean() end);
type(erlang, disconnect_node, 1, Xs) ->
- strict(arg_types(erlang, disconnect_node, 1), Xs, fun (_) -> t_boolean() end);
+ strict(arg_types(erlang, disconnect_node, 1), Xs, fun (_) -> t_sup([t_boolean(), t_atom('ignored')]) end);
type(erlang, display, 1, _) -> t_atom('true');
type(erlang, display_string, 1, Xs) ->
strict(arg_types(erlang, display_string, 1), Xs, fun(_) -> t_atom('true') end);
@@ -1124,7 +1124,7 @@ type(erlang, nodes, 0, _) -> t_list(t_node());
type(erlang, nodes, 1, Xs) ->
strict(arg_types(erlang, nodes, 1), Xs, fun (_) -> t_list(t_node()) end);
type(erlang, now, 0, _) ->
- t_time();
+ t_timestamp();
type(erlang, open_port, 2, Xs) ->
strict(arg_types(erlang, open_port, 2), Xs, fun (_) -> t_port() end);
type(erlang, phash, 2, Xs) ->
@@ -1585,8 +1585,7 @@ type(erlang, system_info, 1, Xs) ->
['multi_scheduling_blockers'] ->
t_list(t_pid());
['os_type'] ->
- t_tuple([t_sup([t_atom('ose'), % XXX: undocumented
- t_atom('unix'),
+ t_tuple([t_sup([t_atom('unix'),
t_atom('vxworks'),
t_atom('win32')]),
t_atom()]);
@@ -2693,7 +2692,7 @@ type(os, getpid, 0, _) -> t_string();
type(os, putenv, 2, Xs) ->
strict(arg_types(os, putenv, 2), Xs, fun (_) -> t_atom('true') end);
type(os, timestamp, 0, _) ->
- t_time();
+ t_timestamp();
%%-- re -----------------------------------------------------------------------
type(re, compile, 1, Xs) ->
strict(arg_types(re, compile, 1), Xs,
@@ -4458,6 +4457,9 @@ t_date() ->
t_time() ->
t_tuple([t_non_neg_fixnum(), t_non_neg_fixnum(), t_non_neg_fixnum()]).
+t_timestamp() ->
+ t_tuple([t_non_neg_fixnum(), t_non_neg_fixnum(), t_non_neg_fixnum()]).
+
t_packet() ->
t_sup([t_binary(), t_iolist(), t_httppacket()]).
diff --git a/lib/kernel/doc/src/Makefile b/lib/kernel/doc/src/Makefile
index de10e31d36..214e994889 100644
--- a/lib/kernel/doc/src/Makefile
+++ b/lib/kernel/doc/src/Makefile
@@ -104,6 +104,8 @@ TOP_SPECS_FILE = specs.xml
# ----------------------------------------------------
XML_FLAGS +=
+SPECS_ESRC = ../../src
+
SPECS_FLAGS = -I../../include
# ----------------------------------------------------
diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml
index 6f85388c22..98cdd416b0 100644
--- a/lib/kernel/doc/src/code.xml
+++ b/lib/kernel/doc/src/code.xml
@@ -288,196 +288,156 @@
<datatypes>
<datatype>
+ <name name="load_ret"/>
+ </datatype>
+ <datatype>
<name name="load_error_rsn"/>
</datatype>
</datatypes>
<funcs>
<func>
- <name>set_path(Path) -> true | {error, What}</name>
+ <name name="set_path" arity="1"/>
<fsummary>Set the code server search path</fsummary>
- <type>
- <v>Path = [Dir]</v>
- <v>Dir = string()</v>
- <v>What = bad_directory | bad_path</v>
- </type>
<desc>
- <p>Sets the code path to the list of directories <c>Path</c>.</p>
+ <p>Sets the code path to the list of directories <c><anno>Path</anno></c>.</p>
<p>Returns <c>true</c> if successful, or
- <c>{error, bad_directory}</c> if any <c>Dir</c> is not
+ <c>{error, bad_directory}</c> if any <c><anno>Dir</anno></c> is not
the name of a directory, or <c>{error, bad_path}</c> if
the argument is invalid.</p>
</desc>
</func>
<func>
- <name>get_path() -> Path</name>
+ <name name="get_path" arity="0"/>
<fsummary>Return the code server search path</fsummary>
- <type>
- <v>Path = [Dir]</v>
- <v>Dir = string()</v>
- </type>
<desc>
<p>Returns the code path</p>
</desc>
</func>
<func>
- <name>add_path(Dir) -> true | {error, What}</name>
- <name>add_pathz(Dir) -> true | {error, What}</name>
+ <name name="add_path" arity="1"/>
+ <name name="add_pathz" arity="1"/>
<fsummary>Add a directory to the end of the code path</fsummary>
- <type>
- <v>Dir = string()</v>
- <v>What = bad_directory</v>
- </type>
+ <type name="add_path_ret"/>
<desc>
- <p>Adds <c>Dir</c> to the code path. The directory is added as
- the last directory in the new path. If <c>Dir</c> already
+ <p>Adds <c><anno>Dir</anno></c> to the code path. The directory is added as
+ the last directory in the new path. If <c><anno>Dir</anno></c> already
exists in the path, it is not added.</p>
<p>Returns <c>true</c> if successful, or
- <c>{error, bad_directory}</c> if <c>Dir</c> is not the name
+ <c>{error, bad_directory}</c> if <c><anno>Dir</anno></c> is not the name
of a directory.</p>
</desc>
</func>
<func>
- <name>add_patha(Dir) -> true | {error, What}</name>
+ <name name="add_patha" arity="1"/>
<fsummary>Add a directory to the beginning of the code path</fsummary>
- <type>
- <v>Dir = string()</v>
- <v>What = bad_directory</v>
- </type>
+ <type name="add_path_ret"/>
<desc>
- <p>Adds <c>Dir</c> to the beginning of the code path. If
- <c>Dir</c> already exists, it is removed from the old
+ <p>Adds <c><anno>Dir</anno></c> to the beginning of the code path. If
+ <c><anno>Dir</anno></c> already exists, it is removed from the old
position in the code path.</p>
<p>Returns <c>true</c> if successful, or
- <c>{error, bad_directory}</c> if <c>Dir</c> is not the name
+ <c>{error, bad_directory}</c> if <c><anno>Dir</anno></c> is not the name
of a directory.</p>
</desc>
</func>
<func>
- <name>add_paths(Dirs) -> ok</name>
- <name>add_pathsz(Dirs) -> ok</name>
+ <name name="add_paths" arity="1"/>
+ <name name="add_pathsz" arity="1"/>
<fsummary>Add directories to the end of the code path</fsummary>
- <type>
- <v>Dirs = [Dir]</v>
- <v>Dir = string()</v>
- </type>
<desc>
- <p>Adds the directories in <c>Dirs</c> to the end of the code
- path. If a <c>Dir</c> already exists, it is not added. This
+ <p>Adds the directories in <c><anno>Dirs</anno></c> to the end of the code
+ path. If a <c><anno>Dir</anno></c> already exists, it is not added. This
function always returns <c>ok</c>, regardless of the validity
- of each individual <c>Dir</c>.</p>
+ of each individual <c><anno>Dir</anno></c>.</p>
</desc>
</func>
<func>
- <name>add_pathsa(Dirs) -> ok</name>
+ <name name="add_pathsa" arity="1"/>
<fsummary>Add directories to the beginning of the code path</fsummary>
- <type>
- <v>Dirs = [Dir]</v>
- <v>Dir = string()</v>
- </type>
<desc>
- <p>Adds the directories in <c>Dirs</c> to the beginning of
- the code path. If a <c>Dir</c> already exists, it is removed
+ <p>Adds the directories in <c><anno>Dirs</anno></c> to the beginning of
+ the code path. If a <c><anno>Dir</anno></c> already exists, it is removed
from the old position in the code path. This function always
returns <c>ok</c>, regardless of the validity of each
- individual <c>Dir</c>.</p>
+ individual <c><anno>Dir</anno></c>.</p>
</desc>
</func>
<func>
- <name>del_path(Name | Dir) -> true | false | {error, What}</name>
+ <name name="del_path" arity="1"/>
<fsummary>Delete a directory from the code path</fsummary>
- <type>
- <v>Name = atom()</v>
- <v>Dir = string()</v>
- <v>What = bad_name</v>
- </type>
<desc>
<p>Deletes a directory from the code path. The argument can be
- an atom <c>Name</c>, in which case the directory with
- the name <c>.../Name[-Vsn][/ebin]</c> is deleted from the code
+ an atom <c><anno>Name</anno></c>, in which case the directory with
+ the name <c>.../<anno>Name</anno>[-Vsn][/ebin]</c> is deleted from the code
path. It is also possible to give the complete directory name
- <c>Dir</c> as argument.</p>
+ <c><anno>Dir</anno></c> as argument.</p>
<p>Returns <c>true</c> if successful, or <c>false</c> if
the directory is not found, or <c>{error, bad_name}</c> if
the argument is invalid.</p>
</desc>
</func>
<func>
- <name>replace_path(Name, Dir) -> true | {error, What}</name>
+ <name name="replace_path" arity="2"/>
<fsummary>Replace a directory with another in the code path</fsummary>
- <type>
- <v>Name = atom()</v>
- <v>Dir = string()</v>
- <v>What = bad_name | bad_directory | {badarg, term()}</v>
- </type>
<desc>
<p>This function replaces an old occurrence of a directory
- named <c>.../Name[-Vsn][/ebin]</c>, in the code path, with
- <c>Dir</c>. If <c>Name</c> does not exist, it adds the new
- directory <c>Dir</c> last in the code path. The new directory
- must also be named <c>.../Name[-Vsn][/ebin]</c>. This function
+ named <c>.../<anno>Name</anno>[-Vsn][/ebin]</c>, in the code path, with
+ <c><anno>Dir</anno></c>. If <c><anno>Name</anno></c> does not exist, it adds the new
+ directory <c><anno>Dir</anno></c> last in the code path. The new directory
+ must also be named <c>.../<anno>Name</anno>[-Vsn][/ebin]</c>. This function
should be used if a new version of the directory (library) is
added to a running system.</p>
<p>Returns <c>true</c> if successful, or
- <c>{error, bad_name}</c> if <c>Name</c> is not found, or
- <c>{error, bad_directory}</c> if <c>Dir</c> does not exist, or
- <c>{error, {badarg, [Name, Dir]}}</c> if <c>Name</c> or
- <c>Dir</c> is invalid.</p>
+ <c>{error, bad_name}</c> if <c><anno>Name</anno></c> is not found, or
+ <c>{error, bad_directory}</c> if <c><anno>Dir</anno></c> does not exist, or
+ <c>{error, {badarg, [<anno>Name</anno>, <anno>Dir</anno>]}}</c> if <c><anno>Name</anno></c> or
+ <c><anno>Dir</anno></c> is invalid.</p>
</desc>
</func>
<func>
- <name>load_file(Module) -> {module, Module} | {error, What}</name>
+ <name name="load_file" arity="1"/>
<fsummary>Load a module</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>What = nofile | sticky_directory | badarg | term()</v>
- </type>
+ <type name="load_ret"/>
<desc>
- <p>Tries to load the Erlang module <c>Module</c>, using
+ <p>Tries to load the Erlang module <c><anno>Module</anno></c>, using
the code path. It looks for the object code file with an
extension that corresponds to the Erlang machine used, for
- example <c>Module.beam</c>. The loading fails if the module
+ example <c><anno>Module</anno>.beam</c>. The loading fails if the module
name found in the object code differs from the name
- <c>Module</c>.
+ <c><anno>Module</anno></c>.
<seealso marker="#load_binary/3">load_binary/3</seealso> must
be used to load object code with a module name that is
different from the file name.</p>
- <p>Returns <c>{module, Module}</c> if successful, or
+ <p>Returns <c>{module, <anno>Module</anno>}</c> if successful, or
<c>{error, nofile}</c> if no object code is found, or
<c>{error, sticky_directory}</c> if the object code resides in
- a sticky directory, or <c>{error, badarg}</c> if the argument
- is invalid. Also if the loading fails, an error tuple is
+ a sticky directory. Also if the loading fails, an error tuple is
returned. See
<seealso marker="erts:erlang#load_module/2">erlang:load_module/2</seealso>
- for possible values of <c>What</c>.</p>
+ for possible values of <c><anno>What</anno></c>.</p>
</desc>
</func>
<func>
- <name>load_abs(Filename) -> {module, Module} | {error, What}</name>
+ <name name="load_abs" arity="1"/>
<fsummary>Load a module, residing in a given file</fsummary>
- <type>
- <v>Filename = string()</v>
- <v>Module = atom()</v>
- <v>What = nofile | sticky_directory | badarg | term()</v>
- </type>
+ <type name="load_ret"/>
+ <type name="loaded_filename"/>
+ <type name="loaded_ret_atoms"/>
<desc>
- <p>Does the same as <c>load_file(Module)</c>, but
- <c>Filename</c> is either an absolute file name, or a
+ <p>Does the same as <c>load_file(<anno>Module</anno>)</c>, but
+ <c><anno>Filename</anno></c> is either an absolute file name, or a
relative file name. The code path is not searched. It returns
a value in the same way as
<seealso marker="#load_file/1">load_file/1</seealso>. Note
- that <c>Filename</c> should not contain the extension (for
+ that <c><anno>Filename</anno></c> should not contain the extension (for
example <c>".beam"</c>); <c>load_abs/1</c> adds the correct
extension itself.</p>
</desc>
</func>
<func>
- <name>ensure_loaded(Module) -> {module, Module} | {error, What}</name>
+ <name name="ensure_loaded" arity="1"/>
<fsummary>Ensure that a module is loaded</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>What = nofile | sticky_directory | embedded | badarg | term()</v>
- </type>
<desc>
<p>Tries to to load a module in the same way as
<seealso marker="#load_file/1">load_file/1</seealso>,
@@ -487,54 +447,45 @@
</desc>
</func>
<func>
- <name>load_binary(Module, Filename, Binary) -> {module, Module} | {error, What}</name>
+ <name name="load_binary" arity="3"/>
<fsummary>Load object code for a module</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>Filename = string()</v>
- <v>What = sticky_directory | badarg | term()</v>
- </type>
+ <type name="loaded_filename"/>
+ <type name="loaded_ret_atoms"/>
<desc>
<p>This function can be used to load object code on remote
- Erlang nodes. The argument <c>Binary</c> must contain
- object code for <c>Module</c>.
- <c>Filename</c> is only used by the code server to keep a
- record of from which file the object code for <c>Module</c>
- comes. Accordingly, <c>Filename</c> is not opened and read by
+ Erlang nodes. The argument <c><anno>Binary</anno></c> must contain
+ object code for <c><anno>Module</anno></c>.
+ <c><anno>Filename</anno></c> is only used by the code server to keep a
+ record of from which file the object code for <c><anno>Module</anno></c>
+ comes. Accordingly, <c><anno>Filename</anno></c> is not opened and read by
the code server.</p>
- <p>Returns <c>{module, Module}</c> if successful, or
+ <p>Returns <c>{module, <anno>Module</anno>}</c> if successful, or
<c>{error, sticky_directory}</c> if the object code resides in
a sticky directory, or <c>{error, badarg}</c> if any argument
is invalid. Also if the loading fails, an error tuple is
returned. See
<seealso marker="erts:erlang#load_module/2">erlang:load_module/2</seealso>
- for possible values of <c>What</c>.</p>
+ for possible values of <c><anno>What</anno></c>.</p>
</desc>
</func>
<func>
- <name>delete(Module) -> true | false</name>
+ <name name="delete" arity="1"/>
<fsummary>Removes current code for a module</fsummary>
- <type>
- <v>Module = atom()</v>
- </type>
<desc>
- <p>Removes the current code for <c>Module</c>, that is,
- the current code for <c>Module</c> is made old. This means
+ <p>Removes the current code for <c><anno>Module</anno></c>, that is,
+ the current code for <c><anno>Module</anno></c> is made old. This means
that processes can continue to execute the code in the module,
but that no external function calls can be made to it.</p>
<p>Returns <c>true</c> if successful, or <c>false</c> if there
- is old code for <c>Module</c> which must be purged first, or
- if <c>Module</c> is not a (loaded) module.</p>
+ is old code for <c><anno>Module</anno></c> which must be purged first, or
+ if <c><anno>Module</anno></c> is not a (loaded) module.</p>
</desc>
</func>
<func>
- <name>purge(Module) -> true | false</name>
+ <name name="purge" arity="1"/>
<fsummary>Removes old code for a module</fsummary>
- <type>
- <v>Module = atom()</v>
- </type>
<desc>
- <p>Purges the code for <c>Module</c>, that is, removes code
+ <p>Purges the code for <c><anno>Module</anno></c>, that is, removes code
marked as old. If some processes still linger in the old code,
these processes are killed before the code is removed.</p>
<p>Returns <c>true</c> if successful and any process needed to
@@ -542,31 +493,26 @@
</desc>
</func>
<func>
- <name>soft_purge(Module) -> true | false</name>
+ <name name="soft_purge" arity="1"/>
<fsummary>Removes old code for a module, unless no process uses it</fsummary>
- <type>
- <v>Module = atom()</v>
- </type>
<desc>
- <p>Purges the code for <c>Module</c>, that is, removes code
+ <p>Purges the code for <c><anno>Module</anno></c>, that is, removes code
marked as old, but only if no processes linger in it.</p>
<p>Returns <c>false</c> if the module could not be purged due
to processes lingering in old code, otherwise <c>true</c>.</p>
</desc>
</func>
<func>
- <name>is_loaded(Module) -> {file, Loaded} | false</name>
+ <name name="is_loaded" arity="1"/>
<fsummary>Check if a module is loaded</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>Loaded = Absname | preloaded | cover_compiled</v>
- <v>Absname = string()</v>
- </type>
- <desc>
- <p>Checks if <c>Module</c> is loaded. If it is,
- <c>{file, Loaded}</c> is returned, otherwise <c>false</c>.</p>
- <p>Normally, <c>Loaded</c> is the absolute file name
- <c>Absname</c> from which the code was obtained. If the module
+ <type name="loaded_filename"/>
+ <type name="loaded_ret_atoms"/>
+ <type_desc name="loaded_filename"><c><anno>Filename</anno></c> is an absolute filename</type_desc>
+ <desc>
+ <p>Checks if <c><anno>Module</anno></c> is loaded. If it is,
+ <c>{file, <anno>Loaded</anno>}</c> is returned, otherwise <c>false</c>.</p>
+ <p>Normally, <c><anno>Loaded</anno></c> is the absolute file name
+ <c>Filename</c> from which the code was obtained. If the module
is preloaded (see
<seealso marker="sasl:script">script(4)</seealso>),
<c>Loaded==preloaded</c>. If the module is Cover compiled (see
@@ -575,32 +521,26 @@
</desc>
</func>
<func>
- <name>all_loaded() -> [{Module, Loaded}]</name>
+ <name name="all_loaded" arity="0"/>
<fsummary>Get all loaded modules</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>Loaded = Absname | preloaded | cover_compiled</v>
- <v>Absname = string()</v>
- </type>
+ <type name="loaded_filename"/>
+ <type name="loaded_ret_atoms"/>
+ <type_desc name="loaded_filename"><c><anno>Filename</anno></c> is an absolute filename</type_desc>
<desc>
- <p>Returns a list of tuples <c>{Module, Loaded}</c> for all
- loaded modules. <c>Loaded</c> is normally the absolute file
+ <p>Returns a list of tuples <c>{<anno>Module</anno>, <anno>Loaded</anno>}</c> for all
+ loaded modules. <c><anno>Loaded</anno></c> is normally the absolute file
name, as described for
<seealso marker="#is_loaded/1">is_loaded/1</seealso>.</p>
</desc>
</func>
<func>
- <name>which(Module) -> Which</name>
+ <name name="which" arity="1"/>
<fsummary>The object code file of a module</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>Which = Filename | non_existing | preloaded | cover_compiled</v>
- <v>Filename = string()</v>
- </type>
+ <type name="loaded_ret_atoms"/>
<desc>
<p>If the module is not loaded, this function searches the code
path for the first file which contains object code for
- <c>Module</c> and returns the absolute file name. If
+ <c><anno>Module</anno></c> and returns the absolute file name. If
the module is loaded, it returns the name of the file which
contained the loaded object code. If the module is pre-loaded,
<c>preloaded</c> is returned. If the module is Cover compiled,
@@ -609,21 +549,16 @@
</desc>
</func>
<func>
- <name>get_object_code(Module) -> {Module, Binary, Filename} | error</name>
+ <name name="get_object_code" arity="1"/>
<fsummary>Get the object code for a module</fsummary>
- <type>
- <v>Module = atom()</v>
- <v>Binary = binary()</v>
- <v>Filename = string()</v>
- </type>
<desc>
<p>Searches the code path for the object code of the module
- <c>Module</c>. It returns <c>{Module, Binary, Filename}</c>
- if successful, and <c>error</c> if not. <c>Binary</c> is a
+ <c><anno>Module</anno></c>. It returns <c>{<anno>Module</anno>, <anno>Binary</anno>, <anno>Filename</anno>}</c>
+ if successful, and <c>error</c> if not. <c><anno>Binary</anno></c> is a
binary data object which contains the object code for
the module. This can be useful if code is to be loaded on a
remote node in a distributed system. For example, loading
- module <c>Module</c> on a node <c>Node</c> is done as
+ module <c><anno>Module</anno></c> on a node <c>Node</c> is done as
follows:</p>
<code type="none">
...
@@ -633,7 +568,7 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>root_dir() -> string()</name>
+ <name name="root_dir" arity="0"/>
<fsummary>Root directory of Erlang/OTP</fsummary>
<desc>
<p>Returns the root directory of Erlang/OTP, which is
@@ -644,7 +579,7 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>lib_dir() -> string()</name>
+ <name name="lib_dir" arity="0"/>
<fsummary>Library directory of Erlang/OTP</fsummary>
<desc>
<p>Returns the library directory, <c>$OTPROOT/lib</c>, where
@@ -655,19 +590,16 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>lib_dir(Name) -> string() | {error, bad_name}</name>
+ <name name="lib_dir" arity="1"/>
<fsummary>Library directory for an application</fsummary>
- <type>
- <v>Name = atom()</v>
- </type>
<desc>
<p>This function is mainly intended for finding out the path
for the "library directory", the top directory, for an
- application <c>Name</c> located under <c>$OTPROOT/lib</c> or
+ application <c><anno>Name</anno></c> located under <c>$OTPROOT/lib</c> or
on a directory referred to via the <c>ERL_LIBS</c>
environment variable.</p>
- <p>If there is a regular directory called <c>Name</c> or
- <c>Name-Vsn</c> in the code path with an <c>ebin</c>
+ <p>If there is a regular directory called <c><anno>Name</anno></c> or
+ <c><anno>Name</anno>-Vsn</c> in the code path with an <c>ebin</c>
subdirectory, the path to this directory is returned (not
the <c>ebin</c> directory). If the directory refers to a
directory in an archive, the archive name is stripped away
@@ -681,23 +613,19 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
<pre>
> <input>code:lib_dir(mnesia).</input>
"/usr/local/otp/lib/mnesia-4.2.2"</pre>
- <p>Returns <c>{error, bad_name}</c> if <c>Name</c>
+ <p>Returns <c>{error, bad_name}</c> if <c><anno>Name</anno></c>
is not the name of an application under <c>$OTPROOT/lib</c> or
on a directory referred to via the <c>ERL_LIBS</c>
environment variable. Fails with an exception if <c>Name</c>
has the wrong type.</p>
- <warning><p>For backward compatibility, <c>Name</c> is also allowed to
+ <warning><p>For backward compatibility, <c><anno>Name</anno></c> is also allowed to
be a string. That will probably change in a future release.</p></warning>
</desc>
</func>
<func>
- <name>lib_dir(Name, SubDir) -> string() | {error, bad_name}</name>
+ <name name="lib_dir" arity="2"/>
<fsummary>subdirectory for an application</fsummary>
- <type>
- <v>Name = atom()</v>
- <v>SubDir = atom()</v>
- </type>
<desc>
<p>Returns the path to a subdirectory directly under the top
directory of an application. Normally the subdirectories
@@ -711,12 +639,12 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
> <input>code:lib_dir(megaco, priv).</input>
"/usr/local/otp/lib/megaco-3.9.1.1/priv"</pre>
- <p>Fails with an exception if <c>Name</c> or <c>SubDir</c> has
+ <p>Fails with an exception if <c><anno>Name</anno></c> or <c><anno>SubDir</anno></c> has
the wrong type.</p>
</desc>
</func>
<func>
- <name>compiler_dir() -> string()</name>
+ <name name="compiler_dir" arity="0"/>
<fsummary>Library directory for the compiler</fsummary>
<desc>
<p>Returns the compiler library directory. Equivalent to
@@ -724,21 +652,18 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>priv_dir(Name) -> string() | {error, bad_name}</name>
+ <name name="priv_dir" arity="1"/>
<fsummary>Priv directory for an application</fsummary>
- <type>
- <v>Name = atom()</v>
- </type>
<desc>
<p>Returns the path to the <c>priv</c> directory in an
- application. Equivalent to <c>code:lib_dir(Name,priv).</c>.</p>
+ application. Equivalent to <c>code:lib_dir(<anno>Name</anno>, priv).</c>.</p>
- <warning><p>For backward compatibility, <c>Name</c> is also allowed to
+ <warning><p>For backward compatibility, <c><anno>Name</anno></c> is also allowed to
be a string. That will probably change in a future release.</p></warning>
</desc>
</func>
<func>
- <name>objfile_extension() -> ".beam"</name>
+ <name name="objfile_extension" arity="0"/>
<fsummary>Object code file extension</fsummary>
<desc>
<p>Returns the object code file extension that corresponds to
@@ -746,24 +671,16 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>stick_dir(Dir) -> ok | error</name>
+ <name name="stick_dir" arity="1"/>
<fsummary>Mark a directory as sticky</fsummary>
- <type>
- <v>Dir = string()</v>
- <v>What = term()</v>
- </type>
<desc>
- <p>This function marks <c>Dir</c> as sticky.</p>
+ <p>This function marks <c><anno>Dir</anno></c> as sticky.</p>
<p>Returns <c>ok</c> if successful or <c>error</c> if not.</p>
</desc>
</func>
<func>
- <name>unstick_dir(Dir) -> ok | error</name>
+ <name name="unstick_dir" arity="1"/>
<fsummary>Remove a sticky directory mark</fsummary>
- <type>
- <v>Dir = string()</v>
- <v>What = term()</v>
- </type>
<desc>
<p>This function unsticks a directory which has been marked as
sticky.</p>
@@ -771,45 +688,39 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>is_sticky(Module) -> true | false</name>
+ <name name="is_sticky" arity="1"/>
<fsummary>Test whether a module is sticky</fsummary>
- <type>
- <v>Module = atom()</v>
- </type>
<desc>
- <p>This function returns <c>true</c> if <c>Module</c> is the
+ <p>This function returns <c>true</c> if <c><anno>Module</anno></c> is the
name of a module that has been loaded from a sticky directory
(or in other words: an attempt to reload the module will fail),
- or <c>false</c> if <c>Module</c> is not a loaded module or is
+ or <c>false</c> if <c><anno>Module</anno></c> is not a loaded module or is
not sticky.</p>
</desc>
</func>
<func>
- <name>rehash() -> ok</name>
+ <name name="rehash" arity="0"/>
<fsummary>Rehash or create code path cache</fsummary>
<desc>
<p>This function creates or rehashes the code path cache.</p>
</desc>
</func>
<func>
- <name>where_is_file(Filename) -> Absname | non_existing</name>
+ <name name="where_is_file" arity="1"/>
<fsummary>Full name of a file located in the code path</fsummary>
- <type>
- <v>Filename = Absname = string()</v>
- </type>
<desc>
- <p>Searches the code path for <c>Filename</c>, a file of
+ <p>Searches the code path for <c><anno>Filename</anno></c>, a file of
arbitrary type. If found, the full name is returned.
<c>non_existing</c> is returned if the file cannot be found.
The function can be useful, for example, to locate
application resource files. If the code path cache is used,
the code server will efficiently read the full name from
- the cache, provided that <c>Filename</c> is an object code
+ the cache, provided that <c><anno>Filename</anno></c> is an object code
file or an <c>.app</c> file.</p>
</desc>
</func>
<func>
- <name>clash() -> ok</name>
+ <name name="clash" arity="0"/>
<fsummary>Search for modules with identical names.</fsummary>
<desc>
<p>Searches the entire code space for module names with
@@ -817,10 +728,10 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
</desc>
</func>
<func>
- <name>is_module_native(Module) -> true | false | undefined</name>
+ <name>is_module_native(Module) -> boolean() | undefined</name>
<fsummary>Test whether a module has native code</fsummary>
<type>
- <v>Module = atom()</v>
+ <v>Module = module()</v>
</type>
<desc>
<p>This function returns <c>true</c> if <c>Module</c> is
diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml
index e0feaf6ee7..861c582211 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -95,9 +95,6 @@
<datatypes>
<datatype>
- <name name="bindings"/>
- </datatype>
- <datatype>
<name name="deep_list"/>
</datatype>
<datatype>
@@ -136,12 +133,6 @@
</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>
@@ -1220,15 +1211,15 @@ f.txt: {person, "kalle", 25}.
<item>
<p>The current system access to the file.</p>
</item>
- <tag><c>atime = time()</c></tag>
+ <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso></c></tag>
<item>
<p>The last (local) time the file was read.</p>
</item>
- <tag><c>mtime = time()</c></tag>
+ <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso></c></tag>
<item>
<p>The last (local) time the file was written.</p>
</item>
- <tag><c>ctime = time()</c></tag>
+ <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso></c></tag>
<item>
<p>The interpretation of this time field depends on
the operating system. On Unix, it is the last time
@@ -1669,15 +1660,15 @@ f.txt: {person, "kalle", 25}.
<p>The following fields are used from the record, if they are
given.</p>
<taglist>
- <tag><c>atime = time()</c></tag>
+ <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso></c></tag>
<item>
<p>The last (local) time the file was read.</p>
</item>
- <tag><c>mtime = time()</c></tag>
+ <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso></c></tag>
<item>
<p>The last (local) time the file was written.</p>
</item>
- <tag><c>ctime = time()</c></tag>
+ <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso></c></tag>
<item>
<p>On Unix, any value give for this field will be ignored
(the "ctime" for the file will be set to the current
diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml
index 56fc1834ec..e94119845a 100644
--- a/lib/kernel/doc/src/os.xml
+++ b/lib/kernel/doc/src/os.xml
@@ -126,9 +126,10 @@ DirOut = os:cmd("dir"), % on Win32 platform</code>
</desc>
</func>
<func>
- <name>timestamp() -> {MegaSecs, Secs, MicroSecs}</name>
+ <name>timestamp() -> Timestamp</name>
<fsummary>Returna a timestamp from the OS in the erlang:now/0 format</fsummary>
<type>
+ <v>Timestamp = {MegaSecs, Secs, MicroSecs} = <seealso marker="erts:erlang#type-timestamp">erlang:timestamp()</seealso></v>
<v>MegaSecs = Secs = MicroSecs = integer() >= 0</v>
</type>
<desc>
diff --git a/lib/kernel/src/auth.erl b/lib/kernel/src/auth.erl
index 25c88a4e1d..ac25ab958c 100644
--- a/lib/kernel/src/auth.erl
+++ b/lib/kernel/src/auth.erl
@@ -58,7 +58,7 @@ start_link() ->
%%--Deprecated interface------------------------------------------------
-spec is_auth(Node) -> 'yes' | 'no' when
- Node :: Node :: node().
+ Node :: node().
is_auth(Node) ->
case net_adm:ping(Node) of
diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl
index b0f99305f2..882e9625fe 100644
--- a/lib/kernel/src/code.erl
+++ b/lib/kernel/src/code.erl
@@ -82,7 +82,8 @@
%% add_pathsa([Dir]) -> ok
%% add_pathsz([Dir]) -> ok
%% del_path(Dir) -> boolean() | {error, bad_name}
-%% replace_path(Name, Dir) -> true | replace_path_error()
+%% replace_path(Name, Dir) -> true | {error, bad_directory | bad_name
+%% | {badarg,_}}
%% load_file(Module) -> {module, Module} | {error, What :: atom()}
%% load_abs(File) -> {module, Module} | {error, What :: atom()}
%% load_abs(File, Module) -> {module, Module} | {error, What :: atom()}
@@ -113,11 +114,16 @@
%% Some types for basic exported functions of this module
%%----------------------------------------------------------------------------
--type load_error_rsn() :: 'badfile' | 'native_code' | 'nofile' | 'not_purged'
- | 'sticky_directory'. % for some functions only
--type load_ret() :: {'error', load_error_rsn()} | {'module', atom()}.
+-type load_error_rsn() :: 'badfile'
+ | 'native_code'
+ | 'nofile'
+ | 'not_purged'
+ | 'on_load'
+ | 'sticky_directory'.
+-type load_ret() :: {'error', What :: load_error_rsn()}
+ | {'module', Module :: module()}.
-type loaded_ret_atoms() :: 'cover_compiled' | 'preloaded'.
--type loaded_filename() :: file:filename() | loaded_ret_atoms().
+-type loaded_filename() :: (Filename :: file:filename()) | loaded_ret_atoms().
%%----------------------------------------------------------------------------
%% User interface
@@ -127,55 +133,74 @@
objfile_extension() ->
init:objfile_extension().
--spec load_file(Module :: atom()) -> load_ret().
+-spec load_file(Module) -> load_ret() when
+ Module :: module().
load_file(Mod) when is_atom(Mod) ->
call({load_file,Mod}).
--spec ensure_loaded(Module :: atom()) -> load_ret().
+-spec ensure_loaded(Module) -> {module, Module} | {error, What} when
+ Module :: module(),
+ What :: embedded | badfile | native_code | nofile | on_load.
ensure_loaded(Mod) when is_atom(Mod) ->
call({ensure_loaded,Mod}).
%% XXX File as an atom is allowed only for backwards compatibility.
--spec load_abs(Filename :: file:filename()) -> load_ret().
+-spec load_abs(Filename) -> load_ret() when
+ Filename :: file:filename().
load_abs(File) when is_list(File); is_atom(File) -> call({load_abs,File,[]}).
%% XXX Filename is also an atom(), e.g. 'cover_compiled'
--spec load_abs(Filename :: loaded_filename(), Module :: atom()) -> load_ret().
+-spec load_abs(Filename :: loaded_filename(), Module :: module()) -> load_ret().
load_abs(File, M) when (is_list(File) orelse is_atom(File)), is_atom(M) ->
call({load_abs,File,M}).
%% XXX Filename is also an atom(), e.g. 'cover_compiled'
--spec load_binary(Module :: atom(), Filename :: loaded_filename(), Binary :: binary()) -> load_ret().
+-spec load_binary(Module, Filename, Binary) ->
+ {module, Module} | {error, What} when
+ Module :: module(),
+ Filename :: loaded_filename(),
+ Binary :: binary(),
+ What :: badarg | load_error_rsn().
load_binary(Mod, File, Bin)
when is_atom(Mod), (is_list(File) orelse is_atom(File)), is_binary(Bin) ->
call({load_binary,Mod,File,Bin}).
--spec load_native_partial(Module :: atom(), Binary :: binary()) -> load_ret().
+-spec load_native_partial(Module :: module(), Binary :: binary()) -> load_ret().
load_native_partial(Mod, Bin) when is_atom(Mod), is_binary(Bin) ->
call({load_native_partial,Mod,Bin}).
--spec load_native_sticky(Module :: atom(), Binary :: binary(), WholeModule :: 'false' | binary()) -> load_ret().
+-spec load_native_sticky(Module :: module(), Binary :: binary(), WholeModule :: 'false' | binary()) -> load_ret().
load_native_sticky(Mod, Bin, WholeModule)
when is_atom(Mod), is_binary(Bin),
(is_binary(WholeModule) orelse WholeModule =:= false) ->
call({load_native_sticky,Mod,Bin,WholeModule}).
--spec delete(Module :: atom()) -> boolean().
+-spec delete(Module) -> boolean() when
+ Module :: module().
delete(Mod) when is_atom(Mod) -> call({delete,Mod}).
--spec purge(Module :: atom()) -> boolean().
+-spec purge(Module) -> boolean() when
+ Module :: module().
purge(Mod) when is_atom(Mod) -> call({purge,Mod}).
--spec soft_purge(Module :: atom()) -> boolean().
+-spec soft_purge(Module) -> boolean() when
+ Module :: module().
soft_purge(Mod) when is_atom(Mod) -> call({soft_purge,Mod}).
--spec is_loaded(Module :: atom()) -> {'file', loaded_filename()} | 'false'.
+-spec is_loaded(Module) -> {'file', Loaded} | false when
+ Module :: module(),
+ Loaded :: loaded_filename().
is_loaded(Mod) when is_atom(Mod) -> call({is_loaded,Mod}).
--spec get_object_code(Module :: atom()) -> {atom(), binary(), file:filename()} | 'error'.
+-spec get_object_code(Module) -> {Module, Binary, Filename} | error when
+ Module :: module(),
+ Binary :: binary(),
+ Filename :: file:filename().
get_object_code(Mod) when is_atom(Mod) -> call({get_object_code, Mod}).
--spec all_loaded() -> [{atom(), loaded_filename()}].
+-spec all_loaded() -> [{Module, Loaded}] when
+ Module :: module(),
+ Loaded :: loaded_filename().
all_loaded() -> call(all_loaded).
-spec stop() -> no_return().
@@ -188,65 +213,86 @@ root_dir() -> call({dir,root_dir}).
lib_dir() -> call({dir,lib_dir}).
%% XXX is_list() is for backwards compatibility -- take out in future version
--spec lib_dir(App :: atom()) -> file:filename() | {'error', 'bad_name'}.
+-spec lib_dir(Name) -> file:filename() | {'error', 'bad_name'} when
+ Name :: atom().
lib_dir(App) when is_atom(App) ; is_list(App) -> call({dir,{lib_dir,App}}).
--spec lib_dir(App :: atom(), SubDir :: atom()) -> file:filename() | {'error', 'bad_name'}.
+-spec lib_dir(Name, SubDir) -> file:filename() | {'error', 'bad_name'} when
+ Name :: atom(),
+ SubDir :: atom().
lib_dir(App, SubDir) when is_atom(App), is_atom(SubDir) -> call({dir,{lib_dir,App,SubDir}}).
-spec compiler_dir() -> file:filename().
compiler_dir() -> call({dir,compiler_dir}).
%% XXX is_list() is for backwards compatibility -- take out in future version
--spec priv_dir(App :: atom()) -> file:filename() | {'error', 'bad_name'}.
+-spec priv_dir(Name) -> file:filename() | {'error', 'bad_name'} when
+ Name :: atom().
priv_dir(App) when is_atom(App) ; is_list(App) -> call({dir,{priv_dir,App}}).
--spec stick_dir(Directory :: file:filename()) -> 'ok' | 'error'.
+-spec stick_dir(Dir) -> 'ok' | 'error' when
+ Dir :: file:filename().
stick_dir(Dir) when is_list(Dir) -> call({stick_dir,Dir}).
--spec unstick_dir(Directory :: file:filename()) -> 'ok' | 'error'.
+-spec unstick_dir(Dir) -> 'ok' | 'error' when
+ Dir :: file:filename().
unstick_dir(Dir) when is_list(Dir) -> call({unstick_dir,Dir}).
--spec stick_mod(Module :: atom()) -> 'true'.
+-spec stick_mod(Module :: module()) -> 'true'.
stick_mod(Mod) when is_atom(Mod) -> call({stick_mod,Mod}).
--spec unstick_mod(Module :: atom()) -> 'true'.
+-spec unstick_mod(Module :: module()) -> 'true'.
unstick_mod(Mod) when is_atom(Mod) -> call({unstick_mod,Mod}).
--spec is_sticky(Module :: atom()) -> boolean().
+-spec is_sticky(Module) -> boolean() when
+ Module :: module().
is_sticky(Mod) when is_atom(Mod) -> call({is_sticky,Mod}).
--spec set_path(Directories :: [file:filename()]) ->
- 'true' | {'error', 'bad_directory' | 'bad_path'}.
+-spec set_path(Path) -> 'true' | {'error', What} when
+ Path :: [Dir :: file:filename()],
+ What :: 'bad_directory' | 'bad_path'.
set_path(PathList) when is_list(PathList) -> call({set_path,PathList}).
--spec get_path() -> [file:filename()].
+-spec get_path() -> Path when
+ Path :: [Dir :: file:filename()].
get_path() -> call(get_path).
-type add_path_ret() :: 'true' | {'error', 'bad_directory'}.
--spec add_path(Directory :: file:filename()) -> add_path_ret().
+-spec add_path(Dir) -> add_path_ret() when
+ Dir :: file:filename().
add_path(Dir) when is_list(Dir) -> call({add_path,last,Dir}).
--spec add_pathz(Directory :: file:filename()) -> add_path_ret().
+-spec add_pathz(Dir) -> add_path_ret() when
+ Dir :: file:filename().
add_pathz(Dir) when is_list(Dir) -> call({add_path,last,Dir}).
--spec add_patha(Directory :: file:filename()) -> add_path_ret().
+-spec add_patha(Dir) -> add_path_ret() when
+ Dir :: file:filename().
add_patha(Dir) when is_list(Dir) -> call({add_path,first,Dir}).
--spec add_paths(Directories :: [file:filename()]) -> 'ok'.
+-spec add_paths(Dirs) -> 'ok' when
+ Dirs :: [Dir :: file:filename()].
add_paths(Dirs) when is_list(Dirs) -> call({add_paths,last,Dirs}).
--spec add_pathsz(Directories :: [file:filename()]) -> 'ok'.
+-spec add_pathsz(Dirs) -> 'ok' when
+ Dirs :: [Dir :: file:filename()].
add_pathsz(Dirs) when is_list(Dirs) -> call({add_paths,last,Dirs}).
--spec add_pathsa(Directories :: [file:filename()]) -> 'ok'.
+-spec add_pathsa(Dirs) -> 'ok' when
+ Dirs :: [Dir :: file:filename()].
add_pathsa(Dirs) when is_list(Dirs) -> call({add_paths,first,Dirs}).
--spec del_path(Name :: file:filename() | atom()) -> boolean() | {'error', 'bad_name'}.
+-spec del_path(NameOrDir) -> boolean() | {'error', What} when
+ NameOrDir :: Name | Dir,
+ Name :: atom(),
+ Dir :: file:filename(),
+ What :: 'bad_name'.
del_path(Name) when is_list(Name) ; is_atom(Name) -> call({del_path,Name}).
--type replace_path_error() :: {'error', 'bad_directory' | 'bad_name' | {'badarg',_}}.
--spec replace_path(Name:: atom(), Dir :: file:filename()) -> 'true' | replace_path_error().
+-spec replace_path(Name, Dir) -> 'true' | {'error', What} when
+ Name:: atom(),
+ Dir :: file:filename(),
+ What :: 'bad_directory' | 'bad_name' | {'badarg',_}.
replace_path(Name, Dir) when (is_atom(Name) orelse is_list(Name)),
(is_atom(Dir) orelse is_list(Dir)) ->
call({replace_path,Name,Dir}).
@@ -351,10 +397,9 @@ get_mode(Flags) ->
%% In that case return the name of the file which contains
%% the loaded object code
--type which_ret_atoms() :: loaded_ret_atoms() | 'non_existing'.
-
--spec which(Module :: atom()) -> file:filename() | which_ret_atoms().
-
+-spec which(Module) -> Which when
+ Module :: module(),
+ Which :: file:filename() | loaded_ret_atoms() | non_existing.
which(Module) when is_atom(Module) ->
case is_loaded(Module) of
false ->
@@ -394,9 +439,9 @@ which(File, Base, [Directory|Tail]) ->
%% Search the code path for a specific file. Try to locate
%% it in the code path cache if possible.
--spec where_is_file(Filename :: file:filename()) ->
- 'non_existing' | file:filename().
-
+-spec where_is_file(Filename) -> non_existing | Absname when
+ Filename :: file:filename(),
+ Absname :: file:filename().
where_is_file(File) when is_list(File) ->
case call({is_cached,File}) of
no ->
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
index f1a8aa9f77..5e4e1b0ba8 100644
--- a/lib/kernel/src/file.erl
+++ b/lib/kernel/src/file.erl
@@ -100,15 +100,7 @@
| 'enotblk' | 'enotdir' | 'enotsup' | 'enxio' | 'eperm'
| 'epipe' | 'erofs' | 'espipe' | 'esrch' | 'estale'
| 'exdev'.
--type bindings() :: erl_eval:binding_struct().
-
--type date() :: {Year :: pos_integer(),
- Month :: pos_integer(),
- Day ::pos_integer()}.
--type time() :: {Hour :: non_neg_integer(),
- Minute :: non_neg_integer(),
- Second :: non_neg_integer()}.
--type date_time() :: {date(), time()}.
+-type date_time() :: calendar:datetime().
-type posix_file_advise() :: 'normal' | 'sequential' | 'random'
| 'no_reuse' | 'will_need' | 'dont_need'.
@@ -920,7 +912,7 @@ eval(File) ->
-spec eval(Filename, Bindings) -> ok | {error, Reason} when
Filename :: name(),
- Bindings :: bindings(),
+ Bindings :: erl_eval:binding_struct(),
Reason :: posix() | badarg | terminated | system_limit
| {Line :: integer(), Mod :: module(), Term :: term()}.
@@ -948,7 +940,7 @@ path_eval(Path, File) ->
{ok, FullName} | {error, Reason} when
Path :: [Dir :: name()],
Filename :: name(),
- Bindings :: bindings(),
+ Bindings :: erl_eval:binding_struct(),
FullName :: filename(),
Reason :: posix() | badarg | terminated | system_limit
| {Line :: integer(), Mod :: module(), Term :: term()}.
@@ -979,7 +971,7 @@ script(File) ->
-spec script(Filename, Bindings) -> {ok, Value} | {error, Reason} when
Filename :: name(),
- Bindings :: bindings(),
+ Bindings :: erl_eval:binding_struct(),
Value :: term(),
Reason :: posix() | badarg | terminated | system_limit
| {Line :: integer(), Mod :: module(), Term :: term()}.
@@ -1010,7 +1002,7 @@ path_script(Path, File) ->
{ok, Value, FullName} | {error, Reason} when
Path :: [Dir :: name()],
Filename :: name(),
- Bindings :: bindings(),
+ Bindings :: erl_eval:binding_struct(),
Value :: term(),
FullName :: filename(),
Reason :: posix() | badarg | terminated | system_limit
diff --git a/lib/kernel/src/inet_config.erl b/lib/kernel/src/inet_config.erl
index 2458876326..1ddbdcec25 100644
--- a/lib/kernel/src/inet_config.erl
+++ b/lib/kernel/src/inet_config.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% 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
@@ -44,26 +44,6 @@
%%
-spec init() -> 'ok'.
init() ->
- OsType = os:type(),
- case OsType of
- {ose,_} ->
- case init:get_argument(loader) of
- {ok,[["ose_inet"]]} ->
- %% port already started by prim_loader
- ok;
- _Other ->
- %% Setup reserved port for ose_inet driver (only OSE)
- case catch erlang:open_port({spawn,"ose_inet"}, [binary]) of
- {'EXIT',Why} ->
- error("can't open port for ose_inet: ~p", [Why]);
- OseInetPort ->
- erlang:display({ose_inet_port,OseInetPort})
- end
- end;
- _ ->
- ok
- end,
-
set_hostname(),
%% Note: In shortnames (or non-distributed) mode we don't need to know
@@ -71,6 +51,7 @@ init() ->
%% the user to provide it (by means of inetrc), so we need to look
%% for it ourselves.
+ OsType = os:type(),
do_load_resolv(OsType, erl_dist_mode()),
case OsType of
@@ -226,35 +207,6 @@ do_load_resolv(vxworks, _) ->
load_resolv(Resolv, resolv)
end;
-do_load_resolv({ose,_Type}, _) ->
- inet_db:set_lookup([file, dns]),
- case os:getenv("NAMESERVER") of
- false ->
- case os:getenv("RESOLVFILE") of
- false ->
- erlang:display('Warning: No NAMESERVER or RESOLVFILE specified!'),
- no_resolv;
- Resolv ->
- load_resolv(Resolv, resolv)
- end;
- Ns ->
- {ok,IP} = inet_parse:address(Ns),
- inet_db:add_rc_list([{nameserver,IP}])
- end,
- case os:getenv("DOMAIN") of
- false ->
- no_domain;
- D ->
- ok = inet_db:add_rc_list([{domain,D}])
- end,
- case os:getenv("HOSTSFILE") of
- false ->
- erlang:display('Warning: No HOSTSFILE specified!'),
- no_hosts_file;
- File ->
- load_hosts(File, ose)
- end;
-
do_load_resolv(_, _) ->
inet_db:set_lookup([native]).
diff --git a/lib/kernel/src/rpc.erl b/lib/kernel/src/rpc.erl
index be35f99ed2..e214ffa404 100644
--- a/lib/kernel/src/rpc.erl
+++ b/lib/kernel/src/rpc.erl
@@ -662,9 +662,10 @@ async_call(Node, Mod, Fun, Args) ->
ReplyTo ! {self(), {promise_reply, R}} %% self() is key
end).
--spec yield(Key) -> {value, Val} | timeout when
+-spec yield(Key) -> Res | {badrpc, Reason} when
Key :: key(),
- Val :: (Res :: term()) | {badrpc, Reason :: term()}.
+ Res :: term(),
+ Reason :: term().
yield(Key) when is_pid(Key) ->
{value,R} = do_yield(Key, infinity),
diff --git a/lib/stdlib/doc/src/calendar.xml b/lib/stdlib/doc/src/calendar.xml
index 4876b37127..f8db48e00c 100644
--- a/lib/stdlib/doc/src/calendar.xml
+++ b/lib/stdlib/doc/src/calendar.xml
@@ -75,13 +75,13 @@
<datatypes>
<datatype>
- <name name="t_datetime"/>
+ <name name="datetime"/>
</datatype>
<datatype>
- <name name="t_datetime1970"/>
+ <name name="datetime1970"/>
</datatype>
<datatype>
- <name name="t_date"/>
+ <name name="date"/>
</datatype>
<datatype>
<name name="year"/>
@@ -100,7 +100,7 @@
<name name="day"/>
</datatype>
<datatype>
- <name name="t_time"/>
+ <name name="time"/>
</datatype>
<datatype>
<name name="hour"/>
@@ -118,12 +118,7 @@
<name name="ldom"/>
</datatype>
<datatype>
- <name name="t_now"/>
- <desc><p>See <seealso marker="erts:erlang#now/0">erlang:now/0</seealso>.</p>
- </desc>
- </datatype>
- <datatype>
- <name name="t_yearweeknum"/>
+ <name name="yearweeknum"/>
</datatype>
<datatype>
<name name="weeknum"/>
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml
index af9c75d546..667d758e29 100644
--- a/lib/stdlib/doc/src/io.xml
+++ b/lib/stdlib/doc/src/io.xml
@@ -439,7 +439,7 @@ ok</pre>
<item>
<p>Prints the argument with the <c>string</c> syntax. The
argument is, if no Unicode translation modifier is present, an
- <seealso marker="erts:erlang#iolist_definition">I/O list</seealso>, a binary, or an atom. If the Unicode translation modifier ('t') is in effect, the argument is unicode:chardata(), meaning that binaries are in UTF-8. The characters
+ iolist(), a binary, or an atom. If the Unicode translation modifier ('t') is in effect, the argument is unicode:chardata(), meaning that binaries are in UTF-8. The characters
are printed without quotes. The string is first truncated
by the given precision and then padded and justified
to the given field width. The default precision is the field width.</p>
diff --git a/lib/stdlib/src/calendar.erl b/lib/stdlib/src/calendar.erl
index 8d1071209e..0320e0cd0e 100644
--- a/lib/stdlib/src/calendar.erl
+++ b/lib/stdlib/src/calendar.erl
@@ -63,7 +63,7 @@
%% Types
%%----------------------------------------------------------------------
--export_type([t_now/0]).
+-export_type([date/0, time/0, datetime/0, datetime1970/0]).
-type year() :: non_neg_integer().
-type year1970() :: 1970..10000. % should probably be 1970..
@@ -76,15 +76,11 @@
-type ldom() :: 28 | 29 | 30 | 31. % last day of month
-type weeknum() :: 1..53.
--type t_now() :: {MegaSecs :: non_neg_integer(),
- Secs :: non_neg_integer(),
- MicroSecs :: non_neg_integer()}.
-
--type t_date() :: {year(),month(),day()}.
--type t_time() :: {hour(),minute(),second()}.
--type t_datetime() :: {t_date(),t_time()}.
--type t_datetime1970() :: {{year1970(),month(),day()},t_time()}.
--type t_yearweeknum() :: {year(),weeknum()}.
+-type date() :: {year(),month(),day()}.
+-type time() :: {hour(),minute(),second()}.
+-type datetime() :: {date(),time()}.
+-type datetime1970() :: {{year1970(),month(),day()},time()}.
+-type yearweeknum() :: {year(),weeknum()}.
%%----------------------------------------------------------------------
@@ -123,7 +119,7 @@ date_to_gregorian_days(Year, Month, Day) when is_integer(Day), Day > 0 ->
end.
-spec date_to_gregorian_days(Date) -> Days when
- Date :: t_date(),
+ Date :: date(),
Days :: non_neg_integer().
date_to_gregorian_days({Year, Month, Day}) ->
date_to_gregorian_days(Year, Month, Day).
@@ -135,7 +131,7 @@ date_to_gregorian_days({Year, Month, Day}) ->
%% January 1st.
%%
-spec datetime_to_gregorian_seconds(DateTime) -> Seconds when
- DateTime :: t_datetime(),
+ DateTime :: datetime(),
Seconds :: non_neg_integer().
datetime_to_gregorian_seconds({Date, Time}) ->
?SECONDS_PER_DAY*date_to_gregorian_days(Date) +
@@ -155,14 +151,14 @@ day_of_the_week(Year, Month, Day) ->
(date_to_gregorian_days(Year, Month, Day) + 5) rem 7 + 1.
-spec day_of_the_week(Date) -> daynum() when
- Date:: t_date().
+ Date:: date().
day_of_the_week({Year, Month, Day}) ->
day_of_the_week(Year, Month, Day).
%% gregorian_days_to_date(Days) = {Year, Month, Day}
%%
--spec gregorian_days_to_date(Days) -> t_date() when
+-spec gregorian_days_to_date(Days) -> date() when
Days :: non_neg_integer().
gregorian_days_to_date(Days) ->
{Year, DayOfYear} = day_to_year(Days),
@@ -172,7 +168,7 @@ gregorian_days_to_date(Days) ->
%% gregorian_seconds_to_datetime(Secs)
%%
--spec gregorian_seconds_to_datetime(Seconds) -> t_datetime() when
+-spec gregorian_seconds_to_datetime(Seconds) -> datetime() when
Seconds :: non_neg_integer().
gregorian_seconds_to_datetime(Secs) when Secs >= 0 ->
Days = Secs div ?SECONDS_PER_DAY,
@@ -198,7 +194,7 @@ is_leap_year1(_) -> false.
%%
%% Calculates the iso week number for the current date.
%%
--spec iso_week_number() -> t_yearweeknum().
+-spec iso_week_number() -> yearweeknum().
iso_week_number() ->
{Date, _} = local_time(),
iso_week_number(Date).
@@ -207,8 +203,8 @@ iso_week_number() ->
%%
%% Calculates the iso week number for the given date.
%%
--spec iso_week_number(Date) -> t_yearweeknum() when
- Date :: t_date().
+-spec iso_week_number(Date) -> yearweeknum() when
+ Date :: date().
iso_week_number({Year, Month, Day}) ->
D = date_to_gregorian_days({Year, Month, Day}),
W01_1_Year = gregorian_days_of_iso_w01_1(Year),
@@ -260,7 +256,7 @@ last_day_of_the_month1(_, M) when is_integer(M), M > 0, M < 13 ->
%% local_time()
%%
%% Returns: {date(), time()}, date() = {Y, M, D}, time() = {H, M, S}.
--spec local_time() -> t_datetime().
+-spec local_time() -> datetime().
local_time() ->
erlang:localtime().
@@ -268,20 +264,20 @@ local_time() ->
%% local_time_to_universal_time(DateTime)
%%
-spec local_time_to_universal_time(DateTime1) -> DateTime2 when
- DateTime1 :: t_datetime1970(),
- DateTime2 :: t_datetime1970().
+ DateTime1 :: datetime1970(),
+ DateTime2 :: datetime1970().
local_time_to_universal_time(DateTime) ->
erlang:localtime_to_universaltime(DateTime).
--spec local_time_to_universal_time(t_datetime1970(),
+-spec local_time_to_universal_time(datetime1970(),
'true' | 'false' | 'undefined') ->
- t_datetime1970().
+ datetime1970().
local_time_to_universal_time(DateTime, IsDst) ->
erlang:localtime_to_universaltime(DateTime, IsDst).
-spec local_time_to_universal_time_dst(DateTime1) -> [DateTime] when
- DateTime1 :: t_datetime1970(),
- DateTime :: t_datetime1970().
+ DateTime1 :: datetime1970(),
+ DateTime :: datetime1970().
local_time_to_universal_time_dst(DateTime) ->
UtDst = erlang:localtime_to_universaltime(DateTime, true),
Ut = erlang:localtime_to_universaltime(DateTime, false),
@@ -309,14 +305,14 @@ local_time_to_universal_time_dst(DateTime) ->
%% = MilliSec = integer()
%% Returns: {date(), time()}, date() = {Y, M, D}, time() = {H, M, S}.
%%
--spec now_to_datetime(Now) -> t_datetime1970() when
- Now :: t_now().
+-spec now_to_datetime(Now) -> datetime1970() when
+ Now :: erlang:timestamp().
now_to_datetime({MSec, Sec, _uSec}) ->
Sec0 = MSec*1000000 + Sec + ?DAYS_FROM_0_TO_1970*?SECONDS_PER_DAY,
gregorian_seconds_to_datetime(Sec0).
--spec now_to_universal_time(Now) -> t_datetime1970() when
- Now :: t_now().
+-spec now_to_universal_time(Now) -> datetime1970() when
+ Now :: erlang:timestamp().
now_to_universal_time(Now) ->
now_to_datetime(Now).
@@ -325,8 +321,8 @@ now_to_universal_time(Now) ->
%%
%% Args: Now = now()
%%
--spec now_to_local_time(Now) -> t_datetime1970() when
- Now :: t_now().
+-spec now_to_local_time(Now) -> datetime1970() when
+ Now :: erlang:timestamp().
now_to_local_time({MSec, Sec, _uSec}) ->
erlang:universaltime_to_localtime(
now_to_universal_time({MSec, Sec, _uSec})).
@@ -338,7 +334,7 @@ now_to_local_time({MSec, Sec, _uSec}) ->
-spec seconds_to_daystime(Seconds) -> {Days, Time} when
Seconds :: integer(),
Days :: integer(),
- Time :: t_time().
+ Time :: time().
seconds_to_daystime(Secs) ->
Days0 = Secs div ?SECONDS_PER_DAY,
Secs0 = Secs rem ?SECONDS_PER_DAY,
@@ -356,7 +352,7 @@ seconds_to_daystime(Secs) ->
%% Wraps.
%%
-type secs_per_day() :: 0..?SECONDS_PER_DAY.
--spec seconds_to_time(Seconds) -> t_time() when
+-spec seconds_to_time(Seconds) -> time() when
Seconds :: secs_per_day().
seconds_to_time(Secs) when Secs >= 0, Secs < ?SECONDS_PER_DAY ->
Secs0 = Secs rem ?SECONDS_PER_DAY,
@@ -375,10 +371,10 @@ seconds_to_time(Secs) when Secs >= 0, Secs < ?SECONDS_PER_DAY ->
%% Year = Month = Day = Hour = Minute = Sec = integer()
%%
-spec time_difference(T1, T2) -> {Days, Time} when
- T1 :: t_datetime(),
- T2 :: t_datetime(),
+ T1 :: datetime(),
+ T2 :: datetime(),
Days :: integer(),
- Time :: t_time().
+ Time :: time().
time_difference({{Y1, Mo1, D1}, {H1, Mi1, S1}},
{{Y2, Mo2, D2}, {H2, Mi2, S2}}) ->
Secs = datetime_to_gregorian_seconds({{Y2, Mo2, D2}, {H2, Mi2, S2}}) -
@@ -390,7 +386,7 @@ time_difference({{Y1, Mo1, D1}, {H1, Mi1, S1}},
%% time_to_seconds(Time)
%%
-spec time_to_seconds(Time) -> secs_per_day() when
- Time :: t_time().
+ Time :: time().
time_to_seconds({H, M, S}) when is_integer(H), is_integer(M), is_integer(S) ->
H * ?SECONDS_PER_HOUR +
M * ?SECONDS_PER_MINUTE + S.
@@ -399,15 +395,15 @@ time_to_seconds({H, M, S}) when is_integer(H), is_integer(M), is_integer(S) ->
%% universal_time()
%%
%% Returns: {date(), time()}, date() = {Y, M, D}, time() = {H, M, S}.
--spec universal_time() -> t_datetime().
+-spec universal_time() -> datetime().
universal_time() ->
erlang:universaltime().
%% universal_time_to_local_time(DateTime)
%%
--spec universal_time_to_local_time(DateTime) -> t_datetime() when
- DateTime :: t_datetime1970().
+-spec universal_time_to_local_time(DateTime) -> datetime() when
+ DateTime :: datetime1970().
universal_time_to_local_time(DateTime) ->
erlang:universaltime_to_localtime(DateTime).
@@ -429,7 +425,7 @@ valid_date1(_, _, _) ->
false.
-spec valid_date(Date) -> boolean() when
- Date :: t_date().
+ Date :: date().
valid_date({Y, M, D}) ->
valid_date(Y, M, D).
diff --git a/lib/stdlib/src/timer.erl b/lib/stdlib/src/timer.erl
index 89fae05e4f..e3d6c905b6 100644
--- a/lib/stdlib/src/timer.erl
+++ b/lib/stdlib/src/timer.erl
@@ -200,8 +200,8 @@ tc(M, F, A) ->
%% erlang:now() timestamps, T2-T1.
%%
-spec now_diff(T1, T2) -> Tdiff when
- T1 :: calendar:t_now(),
- T2 :: calendar:t_now(),
+ T1 :: erlang:timestamp(),
+ T2 :: erlang:timestamp(),
Tdiff :: integer().
now_diff({A2, B2, C2}, {A1, B1, C1}) ->
((A2-A1)*1000000 + B2-B1)*1000000 + C2-C1.