aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kernel/src/application.erl6
-rw-r--r--lib/kernel/src/disk_log_1.erl8
-rw-r--r--lib/kernel/src/erl_ddll.erl33
-rw-r--r--lib/kernel/src/error_handler.erl6
-rw-r--r--lib/kernel/src/global.erl30
-rw-r--r--lib/kernel/src/os.erl2
6 files changed, 59 insertions, 26 deletions
diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl
index d9db23d652..2a193affd4 100644
--- a/lib/kernel/src/application.erl
+++ b/lib/kernel/src/application.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -204,12 +204,12 @@ get_env(Key) ->
get_env(Application, Key) ->
application_controller:get_env(Application, Key).
--spec get_all_env() -> [] | [{atom(), any()}].
+-spec get_all_env() -> [{atom(), any()}].
get_all_env() ->
application_controller:get_pid_all_env(group_leader()).
--spec get_all_env(atom()) -> [] | [{atom(), any()}].
+-spec get_all_env(atom()) -> [{atom(), any()}].
get_all_env(Application) ->
application_controller:get_all_env(Application).
diff --git a/lib/kernel/src/disk_log_1.erl b/lib/kernel/src/disk_log_1.erl
index 8ccdb88d12..266df84a03 100644
--- a/lib/kernel/src/disk_log_1.erl
+++ b/lib/kernel/src/disk_log_1.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
@@ -581,11 +581,13 @@ done_scan(In, Out, OutName, FName, RecoveredTerms, BadChars) ->
file:delete(OutName),
throw(Error)
end.
-
+
+-spec repair_err(file:io_device(), #cache{}, file:filename(),
+ file:filename(), {'error', file:posix()}) -> no_return().
repair_err(In, Out, OutName, ErrFileName, Error) ->
file:close(In),
catch fclose(Out, OutName),
- % OutName is often the culprit, try to remove it anyway...
+ %% OutName is often the culprit, try to remove it anyway...
file:delete(OutName),
file_error(ErrFileName, Error).
diff --git a/lib/kernel/src/erl_ddll.erl b/lib/kernel/src/erl_ddll.erl
index 88f91de24f..ce64589a29 100644
--- a/lib/kernel/src/erl_ddll.erl
+++ b/lib/kernel/src/erl_ddll.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. 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
%% 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.
-%%
+%%
%% %CopyrightEnd%
%%
%% Dynamic Driver Loader and Linker
@@ -29,6 +29,11 @@
%%----------------------------------------------------------------------------
+-type path() :: string() | atom().
+-type driver() :: string() | atom().
+
+%%----------------------------------------------------------------------------
+
-spec start() -> {'error', {'already_started', 'undefined'}}.
start() ->
@@ -39,13 +44,13 @@ start() ->
stop() ->
ok.
--spec load_driver(Path :: string() | atom(), Driver :: string() | atom()) ->
+-spec load_driver(Path :: path(), Driver :: driver()) ->
'ok' | {'error', any()}.
load_driver(Path, Driver) ->
do_load_driver(Path, Driver, [{driver_options,[kill_ports]}]).
--spec load(Path :: string() | atom(), Driver :: string() | atom()) ->
+-spec load(Path :: path(), Driver :: driver()) ->
'ok' | {'error', any()}.
load(Path, Driver) ->
@@ -95,23 +100,23 @@ do_unload_driver(Driver,Flags) ->
end
end.
--spec unload_driver(Driver :: string() | atom()) -> 'ok' | {'error', any()}.
+-spec unload_driver(Driver :: driver()) -> 'ok' | {'error', any()}.
unload_driver(Driver) ->
do_unload_driver(Driver,[{monitor,pending_driver},kill_ports]).
--spec unload(Driver :: string() | atom()) -> 'ok' | {'error', any()}.
+-spec unload(Driver :: driver()) -> 'ok' | {'error', any()}.
unload(Driver) ->
do_unload_driver(Driver,[]).
--spec reload(Path :: string() | atom(), Driver :: string() | atom()) ->
+-spec reload(Path :: path(), Driver :: driver()) ->
'ok' | {'error', any()}.
reload(Path,Driver) ->
do_load_driver(Path, Driver, [{reload,pending_driver}]).
--spec reload_driver(Path :: string() | atom(), Driver :: string() | atom()) ->
+-spec reload_driver(Path :: path(), Driver :: driver()) ->
'ok' | {'error', any()}.
reload_driver(Path,Driver) ->
@@ -122,15 +127,15 @@ reload_driver(Path,Driver) ->
format_error(Code) ->
case Code of
- % This is the only error code returned only from erlang code...
- % 'permanent' has a translation in the emulator, even though the erlang code uses it to...
+ %% This is the only error code returned only from erlang code...
+ %% 'permanent' has a translation in the emulator, even though the erlang code uses it to...
load_cancelled ->
"Loading was cancelled from other process";
_ ->
erl_ddll:format_error_int(Code)
end.
--spec info(Driver :: string() | atom()) -> [{atom(), any()}].
+-spec info(Driver :: driver()) -> [{atom(), any()}, ...].
info(Driver) ->
[{processes, erl_ddll:info(Driver,processes)},
diff --git a/lib/kernel/src/error_handler.erl b/lib/kernel/src/error_handler.erl
index 885eeb2b0f..6f69f4ccb9 100644
--- a/lib/kernel/src/error_handler.erl
+++ b/lib/kernel/src/error_handler.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -80,9 +80,13 @@ int() -> int.
%%
%% Crash providing a beautiful stack backtrace.
%%
+-spec crash(atom(), [term()]) -> no_return().
+
crash(Fun, Args) ->
crash({Fun,Args}).
+-spec crash(atom(), atom(), arity()) -> no_return().
+
crash(M, F, A) ->
crash({M,F,A}).
diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl
index 081e7e2f93..6343acd000 100644
--- a/lib/kernel/src/global.erl
+++ b/lib/kernel/src/global.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-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
@@ -113,8 +113,9 @@
syncers = [] :: [pid()],
node_name = node() :: node(),
the_locker, the_registrar, trace,
- global_lock_down = false
+ global_lock_down = false :: boolean()
}).
+-type state() :: #state{}.
%%% There are also ETS tables used for bookkeeping of locks and names
%%% (the first position is the key):
@@ -399,6 +400,9 @@ info() ->
%%%-----------------------------------------------------------------
%%% Call-back functions from gen_server
%%%-----------------------------------------------------------------
+
+-spec init([]) -> {'ok', state()}.
+
init([]) ->
process_flag(trap_exit, true),
_ = ets:new(global_locks, [set, named_table, protected]),
@@ -542,6 +546,11 @@ init([]) ->
%% sent by each node to all new nodes (Node becomes known to them)
%%-----------------------------------------------------------------
+-spec handle_call(term(), {pid(), term()}, state()) ->
+ {'noreply', state()} |
+ {'reply', term(), state()} |
+ {'stop', 'normal', 'stopped', state()}.
+
handle_call({whereis, Name}, From, S) ->
do_whereis(Name, From),
{noreply, S};
@@ -621,6 +630,9 @@ handle_call(Request, From, S) ->
%% init_connect
%%
%%========================================================================
+
+-spec handle_cast(term(), state()) -> {'noreply', state()}.
+
handle_cast({init_connect, Vsn, Node, InitMsg}, S) ->
%% Sent from global_name_server at Node.
?trace({'####', init_connect, {vsn, Vsn}, {node,Node},{initmsg,InitMsg}}),
@@ -782,6 +794,11 @@ handle_cast(Request, S) ->
"handle_cast(~p, _)\n", [Request]),
{noreply, S}.
+%%========================================================================
+
+-spec handle_info(term(), state()) ->
+ {'noreply', state()} | {'stop', term(), state()}.
+
handle_info({'EXIT', Locker, _Reason}=Exit, #state{the_locker=Locker}=S) ->
{stop, {locker_died,Exit}, S#state{the_locker=undefined}};
handle_info({'EXIT', Registrar, _}=Exit, #state{the_registrar=Registrar}=S) ->
@@ -1122,12 +1139,17 @@ do_whereis(Name, From) ->
send_again({whereis, Name, From})
end.
+-spec terminate(term(), state()) -> 'ok'.
+
terminate(_Reason, _S) ->
true = ets:delete(global_names),
true = ets:delete(global_names_ext),
true = ets:delete(global_locks),
true = ets:delete(global_pid_names),
- true = ets:delete(global_pid_ids).
+ true = ets:delete(global_pid_ids),
+ ok.
+
+-spec code_change(term(), state(), term()) -> {'ok', state()}.
code_change(_OldVsn, S, _Extra) ->
{ok, S}.
@@ -1955,7 +1977,7 @@ delete_lock(Ref, S0) ->
Locks = pid_locks(Ref),
F = fun({ResourceId, LockRequesterId, PidRefs}, S) ->
{Pid, _RPid, Ref} = lists:keyfind(Ref, 3, PidRefs),
- remove_lock(ResourceId, LockRequesterId, Pid, PidRefs, true,S)
+ remove_lock(ResourceId, LockRequesterId, Pid, PidRefs, true, S)
end,
lists:foldl(F, S0, Locks).
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 95a2f71ec0..d1feae771d 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -137,7 +137,7 @@ reverse_element([$"|T]) -> %"
reverse_element(List) ->
lists:reverse(List).
--spec extensions() -> [string()].
+-spec extensions() -> [string(),...].
%% Extensions in lower case
extensions() ->
case type() of