Sets the code path to the list of directories Path.
+
Sets the code path to the list of directories Path.
Returns true if successful, or
- {error, bad_directory} if any Dir is not
+ {error, bad_directory} if any Dir is not
the name of a directory, or {error, bad_path} if
the argument is invalid.
- get_path() -> Path
+ Return the code server search path
-
- Path = [Dir]
- Dir = string()
-
Returns the code path
- add_path(Dir) -> true | {error, What}
- add_pathz(Dir) -> true | {error, What}
+
+ Add a directory to the end of the code path
-
- Dir = string()
- What = bad_directory
-
+
-
Adds Dir to the code path. The directory is added as
- the last directory in the new path. If Dir already
+
Adds Dir to the code path. The directory is added as
+ the last directory in the new path. If Dir already
exists in the path, it is not added.
Returns true if successful, or
- {error, bad_directory} if Dir is not the name
+ {error, bad_directory} if Dir is not the name
of a directory.
- add_patha(Dir) -> true | {error, What}
+ Add a directory to the beginning of the code path
-
- Dir = string()
- What = bad_directory
-
+
-
Adds Dir to the beginning of the code path. If
- Dir already exists, it is removed from the old
+
Adds Dir to the beginning of the code path. If
+ Dir already exists, it is removed from the old
position in the code path.
Returns true if successful, or
- {error, bad_directory} if Dir is not the name
+ {error, bad_directory} if Dir is not the name
of a directory.
- add_paths(Dirs) -> ok
- add_pathsz(Dirs) -> ok
+
+ Add directories to the end of the code path
-
- Dirs = [Dir]
- Dir = string()
-
-
Adds the directories in Dirs to the end of the code
- path. If a Dir already exists, it is not added. This
+
Adds the directories in Dirs to the end of the code
+ path. If a Dir already exists, it is not added. This
function always returns ok, regardless of the validity
- of each individual Dir.
+ of each individual Dir.
- add_pathsa(Dirs) -> ok
+ Add directories to the beginning of the code path
-
- Dirs = [Dir]
- Dir = string()
-
-
Adds the directories in Dirs to the beginning of
- the code path. If a Dir already exists, it is removed
+
Adds the directories in Dirs to the beginning of
+ the code path. If a Dir already exists, it is removed
from the old position in the code path. This function always
returns ok, regardless of the validity of each
- individual Dir.
+ individual Dir.
- del_path(Name | Dir) -> true | false | {error, What}
+ Delete a directory from the code path
-
- Name = atom()
- Dir = string()
- What = bad_name
-
Deletes a directory from the code path. The argument can be
- an atom Name, in which case the directory with
- the name .../Name[-Vsn][/ebin] is deleted from the code
+ an atom Name, in which case the directory with
+ the name .../Name[-Vsn][/ebin] is deleted from the code
path. It is also possible to give the complete directory name
- Dir as argument.
+ Dir as argument.
Returns true if successful, or false if
the directory is not found, or {error, bad_name} if
the argument is invalid.
- replace_path(Name, Dir) -> true | {error, What}
+ Replace a directory with another in the code path
-
- Name = atom()
- Dir = string()
- What = bad_name | bad_directory | {badarg, term()}
-
This function replaces an old occurrence of a directory
- named .../Name[-Vsn][/ebin], in the code path, with
- Dir. If Name does not exist, it adds the new
- directory Dir last in the code path. The new directory
- must also be named .../Name[-Vsn][/ebin]. This function
+ named .../Name[-Vsn][/ebin], in the code path, with
+ Dir. If Name does not exist, it adds the new
+ directory Dir last in the code path. The new directory
+ must also be named .../Name[-Vsn][/ebin]. This function
should be used if a new version of the directory (library) is
added to a running system.
Returns true if successful, or
- {error, bad_name} if Name is not found, or
- {error, bad_directory} if Dir does not exist, or
- {error, {badarg, [Name, Dir]}} if Name or
- Dir is invalid.
+ {error, bad_name} if Name is not found, or
+ {error, bad_directory} if Dir does not exist, or
+ {error, {badarg, [Name, Dir]}} if Name or
+ Dir is invalid.
- load_file(Module) -> {module, Module} | {error, What}
+ Load a module
-
- Module = atom()
- What = nofile | sticky_directory | badarg | term()
-
+
-
Tries to load the Erlang module Module, using
+
Tries to load the Erlang module Module, using
the code path. It looks for the object code file with an
extension that corresponds to the Erlang machine used, for
- example Module.beam. The loading fails if the module
+ example Module.beam. The loading fails if the module
name found in the object code differs from the name
- Module.
+ Module.
load_binary/3 must
be used to load object code with a module name that is
different from the file name.
-
Returns {module, Module} if successful, or
+
Returns {module, Module} if successful, or
{error, nofile} if no object code is found, or
{error, sticky_directory} if the object code resides in
- a sticky directory, or {error, badarg} 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
erlang:load_module/2
- for possible values of What.
+ for possible values of What.
- load_abs(Filename) -> {module, Module} | {error, What}
+ Load a module, residing in a given file
-
- Filename = string()
- Module = atom()
- What = nofile | sticky_directory | badarg | term()
-
+
+
+
-
Does the same as load_file(Module), but
- Filename is either an absolute file name, or a
+
Does the same as load_file(Module), but
+ Filename 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
load_file/1. Note
- that Filename should not contain the extension (for
+ that Filename should not contain the extension (for
example ".beam"); load_abs/1 adds the correct
extension itself.
- ensure_loaded(Module) -> {module, Module} | {error, What}
+ Ensure that a module is loaded
-
- Module = atom()
- What = nofile | sticky_directory | embedded | badarg | term()
-
Tries to to load a module in the same way as
load_file/1,
@@ -487,54 +447,45 @@
This function can be used to load object code on remote
- Erlang nodes. The argument Binary must contain
- object code for Module.
- Filename is only used by the code server to keep a
- record of from which file the object code for Module
- comes. Accordingly, Filename is not opened and read by
+ Erlang nodes. The argument Binary must contain
+ object code for Module.
+ Filename is only used by the code server to keep a
+ record of from which file the object code for Module
+ comes. Accordingly, Filename is not opened and read by
the code server.
-
Returns {module, Module} if successful, or
+
Returns {module, Module} if successful, or
{error, sticky_directory} if the object code resides in
a sticky directory, or {error, badarg} if any argument
is invalid. Also if the loading fails, an error tuple is
returned. See
erlang:load_module/2
- for possible values of What.
+ for possible values of What.
- delete(Module) -> true | false
+ Removes current code for a module
-
- Module = atom()
-
-
Removes the current code for Module, that is,
- the current code for Module is made old. This means
+
Removes the current code for Module, that is,
+ the current code for Module 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.
Returns true if successful, or false if there
- is old code for Module which must be purged first, or
- if Module is not a (loaded) module.
+ is old code for Module which must be purged first, or
+ if Module is not a (loaded) module.
- purge(Module) -> true | false
+ Removes old code for a module
-
- Module = atom()
-
-
Purges the code for Module, that is, removes code
+
Purges the code for Module, 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.
Returns true if successful and any process needed to
@@ -542,31 +493,26 @@
- soft_purge(Module) -> true | false
+ Removes old code for a module, unless no process uses it
-
- Module = atom()
-
-
Purges the code for Module, that is, removes code
+
Purges the code for Module, that is, removes code
marked as old, but only if no processes linger in it.
Returns false if the module could not be purged due
to processes lingering in old code, otherwise true.
Checks if Module is loaded. If it is,
- {file, Loaded} is returned, otherwise false.
-
Normally, Loaded is the absolute file name
- Absname from which the code was obtained. If the module
+
+
+ Filename is an absolute filename
+
+
Checks if Module is loaded. If it is,
+ {file, Loaded} is returned, otherwise false.
+
Normally, Loaded is the absolute file name
+ Filename from which the code was obtained. If the module
is preloaded (see
script(4)),
Loaded==preloaded. If the module is Cover compiled (see
@@ -575,32 +521,26 @@
- all_loaded() -> [{Module, Loaded}]
+ Get all loaded modules
-
- Module = atom()
- Loaded = Absname | preloaded | cover_compiled
- Absname = string()
-
+
+
+ Filename is an absolute filename
-
Returns a list of tuples {Module, Loaded} for all
- loaded modules. Loaded is normally the absolute file
+
Returns a list of tuples {Module, Loaded} for all
+ loaded modules. Loaded is normally the absolute file
name, as described for
is_loaded/1.
- which(Module) -> Which
+ The object code file of a module
-
- Module = atom()
- Which = Filename | non_existing | preloaded | cover_compiled
- Filename = string()
-
+
If the module is not loaded, this function searches the code
path for the first file which contains object code for
- Module and returns the absolute file name. If
+ Module 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,
preloaded is returned. If the module is Cover compiled,
@@ -609,21 +549,16 @@
- get_object_code(Module) -> {Module, Binary, Filename} | error
+ Get the object code for a module
-
- Module = atom()
- Binary = binary()
- Filename = string()
-
Searches the code path for the object code of the module
- Module. It returns {Module, Binary, Filename}
- if successful, and error if not. Binary is a
+ Module. It returns {Module, Binary, Filename}
+ if successful, and error if not. Binary 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 Module on a node Node is done as
+ module Module on a node Node is done as
follows:
Returns the root directory of Erlang/OTP, which is
@@ -644,7 +579,7 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
- lib_dir() -> string()
+ Library directory of Erlang/OTP
Returns the library directory, $OTPROOT/lib, where
@@ -655,19 +590,16 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
- lib_dir(Name) -> string() | {error, bad_name}
+ Library directory for an application
-
- Name = atom()
-
This function is mainly intended for finding out the path
for the "library directory", the top directory, for an
- application Name located under $OTPROOT/lib or
+ application Name located under $OTPROOT/lib or
on a directory referred to via the ERL_LIBS
environment variable.
-
If there is a regular directory called Name or
- Name-Vsn in the code path with an ebin
+
If there is a regular directory called Name or
+ Name-Vsn in the code path with an ebin
subdirectory, the path to this directory is returned (not
the ebin 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]),
Returns {error, bad_name} if Name
is not the name of an application under $OTPROOT/lib or
on a directory referred to via the ERL_LIBS
environment variable. Fails with an exception if Name
has the wrong type.
-
For backward compatibility, Name is also allowed to
+
For backward compatibility, Name is also allowed to
be a string. That will probably change in a future release.
- lib_dir(Name, SubDir) -> string() | {error, bad_name}
+ subdirectory for an application
-
- Name = atom()
- SubDir = atom()
-
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]),
> code:lib_dir(megaco, priv).
"/usr/local/otp/lib/megaco-3.9.1.1/priv"
-
Fails with an exception if Name or SubDir has
+
Fails with an exception if Name or SubDir has
the wrong type.
- compiler_dir() -> string()
+ Library directory for the compiler
Returns the compiler library directory. Equivalent to
@@ -724,21 +652,18 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
- priv_dir(Name) -> string() | {error, bad_name}
+ Priv directory for an application
-
- Name = atom()
-
Returns the path to the priv directory in an
- application. Equivalent to code:lib_dir(Name,priv)..
+ application. Equivalent to code:lib_dir(Name, priv)..
-
For backward compatibility, Name is also allowed to
+
For backward compatibility, Name is also allowed to
be a string. That will probably change in a future release.
Returns the object code file extension that corresponds to
@@ -746,24 +671,16 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
- stick_dir(Dir) -> ok | error
+ Mark a directory as sticky
-
- Dir = string()
- What = term()
-
-
This function marks Dir as sticky.
+
This function marks Dir as sticky.
Returns ok if successful or error if not.
- unstick_dir(Dir) -> ok | error
+ Remove a sticky directory mark
-
- Dir = string()
- What = term()
-
This function unsticks a directory which has been marked as
sticky.
@@ -771,45 +688,39 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
- is_sticky(Module) -> true | false
+ Test whether a module is sticky
-
- Module = atom()
-
-
This function returns true if Module is the
+
This function returns true if Module 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 false if Module is not a loaded module or is
+ or false if Module is not a loaded module or is
not sticky.
- rehash() -> ok
+ Rehash or create code path cache
This function creates or rehashes the code path cache.
- where_is_file(Filename) -> Absname | non_existing
+ Full name of a file located in the code path
-
- Filename = Absname = string()
-
-
Searches the code path for Filename, a file of
+
Searches the code path for Filename, a file of
arbitrary type. If found, the full name is returned.
non_existing 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 Filename is an object code
+ the cache, provided that Filename is an object code
file or an .app file.
- clash() -> ok
+ Search for modules with identical names.
Searches the entire code space for module names with
@@ -817,10 +728,10 @@ rpc:call(Node, code, load_binary, [Module, Filename, Binary]),
This function returns true if Module 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
@@ -94,9 +94,6 @@
-
-
-
@@ -135,12 +132,6 @@
Unix, and in the runtime libraries of most C compilers.
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}.
The following fields are used from the record, if they are
given.
- atime = time()
+ atime = date_time()
The last (local) time the file was read.
- mtime = time()
+ mtime = date_time()
The last (local) time the file was written.
- ctime = time()
+ ctime = date_time()
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
- timestamp() -> {MegaSecs, Secs, MicroSecs}
+ timestamp() -> TimestampReturna a timestamp from the OS in the erlang:now/0 format
+ Timestamp = {MegaSecs, Secs, MicroSecs} = erlang:timestamp()MegaSecs = Secs = MicroSecs = integer() >= 0
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),
--
cgit v1.2.3