From 664c94ce53f21d7c2927ffab60aeaf74b4627049 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Tue, 7 Dec 2010 15:11:07 +0100 Subject: Improve implicit_inet6 testcase skip conditions --- lib/kernel/test/gen_tcp_api_SUITE.erl | 54 ++++++++++++++++++---------------- lib/kernel/test/gen_udp_SUITE.erl | 55 ++++++++++++++++++----------------- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index 94637290a1..5f190f3e30 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -160,34 +160,38 @@ t_fdopen(Config) when is_list(Config) -> %%% implicit inet6 option to api functions t_implicit_inet6(Config) when is_list(Config) -> - ?line Hostname = ok(inet:gethostname()), + ?line Host = ok(inet:gethostname()), + ?line + case inet:getaddr(Host, inet6) of + {ok,Addr} -> + ?line t_implicit_inet6(Host, Addr); + {error,Reason} -> + {skip, + "Can not look up IPv6 address: " + ++atom_to_list(Reason)} + end. + +t_implicit_inet6(Host, Addr) -> ?line case gen_tcp:listen(0, [inet6]) of {ok,S1} -> - ?line - case inet:getaddr(Hostname, inet6) of - {ok,Host} -> - ?line Loopback = {0,0,0,0,0,0,0,1}, - ?line io:format("~s ~p~n", ["Loopback",Loopback]), - ?line implicit_inet6(S1, Loopback), - ?line ok = gen_tcp:close(S1), - %% - ?line Localhost = - ok(inet:getaddr("localhost", inet6)), - ?line io:format("~s ~p~n", ["localhost",Localhost]), - ?line S2 = ok(gen_tcp:listen(0, [{ip,Localhost}])), - ?line implicit_inet6(S2, Localhost), - ?line ok = gen_tcp:close(S2), - %% - ?line io:format("~s ~p~n", [Hostname,Host]), - ?line S3 = ok(gen_tcp:listen(0, [{ifaddr,Host}])), - ?line implicit_inet6(S3, Host), - ?line ok = gen_tcp:close(S1); - {error,eafnosupport} -> - ?line ok = gen_tcp:close(S1), - {skip,"Can not look up IPv6 address"} - end; - _ -> + ?line Loopback = {0,0,0,0,0,0,0,1}, + ?line io:format("~s ~p~n", ["::1",Loopback]), + ?line implicit_inet6(S1, Loopback), + ?line ok = gen_tcp:close(S1), + %% + ?line Localhost = "localhost", + ?line Localaddr = ok(inet:getaddr(Localhost, inet6)), + ?line io:format("~s ~p~n", [Localhost,Localaddr]), + ?line S2 = ok(gen_tcp:listen(0, [{ip,Localaddr}])), + ?line implicit_inet6(S2, Localaddr), + ?line ok = gen_tcp:close(S2), + %% + ?line io:format("~s ~p~n", [Host,Addr]), + ?line S3 = ok(gen_tcp:listen(0, [{ifaddr,Addr}])), + ?line implicit_inet6(S3, Addr), + ?line ok = gen_tcp:close(S3); + {error,_} -> {skip,"IPv6 not supported"} end. diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index 2ff1d7210a..e8470394a4 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -431,36 +431,38 @@ connect(Config) when is_list(Config) -> ok. implicit_inet6(Config) when is_list(Config) -> - ?line Hostname = ok(inet:gethostname()), + ?line Host = ok(inet:gethostname()), + ?line + case inet:getaddr(Host, inet6) of + {ok,Addr} -> + ?line implicit_inet6(Host, Addr); + {error,Reason} -> + {skip, + "Can not look up IPv6 address: " + ++atom_to_list(Reason)} + end. + +implicit_inet6(Host, Addr) -> ?line Active = {active,false}, ?line case gen_udp:open(0, [inet6,Active]) of {ok,S1} -> - ?line - case inet:getaddr(Hostname, inet6) of - {ok,Host} -> - ?line Loopback = {0,0,0,0,0,0,0,1}, - ?line io:format("~s ~p~n", ["Loopback",Loopback]), - ?line implicit_inet6(S1, Active, Loopback), - ?line ok = gen_udp:close(S1), - %% - ?line Localhost = - ok(inet:getaddr("localhost", inet6)), - ?line io:format("~s ~p~n", ["localhost",Localhost]), - ?line S2 = - ok(gen_udp:open(0, [{ip,Localhost},Active])), - ?line implicit_inet6(S2, Active, Localhost), - ?line ok = gen_udp:close(S2), - %% - ?line io:format("~s ~p~n", [Hostname,Host]), - ?line S3 = - ok(gen_udp:open(0, [{ifaddr,Host},Active])), - ?line implicit_inet6(S3, Active, Host), - ?line ok = gen_udp:close(S1); - {error,eafnosupport} -> - ?line ok = gen_udp:close(S1), - {skip,"Can not look up IPv6 address"} - end; + ?line Loopback = {0,0,0,0,0,0,0,1}, + ?line io:format("~s ~p~n", ["::1",Loopback]), + ?line implicit_inet6(S1, Active, Loopback), + ?line ok = gen_udp:close(S1), + %% + ?line Localhost = "localhost", + ?line Localaddr = ok(inet:getaddr(Localhost, inet6)), + ?line io:format("~s ~p~n", [Localhost,Localaddr]), + ?line S2 = ok(gen_udp:open(0, [{ip,Localaddr},Active])), + ?line implicit_inet6(S2, Active, Localaddr), + ?line ok = gen_udp:close(S2), + %% + ?line io:format("~s ~p~n", [Host,Addr]), + ?line S3 = ok(gen_udp:open(0, [{ifaddr,Addr},Active])), + ?line implicit_inet6(S3, Active, Addr), + ?line ok = gen_udp:close(S3); _ -> {skip,"IPv6 not supported"} end. @@ -481,5 +483,4 @@ implicit_inet6(S1, Active, Addr) -> ?line {Addr,P2,"pong"} = ok(gen_udp:recv(S1, 1024)), ?line ok = gen_udp:close(S2). - ok({ok,V}) -> V. -- cgit v1.2.3 From c5377779548f706c7c82be38fdd9b16551100c38 Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Mon, 13 Dec 2010 15:12:28 +0000 Subject: Fixes to the dict module documentation Fixed grammar and one inconsistency (Key - Value instead of key/value, since everywhere else the former is used). --- lib/stdlib/doc/src/dict.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/stdlib/doc/src/dict.xml b/lib/stdlib/doc/src/dict.xml index ebcd2eed09..1695e9d14f 100644 --- a/lib/stdlib/doc/src/dict.xml +++ b/lib/stdlib/doc/src/dict.xml @@ -165,8 +165,8 @@ dictionary() Dict = dictionary() -

This function converts the key/value list List to a - dictionary.

+

This function converts the Key - Value list + List to a dictionary.

@@ -270,7 +270,7 @@ merge(Fun, D1, D2) -> Dict1 = Dict2 = dictionary() -

Update the a value in a dictionary by calling Fun on +

Update a value in a dictionary by calling Fun on the value to get a new value. An exception is generated if Key is not present in the dictionary.

@@ -285,7 +285,7 @@ merge(Fun, D1, D2) -> Dict1 = Dict2 = dictionary() -

Update the a value in a dictionary by calling Fun on +

Update a value in a dictionary by calling Fun on the value to get a new value. If Key is not present in the dictionary then Initial will be stored as the first value. For example append/3 could be defined -- cgit v1.2.3 From 18777e8f34979c4bc66ccd6930ed095a7a88891a Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Mon, 13 Dec 2010 18:05:44 +0000 Subject: Fixes to the orddict module documentation Fixed grammar and one inconsistency (Key - Value instead of key/value, since everywhere else the former is used). --- lib/stdlib/doc/src/orddict.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/stdlib/doc/src/orddict.xml b/lib/stdlib/doc/src/orddict.xml index 08c808f822..9d036f0725 100644 --- a/lib/stdlib/doc/src/orddict.xml +++ b/lib/stdlib/doc/src/orddict.xml @@ -172,8 +172,8 @@ ordered_dictionary() Orddict = ordered_dictionary() -

This function converts the key/value list List to a - dictionary.

+

This function converts the Key - Value list + List to a dictionary.

@@ -277,7 +277,7 @@ merge(Fun, D1, D2) -> Orddict1 = Orddict2 = ordered_dictionary() -

Update the a value in a dictionary by calling Fun on +

Update a value in a dictionary by calling Fun on the value to get a new value. An exception is generated if Key is not present in the dictionary.

@@ -292,7 +292,7 @@ merge(Fun, D1, D2) -> Orddict1 = Orddict2 = ordered_dictionary() -

Update the a value in a dictionary by calling Fun on +

Update a value in a dictionary by calling Fun on the value to get a new value. If Key is not present in the dictionary then Initial will be stored as the first value. For example append/3 could be defined -- cgit v1.2.3 From 778a60894820bbecd2f3b62619e4c284c9e53ca9 Mon Sep 17 00:00:00 2001 From: Filipe David Manana Date: Thu, 16 Dec 2010 11:22:02 +0000 Subject: Grammar and typo fixes for the httpc module documentation --- lib/inets/doc/src/httpc.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index c20358178b..69e1009bc2 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -36,7 +36,7 @@

When starting the Inets application a manager process for the default profile will be started. The functions in this API - that does not explicitly use a profile will accesses the + that do not explicitly use a profile will access the default profile. A profile keeps track of proxy options, cookies and other options that can be applied to more than one request.

@@ -209,7 +209,7 @@ ssl_options() = {verify, code()} |

Timeout time for the request.

-

The clock start ticking as soon as the request has been +

The clock starts ticking as soon as the request has been sent.

Time is in milliseconds.

Defaults to infinity.

@@ -246,11 +246,11 @@ ssl_options() = {verify, code()} | -

Should the client automatically retreive the information +

Should the client automatically retrieve the information from the new URI and return that as the result instead of a 30X-result code.

Note that for some 30X-result codes automatic redirect - is not allowed in these cases the 30X-result will always + is not allowed. In these cases the 30X-result will always be returned.

Defaults to true.

@@ -296,11 +296,11 @@ ssl_options() = {verify, code()} |

Streams the body of a 200 or 206 response to the calling process or to a file. When streaming to the calling process - using the option self the the following stream messages + using the option self the following stream messages will be sent to that process: {http, {RequestId, stream_start, Headers}, {http, {RequestId, stream, BinBodyPart}, {http, {RequestId, stream_end, Headers}. When - streaming to to the calling processes using the option + streaming to the calling processes using the option {self, once} the first message will have an additional element e.i. {http, {RequestId, stream_start, Headers, Pid}, this is the process id that should be used as an argument to @@ -338,7 +338,7 @@ ssl_options() = {verify, code()} | case insenstive. This feature should only be used if there is no other way to communicate with the server or for testing purpose. Also note that when this option is used no headers - will be automatically added, all necessary headers has to be + will be automatically added, all necessary headers have to be provided by the user.

Defaults to false.

@@ -354,17 +354,17 @@ ssl_options() = {verify, code()} | checked in any way.

Note that this may change the socket behaviour (see inet:setopts/2) - for an already existing, and therefor already connected + for an already existing one, and therefore an already connected request handler.

-

By defaults the socket options set by the +

By default the socket options set by the set_options/1,2 - function is used when establishing connection.

+ function are used when establishing the connection.

-

Defines how the client will deliver the result for a - asynchroneous request (sync has the value +

Defines how the client will deliver the result for an + asynchronous request (sync has the value false).

@@ -480,7 +480,7 @@ apply(Module, Function, [ReplyInfo | Args]) Default is 120000 (= 2 min). If a persistent connection is idle longer than the keep_alive_timeout the client will close the connection. - The server may also have a such a time out but you should + The server may also have such a timeout but you should not count on it! MaxPipeline = integer() Default is 2. @@ -527,7 +527,7 @@ apply(Module, Function, [ReplyInfo | Args]) ideal to be sent on a persistent connection, this very much depends on the application. Note that a very long queue of requests may cause a - user perceived delays as earlier request may take a long time + user perceived delay as earlier requests may take a long time to complete. The HTTP/1.1 specification does suggest a limit of 2 persistent connections per server, which is the default value of the max_sessions option.

-- cgit v1.2.3 From 326ec4e6a86e7ddb7b49f2465ad43adf86399aac Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Mon, 3 Jan 2011 13:59:19 +0200 Subject: Cosmetic changes --- lib/dialyzer/src/dialyzer_dataflow.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl index b80c7efc1a..0e51ce059c 100644 --- a/lib/dialyzer/src/dialyzer_dataflow.erl +++ b/lib/dialyzer/src/dialyzer_dataflow.erl @@ -1748,7 +1748,7 @@ bind_opaque_pats(GenType, Type, Pat, Map, State, Rev) -> bind_guard(Guard, Map, State) -> try bind_guard(Guard, Map, dict:new(), pos, State) of - {Map1, _Type} -> Map1 + {Map1, _Type} -> Map1 catch throw:{fail, Warning} -> {error, Warning}; throw:{fatal_fail, Warning} -> {error, Warning} @@ -2274,7 +2274,7 @@ handle_guard_and(Guard, Map, Env, Eval, State) -> handle_guard_or(Guard, Map, Env, Eval, State) -> [Arg1, Arg2] = cerl:call_args(Guard), case Eval of - pos -> + pos -> {Map1, Bool1} = try bind_guard(Arg1, Map, Env, pos, State) catch -- cgit v1.2.3 From 02e0f98ab537b002f2ccb1092d9e7310d9e15c58 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Mon, 3 Jan 2011 15:07:55 +0200 Subject: Fix errors in the handling of 'and'/'or' guards Apart from the obvious bug in the negative evaluation of an 'and' guard, Dialyzer handled dont_know cases rather single-mindedly towards the positive branch. This patch allows for negative results as well and does some clever guesses to narrow them down. It was constructed similarly to the handling of the 'not' guard. --- lib/dialyzer/src/dialyzer_dataflow.erl | 47 +++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl index 0e51ce059c..1723380c8c 100644 --- a/lib/dialyzer/src/dialyzer_dataflow.erl +++ b/lib/dialyzer/src/dialyzer_dataflow.erl @@ -2250,24 +2250,30 @@ handle_guard_and(Guard, Map, Env, Eval, State) -> catch throw:{fail, _} -> bind_guard(Arg2, Map, Env, pos, State) end, {Map2, Type2} = - try bind_guard(Arg1, Map, Env, neg, State) - catch throw:{fail, _} -> bind_guard(Arg2, Map, Env, pos, State) + try bind_guard(Arg2, Map, Env, neg, State) + catch throw:{fail, _} -> bind_guard(Arg1, Map, Env, pos, State) end, case t_is_atom(false, Type1) orelse t_is_atom(false, Type2) of true -> {join_maps([Map1, Map2], Map), t_atom(false)}; false -> throw({fail, none}) end; dont_know -> - True = t_atom(true), {Map1, Type1} = bind_guard(Arg1, Map, Env, dont_know, State), - case t_is_none(t_inf(Type1, t_boolean())) of - true -> throw({fail, none}); + {Map2, Type2} = bind_guard(Arg2, Map, Env, dont_know, State), + Bool1 = t_inf(Type1, t_boolean()), + Bool2 = t_inf(Type2, t_boolean()), + case t_is_none(Bool1) orelse t_is_none(Bool2) of + true -> throw({fatal_fail, none}); false -> - {Map2, Type2} = bind_guard(Arg2, Map1, Env, Eval, State), - case t_is_none(t_inf(Type2, t_boolean())) of - true -> throw({fail, none}); - false -> {Map2, True} - end + NewMap = join_maps([Map1, Map2], Map), + NewType = + case {t_atom_vals(Bool1), t_atom_vals(Bool2)} of + {['true'] , ['true'] } -> t_atom(true); + {['false'], _ } -> t_atom(false); + {_ , ['false']} -> t_atom(false); + {_ , _ } -> t_boolean() + end, + {NewMap, NewType} end end. @@ -2303,11 +2309,22 @@ handle_guard_or(Guard, Map, Env, Eval, State) -> end end; dont_know -> - {Map1, Bool1} = bind_guard(Arg1, Map, Env, dont_know, State), - {Map2, Bool2} = bind_guard(Arg2, Map, Env, dont_know, State), - case t_is_boolean(Bool1) andalso t_is_boolean(Bool2) of - true -> {join_maps([Map1, Map2], Map), t_sup(Bool1, Bool2)}; - false -> throw({fail, none}) + {Map1, Type1} = bind_guard(Arg1, Map, Env, dont_know, State), + {Map2, Type2} = bind_guard(Arg2, Map, Env, dont_know, State), + Bool1 = t_inf(Type1, t_boolean()), + Bool2 = t_inf(Type2, t_boolean()), + case t_is_none(Bool1) orelse t_is_none(Bool2) of + true -> throw({fatal_fail, none}); + false -> + NewMap = join_maps([Map1, Map2], Map), + NewType = + case {t_atom_vals(Bool1), t_atom_vals(Bool2)} of + {['false'], ['false']} -> t_atom(false); + {['true'] , _ } -> t_atom(true); + {_ , ['true'] } -> t_atom(true); + {_ , _ } -> t_boolean() + end, + {NewMap, NewType} end end. -- cgit v1.2.3 From 271ee9372e07feafae6af35ccc783946371d50bd Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Fri, 14 Jan 2011 15:36:01 +0200 Subject: Fix warnings about guards containing not The wording of warnings about unsatisfiable guards that used 'not' was incorrect (the 'not' was not mentioned and it appeared as "Guard test is_atom(atom()) can never succeed"). --- lib/dialyzer/src/dialyzer.erl | 2 + lib/dialyzer/src/dialyzer_dataflow.erl | 69 +++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/lib/dialyzer/src/dialyzer.erl b/lib/dialyzer/src/dialyzer.erl index 471f9fccd2..550bf76823 100644 --- a/lib/dialyzer/src/dialyzer.erl +++ b/lib/dialyzer/src/dialyzer.erl @@ -325,6 +325,8 @@ message_to_string({guard_fail, [Arg1, Infix, Arg2]}) -> io_lib:format("Guard test ~s ~s ~s can never succeed\n", [Arg1, Infix, Arg2]); message_to_string({guard_fail, [Guard, Args]}) -> io_lib:format("Guard test ~w~s can never succeed\n", [Guard, Args]); +message_to_string({neg_guard_fail, [Guard, Args]}) -> + io_lib:format("Guard test not(~w~s) can never succeed\n", [Guard, Args]); message_to_string({guard_fail_pat, [Pat, Type]}) -> io_lib:format("Clause guard cannot succeed. The ~s was matched" " against the type ~s\n", [Pat, Type]); diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl index 1723380c8c..2ffbcd3e82 100644 --- a/lib/dialyzer/src/dialyzer_dataflow.erl +++ b/lib/dialyzer/src/dialyzer_dataflow.erl @@ -1457,6 +1457,7 @@ do_clause(C, Arg, ArgType0, OrigArgType, Map, false -> WarnType = case Msg of {guard_fail, _} -> ?WARN_MATCHING; + {neg_guard_fail, _} -> ?WARN_MATCHING; {opaque_guard, _} -> ?WARN_OPAQUE end, state__add_warning(State1, WarnType, FailGuard, Msg); @@ -1869,8 +1870,8 @@ handle_guard_gen_fun({M, F, A}, Guard, Map, Env, Eval, State) -> true -> %% Is this an error-bif? case t_is_none(erl_bif_types:type(M, F, A)) of - true -> signal_guard_fail(Guard, As, State); - false -> signal_guard_fatal_fail(Guard, As, State) + true -> signal_guard_fail(Eval, Guard, As, State); + false -> signal_guard_fatal_fail(Eval, Guard, As, State) end; false -> BifArgs = case erl_bif_types:arg_types(M, F, A) of @@ -1887,7 +1888,7 @@ handle_guard_gen_fun({M, F, A}, Guard, Map, Env, Eval, State) -> case t_is_none(Ret) of true -> case Eval =:= pos of - true -> signal_guard_fail(Guard, As, State); + true -> signal_guard_fail(Eval, Guard, As, State); false -> throw({fail, none}) end; false -> {Map2, Ret} @@ -1900,7 +1901,7 @@ handle_guard_type_test(Guard, F, Map, Env, Eval, State) -> case bind_type_test(Eval, F, ArgType, State) of error -> ?debug("Type test: ~w failed\n", [F]), - signal_guard_fail(Guard, [ArgType], State); + signal_guard_fail(Eval, Guard, [ArgType], State); {ok, NewArgType, Ret} -> ?debug("Type test: ~w succeeded, NewType: ~s, Ret: ~s\n", [F, t_to_string(NewArgType), t_to_string(Ret)]), @@ -1963,18 +1964,19 @@ handle_guard_comp(Guard, Comp, Map, Env, Eval, State) -> true when Eval =:= pos -> {Map, t_atom(true)}; true when Eval =:= dont_know -> {Map, t_atom(true)}; true when Eval =:= neg -> {Map, t_atom(true)}; - false when Eval =:= pos -> signal_guard_fail(Guard, ArgTypes, State); + false when Eval =:= pos -> + signal_guard_fail(Eval, Guard, ArgTypes, State); false when Eval =:= dont_know -> {Map, t_atom(false)}; false when Eval =:= neg -> {Map, t_atom(false)} end; {literal, var} when IsInt1 andalso IsInt2 andalso (Eval =:= pos) -> case bind_comp_literal_var(Arg1, Arg2, Type2, Comp, Map1) of - error -> signal_guard_fail(Guard, ArgTypes, State); + error -> signal_guard_fail(Eval, Guard, ArgTypes, State); {ok, NewMap} -> {NewMap, t_atom(true)} end; {var, literal} when IsInt1 andalso IsInt2 andalso (Eval =:= pos) -> case bind_comp_literal_var(Arg2, Arg1, Type1, invert_comp(Comp), Map1) of - error -> signal_guard_fail(Guard, ArgTypes, State); + error -> signal_guard_fail(Eval, Guard, ArgTypes, State); {ok, NewMap} -> {NewMap, t_atom(true)} end; {_, _} -> @@ -2014,7 +2016,7 @@ handle_guard_is_function(Guard, Map, Env, Eval, State) -> [FunType0, ArityType0] = ArgTypes0, ArityType = t_inf(ArityType0, t_integer()), case t_is_none(ArityType) of - true -> signal_guard_fail(Guard, ArgTypes0, State); + true -> signal_guard_fail(Eval, Guard, ArgTypes0, State); false -> FunTypeConstr = case t_number_vals(ArityType) of @@ -2026,7 +2028,7 @@ handle_guard_is_function(Guard, Map, Env, Eval, State) -> case t_is_none(FunType) of true -> case Eval of - pos -> signal_guard_fail(Guard, ArgTypes0, State); + pos -> signal_guard_fail(Eval, Guard, ArgTypes0, State); neg -> {Map1, t_atom(false)}; dont_know -> {Map1, t_atom(false)} end; @@ -2062,7 +2064,7 @@ handle_guard_is_record(Guard, Map, Env, Eval, State) -> case t_is_none(Type) of true -> case Eval of - pos -> signal_guard_fail(Guard, + pos -> signal_guard_fail(Eval, Guard, [RecType, t_from_term(Tag), t_from_term(Arity)], State); @@ -2095,7 +2097,7 @@ handle_guard_eq(Guard, Map, Env, Eval, State) -> Eval =:= pos -> ArgTypes = [t_from_term(cerl:concrete(Arg1)), t_from_term(cerl:concrete(Arg2))], - signal_guard_fail(Guard, ArgTypes, State) + signal_guard_fail(Eval, Guard, ArgTypes, State) end end; {literal, _} when Eval =:= pos -> @@ -2150,7 +2152,7 @@ handle_guard_eqeq(Guard, Map, Env, Eval, State) -> Eval =:= pos -> ArgTypes = [t_from_term(cerl:concrete(Arg1)), t_from_term(cerl:concrete(Arg2))], - signal_guard_fail(Guard, ArgTypes, State) + signal_guard_fail(Eval, Guard, ArgTypes, State) end end; {literal, _} when Eval =:= pos -> @@ -2172,7 +2174,7 @@ bind_eqeq_guard(Guard, Arg1, Arg2, Map, Env, Eval, State) -> case Eval of neg -> {Map2, t_atom(false)}; dont_know -> {Map2, t_atom(false)}; - pos -> signal_guard_fail(Guard, [Type1, Type2], State) + pos -> signal_guard_fail(Eval, Guard, [Type1, Type2], State) end; false -> case Eval of @@ -2199,29 +2201,29 @@ bind_eqeq_guard(Guard, Arg1, Arg2, Map, Env, Eval, State) -> end. bind_eqeq_guard_lit_other(Guard, Arg1, Arg2, Map, Env, State) -> - %% Assumes positive evaluation + Eval = dont_know, case cerl:concrete(Arg1) of true -> {_, Type} = MT = bind_guard(Arg2, Map, Env, pos, State), case t_is_atom(true, Type) of true -> MT; false -> - {_, Type0} = bind_guard(Arg2, Map, Env, dont_know, State), - signal_guard_fail(Guard, [Type0, t_atom(true)], State) + {_, Type0} = bind_guard(Arg2, Map, Env, Eval, State), + signal_guard_fail(Eval, Guard, [Type0, t_atom(true)], State) end; false -> {Map1, Type} = bind_guard(Arg2, Map, Env, neg, State), case t_is_atom(false, Type) of true -> {Map1, t_atom(true)}; false -> - {_, Type0} = bind_guard(Arg2, Map, Env, dont_know, State), - signal_guard_fail(Guard, [Type0, t_atom(true)], State) + {_, Type0} = bind_guard(Arg2, Map, Env, Eval, State), + signal_guard_fail(Eval, Guard, [Type0, t_atom(true)], State) end; Term -> LitType = t_from_term(Term), - {Map1, Type} = bind_guard(Arg2, Map, Env, dont_know, State), + {Map1, Type} = bind_guard(Arg2, Map, Env, Eval, State), case t_is_subtype(LitType, Type) of - false -> signal_guard_fail(Guard, [Type, LitType], State); + false -> signal_guard_fail(Eval, Guard, [Type, LitType], State); true -> case cerl:is_c_var(Arg2) of true -> {enter_type(Arg2, LitType, Map1), t_atom(true)}; @@ -2366,10 +2368,12 @@ bind_guard_list([G|Gs], Map, Env, Eval, State, Acc) -> bind_guard_list([], Map, _Env, _Eval, _State, Acc) -> {Map, lists:reverse(Acc)}. --spec signal_guard_fail(cerl:c_call(), [erl_types:erl_type()], state()) -> - no_return(). +-type eval() :: 'pos' | 'neg' | 'dont_know'. -signal_guard_fail(Guard, ArgTypes, State) -> +-spec signal_guard_fail(eval(), cerl:c_call(), [erl_types:erl_type()], + state()) -> no_return(). + +signal_guard_fail(Eval, Guard, ArgTypes, State) -> Args = cerl:call_args(Guard), F = cerl:atom_val(cerl:call_name(Guard)), MFA = {cerl:atom_val(cerl:call_module(Guard)), F, length(Args)}, @@ -2382,7 +2386,7 @@ signal_guard_fail(Guard, ArgTypes, State) -> atom_to_list(F), format_args_1([Arg2], [ArgType2], State)]}; false -> - mk_guard_msg(F, Args, ArgTypes, State) + mk_guard_msg(Eval, F, Args, ArgTypes, State) end, throw({fail, {Guard, Msg}}). @@ -2397,20 +2401,25 @@ is_infix_op({erlang, '>=', 2}) -> true; is_infix_op({M, F, A}) when is_atom(M), is_atom(F), is_integer(A), 0 =< A, A =< 255 -> false. --spec signal_guard_fatal_fail(cerl:c_call(), [erl_types:erl_type()], state()) -> - no_return(). +-spec signal_guard_fatal_fail(eval(), cerl:c_call(), [erl_types:erl_type()], + state()) -> no_return(). -signal_guard_fatal_fail(Guard, ArgTypes, State) -> +signal_guard_fatal_fail(Eval, Guard, ArgTypes, State) -> Args = cerl:call_args(Guard), F = cerl:atom_val(cerl:call_name(Guard)), - Msg = mk_guard_msg(F, Args, ArgTypes, State), + Msg = mk_guard_msg(Eval, F, Args, ArgTypes, State), throw({fatal_fail, {Guard, Msg}}). -mk_guard_msg(F, Args, ArgTypes, State) -> +mk_guard_msg(Eval, F, Args, ArgTypes, State) -> FArgs = [F, format_args(Args, ArgTypes, State)], case any_has_opaque_subtype(ArgTypes) of true -> {opaque_guard, FArgs}; - false -> {guard_fail, FArgs} + false -> + case Eval of + neg -> {neg_guard_fail, FArgs}; + pos -> {guard_fail, FArgs}; + dont_know -> {guard_fail, FArgs} + end end. bind_guard_case_clauses(Arg, Clauses, Map, Env, Eval, State) -> -- cgit v1.2.3 From b4c3711c6daa2f171f56b984235969e223ce8f9c Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Thu, 20 Jan 2011 19:12:01 +0200 Subject: Add a --fullpath option to Dialyzer This change adds a --fullpath option to Dialyzer, which makes the warning messages contain the full path of the corresponding file. Original patch submitted by Magnus Henoch (legoscia) on 15/9/2010 and cooked to death in the 'pu' branch all this time. The patch was essentially correct and most of it has been used as is, but there have been some changes to make the code slightly prettier, avoid some code duplication, and add documentation to dialyzer's doc files and to its help message. --- lib/dialyzer/doc/manual.txt | 4 +++- lib/dialyzer/doc/src/dialyzer.xml | 6 ++++-- lib/dialyzer/src/dialyzer.erl | 23 +++++++++++++++++------ lib/dialyzer/src/dialyzer.hrl | 14 ++++++++------ lib/dialyzer/src/dialyzer_cl.erl | 14 +++++++++----- lib/dialyzer/src/dialyzer_cl_parse.erl | 11 +++++++++-- lib/dialyzer/src/dialyzer_options.erl | 12 +++++++++++- 7 files changed, 61 insertions(+), 23 deletions(-) diff --git a/lib/dialyzer/doc/manual.txt b/lib/dialyzer/doc/manual.txt index cc6f9130c7..1d7a1a6222 100644 --- a/lib/dialyzer/doc/manual.txt +++ b/lib/dialyzer/doc/manual.txt @@ -129,7 +129,7 @@ Usage: dialyzer [--help] [--version] [--shell] [--quiet] [--verbose] [--apps applications] [-o outfile] [--build_plt] [--add_to_plt] [--remove_from_plt] [--check_plt] [--no_check_plt] [--plt_info] [--get_warnings] - [--no_native] + [--no_native] [--fullpath] Options: files_or_dirs (for backwards compatibility also as: -c files_or_dirs) @@ -231,6 +231,8 @@ Options: Bypass the native code compilation of some key files that Dialyzer heuristically performs when dialyzing many files; this avoids the compilation time but it may result in (much) longer analysis time. + --fullpath + Display the full path names of files for which warnings are emitted. --gui Use the gs-based GUI. --wx diff --git a/lib/dialyzer/doc/src/dialyzer.xml b/lib/dialyzer/doc/src/dialyzer.xml index 01a7e478bc..8813d51f1f 100644 --- a/lib/dialyzer/doc/src/dialyzer.xml +++ b/lib/dialyzer/doc/src/dialyzer.xml @@ -71,7 +71,7 @@ [--apps applications] [-o outfile] [--build_plt] [--add_to_plt] [--remove_from_plt] [--check_plt] [--no_check_plt] [--plt_info] [--get_warnings] - [--no_native] + [--no_native] [--fullpath] ]]>

Options:

@@ -198,10 +198,12 @@ heuristically performs when dialyzing many files; this avoids the compilation time but it may result in (much) longer analysis time.
+ + Display the full path names of files for which warnings are emitted. Use the gs-based GUI. - Use the wx-based GUI.. + Use the wx-based GUI.

* denotes that multiple occurrences of these options are possible.

diff --git a/lib/dialyzer/src/dialyzer.erl b/lib/dialyzer/src/dialyzer.erl index 471f9fccd2..f4b3cff19c 100644 --- a/lib/dialyzer/src/dialyzer.erl +++ b/lib/dialyzer/src/dialyzer.erl @@ -2,7 +2,7 @@ %%----------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -38,7 +38,8 @@ gui/0, gui/1, plt_info/1, - format_warning/1]). + format_warning/1, + format_warning/2]). -include("dialyzer.hrl"). @@ -48,6 +49,8 @@ %% - run/1: Erlang interface for a command line-like analysis %% - gui/0/1: Erlang interface for the gui. %% - format_warning/1: Get the string representation of a warning. +%% - format_warning/1: Likewise, but with an option whether +%% to display full path names or not %% - plt_info/1: Get information of the specified plt. %%-------------------------------------------------------------------- @@ -281,11 +284,19 @@ cl_check_log(Output) -> -spec format_warning(dial_warning()) -> string(). -format_warning({_Tag, {File, Line}, Msg}) when is_list(File), - is_integer(Line) -> - BaseName = filename:basename(File), +format_warning(W) -> + format_warning(W, basename). + +-spec format_warning(dial_warning(), fopt()) -> string(). + +format_warning({_Tag, {File, Line}, Msg}, FOpt) when is_list(File), + is_integer(Line) -> + F = case FOpt of + fullpath -> File; + basename -> filename:basename(File) + end, String = lists:flatten(message_to_string(Msg)), - lists:flatten(io_lib:format("~s:~w: ~s", [BaseName, Line, String])). + lists:flatten(io_lib:format("~s:~w: ~s", [F, Line, String])). %%----------------------------------------------------------------------------- diff --git a/lib/dialyzer/src/dialyzer.hrl b/lib/dialyzer/src/dialyzer.hrl index 1d98574585..aa3f703af2 100644 --- a/lib/dialyzer/src/dialyzer.hrl +++ b/lib/dialyzer/src/dialyzer.hrl @@ -2,7 +2,7 @@ %%% %%% %CopyrightBegin% %%% -%%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%%% Copyright Ericsson AB 2006-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 @@ -31,7 +31,7 @@ -define(RET_DISCREPANCIES, 2). -type dial_ret() :: ?RET_NOTHING_SUSPICIOUS - | ?RET_INTERNAL_ERROR + | ?RET_INTERNAL_ERROR | ?RET_DISCREPANCIES. %%-------------------------------------------------------------------- @@ -87,7 +87,7 @@ %%-------------------------------------------------------------------- %% THIS TYPE SHOULD ONE DAY DISAPPEAR -- IT DOES NOT BELONG HERE %%-------------------------------------------------------------------- - + -type ordset(T) :: [T] . %% XXX: temporarily %%-------------------------------------------------------------------- @@ -102,6 +102,8 @@ -type dial_define() :: {atom(), term()}. -type dial_option() :: {atom(), term()}. -type dial_options() :: [dial_option()]. +-type fopt() :: 'basename' | 'fullpath'. +-type format() :: 'formatted' | 'raw'. -type label() :: non_neg_integer(). -type rep_mode() :: 'quiet' | 'normal' | 'verbose'. -type start_from() :: 'byte_code' | 'src_code'. @@ -137,10 +139,10 @@ erlang_mode = false :: boolean(), use_contracts = true :: boolean(), output_file = none :: 'none' | file:filename(), - output_format = formatted :: 'raw' | 'formatted', + output_format = formatted :: format(), + filename_opt = basename :: fopt(), callgraph_file = "" :: file:filename(), - check_plt = true :: boolean() - }). + check_plt = true :: boolean()}). -record(contract, {contracts = [] :: [contract_pair()], args = [] :: [erl_types:erl_type()], diff --git a/lib/dialyzer/src/dialyzer_cl.erl b/lib/dialyzer/src/dialyzer_cl.erl index 1987c1732c..86f1ba4696 100644 --- a/lib/dialyzer/src/dialyzer_cl.erl +++ b/lib/dialyzer/src/dialyzer_cl.erl @@ -2,7 +2,7 @@ %%------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -46,7 +46,8 @@ legal_warnings = ordsets:new() :: [dial_warn_tag()], mod_deps = dict:new() :: dict(), output = standard_io :: io:device(), - output_format = formatted :: 'raw' | 'formatted', + output_format = formatted :: format(), + filename_opt = basename :: fopt(), output_plt = none :: 'none' | file:filename(), plt_info = none :: 'none' | dialyzer_plt:plt_info(), report_mode = normal :: rep_mode(), @@ -532,8 +533,10 @@ hc(Mod) -> new_state() -> #cl_state{}. -init_output(State0, #options{output_file = OutFile, output_format = OutFormat}) -> - State = State0#cl_state{output_format = OutFormat}, +init_output(State0, #options{output_file = OutFile, + output_format = OutFormat, + filename_opt = FOpt}) -> + State = State0#cl_state{output_format = OutFormat, filename_opt = FOpt}, case OutFile =:= none of true -> State; @@ -766,6 +769,7 @@ print_warnings(#cl_state{stored_warnings = []}) -> ok; print_warnings(#cl_state{output = Output, output_format = Format, + filename_opt = FOpt, stored_warnings = Warnings}) -> PrWarnings = process_warnings(Warnings), case PrWarnings of @@ -773,7 +777,7 @@ print_warnings(#cl_state{output = Output, [_|_] -> S = case Format of formatted -> - [dialyzer:format_warning(W) || W <- PrWarnings]; + [dialyzer:format_warning(W, FOpt) || W <- PrWarnings]; raw -> [io_lib:format("~p. \n", [W]) || W <- PrWarnings] end, diff --git a/lib/dialyzer/src/dialyzer_cl_parse.erl b/lib/dialyzer/src/dialyzer_cl_parse.erl index 5ca7599b35..f9baf36822 100644 --- a/lib/dialyzer/src/dialyzer_cl_parse.erl +++ b/lib/dialyzer/src/dialyzer_cl_parse.erl @@ -2,7 +2,7 @@ %%----------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -133,6 +133,9 @@ cl(["-o"++Output|T]) -> cl(["--raw"|T]) -> put(dialyzer_output_format, raw), cl(T); +cl(["--fullpath"|T]) -> + put(dialyzer_filename_opt, fullpath), + cl(T); cl(["-pa", Path|T]) -> case code:add_patha(Path) of true -> cl(T); @@ -243,6 +246,7 @@ init() -> put(dialyzer_options_defines, DefaultOpts#options.defines), put(dialyzer_options_files, DefaultOpts#options.files), put(dialyzer_output_format, formatted), + put(dialyzer_filename_opt, basename), put(dialyzer_options_check_plt, DefaultOpts#options.check_plt), ok. @@ -281,6 +285,7 @@ cl_options() -> {files_rec, get(dialyzer_options_files_rec)}, {output_file, get(dialyzer_output)}, {output_format, get(dialyzer_output_format)}, + {filename_opt, get(dialyzer_filename_opt)}, {analysis_type, get(dialyzer_options_analysis_type)}, {get_warnings, get(dialyzer_options_get_warnings)}, {callgraph_file, get(dialyzer_callgraph_file)} @@ -335,7 +340,7 @@ help_message() -> [--apps applications] [-o outfile] [--build_plt] [--add_to_plt] [--remove_from_plt] [--check_plt] [--no_check_plt] [--plt_info] [--get_warnings] - [--no_native] + [--no_native] [--fullpath] Options: files_or_dirs (for backwards compatibility also as: -c files_or_dirs) Use Dialyzer from the command line to detect defects in the @@ -437,6 +442,8 @@ Options: Bypass the native code compilation of some key files that Dialyzer heuristically performs when dialyzing many files; this avoids the compilation time but it may result in (much) longer analysis time. + --fullpath + Display the full path names of files for which warnings are emitted. --gui Use the gs-based GUI. --wx diff --git a/lib/dialyzer/src/dialyzer_options.erl b/lib/dialyzer/src/dialyzer_options.erl index 2c0afa6e2b..b5cefd16ca 100644 --- a/lib/dialyzer/src/dialyzer_options.erl +++ b/lib/dialyzer/src/dialyzer_options.erl @@ -2,7 +2,7 @@ %%----------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -169,6 +169,9 @@ build_options([{OptionName, Value} = Term|Rest], Options) -> output_format -> assert_output_format(Value), build_options(Rest, Options#options{output_format = Value}); + filename_opt -> + assert_filename_opt(Value), + build_options(Rest, Options#options{filename_opt = Value}); output_plt -> assert_filename(Value), build_options(Rest, Options#options{output_plt = Value}); @@ -218,6 +221,13 @@ assert_output_format(formatted) -> assert_output_format(Term) -> bad_option("Illegal value for output_format", Term). +assert_filename_opt(basename) -> + ok; +assert_filename_opt(fullpath) -> + ok; +assert_filename_opt(Term) -> + bad_option("Illegal value for filename_opt", Term). + assert_plt_op(#options{analysis_type = OldVal}, #options{analysis_type = NewVal}) -> case is_plt_mode(OldVal) andalso is_plt_mode(NewVal) of -- cgit v1.2.3 From 98e954dfaf707895f1558d51a1ea9fd22812e161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Wei=C3=9F?= Date: Mon, 24 Jan 2011 17:36:57 +0100 Subject: Mention that "-detached" implies "-noinput" Clarify that specifying "-noinput" is unnecessary if the "-detached" flag is given. --- erts/doc/src/erl.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml index 77bd952d41..1e6e290f6b 100644 --- a/erts/doc/src/erl.xml +++ b/erts/doc/src/erl.xml @@ -231,7 +231,8 @@

Starts the Erlang runtime system detached from the system - console. Useful for running daemons and backgrounds processes.

+ console. Useful for running daemons and backgrounds processes. Implies + .

-- cgit v1.2.3 From 2697ce88a724423905e264fedd304bb703a50689 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Sun, 30 Jan 2011 20:34:48 +0200 Subject: Sanitize the specs of the code module After the addition of unicode_binary() to the file:filename() type, dialyzer started complaining about erroneous or incomplete specs in some functions of the 'code' module. The culprit was hard-coded information in erl_bif_types for functions of this module, which were not updated. Since these functions have proper specs these days and code duplication (pun intended) is never a good idea, their type information was removed from erl_bif_types. While doing this, some erroneous comments were fixed in the code module and also made sure that the code now runs without dialyzer warnings even when the -Wunmatched_returns option is used. Some cleanups were applied to erl_bif_types too. --- lib/hipe/cerl/erl_bif_types.erl | 197 +++------------------------------------- lib/kernel/src/code.erl | 129 +++++++++++++------------- 2 files changed, 76 insertions(+), 250 deletions(-) diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 309c118107..adddd88ae3 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -191,127 +191,19 @@ type(binary, referenced_byte_size, 1, Xs) -> strict(arg_types(binary, referenced_byte_size, 1), Xs, fun(_) -> t_non_neg_integer() end); %%-- code --------------------------------------------------------------------- -type(code, add_path, 1, Xs) -> - strict(arg_types(code, add_path, 1), Xs, - fun (_) -> - t_sup(t_atom('true'), - t_tuple([t_atom('error'), t_atom('bad_directory')])) - end); -type(code, add_patha, 1, Xs) -> - type(code, add_path, 1, Xs); -type(code, add_paths, 1, Xs) -> - strict(arg_types(code, add_paths, 1), Xs, fun(_) -> t_atom('ok') end); -type(code, add_pathsa, 1, Xs) -> - type(code, add_paths, 1, Xs); -type(code, add_pathsz, 1, Xs) -> - type(code, add_paths, 1, Xs); -type(code, add_pathz, 1, Xs) -> - type(code, add_path, 1, Xs); -type(code, all_loaded, 0, _) -> - t_list(t_tuple([t_atom(), t_code_loaded_fname_or_status()])); -type(code, compiler_dir, 0, _) -> - t_string(); -type(code, del_path, 1, Xs) -> - strict(arg_types(code, del_path, 1), Xs, - fun (_) -> - t_sup(t_boolean(), - t_tuple([t_atom('error'), t_atom('bad_name')])) - end); -type(code, delete, 1, Xs) -> - strict(arg_types(code, delete, 1), Xs, fun (_) -> t_boolean() end); -type(code, ensure_loaded, 1, Xs) -> - type(code, load_file, 1, Xs); type(code, get_chunk, 2, Xs) -> strict(arg_types(code, get_chunk, 2), Xs, fun (_) -> t_sup(t_binary(), t_atom('undefined')) end); -type(code, get_object_code, 1, Xs) -> - strict(arg_types(code, get_object_code, 1), Xs, - fun (_) -> - t_sup(t_tuple([t_atom(), t_binary(), t_string()]), - t_atom('error')) - end); -type(code, get_path, 0, _) -> - t_list(t_string()); -type(code, is_loaded, 1, Xs) -> - strict(arg_types(code, is_loaded, 1), Xs, - fun (_) -> - t_sup([t_tuple([t_atom('file'), t_code_loaded_fname_or_status()]), - t_atom('false')]) - end); -type(code, is_sticky, 1, Xs) -> - strict(arg_types(code, is_sticky, 1), Xs, fun (_) -> t_boolean() end); type(code, is_module_native, 1, Xs) -> strict(arg_types(code, is_module_native, 1), Xs, fun (_) -> t_sup(t_boolean(), t_atom('undefined')) end); -type(code, lib_dir, 0, _) -> - t_string(); -type(code, lib_dir, 1, Xs) -> - strict(arg_types(code, lib_dir, 1), Xs, - fun (_) -> - t_sup(t_string(), - t_tuple([t_atom('error'), t_atom('bad_name')])) - end); -type(code, load_abs, 1, Xs) -> - strict(arg_types(code, load_abs, 1), Xs, - fun ([_File]) -> t_code_load_return(t_atom()) end); % XXX: cheating -type(code, load_abs, 2, Xs) -> - strict(arg_types(code, load_abs, 2), Xs, - fun ([_File,Mod]) -> t_code_load_return(Mod) end); -type(code, load_binary, 3, Xs) -> - strict(arg_types(code, load_binary, 3), Xs, - fun ([Mod,_File,_Bin]) -> t_code_load_return(Mod) end); -type(code, load_file, 1, Xs) -> - strict(arg_types(code, load_file, 1), Xs, - fun ([Mod]) -> t_code_load_return(Mod) end); -type(code, load_native_partial, 2, Xs) -> - strict(arg_types(code, load_native_partial, 2), Xs, - fun ([Mod,_Bin]) -> t_code_load_return(Mod) end); -type(code, load_native_sticky, 3, Xs) -> - strict(arg_types(code, load_native_sticky, 3), Xs, - fun ([Mod,_Bin,_]) -> t_code_load_return(Mod) end); type(code, module_md5, 1, Xs) -> strict(arg_types(code, module_md5, 1), Xs, fun (_) -> t_sup(t_binary(), t_atom('undefined')) end); type(code, make_stub_module, 3, Xs) -> strict(arg_types(code, make_stub_module, 3), Xs, fun ([Mod,_,_]) -> Mod end); -type(code, priv_dir, 1, Xs) -> - strict(arg_types(code, priv_dir, 1), Xs, - fun (_) -> - t_sup(t_string(), t_tuple([t_atom('error'), t_atom('bad_name')])) - end); -type(code, purge, 1, Xs) -> - type(code, delete, 1, Xs); -type(code, rehash, 0, _) -> t_atom('ok'); -type(code, replace_path, 2, Xs) -> - strict(arg_types(code, replace_path, 2), Xs, - fun (_) -> - t_sup([t_atom('true'), - t_tuple([t_atom('error'), t_atom('bad_name')]), - t_tuple([t_atom('error'), t_atom('bad_directory')]), - t_tuple([t_atom('error'), - t_tuple([t_atom('badarg'), t_any()])])]) - end); -type(code, root_dir, 0, _) -> - t_string(); -type(code, set_path, 1, Xs) -> - strict(arg_types(code, set_path, 1), Xs, - fun (_) -> - t_sup([t_atom('true'), - t_tuple([t_atom('error'), t_atom('bad_path')]), - t_tuple([t_atom('error'), t_atom('bad_directory')])]) - end); -type(code, soft_purge, 1, Xs) -> - type(code, delete, 1, Xs); -type(code, stick_mod, 1, Xs) -> - strict(arg_types(code, stick_mod, 1), Xs, fun (_) -> t_atom('true') end); -type(code, unstick_mod, 1, Xs) -> - type(code, stick_mod, 1, Xs); -type(code, which, 1, Xs) -> - strict(arg_types(code, which, 1), Xs, - fun (_) -> - t_sup([t_code_loaded_fname_or_status(), - t_atom('non_existing')]) - end); +type(code, rehash, 0, _) -> + t_atom('ok'); %%-- erl_ddll ----------------------------------------------------------------- type(erl_ddll, demonitor, 1, Xs) -> type(erlang, demonitor, 1, Xs); @@ -3334,80 +3226,16 @@ arg_types(binary, part, 3) -> arg_types(binary, referenced_byte_size, 1) -> [t_binary()]; %%------- code ---------------------------------------------------------------- -arg_types(code, add_path, 1) -> - [t_string()]; -arg_types(code, add_patha, 1) -> - arg_types(code, add_path, 1); -arg_types(code, add_paths, 1) -> - [t_list(t_string())]; -arg_types(code, add_pathsa, 1) -> - arg_types(code, add_paths, 1); -arg_types(code, add_pathsz, 1) -> - arg_types(code, add_paths, 1); -arg_types(code, add_pathz, 1) -> - arg_types(code, add_path, 1); -arg_types(code, all_loaded, 0) -> - []; -arg_types(code, compiler_dir, 0) -> - []; -arg_types(code, del_path, 1) -> - [t_sup(t_string(), t_atom())]; % OBS: differs from add_path/1 -arg_types(code, delete, 1) -> - [t_atom()]; -arg_types(code, ensure_loaded, 1) -> - arg_types(code, load_file, 1); arg_types(code, get_chunk, 2) -> [t_binary(), t_string()]; -arg_types(code, get_object_code, 1) -> - [t_atom()]; -arg_types(code, get_path, 0) -> - []; -arg_types(code, is_loaded, 1) -> - [t_atom()]; -arg_types(code, is_sticky, 1) -> - [t_atom()]; arg_types(code, is_module_native, 1) -> [t_atom()]; -arg_types(code, lib_dir, 0) -> - []; -arg_types(code, lib_dir, 1) -> - [t_atom()]; -arg_types(code, load_abs, 1) -> - [t_string()]; -arg_types(code, load_abs, 2) -> - [t_code_loaded_fname_or_status(), t_atom()]; -arg_types(code, load_binary, 3) -> - [t_atom(), t_code_loaded_fname_or_status(), t_binary()]; -arg_types(code, load_file, 1) -> - [t_atom()]; -arg_types(code, load_native_partial, 2) -> - [t_atom(), t_binary()]; -arg_types(code, load_native_sticky, 3) -> - [t_atom(), t_binary(), t_sup(t_binary(), t_atom('false'))]; arg_types(code, module_md5, 1) -> [t_binary()]; arg_types(code, make_stub_module, 3) -> [t_atom(), t_binary(), t_tuple([t_list(), t_list()])]; -arg_types(code, priv_dir, 1) -> - [t_atom()]; -arg_types(code, purge, 1) -> - arg_types(code, delete, 1); arg_types(code, rehash, 0) -> []; -arg_types(code, replace_path, 2) -> - [t_atom(), t_string()]; -arg_types(code, root_dir, 0) -> - []; -arg_types(code, set_path, 1) -> - [t_list(t_string())]; -arg_types(code, soft_purge, 1) -> - arg_types(code, delete, 1); -arg_types(code, stick_mod, 1) -> - [t_atom()]; -arg_types(code, unstick_mod, 1) -> - arg_types(code, stick_mod, 1); -arg_types(code, which, 1) -> - [t_atom()]; %%------- erl_ddll ------------------------------------------------------------ arg_types(erl_ddll, demonitor, 1) -> arg_types(erlang, demonitor, 1); @@ -3536,9 +3364,9 @@ arg_types(erlang, atom_to_binary, 2) -> arg_types(erlang, atom_to_list, 1) -> [t_atom()]; arg_types(erlang, binary_part, 2) -> - [t_binary(), t_tuple([t_integer(),t_integer()])]; + [t_binary(), t_tuple([t_non_neg_integer(), t_integer()])]; arg_types(erlang, binary_part, 3) -> - [t_binary(), t_integer(), t_integer()]; + [t_binary(), t_non_neg_integer(), t_integer()]; arg_types(erlang, binary_to_atom, 2) -> [t_binary(), t_encoding_a2b()]; arg_types(erlang, binary_to_existing_atom, 2) -> @@ -3801,9 +3629,10 @@ arg_types(erlang, nodes, 1) -> arg_types(erlang, now, 0) -> []; arg_types(erlang, open_port, 2) -> + ArgT = t_sup(t_unicode_string(), t_binary()), [t_sup(t_atom(), t_sup([t_tuple([t_atom('spawn'), t_string()]), t_tuple([t_atom('spawn_driver'), t_string()]), - t_tuple([t_atom('spawn_executable'), t_sup(t_unicode_string(),t_binary())]), + t_tuple([t_atom('spawn_executable'), ArgT]), t_tuple([t_atom('fd'), t_integer(), t_integer()])])), t_list(t_sup(t_sup([t_atom('stream'), t_atom('exit_status'), @@ -3819,8 +3648,8 @@ arg_types(erlang, open_port, 2) -> t_tuple([t_atom('line'), t_integer()]), t_tuple([t_atom('cd'), t_string()]), t_tuple([t_atom('env'), t_list(t_tuple(2))]), % XXX: More - t_tuple([t_atom('args'), t_list(t_sup(t_unicode_string(),t_binary()))]), - t_tuple([t_atom('arg0'),t_sup(t_unicode_string(),t_binary())])])))]; + t_tuple([t_atom('args'), t_list(ArgT)]), + t_tuple([t_atom('arg0'), ArgT])])))]; arg_types(erlang, phash, 2) -> [t_any(), t_pos_integer()]; arg_types(erlang, phash2, 1) -> @@ -4643,10 +4472,10 @@ t_endian() -> %% ===================================================================== t_binary_part() -> - t_tuple([t_non_neg_integer(),t_integer()]). + t_tuple([t_non_neg_integer(), t_integer()]). t_binary_canonical_part() -> - t_tuple([t_non_neg_integer(),t_non_neg_integer()]). + t_tuple([t_non_neg_integer(), t_non_neg_integer()]). t_binary_pattern() -> t_sup([t_binary(), @@ -4654,10 +4483,10 @@ t_binary_pattern() -> t_binary_compiled_pattern()]). t_binary_compiled_pattern() -> - t_tuple([t_atom('cp'),t_binary()]). + t_tuple([t_atom('cp'), t_binary()]). t_binary_options() -> - t_list(t_tuple([t_atom('scope'),t_binary_part()])). + t_list(t_tuple([t_atom('scope'), t_binary_part()])). %% ===================================================================== %% HTTP types documented in R12B-4 diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl index feb5131aad..b0f99305f2 100644 --- a/lib/kernel/src/code.erl +++ b/lib/kernel/src/code.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 @@ -72,39 +72,42 @@ %% User interface. %% -%% objfile_extension() -> ".beam" -%% set_path(Dir*) -> true -%% get_path() -> Dir* -%% add_path(Dir) -> true | {error, What} -%% add_patha(Dir) -> true | {error, What} -%% add_pathz(Dir) -> true | {error, What} -%% add_paths(DirList) -> true | {error, What} -%% add_pathsa(DirList) -> true | {error, What} -%% add_pathsz(DirList) -> true | {error, What} -%% del_path(Dir) -> true | {error, What} -%% replace_path(Name,Dir) -> true | {error, What} -%% load_file(File) -> {error,What} | {module, Mod} -%% load_abs(File) -> {error,What} | {module, Mod} -%% load_abs(File,Mod) -> {error,What} | {module, Mod} -%% load_binary(Mod,File,Bin) -> {error,What} | {module,Mod} -%% ensure_loaded(Module) -> {error,What} | {module, Mod} -%% delete(Module) -%% purge(Module) kills all procs running old code -%% soft_purge(Module) -> true | false -%% is_loaded(Module) -> {file, File} | false -%% all_loaded() -> {Module, File}* -%% get_object_code(Mod) -> error | {Mod, Bin, Filename} -%% stop() -> true -%% root_dir() -%% compiler_dir() -%% lib_dir() -%% priv_dir(Name) -%% stick_dir(Dir) -> ok | error -%% unstick_dir(Dir) -> ok | error -%% is_sticky(Module) -> true | false -%% which(Module) -> Filename -%% set_primary_archive((FileName, Bin, FileInfo) -> ok | {error, Reason} -%% clash() -> -> print out +%% objfile_extension() -> ".beam" +%% get_path() -> [Dir] +%% set_path([Dir]) -> true | {error, bad_directory | bad_path} +%% add_path(Dir) -> true | {error, bad_directory} +%% add_patha(Dir) -> true | {error, bad_directory} +%% add_pathz(Dir) -> true | {error, bad_directory} +%% add_paths([Dir]) -> ok +%% add_pathsa([Dir]) -> ok +%% add_pathsz([Dir]) -> ok +%% del_path(Dir) -> boolean() | {error, bad_name} +%% replace_path(Name, Dir) -> true | replace_path_error() +%% 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()} +%% load_binary(Module, File, Bin)-> {module, Module} | {error, What :: atom()} +%% ensure_loaded(Module) -> {module, Module} | {error, What :: atom()} +%% delete(Module) -> boolean() +%% purge(Module) -> boolean() kills all procs running old code +%% soft_purge(Module) -> boolean() +%% is_loaded(Module) -> {file, loaded_filename()} | false +%% all_loaded() -> [{Module, loaded_filename()}] +%% get_object_code(Module) -> {Module, Bin, Filename} | error +%% stop() -> no_return() +%% root_dir() -> Dir +%% compiler_dir() -> Dir +%% lib_dir() -> Dir +%% lib_dir(Application) -> Dir | {error, bad_name} +%% priv_dir(Application) -> Dir | {error, bad_name} +%% stick_dir(Dir) -> ok | error +%% unstick_dir(Dir) -> ok | error +%% stick_mod(Module) -> true +%% unstick_mod(Module) -> true +%% is_sticky(Module) -> boolean() +%% which(Module) -> Filename | loaded_ret_atoms() | non_existing +%% set_primary_archive((FileName, Bin, FileInfo) -> ok | {error, Reason} +%% clash() -> ok prints out number of clashes %%---------------------------------------------------------------------------- %% Some types for basic exported functions of this module @@ -120,7 +123,7 @@ %% User interface %%---------------------------------------------------------------------------- --spec objfile_extension() -> file:filename(). +-spec objfile_extension() -> nonempty_string(). objfile_extension() -> init:objfile_extension(). @@ -138,21 +141,21 @@ 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(). -load_abs(File,M) when (is_list(File) orelse is_atom(File)), is_atom(M) -> +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(). -load_binary(Mod,File,Bin) +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(). -load_native_partial(Mod,Bin) when is_atom(Mod), is_binary(Bin) -> +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(). -load_native_sticky(Mod,Bin,WholeModule) +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}). @@ -160,7 +163,7 @@ load_native_sticky(Mod,Bin,WholeModule) -spec delete(Module :: atom()) -> boolean(). delete(Mod) when is_atom(Mod) -> call({delete,Mod}). --spec purge/1 :: (Module :: atom()) -> boolean(). +-spec purge(Module :: atom()) -> boolean(). purge(Mod) when is_atom(Mod) -> call({purge,Mod}). -spec soft_purge(Module :: atom()) -> boolean(). @@ -195,7 +198,7 @@ lib_dir(App, SubDir) when is_atom(App), is_atom(SubDir) -> call({dir,{lib_dir,Ap compiler_dir() -> call({dir,compiler_dir}). %% XXX is_list() is for backwards compatibility -- take out in future version --spec priv_dir(Appl :: atom()) -> file:filename() | {'error', 'bad_name'}. +-spec priv_dir(App :: atom()) -> file:filename() | {'error', 'bad_name'}. priv_dir(App) when is_atom(App) ; is_list(App) -> call({dir,{priv_dir,App}}). -spec stick_dir(Directory :: file:filename()) -> 'ok' | 'error'. @@ -220,13 +223,14 @@ set_path(PathList) when is_list(PathList) -> call({set_path,PathList}). -spec get_path() -> [file:filename()]. get_path() -> call(get_path). --spec add_path(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. +-type add_path_ret() :: 'true' | {'error', 'bad_directory'}. +-spec add_path(Directory :: file:filename()) -> add_path_ret(). add_path(Dir) when is_list(Dir) -> call({add_path,last,Dir}). --spec add_pathz(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. +-spec add_pathz(Directory :: file:filename()) -> add_path_ret(). add_pathz(Dir) when is_list(Dir) -> call({add_path,last,Dir}). --spec add_patha(Directory :: file:filename()) -> 'true' | {'error', 'bad_directory'}. +-spec add_patha(Directory :: file:filename()) -> add_path_ret(). add_patha(Dir) when is_list(Dir) -> call({add_path,first,Dir}). -spec add_paths(Directories :: [file:filename()]) -> 'ok'. @@ -243,8 +247,8 @@ 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(). -replace_path(Name, Dir) when (is_atom(Name) or is_list(Name)) and - (is_atom(Dir) or is_list(Dir)) -> +replace_path(Name, Dir) when (is_atom(Name) orelse is_list(Name)), + (is_atom(Dir) orelse is_list(Dir)) -> call({replace_path,Name,Dir}). -spec rehash() -> 'ok'. @@ -275,21 +279,14 @@ start_link(Flags) -> do_start(Flags) -> %% The following module_info/1 calls are here to ensure - %% that the modules are loaded prior to their use elsewhere in + %% that these modules are loaded prior to their use elsewhere in %% the code_server. %% Otherwise a deadlock may occur when the code_server is starting. - code_server:module_info(module), - packages:module_info(module), + code_server = code_server:module_info(module), + packages = packages:module_info(module), catch hipe_unified_loader:load_hipe_modules(), - gb_sets:module_info(module), - gb_trees:module_info(module), - - ets:module_info(module), - os:module_info(module), - binary:module_info(module), - unicode:module_info(module), - filename:module_info(module), - lists:module_info(module), + Modules2 = [gb_sets, gb_trees, ets, os, binary, unicode, filename, lists], + lists:foreach(fun (M) -> M = M:module_info(module) end, Modules2), Mode = get_mode(Flags), case init:get_argument(root) of @@ -297,7 +294,7 @@ do_start(Flags) -> Root = filename:join([Root0]), % Normalize. Use filename case code_server:start_link([Root,Mode]) of {ok,_Pid} = Ok2 -> - if + if Mode =:= interactive -> case lists:member(stick, Flags) of true -> do_stick_dirs(); @@ -306,14 +303,14 @@ do_start(Flags) -> true -> ok end, - % Quietly load the native code for all modules loaded so far. + %% Quietly load native code for all modules loaded so far catch load_native_code_for_all_loaded(), Ok2; Other -> Other end; Other -> - error_logger:error_msg("Can not start code server ~w ~n",[Other]), + error_logger:error_msg("Can not start code server ~w ~n", [Other]), {error, crash} end. @@ -330,7 +327,7 @@ do_s(Lib) -> %% The return value is intentionally ignored. Missing %% directories is not a fatal error. (In embedded systems, %% there is usually no compiler directory.) - stick_dir(filename:append(Dir, "ebin")), + _ = stick_dir(filename:append(Dir, "ebin")), ok end. @@ -428,7 +425,7 @@ where_is_file(Path, File) when is_list(Path), is_list(File) -> -spec set_primary_archive(ArchiveFile :: file:filename(), ArchiveBin :: binary(), - FileInfo :: #file_info{}) + FileInfo :: file:file_info()) -> 'ok' | {'error', atom()}. set_primary_archive(ArchiveFile0, ArchiveBin, #file_info{} = FileInfo) @@ -485,13 +482,13 @@ filter(Ext, _, {ok,Files}) -> filter2(Ext, length(Ext), Files). filter2(_Ext, _Extlen, []) -> []; -filter2(Ext, Extlen,[File|Tail]) -> - case has_ext(Ext,Extlen, File) of +filter2(Ext, Extlen, [File|Tail]) -> + case has_ext(Ext, Extlen, File) of true -> [File | filter2(Ext, Extlen, Tail)]; false -> filter2(Ext, Extlen, Tail) end. -has_ext(Ext, Extlen,File) -> +has_ext(Ext, Extlen, File) -> L = length(File), case catch lists:nthtail(L - Extlen, File) of Ext -> true; -- cgit v1.2.3 From 68aed1c7441ceb2e8dd87f5fa9ac8fefe98e3b47 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 26 Dec 2010 17:56:42 +0100 Subject: Fix a couple typos in driver_entry(3) --- erts/doc/src/driver_entry.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erts/doc/src/driver_entry.xml b/erts/doc/src/driver_entry.xml index dd949d4048..aa890e1ecd 100644 --- a/erts/doc/src/driver_entry.xml +++ b/erts/doc/src/driver_entry.xml @@ -36,7 +36,7 @@

As of erts version 5.5.3 the driver interface has been extended (see extended marker). - The extended interface introduce + The extended interface introduces version management, the possibility to pass capability flags (see driver flags) @@ -45,21 +45,21 @@

Old drivers (compiled with an erl_driver.h from an earlier erts version than 5.5.3) have to be recompiled - (but does not have to use the extended interface).

+ (but do not have to use the extended interface).

The driver_entry structure is a C struct that all erlang - drivers defines. It contains entry points for the erlang driver + drivers define. It contains entry points for the erlang driver that are called by the erlang emulator when erlang code accesses the driver.

The erl_driver driver - API functions needs a port handle + API functions need a port handle that identifies the driver instance (and the port in the emulator). This is only passed to the start function, but not to the other functions. The start function returns a driver-defined handle that is passed to the other functions. A - common practice is to have the start function allocating + common practice is to have the start function allocate some application-defined structure and stash the port handle in it, to use it later with the driver API functions.

The driver call-back functions are called synchronously from the @@ -235,7 +235,7 @@ typedef struct erl_drv_entry { void *handle -

This field is reserved for the emulators internal use. The +

This field is reserved for the emulator's internal use. The emulator will modify this field; therefore, it is important that the driver_entry isn't declared const.

@@ -399,7 +399,7 @@ typedef struct erl_drv_entry { void *handle2

- This field is reserved for the emulators internal use. The + This field is reserved for the emulator's internal use. The emulator will modify this field; therefore, it is important that the driver_entry isn't declared const.

-- cgit v1.2.3 From 59bb06a90248defb4c0be98f10afae88c2251fe7 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 10 Feb 2011 16:18:50 +0100 Subject: Eliminated Dialyzer warnings when using exit or throw. --- lib/cosEvent/doc/src/notes.xml | 36 +++++++++++++++++----- lib/cosEvent/src/cosEventApp.erl | 4 ++- lib/cosEvent/vsn.mk | 13 +------- lib/cosEventDomain/doc/src/notes.xml | 34 +++++++++++++++++++- .../src/CosEventDomainAdmin_EventDomain_impl.erl | 6 +++- lib/cosEventDomain/src/cosEventDomainApp.erl | 4 ++- lib/cosEventDomain/vsn.mk | 13 +------- lib/cosNotification/doc/src/notes.xml | 16 +++++++++- lib/cosNotification/src/CosNotification_Common.erl | 8 +++-- lib/cosNotification/vsn.mk | 16 +--------- lib/cosProperty/doc/src/notes.xml | 30 +++++++++++++++++- ...sPropertyService_PropertySetDefFactory_impl.erl | 5 ++- .../CosPropertyService_PropertySetFactory_impl.erl | 7 +++-- lib/cosProperty/vsn.mk | 12 +------- lib/cosTime/doc/src/notes.xml | 34 +++++++++++++++++++- lib/cosTime/src/cosTime.erl | 4 ++- lib/cosTime/vsn.mk | 12 +------- lib/orber/doc/src/notes.xml | 18 ++++++++++- lib/orber/include/ifr_types.hrl | 4 +-- lib/orber/src/orber.app.src | 2 +- lib/orber/src/orber.erl | 4 ++- lib/orber/vsn.mk | 2 +- 22 files changed, 197 insertions(+), 87 deletions(-) diff --git a/lib/cosEvent/doc/src/notes.xml b/lib/cosEvent/doc/src/notes.xml index 78299a38dc..1a5c8afa17 100644 --- a/lib/cosEvent/doc/src/notes.xml +++ b/lib/cosEvent/doc/src/notes.xml @@ -4,7 +4,7 @@
- 19992010 + 19992011 Ericsson AB. All Rights Reserved. @@ -33,26 +33,48 @@
- cosEvent 2.1.8 + cosEvent 2.1.10
Improvements and New Features

- Removed the usage of the codeinclude tag in the documentation.

+ Eliminated Dialyzer warnings when using exit or throw.

- Own Id: OTP-8409 Aux Id:

+ Own Id: OTP-9050 Aux Id:

+
+ +
+ cosEvent 2.1.9
- Fixed Bugs and Malfunctions + Improvements and New Features + + +

+ Test suites published.

+

+ Own Id: OTP-8543 Aux Id:

+
+
+
+
+ +
+ cosEvent 2.1.8 + +
+ Improvements and New Features -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

+

+ Removed the usage of the codeinclude tag in the documentation.

+

+ Own Id: OTP-8409 Aux Id:

diff --git a/lib/cosEvent/src/cosEventApp.erl b/lib/cosEvent/src/cosEventApp.erl index 084490f845..373e2d170b 100644 --- a/lib/cosEvent/src/cosEventApp.erl +++ b/lib/cosEvent/src/cosEventApp.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-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 @@ -98,6 +98,8 @@ Trying to unregister ~p~n", [H,Accum]), uninstall() -> uninstall_loop(lists:reverse(?IDL_MODULES), ok). +%% To avoid dialyzer warnings due to the use of exit(..). +-spec(uninstall_loop/2 :: (_, _) -> no_return()). uninstall_loop([],ok) -> ok; uninstall_loop([],{exit, register}) -> diff --git a/lib/cosEvent/vsn.mk b/lib/cosEvent/vsn.mk index 8915903bbe..f0b4b0588c 100644 --- a/lib/cosEvent/vsn.mk +++ b/lib/cosEvent/vsn.mk @@ -1,13 +1,2 @@ -COSEVENT_VSN = 2.1.8 - -TICKETS = OTP-8355 \ - OTP-8409 - -TICKETS_2.1.7 = OTP-8201 - -TICKETS_2.1.6 = OTP-7987 - -TICKETS_2.1.5 = OTP-7837 - -TICKETS_2.1.4 = OTP-7595 +COSEVENT_VSN = 2.1.10 diff --git a/lib/cosEventDomain/doc/src/notes.xml b/lib/cosEventDomain/doc/src/notes.xml index 0ad42948af..a6b4471831 100644 --- a/lib/cosEventDomain/doc/src/notes.xml +++ b/lib/cosEventDomain/doc/src/notes.xml @@ -4,7 +4,7 @@
- 20012009 + 20012011 Ericsson AB. All Rights Reserved. @@ -31,6 +31,38 @@ notes.xml
+
+ cosEventDomain 1.1.10 + +
+ Improvements and New Features + + +

+ Eliminated Dialyzer warnings when using exit or throw.

+

+ Own Id: OTP-9050 Aux Id:

+
+
+
+
+ +
+ cosEventDomain 1.1.9 + +
+ Improvements and New Features + + +

+ Test suites published.

+

+ Own Id: OTP-8543 Aux Id:

+
+
+
+
+
cosEventDomain 1.1.8 diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl index 0b73100540..ddff0f8632 100644 --- a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl +++ b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-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 @@ -780,6 +780,8 @@ set_qos(_OE_This, State, NewQoS) -> QoS = cosEventDomainApp:get_qos(NewQoS), set_qos_helper(QoS, State, []). +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(set_qos_helper/3 :: (_, _, _) -> no_return()). set_qos_helper([], State, []) -> {reply, ok, State}; set_qos_helper([], _, Errors) -> @@ -830,6 +832,8 @@ validate_qos(_OE_This, State, WantedQoS) -> QoS = cosEventDomainApp:get_qos(WantedQoS), {reply, {ok, validate_qos_helper(QoS, State, [], [])}, State}. +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(validate_qos_helper/4 :: (_, _, _, _) -> no_return()). validate_qos_helper([], _, Properties, []) -> Properties; validate_qos_helper([], _, _, Errors) -> diff --git a/lib/cosEventDomain/src/cosEventDomainApp.erl b/lib/cosEventDomain/src/cosEventDomainApp.erl index d57f51443c..3cb4055fba 100644 --- a/lib/cosEventDomain/src/cosEventDomainApp.erl +++ b/lib/cosEventDomain/src/cosEventDomainApp.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-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 @@ -272,6 +272,8 @@ get_qos([]) -> get_qos(Properties) -> get_qos(Properties, [], []). +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(get_qos/3 :: (_, _, _) -> no_return()). get_qos([], Supported, []) -> Supported; get_qos([], _, Unsupported) -> diff --git a/lib/cosEventDomain/vsn.mk b/lib/cosEventDomain/vsn.mk index 483b130819..f6d1c7a332 100644 --- a/lib/cosEventDomain/vsn.mk +++ b/lib/cosEventDomain/vsn.mk @@ -1,13 +1,2 @@ -COSEVENTDOMAIN_VSN = 1.1.8 - -TICKETS = OTP-8353 \ - OTP-8355 - -TICKETS_1.1.7 = OTP-8201 - -TICKETS_1.1.6 = OTP-7987 - -TICKETS_1.1.5 = OTP-7837 - -TICKETS_1.1.4 = OTP-7595 +COSEVENTDOMAIN_VSN = 1.1.10 diff --git a/lib/cosNotification/doc/src/notes.xml b/lib/cosNotification/doc/src/notes.xml index dfbabadfa2..a92aa4d11b 100644 --- a/lib/cosNotification/doc/src/notes.xml +++ b/lib/cosNotification/doc/src/notes.xml @@ -4,7 +4,7 @@
- 20002010 + 20002011 Ericsson AB. All Rights Reserved. @@ -31,6 +31,20 @@ notes.xml
+
cosNotification 1.1.16 + +
Improvements and New Features + + +

+ Eliminated Dialyzer warnings when using exit or throw.

+

+ Own Id: OTP-9050

+
+
+
+
+
cosNotification 1.1.15
Improvements and New Features diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl index 0e0f1da0d5..73a5550911 100644 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ b/lib/cosNotification/src/CosNotification_Common.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -28,7 +28,6 @@ %%--------------- INCLUDES ----------------------------------- -include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). %% Application files -include("CosNotification.hrl"). -include("CosNotifyChannelAdmin.hrl"). @@ -947,6 +946,9 @@ check_limits(LQS, NPR) -> validate_event_qos(Wanted, Curr) -> v_e_q_helper(Wanted, Curr, []), []. + +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(v_e_q_helper/3 :: (_, _, _) -> no_return()). v_e_q_helper([], _Curr, []) -> %% Parsed all and foynd no conflicts. ok; @@ -1071,6 +1073,8 @@ v_e_q_helper(What, _, _) -> %% LQS - local representation of QoS. %% Returns : {NewOMGStyleQoS, NewLocalQoS} | #'CosNotification_UnsupportedQoS'{} %%------------------------------------------------------------ +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(set_properties/9 :: (_, _, _, _, _, _, _, _, _) -> no_return()). set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> merge_properties(NewQoS, Curr, LAS); set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> diff --git a/lib/cosNotification/vsn.mk b/lib/cosNotification/vsn.mk index be7aa56e15..6cea4b35b9 100644 --- a/lib/cosNotification/vsn.mk +++ b/lib/cosNotification/vsn.mk @@ -1,15 +1 @@ -COSNOTIFICATION_VSN = 1.1.15 - -TICKETS = OTP-8353 \ - OTP-8354 \ - OTP-8355 - -TICKETS_1.1.12 = OTP-8201 - -TICKETS_1.1.11 = OTP-7987 - -TICKETS_1.1.10 = OTP-7837 - -TICKETS_1.1.9 = OTP-7595 - -TICKETS_1.1.8 = OTP-7553 +COSNOTIFICATION_VSN = 1.1.16 diff --git a/lib/cosProperty/doc/src/notes.xml b/lib/cosProperty/doc/src/notes.xml index e80c90849f..770d50f777 100644 --- a/lib/cosProperty/doc/src/notes.xml +++ b/lib/cosProperty/doc/src/notes.xml @@ -4,7 +4,7 @@
- 20002009 + 20002011 Ericsson AB. All Rights Reserved. @@ -31,6 +31,34 @@ notes.xml
+
+ cosProperty 1.1.11 + +
+ Fixed Bugs and Malfunctions + + +

Eliminated Dialyzer warnings when using exit or throw.

+

Own id: OTP-9050 Aux Id:

+
+
+
+
+ +
+ cosProperty 1.1.12 + +
+ Fixed Bugs and Malfunctions + + +

Test suites published.

+

Own id: OTP-8543 Aux Id:

+
+
+
+
+
cosProperty 1.1.11 diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl index b099026b88..45fd097bff 100644 --- a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl +++ b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -153,6 +153,9 @@ create_initial_propertysetdef(_OE_This, State, PropDefs) -> %%====================================================================== evaluate_propertysetdef(SetDefs) -> evaluate_propertysetdef(SetDefs, [], []). + +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(evaluate_propertysetdef/3 :: (_, _, _) -> no_return()). evaluate_propertysetdef([], NewProperties, []) -> %% No exceptions found. NewProperties; diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl index ad3cdb62d4..c251421205 100644 --- a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl +++ b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl @@ -2,10 +2,10 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 +%% Version 1.1, (the "License"); yu 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/. @@ -154,6 +154,9 @@ create_initial_propertyset(_OE_This, State, Properties) -> %%====================================================================== evaluate_propertyset(Sets) -> evaluate_propertyset(Sets, [], []). + +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(evaluate_propertyset/3 :: (_, _, _) -> no_return()). evaluate_propertyset([], NewProperties, []) -> %% No exceptions found. NewProperties; diff --git a/lib/cosProperty/vsn.mk b/lib/cosProperty/vsn.mk index c221e6fa4a..6d770a7d69 100644 --- a/lib/cosProperty/vsn.mk +++ b/lib/cosProperty/vsn.mk @@ -1,11 +1 @@ -COSPROPERTY_VSN = 1.1.11 - -TICKETS = OTP-8355 - -TICKETS_1.1.10 = OTP-8201 - -TICKETS_1.1.9 = OTP-7987 - -TICKETS_1.1.8 = OTP-7837 - -TICKETS_1.1.7 = OTP-7595 +COSPROPERTY_VSN = 1.1.13 diff --git a/lib/cosTime/doc/src/notes.xml b/lib/cosTime/doc/src/notes.xml index 9f23a8633c..6a5bc7be00 100644 --- a/lib/cosTime/doc/src/notes.xml +++ b/lib/cosTime/doc/src/notes.xml @@ -4,7 +4,7 @@
- 20002009 + 20002011 Ericsson AB. All Rights Reserved. @@ -32,6 +32,38 @@ notes.xml
+
+ cosTime 1.1.10 + +
+ Improvements and New Features + + +

+ Eliminated Dialyzer warnings when using exit or throw.

+

+ Own Id: OTP-9050 Aux Id:

+
+
+
+
+ +
+ cosTime 1.1.9 + +
+ Improvements and New Features + + +

+ Test suites published.

+

+ Own Id: OTP-8543 Aux Id:

+
+
+
+
+
cosTime 1.1.8 diff --git a/lib/cosTime/src/cosTime.erl b/lib/cosTime/src/cosTime.erl index f4e67570ad..3f6050444a 100644 --- a/lib/cosTime/src/cosTime.erl +++ b/lib/cosTime/src/cosTime.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -110,6 +110,8 @@ uninstall_time() -> uninstall_timerevent() -> uninstall_loop(lists:reverse(?IDL_TIMEREVENT_MODULES),ok). +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(uninstall_loop/2 :: (_, _) -> no_return()). uninstall_loop([],ok) -> ok; uninstall_loop([],{exit, register}) -> diff --git a/lib/cosTime/vsn.mk b/lib/cosTime/vsn.mk index db51bf39b9..e93a4907ce 100644 --- a/lib/cosTime/vsn.mk +++ b/lib/cosTime/vsn.mk @@ -1,11 +1 @@ -COSTIME_VSN = 1.1.8 - -TICKETS = OTP-8355 - -TICKETS_1.1.7 = OTP-8201 - -TICKETS_1.1.6 = OTP-7987 - -TICKETS_1.1.5 = OTP-7837 - -TICKETS_1.1.4 = OTP-7595 +COSTIME_VSN = 1.1.10 diff --git a/lib/orber/doc/src/notes.xml b/lib/orber/doc/src/notes.xml index ba16682f0b..589123ef73 100644 --- a/lib/orber/doc/src/notes.xml +++ b/lib/orber/doc/src/notes.xml @@ -4,7 +4,7 @@
- 19972010 + 19972011 Ericsson AB. All Rights Reserved. @@ -32,6 +32,22 @@ notes.xml
+
+ Orber 3.6.20 + +
+ Improvements and New Features + + +

+ Eliminated Dialyzer warnings when using exit or throw.

+

+ Own Id: OTP-9050 Aux Id:

+
+
+
+
+
Orber 3.6.19 diff --git a/lib/orber/include/ifr_types.hrl b/lib/orber/include/ifr_types.hrl index d982850e98..f4a1c533e1 100644 --- a/lib/orber/include/ifr_types.hrl +++ b/lib/orber/include/ifr_types.hrl @@ -2,7 +2,7 @@ %% %% %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 @@ -54,7 +54,7 @@ id = Obj#Object_type.id, defined_in = Obj#Object_type.defined_in, version = Obj#Object_type.version, - type = Obj#Object_type.type}. + type = Obj#Object_type.type}). -record(exceptiondescription, {name, id, defined_in, version, type}). diff --git a/lib/orber/src/orber.app.src b/lib/orber/src/orber.app.src index fe911d65a4..88df4162b6 100644 --- a/lib/orber/src/orber.app.src +++ b/lib/orber/src/orber.app.src @@ -101,7 +101,7 @@ orber_iiop_insup, orber_init, orber_reqno, orber_objkeyserver, orber_iiop_socketsup, orber_iiop_pm, orber_env]}, - {applications, [stdlib, kernel]}, + {applications, [stdlib, kernel, mnesia]}, {env, []}, {mod, {orber, []}} ]}. diff --git a/lib/orber/src/orber.erl b/lib/orber/src/orber.erl index c3d37ad1fb..9902306161 100644 --- a/lib/orber/src/orber.erl +++ b/lib/orber/src/orber.erl @@ -2,7 +2,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 @@ -1029,6 +1029,8 @@ remove_node(Node) when is_atom(Node) -> remove_tables(Tables, Node) -> remove_tables(Tables, Node, []). +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(remove_tables/3 :: (_, _, _) -> no_return()). remove_tables([], _, []) -> ok; remove_tables([], Node, Failed) -> ?EFORMAT("orber:remove_node(~p) failed. Unable to remove table(s): ~p", diff --git a/lib/orber/vsn.mk b/lib/orber/vsn.mk index c265db188f..5f17cda229 100644 --- a/lib/orber/vsn.mk +++ b/lib/orber/vsn.mk @@ -1,3 +1,3 @@ -ORBER_VSN = 3.6.19 +ORBER_VSN = 3.6.20 -- cgit v1.2.3 From 27d6af0ed32a25d7ea1dcd83a4163f8e6ec67844 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Mon, 14 Feb 2011 10:31:00 +0100 Subject: Corrected spec usage. --- lib/cosNotification/src/CosNotification_Common.erl | 4 ++-- ...sPropertyService_PropertySetDefFactory_impl.erl | 2 -- .../CosPropertyService_PropertySetFactory_impl.erl | 4 +--- lib/cosTime/src/cosTime.erl | 24 +++++++++++++--------- lib/orber/src/corba.erl | 6 +++++- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl index 73a5550911..1e2d9640aa 100644 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ b/lib/cosNotification/src/CosNotification_Common.erl @@ -948,7 +948,7 @@ validate_event_qos(Wanted, Curr) -> []. %% To avoid dialyzer warnings due to the use of exit/throw. --spec(v_e_q_helper/3 :: (_, _, _) -> no_return()). +%%-spec(v_e_q_helper/3 :: (_, _, _) -> no_return()). v_e_q_helper([], _Curr, []) -> %% Parsed all and foynd no conflicts. ok; @@ -1074,7 +1074,7 @@ v_e_q_helper(What, _, _) -> %% Returns : {NewOMGStyleQoS, NewLocalQoS} | #'CosNotification_UnsupportedQoS'{} %%------------------------------------------------------------ %% To avoid dialyzer warnings due to the use of exit/throw. --spec(set_properties/9 :: (_, _, _, _, _, _, _, _, _) -> no_return()). +%%-spec(set_properties/9 :: (_, _, _, _, _, _, _, _, _) -> no_return()). set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> merge_properties(NewQoS, Curr, LAS); set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl index 45fd097bff..82bc00aa7f 100644 --- a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl +++ b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl @@ -154,8 +154,6 @@ create_initial_propertysetdef(_OE_This, State, PropDefs) -> evaluate_propertysetdef(SetDefs) -> evaluate_propertysetdef(SetDefs, [], []). -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(evaluate_propertysetdef/3 :: (_, _, _) -> no_return()). evaluate_propertysetdef([], NewProperties, []) -> %% No exceptions found. NewProperties; diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl index c251421205..1a8f83617a 100644 --- a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl +++ b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl @@ -5,7 +5,7 @@ %% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); yu may not use this file except in +%% 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/. @@ -155,8 +155,6 @@ create_initial_propertyset(_OE_This, State, Properties) -> evaluate_propertyset(Sets) -> evaluate_propertyset(Sets, [], []). -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(evaluate_propertyset/3 :: (_, _, _) -> no_return()). evaluate_propertyset([], NewProperties, []) -> %% No exceptions found. NewProperties; diff --git a/lib/cosTime/src/cosTime.erl b/lib/cosTime/src/cosTime.erl index 3f6050444a..b02cb72509 100644 --- a/lib/cosTime/src/cosTime.erl +++ b/lib/cosTime/src/cosTime.erl @@ -110,30 +110,34 @@ uninstall_time() -> uninstall_timerevent() -> uninstall_loop(lists:reverse(?IDL_TIMEREVENT_MODULES),ok). -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(uninstall_loop/2 :: (_, _) -> no_return()). uninstall_loop([],ok) -> ok; uninstall_loop([],{exit, register}) -> - exit({?MODULE, "oe_register failed"}); + do_exit({?MODULE, "oe_register failed"}); uninstall_loop([],{exit, unregister}) -> - exit({?MODULE, "oe_unregister failed"}); + do_exit({?MODULE, "oe_unregister failed"}); uninstall_loop([],{exit, both}) -> - exit({?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}); + do_exit({?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}); uninstall_loop([H|T], Status) -> case catch H:'oe_unregister'() of ok -> uninstall_loop(T, Status); _ when Status == ok -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered. -You are adviced to confirm this.~n",[H]), + ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" + "You are adviced to confirm this.~n",[H]), uninstall_loop(T, {exit, unregister}); _ -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered. -You are adviced to confirm this.~n",[H]), + ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" + "You are adviced to confirm this.~n",[H]), uninstall_loop(T, {exit, both}) end. - + + +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(do_exit/1 :: (_) -> no_return()). +do_exit(Reason) -> + exit(Reason). + %%------------------------------------------------------------ %% function : start/stop %% Arguments: diff --git a/lib/orber/src/corba.erl b/lib/orber/src/corba.erl index ea1363742c..f4a17c10e9 100644 --- a/lib/orber/src/corba.erl +++ b/lib/orber/src/corba.erl @@ -2,7 +2,7 @@ %% %% %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 @@ -620,6 +620,8 @@ get_pid(Objkey) -> %% Returns : Throws the exception. %% Description: %%---------------------------------------------------------------------- +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(raise/1 :: (_) -> no_return()). raise(E) -> throw({'EXCEPTION', E}). @@ -629,6 +631,8 @@ raise(E) -> %% Returns : Throws the exception. %% Description: %%---------------------------------------------------------------------- +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(raise_with_state/2 :: (_, _) -> no_return()). raise_with_state(E, State) -> throw({reply, {'EXCEPTION', E}, State}). -- cgit v1.2.3 From d2bb03ce3a6a99f3e3f0abe1f74a355879437c4f Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Mon, 14 Feb 2011 14:34:00 +0100 Subject: Updsated macro EFORMAT exit handling. --- lib/cosNotification/src/CosNotification_Common.erl | 4 ---- lib/orber/src/orber.erl | 10 +++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl index 1e2d9640aa..bcd241f3a8 100644 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ b/lib/cosNotification/src/CosNotification_Common.erl @@ -947,8 +947,6 @@ validate_event_qos(Wanted, Curr) -> v_e_q_helper(Wanted, Curr, []), []. -%% To avoid dialyzer warnings due to the use of exit/throw. -%%-spec(v_e_q_helper/3 :: (_, _, _) -> no_return()). v_e_q_helper([], _Curr, []) -> %% Parsed all and foynd no conflicts. ok; @@ -1073,8 +1071,6 @@ v_e_q_helper(What, _, _) -> %% LQS - local representation of QoS. %% Returns : {NewOMGStyleQoS, NewLocalQoS} | #'CosNotification_UnsupportedQoS'{} %%------------------------------------------------------------ -%% To avoid dialyzer warnings due to the use of exit/throw. -%%-spec(set_properties/9 :: (_, _, _, _, _, _, _, _, _) -> no_return()). set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> merge_properties(NewQoS, Curr, LAS); set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> diff --git a/lib/orber/src/orber.erl b/lib/orber/src/orber.erl index 9902306161..f0820811f5 100644 --- a/lib/orber/src/orber.erl +++ b/lib/orber/src/orber.erl @@ -95,7 +95,13 @@ -define(DEBUG_LEVEL, 5). -define(FORMAT(_F, _A), lists:flatten(io_lib:format(_F, _A))). --define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). +-define(EFORMAT(_F, _A), do_exit(lists:flatten(io_lib:format(_F, _A)))). + + +%% To avoid dialyzer warnings due to the use of exit/throw. +-spec(do_exit/1 :: (_) -> no_return()). +do_exit(Reason) -> + exit(Reason). %%----------------------------------------------------------------- @@ -1029,8 +1035,6 @@ remove_node(Node) when is_atom(Node) -> remove_tables(Tables, Node) -> remove_tables(Tables, Node, []). -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(remove_tables/3 :: (_, _, _) -> no_return()). remove_tables([], _, []) -> ok; remove_tables([], Node, Failed) -> ?EFORMAT("orber:remove_node(~p) failed. Unable to remove table(s): ~p", -- cgit v1.2.3 From b397a5b6d3dce5ad0be19a7bac262d6f636a666d Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Wed, 2 Feb 2011 12:27:44 +0200 Subject: Various cleanups and cosmetic changes --- lib/hipe/icode/hipe_icode_range.erl | 212 ++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl index c7e6a451af..91f6fb47f3 100644 --- a/lib/hipe/icode/hipe_icode_range.erl +++ b/lib/hipe/icode/hipe_icode_range.erl @@ -1,20 +1,20 @@ %% -*- erlang-indent-level: 2 -*- %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2007-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% %% %%%------------------------------------------------------------------- @@ -108,8 +108,8 @@ cfg(Cfg, MFA, Options, Servers) -> -spec concurrent_cfg(cfg(), mfa(), pid()) -> cfg(). concurrent_cfg(Cfg, MFA, CompServer) -> - CompServer ! {ready, {MFA,self()}}, - {ArgsFun,CallFun,FinalFun} = do_analysis(Cfg, MFA), + CompServer ! {ready, {MFA, self()}}, + {ArgsFun, CallFun, FinalFun} = do_analysis(Cfg, MFA), Ans = do_rewrite(Cfg, MFA, ArgsFun, CallFun, FinalFun), CompServer ! {done_rewrite, MFA}, Ans. @@ -266,7 +266,7 @@ handle_args(I, Info, WidenFun) -> %% io:format("Uses: ~p~nRanges: ~p~n", [Uses, PresentRanges]), JoinFun = fun(Var, Range) -> update_info(Var, Range, WidenFun) end, NewUses = lists:zipwith(JoinFun, Uses, PresentRanges), - hipe_icode:subst_uses(lists:zip(Uses, NewUses),I). + hipe_icode:subst_uses(lists:zip(Uses, NewUses), I). -spec join_info(#ann{}, #range{}, three_range_fun()) -> #ann{}. @@ -317,7 +317,7 @@ update_ann(Ann = #ann{range = R1, type = Type, count = C}, R2, _Fun) -> -spec type_to_ann(erl_types:erl_type()) -> #ann{}. type_to_ann(Type) -> - #ann{range = range_from_simple_type(Type), type = t_limit(Type,1), count=1}. + #ann{range = range_from_simple_type(Type), type = t_limit(Type,1), count = 1}. -spec make_range_anno(#ann{}) -> range_anno(). @@ -333,52 +333,52 @@ update_three(_R1, R2, R3) -> safe_widen(#range{range=Old}, #range{range=New}, T = #range{range=Wide}) -> ResRange = - case {Old,New,Wide} of - {{Min,Max1},{Min,Max2},{_,Max}} -> - case inf_geq(OMax = next_up_limit(inf_max([Max1,Max2])),Max) of + case {Old, New, Wide} of + {{Min,Max1}, {Min,Max2}, {_,Max}} -> + case inf_geq(OMax = next_up_limit(inf_max([Max1, Max2])), Max) of true -> {Min,Max}; false -> {Min,OMax} end; - {{Min1,Max},{Min2,Max},{Min,_}} -> - case inf_geq(Min, OMin = next_down_limit(inf_min([Min1,Min2]))) of + {{Min1,Max}, {Min2,Max}, {Min,_}} -> + case inf_geq(Min, OMin = next_down_limit(inf_min([Min1, Min2]))) of true -> {Min,Max}; false -> {OMin,Max} end; - {{Min1,Max1},{Min2,Max2},{Min,Max}} -> + {{Min1,Max1}, {Min2,Max2}, {Min,Max}} -> RealMax = - case inf_geq(OMax = next_up_limit(inf_max([Max1,Max2])),Max) of + case inf_geq(OMax = next_up_limit(inf_max([Max1, Max2])), Max) of true -> Max; false -> OMax end, RealMin = - case inf_geq(Min, OMin = next_down_limit(inf_min([Min1,Min2]))) of + case inf_geq(Min, OMin = next_down_limit(inf_min([Min1, Min2]))) of true -> Min; false -> OMin end, - {RealMin,RealMax}; + {RealMin, RealMax}; _ -> Wide end, - T#range{range=ResRange}. + T#range{range = ResRange}. -spec widen(#range{}, #range{}, #range{}) -> #range{}. widen(#range{range=Old}, #range{range=New}, T = #range{range=Wide}) -> ResRange = - case {Old,New,Wide} of - {{Min,_},{Min,Max2},{_,Max}} -> - case inf_geq(OMax = next_up_limit(Max2),Max) of + case {Old, New, Wide} of + {{Min,_}, {Min,Max2}, {_,Max}} -> + case inf_geq(OMax = next_up_limit(Max2), Max) of true -> {Min,Max}; false -> {Min,OMax} end; - {{_,Max},{Min2,Max},{Min,_}} -> + {{_,Max}, {Min2,Max}, {Min,_}} -> case inf_geq(Min, OMin = next_down_limit(Min2)) of true -> {Min,Max}; false -> {OMin,Max} end; - {_,{Min2,Max2},{Min,Max}} -> + {_, {Min2,Max2}, {Min,Max}} -> RealMax = - case inf_geq(OMax = next_up_limit(Max2),Max) of + case inf_geq(OMax = next_up_limit(Max2), Max) of true -> Max; false -> OMax end, @@ -387,11 +387,11 @@ widen(#range{range=Old}, #range{range=New}, T = #range{range=Wide}) -> true -> Min; false -> OMin end, - {RealMin,RealMax}; + {RealMin, RealMax}; _ -> Wide end, - T#range{range=ResRange}. + T#range{range = ResRange}. -spec analyse_call(#icode_call{}, call_fun()) -> #icode_call{}. @@ -421,7 +421,7 @@ analyse_move(Move) -> analyse_begin_handler(Handler) -> SubstList = - [{Dst,update_info(Dst,any_type())} || + [{Dst, update_info(Dst, any_type())} || Dst <- hipe_icode:begin_handler_dstlist(Handler)], hipe_icode:subst_defines(SubstList, Handler). @@ -497,7 +497,7 @@ analyse_switch_val(Switch, Info, Rewrite) -> -spec update_infos(argument(), info(), [{#range{},label()}]) -> [{label(),info()}]. update_infos(Arg, Info, [{Range, Label}|Rest]) -> - [{Label,enter_define({Arg,Range},Info)} | update_infos(Arg,Info,Rest)]; + [{Label,enter_define({Arg,Range},Info)} | update_infos(Arg, Info, Rest)]; update_infos(_, _, []) -> []. -spec get_range_label_list([{argument(),label()}], #range{}, [{#range{},label()}]) -> @@ -524,7 +524,7 @@ update_switch(Switch, LabelRangeList, KeepFail) -> case label_range_list_to_cases(LabelRangeList, []) of no_update -> Switch; - Cases -> + Cases -> hipe_icode:switch_val_cases_update(Switch, Cases) end, if KeepFail -> S2; @@ -586,9 +586,9 @@ analyse_last_call(Call, Info, LookupFun) -> NewInfo = enter_vals(NewI, Info), case hipe_icode:call_fail_label(Call) of [] -> - {NewI, [{Continuation,NewInfo}]}; + {NewI, [{Continuation, NewInfo}]}; Fail -> - {NewI, [{Continuation,NewInfo}, {Fail,Info}]} + {NewI, [{Continuation, NewInfo}, {Fail, Info}]} end. -spec analyse_if(#icode_if{}, info(), boolean()) -> @@ -596,12 +596,12 @@ analyse_last_call(Call, Info, LookupFun) -> analyse_if(If, Info, Rewrite) -> case hipe_icode:if_args(If) of - Args = [_,_] -> + [_, _] = Args -> analyse_sane_if(If, Info, Args, get_range_from_args(Args), Rewrite); _ -> TrueLabel = hipe_icode:if_true_label(If), FalseLabel = hipe_icode:if_false_label(If), - {If, [{TrueLabel,Info},{FalseLabel,Info}]} + {If, [{TrueLabel, Info}, {FalseLabel, Info}]} end. -spec analyse_sane_if(#icode_if{}, info(), [argument(),...], @@ -613,59 +613,61 @@ analyse_sane_if(If, Info, [Arg1, Arg2], [Range1, Range2], Rewrite) -> '>' -> {TrueRange2, TrueRange1, FalseRange2, FalseRange1} = range_inequality_propagation(Range2, Range1); - '==' -> - {TempTrueRange1, TempTrueRange2, FalseRange1, FalseRange2}= - range_equality_propagation(Range1, Range2), - TrueRange1 = set_other(TempTrueRange1,other(Range1)), - TrueRange2 = set_other(TempTrueRange2,other(Range2)); '<' -> - {TrueRange1, TrueRange2, FalseRange1, FalseRange2} = + {TrueRange1, TrueRange2, FalseRange1, FalseRange2} = range_inequality_propagation(Range1, Range2); '>=' -> {FalseRange1, FalseRange2, TrueRange1, TrueRange2} = range_inequality_propagation(Range1, Range2); '=<' -> - {FalseRange2, FalseRange1, TrueRange2, TrueRange1} = + {FalseRange2, FalseRange1, TrueRange2, TrueRange1} = range_inequality_propagation(Range2, Range1); '=:=' -> - {TrueRange1, TrueRange2, FalseRange1, FalseRange2}= + {TrueRange1, TrueRange2, FalseRange1, FalseRange2} = range_equality_propagation(Range1, Range2); '=/=' -> {FalseRange1, FalseRange2, TrueRange1, TrueRange2} = range_equality_propagation(Range1, Range2); + '==' -> + {TempTrueRange1, TempTrueRange2, FalseRange1, FalseRange2} = + range_equality_propagation(Range1, Range2), + TrueRange1 = set_other(TempTrueRange1, other(Range1)), + TrueRange2 = set_other(TempTrueRange2, other(Range2)); '/=' -> - {TempFalseRange1, TempFalseRange2, TrueRange1, TrueRange2}= + {TempFalseRange1, TempFalseRange2, TrueRange1, TrueRange2} = range_equality_propagation(Range1, Range2), - FalseRange1 = set_other(TempFalseRange1,other(Range1)), - FalseRange2 = set_other(TempFalseRange2,other(Range2)) + FalseRange1 = set_other(TempFalseRange1, other(Range1)), + FalseRange2 = set_other(TempFalseRange2, other(Range2)) end, - TrueLabel = hipe_icode:if_true_label(If), - FalseLabel = hipe_icode:if_false_label(If), - TrueInfo = - enter_defines([{Arg1,TrueRange1}, {Arg2,TrueRange2}],Info), - FalseInfo = - enter_defines([{Arg1,FalseRange1}, {Arg2,FalseRange2}],Info), - True = - case lists:any(fun range__is_none/1,[TrueRange1,TrueRange2]) of + %% io:format("TR1 = ~w\nTR2 = ~w\n", [TrueRange1, TrueRange2]), + True = + case lists:any(fun range__is_none/1, [TrueRange1, TrueRange2]) of true -> []; - false -> [{TrueLabel,TrueInfo}] + false -> + TrueLabel = hipe_icode:if_true_label(If), + TrueArgRanges = [{Arg1, TrueRange1}, {Arg2, TrueRange2}], + TrueInfo = enter_defines(TrueArgRanges, Info), + [{TrueLabel, TrueInfo}] end, - False = - case lists:any(fun range__is_none/1, [FalseRange1,FalseRange2]) of + %% io:format("FR1 = ~w\nFR2 = ~w\n", [FalseRange1, FalseRange2]), + False = + case lists:any(fun range__is_none/1, [FalseRange1, FalseRange2]) of true -> []; - false -> [{FalseLabel,FalseInfo}] + false -> + FalseLabel = hipe_icode:if_false_label(If), + FalseArgRanges = [{Arg1, FalseRange1}, {Arg2, FalseRange2}], + FalseInfo = enter_defines(FalseArgRanges, Info), + [{FalseLabel, FalseInfo}] end, - UpdateInfo = True++False, + UpdateInfo = True ++ False, NewIF = if Rewrite -> - %%io:format("~w~n~w~n", [{Arg1,FalseRange1},{Arg2,FalseRange2}]), - %%io:format("Any none: ~w~n", [lists:any(fun range__is_none/1,[FalseRange1,FalseRange2])]), case UpdateInfo of - [] -> %%This is weird + [] -> %% This is weird If; - [{Label,_Info}] -> + [{Label, _Info}] -> hipe_icode:mk_goto(Label); - [_,_] -> + [_, _] -> If end; true -> @@ -692,7 +694,7 @@ normalize_name(Name) -> range_equality_propagation(Range_1, Range_2) -> True_range = inf(Range_1, Range_2), case {range(Range_1), range(Range_2)} of - {{N,N},{ N,N}} -> + {{N,N}, {N,N}} -> False_range_1 = none_range(), False_range_2 = none_range(); {{N1,N1}, {N2,N2}} -> @@ -781,26 +783,24 @@ analyse_type(Type, Info, Rewrite) -> TrueRange = inf(any_range(), OldVarRange), FalseRange = inf(none_range(), OldVarRange); _ -> - TrueRange = inf(none_range(),OldVarRange), + TrueRange = inf(none_range(), OldVarRange), FalseRange = OldVarRange end, TrueLabel = hipe_icode:type_true_label(Type), FalseLabel = hipe_icode:type_false_label(Type), - TrueInfo = - enter_define({Arg,TrueRange},Info), - FalseInfo = - enter_define({Arg,FalseRange},Info), - True = + TrueInfo = enter_define({Arg, TrueRange}, Info), + FalseInfo = enter_define({Arg, FalseRange}, Info), + True = case range__is_none(TrueRange) of true -> []; - false -> [{TrueLabel,TrueInfo}] + false -> [{TrueLabel, TrueInfo}] end, - False = + False = case range__is_none(FalseRange) of true -> []; - false -> [{FalseLabel,FalseInfo}] + false -> [{FalseLabel, FalseInfo}] end, - UpdateInfo = True++False, + UpdateInfo = True ++ False, NewType = if Rewrite -> case UpdateInfo of @@ -808,13 +808,13 @@ analyse_type(Type, Info, Rewrite) -> Type; [{Label,_Info}] -> hipe_icode:mk_goto(Label); - [_,_] -> + [_, _] -> Type end; true -> Type end, - {NewType,True ++ False}. + {NewType, True ++ False}. -spec compare_with_integer(integer(), #range{}) -> {#range{}, #range{}}. @@ -845,11 +845,11 @@ compare_with_integer(N, OldVarRange) -> -spec pp_ann(#ann{} | erl_types:erl_type()) -> string(). -pp_ann(#ann{range=#range{range=R, other=false}}) -> +pp_ann(#ann{range = #range{range = R, other = false}}) -> pp_range(R); -pp_ann(#ann{range=#range{range=empty, other=true}, type=Type}) -> +pp_ann(#ann{range = #range{range = empty, other = true}, type = Type}) -> t_to_string(Type); -pp_ann(#ann{range=#range{range=R, other=true}, type=Type}) -> +pp_ann(#ann{range = #range{range = R, other = true}, type = Type}) -> pp_range(R) ++ " | " ++ t_to_string(Type); pp_ann(Type) -> t_to_string(Type). @@ -913,23 +913,23 @@ set_other(R, O) -> R#range{other = O}. -spec range__min(#range{}) -> 'empty' | 'neg_inf' | integer(). -range__min(#range{range=empty}) -> empty; -range__min(#range{range={Min,_}}) -> Min. +range__min(#range{range = empty}) -> empty; +range__min(#range{range = {Min,_}}) -> Min. -spec range__max(#range{}) -> 'empty' | 'pos_inf' | integer(). -range__max(#range{range=empty}) -> empty; -range__max(#range{range={_,Max}}) -> Max. +range__max(#range{range = empty}) -> empty; +range__max(#range{range = {_,Max}}) -> Max. -spec range__is_none(#range{}) -> boolean(). -range__is_none(#range{range=empty, other=false}) -> true; +range__is_none(#range{range = empty, other = false}) -> true; range__is_none(#range{}) -> false. -spec range__is_empty(#range{}) -> boolean(). -range__is_empty(#range{range=empty}) -> true; -range__is_empty(#range{range={_,_}}) -> false. +range__is_empty(#range{range = empty}) -> true; +range__is_empty(#range{range = {_,_}}) -> false. -spec remove_point_types(#range{}, [#range{}]) -> #range{}. @@ -941,31 +941,31 @@ remove_point_types(Range, Ranges) -> -spec range__remove_constant(#range{}, #range{}) -> #range{}. -range__remove_constant(R = #range{range={C,C}}, #range{range={C,C}}) -> - R#range{range=empty}; -range__remove_constant(R = #range{range={C,H}}, #range{range={C,C}}) -> - R#range{range={C+1,H}}; -range__remove_constant(R = #range{range={L,C}}, #range{range={C,C}}) -> - R#range{range={L,C-1}}; -range__remove_constant(R = #range{}, #range{range={C,C}}) -> +range__remove_constant(#range{range = {C, C}} = R, #range{range = {C, C}}) -> + R#range{range = empty}; +range__remove_constant(#range{range = {C, H}} = R, #range{range = {C, C}}) -> + R#range{range = {C+1, H}}; +range__remove_constant(#range{range = {L, C}} = R, #range{range = {C, C}}) -> + R#range{range = {L, C-1}}; +range__remove_constant(#range{} = R, #range{range = {C,C}}) -> R; -range__remove_constant(R = #range{}, _) -> +range__remove_constant(#range{} = R, _) -> R. -spec any_type() -> #range{}. any_type() -> - #range{range=any_r(), other=true}. + #range{range = any_r(), other = true}. -spec any_range() -> #range{}. any_range() -> - #range{range=any_r(), other=false}. + #range{range = any_r(), other = false}. -spec none_range() -> #range{}. none_range() -> - #range{range=empty, other=true}. + #range{range = empty, other = true}. -spec none_type() -> #range{}. @@ -989,15 +989,15 @@ get_range_from_arg(Arg) -> Value = hipe_icode:const_value(Arg), case is_integer(Value) of true -> - #range{range={Value,Value}, other=false}; + #range{range = {Value, Value}, other = false}; false -> - #range{range=empty, other=true} + #range{range = empty, other = true} end; false -> case hipe_icode:is_annotated_variable(Arg) of true -> case hipe_icode:variable_annotation(Arg) of - {range_anno, #ann{range=Range}, _} -> + {range_anno, #ann{range = Range}, _} -> Range; {type_anno, Type, _} -> range_from_simple_type(Type) @@ -1022,8 +1022,8 @@ inf(#range{range=R1, other=O1}, #range{range=R2, other=O2}) -> range_inf(empty, _) -> empty; range_inf(_, empty) -> empty; range_inf({Min1,Max1}, {Min2,Max2}) -> - NewMin = inf_max([Min1,Min2]), - NewMax = inf_min([Max1,Max2]), + NewMin = inf_max([Min1, Min2]), + NewMax = inf_min([Max1, Max2]), case inf_geq(NewMax, NewMin) of true -> {NewMin, NewMax}; @@ -1105,7 +1105,7 @@ analyse_call_or_enter_fun(Fun, Args, CallType, LookupFun) -> [any_type()]; {hipe_bs_primop, {bs_get_integer, Size, Flags}} -> {Min, Max} = analyse_bs_get_integer(Size, Flags, length(Args) =:= 1), - [#range{range={Min, Max}, other=false}, any_type()]; + [#range{range = {Min, Max}, other = false}, any_type()]; {hipe_bs_primop, _} = Primop -> Type = hipe_icode_primops:type(Primop), range_from_type(Type) @@ -1115,9 +1115,9 @@ analyse_call_or_enter_fun(Fun, Args, CallType, LookupFun) -> -type unary_operation() :: fun((#range{}) -> #range{}). -spec basic_type(fun_name()) -> 'not_int' | 'not_analysed' - | {bin, bin_operation()} - | {unary, unary_operation()} - | {fcall, mfa()} | {hipe_bs_primop, _}. + | {'bin', bin_operation()} + | {'unary', unary_operation()} + | {'fcall', mfa()} | {'hipe_bs_primop', _}. %% Arithmetic operations basic_type('+') -> {bin, fun(R1, R2) -> range_add(R1, R2) end}; -- cgit v1.2.3 From 6c9a53e0e155dae4325fb104a4108cd6446940f3 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Wed, 2 Feb 2011 12:29:59 +0200 Subject: Fix bug in the simplification of inexact comparisons On 31/1/2011 Paul Guyot reported a bug in the native code compilation of inexact equality/inequality tests between floats and integers. The relevant test was: f(X) -> Y = X / 2, Y == 0. and hipe erroneously evaluated the calls f(0) and f(0.0) to 'false'. The culprit was in the simplification code of the Icode range analysis which used an erroneous test (lists:any/1 instead of lists:all/1). --- lib/hipe/icode/hipe_icode_range.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl index 91f6fb47f3..cdd5f7ace5 100644 --- a/lib/hipe/icode/hipe_icode_range.erl +++ b/lib/hipe/icode/hipe_icode_range.erl @@ -641,7 +641,7 @@ analyse_sane_if(If, Info, [Arg1, Arg2], [Range1, Range2], Rewrite) -> end, %% io:format("TR1 = ~w\nTR2 = ~w\n", [TrueRange1, TrueRange2]), True = - case lists:any(fun range__is_none/1, [TrueRange1, TrueRange2]) of + case lists:all(fun range__is_none/1, [TrueRange1, TrueRange2]) of true -> []; false -> TrueLabel = hipe_icode:if_true_label(If), @@ -651,7 +651,7 @@ analyse_sane_if(If, Info, [Arg1, Arg2], [Range1, Range2], Rewrite) -> end, %% io:format("FR1 = ~w\nFR2 = ~w\n", [FalseRange1, FalseRange2]), False = - case lists:any(fun range__is_none/1, [FalseRange1, FalseRange2]) of + case lists:all(fun range__is_none/1, [FalseRange1, FalseRange2]) of true -> []; false -> FalseLabel = hipe_icode:if_false_label(If), -- cgit v1.2.3 From cc526d2b1f22d67ddd5f6fb49fee0d5cd94761cd Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Wed, 2 Feb 2011 16:48:44 +0200 Subject: Cleanup specs --- lib/hipe/icode/hipe_icode_range.erl | 152 ++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 75 deletions(-) diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl index cdd5f7ace5..c222e8a5d5 100644 --- a/lib/hipe/icode/hipe_icode_range.erl +++ b/lib/hipe/icode/hipe_icode_range.erl @@ -59,15 +59,17 @@ -record(range, {range :: range_rep(), other :: boolean()}). +-type range() :: #range{}. --record(ann, {range :: #range{}, +-record(ann, {range :: range(), type :: erl_types:erl_type(), count :: integer()}). +-type ann() :: #ann{}. --type range_anno() :: {range_anno, #ann{}, fun((#ann{}) -> string())}. --type args_fun() :: fun((mfa(),cfg()) -> [#range{}]). --type call_fun() :: fun((mfa(),[#range{}]) -> #range{}). --type final_fun() :: fun((mfa(),[#range{}]) -> ok). +-type range_anno() :: {'range_anno', ann(), fun((ann()) -> string())}. +-type args_fun() :: fun((mfa(), cfg()) -> [range()]). +-type call_fun() :: fun((mfa(), [range()]) -> range()). +-type final_fun() :: fun((mfa(), [range()]) -> 'ok'). -type data() :: {mfa(), args_fun(), call_fun(), final_fun()}. -type label() :: non_neg_integer(). -type info() :: gb_tree(). @@ -75,15 +77,15 @@ -type variable() :: #icode_variable{}. -type annotated_variable() :: #icode_variable{}. -type argument() :: #icode_const{} | variable(). --type three_range_fun() :: fun((#range{},#range{},#range{}) -> #range{}). +-type three_range_fun() :: fun((range(),range(),range()) -> range()). -type instr_split_info() :: {icode_instr(), [{label(),info()}]}. --type last_instr_return() :: {instr_split_info(), #range{}}. +-type last_instr_return() :: {instr_split_info(), range()}. -record(state, {info_map = gb_trees:empty() :: info(), counter = dict:new() :: dict(), cfg :: cfg(), liveness = gb_trees:empty() :: gb_tree(), - ret_type :: #range{}, + ret_type :: range(), lookup_fun :: call_fun(), result_action :: final_fun()}). @@ -227,7 +229,7 @@ analyse_block(Label, Info, State, Rewrite) -> state__update_info(State2, InfoList, Rewrite). -spec analyse_BB([icode_instr()], info(), [icode_instr()], boolean(), call_fun()) -> - {[icode_instr()], [{label(),info()}], #range{}}. + {[icode_instr()], [{label(),info()}], range()}. analyse_BB([Last], Info, Code, Rewrite, LookupFun) -> {{NewI, LabelInfoList}, RetType} = @@ -268,7 +270,7 @@ handle_args(I, Info, WidenFun) -> NewUses = lists:zipwith(JoinFun, Uses, PresentRanges), hipe_icode:subst_uses(lists:zip(Uses, NewUses), I). --spec join_info(#ann{}, #range{}, three_range_fun()) -> #ann{}. +-spec join_info(ann(), range(), three_range_fun()) -> ann(). join_info(Ann = #ann{range = R1, type = Type, count = ?WIDEN}, R2, Fun) -> Ann#ann{range = Fun(R1, R2, range_from_simple_type(Type))}; @@ -278,17 +280,17 @@ join_info(Ann = #ann{range = R1, type = Type, count = C}, R2, _Fun) when C < ?WI NewR -> Ann#ann{range = NewR, count = C+1} end. --spec join_three(#range{}, #range{}, #range{}) -> #range{}. +-spec join_three(range(), range(), range()) -> range(). join_three(R1, R2, R3) -> inf(sup(R1, R2), R3). --spec update_info(variable(), #range{}) -> annotated_variable(). +-spec update_info(variable(), range()) -> annotated_variable(). update_info(Var, Range) -> update_info(Var, Range, fun update_three/3). --spec update_info(variable(), #range{}, three_range_fun()) -> annotated_variable(). +-spec update_info(variable(), range(), three_range_fun()) -> annotated_variable(). update_info(Arg, R, Fun) -> case hipe_icode:is_annotated_variable(Arg) of @@ -299,7 +301,7 @@ update_info(Arg, R, Fun) -> Arg end. --spec update_info1(any(), #range{}, three_range_fun()) -> range_anno(). +-spec update_info1(any(), range(), three_range_fun()) -> range_anno(). update_info1({range_anno, Ann, _}, R2, Fun) -> make_range_anno(update_ann(Ann,R2,Fun)); @@ -314,22 +316,22 @@ update_ann(Ann = #ann{range = R1, type = Type, count = C}, R2, _Fun) -> NewR -> Ann#ann{range = NewR, count = C+1} end. --spec type_to_ann(erl_types:erl_type()) -> #ann{}. +-spec type_to_ann(erl_types:erl_type()) -> ann(). type_to_ann(Type) -> #ann{range = range_from_simple_type(Type), type = t_limit(Type,1), count = 1}. --spec make_range_anno(#ann{}) -> range_anno(). +-spec make_range_anno(ann()) -> range_anno(). make_range_anno(Ann) -> {range_anno, Ann, fun pp_ann/1}. --spec update_three(#range{}, #range{}, #range{}) -> #range{}. +-spec update_three(range(), range(), range()) -> range(). update_three(_R1, R2, R3) -> inf(R2, R3). --spec safe_widen(#range{}, #range{}, #range{}) -> #range{}. +-spec safe_widen(range(), range(), range()) -> range(). safe_widen(#range{range=Old}, #range{range=New}, T = #range{range=Wide}) -> ResRange = @@ -361,7 +363,7 @@ safe_widen(#range{range=Old}, #range{range=New}, T = #range{range=Wide}) -> end, T#range{range = ResRange}. --spec widen(#range{}, #range{}, #range{}) -> #range{}. +-spec widen(range(), range(), range()) -> range(). widen(#range{range=Old}, #range{range=New}, T = #range{range=Wide}) -> ResRange = @@ -494,14 +496,14 @@ analyse_switch_val(Switch, Info, Rewrite) -> end end. --spec update_infos(argument(), info(), [{#range{},label()}]) -> [{label(),info()}]. +-spec update_infos(argument(), info(), [{range(),label()}]) -> [{label(),info()}]. update_infos(Arg, Info, [{Range, Label}|Rest]) -> [{Label,enter_define({Arg,Range},Info)} | update_infos(Arg, Info, Rest)]; update_infos(_, _, []) -> []. --spec get_range_label_list([{argument(),label()}], #range{}, [{#range{},label()}]) -> - {#range{},[{#range{},label()}]}. +-spec get_range_label_list([{argument(),label()}], range(), [{range(),label()}]) -> + {range(),[{range(),label()}]}. get_range_label_list([{Val,Label}|Cases], SRange, Acc) -> VRange = get_range_from_arg(Val), @@ -516,7 +518,7 @@ get_range_label_list([], SRange, Acc) -> {PointTypes, _} = lists:unzip(Acc), {remove_point_types(SRange, PointTypes), Acc}. --spec update_switch(#icode_switch_val{}, [{#range{},label()}], boolean()) -> +-spec update_switch(#icode_switch_val{}, [{range(),label()}], boolean()) -> #icode_switch_val{}. update_switch(Switch, LabelRangeList, KeepFail) -> @@ -531,7 +533,7 @@ update_switch(Switch, LabelRangeList, KeepFail) -> true -> S2 end. --spec label_range_list_to_cases([{#range{},label()}], [{#icode_const{},label()}]) -> +-spec label_range_list_to_cases([{range(),label()}], [{#icode_const{},label()}]) -> 'no_update' | [{#icode_const{},label()}]. label_range_list_to_cases([{#range{range={C,C},other=false},Label}|Rest], @@ -605,7 +607,7 @@ analyse_if(If, Info, Rewrite) -> end. -spec analyse_sane_if(#icode_if{}, info(), [argument(),...], - [#range{},...], boolean()) -> + [range(),...], boolean()) -> {#icode_goto{} | #icode_if{}, [{label(), info()}]}. analyse_sane_if(If, Info, [Arg1, Arg2], [Range1, Range2], Rewrite) -> @@ -688,8 +690,8 @@ normalize_name(Name) -> Name -> Name end. --spec range_equality_propagation(#range{}, #range{}) -> - {#range{}, #range{}, #range{}, #range{}}. +-spec range_equality_propagation(range(), range()) -> + {range(), range(), range(), range()}. range_equality_propagation(Range_1, Range_2) -> True_range = inf(Range_1, Range_2), @@ -712,8 +714,8 @@ range_equality_propagation(Range_1, Range_2) -> end, {True_range, True_range, False_range_1, False_range_2}. --spec range_inequality_propagation(#range{}, #range{}) -> - {#range{}, #range{}, #range{}, #range{}}. +-spec range_inequality_propagation(range(), range()) -> + {range(), range(), range(), range()}. %% Range1 < Range2 range_inequality_propagation(Range1, Range2) -> @@ -816,7 +818,7 @@ analyse_type(Type, Info, Rewrite) -> end, {NewType, True ++ False}. --spec compare_with_integer(integer(), #range{}) -> {#range{}, #range{}}. +-spec compare_with_integer(integer(), range()) -> {range(), range()}. compare_with_integer(N, OldVarRange) -> TestRange = range_init({N, N}, false), @@ -843,7 +845,7 @@ compare_with_integer(N, OldVarRange) -> %%== Ranges ================================================================== --spec pp_ann(#ann{} | erl_types:erl_type()) -> string(). +-spec pp_ann(ann() | erl_types:erl_type()) -> string(). pp_ann(#ann{range = #range{range = R, other = false}}) -> pp_range(R); @@ -867,12 +869,12 @@ val_to_string(pos_inf) -> "inf"; val_to_string(neg_inf) -> "-inf"; val_to_string(X) when is_integer(X) -> integer_to_list(X). --spec range_from_type(erl_types:erl_type()) -> [#range{}]. +-spec range_from_type(erl_types:erl_type()) -> [range()]. range_from_type(Type) -> [range_from_simple_type(T) || T <- t_to_tlist(Type)]. --spec range_from_simple_type(erl_types:erl_type()) -> #range{}. +-spec range_from_simple_type(erl_types:erl_type()) -> range(). range_from_simple_type(Type) -> None = t_none(), @@ -887,7 +889,7 @@ range_from_simple_type(Type) -> #range{range = Range, other = true} end. --spec range_init(range_rep(), boolean()) -> #range{}. +-spec range_init(range_rep(), boolean()) -> range(). range_init({Min, Max} = Range, Other) -> case inf_geq(Max, Min) of @@ -899,39 +901,39 @@ range_init({Min, Max} = Range, Other) -> range_init(empty, Other) -> #range{range = empty, other = Other}. --spec range(#range{}) -> range_rep(). +-spec range(range()) -> range_rep(). range(#range{range = R}) -> R. --spec other(#range{}) -> boolean(). +-spec other(range()) -> boolean(). other(#range{other = O}) -> O. --spec set_other(#range{}, boolean()) -> #range{}. +-spec set_other(range(), boolean()) -> range(). set_other(R, O) -> R#range{other = O}. --spec range__min(#range{}) -> 'empty' | 'neg_inf' | integer(). +-spec range__min(range()) -> 'empty' | 'neg_inf' | integer(). range__min(#range{range = empty}) -> empty; range__min(#range{range = {Min,_}}) -> Min. --spec range__max(#range{}) -> 'empty' | 'pos_inf' | integer(). +-spec range__max(range()) -> 'empty' | 'pos_inf' | integer(). range__max(#range{range = empty}) -> empty; range__max(#range{range = {_,Max}}) -> Max. --spec range__is_none(#range{}) -> boolean(). +-spec range__is_none(range()) -> boolean(). range__is_none(#range{range = empty, other = false}) -> true; range__is_none(#range{}) -> false. --spec range__is_empty(#range{}) -> boolean(). +-spec range__is_empty(range()) -> boolean(). range__is_empty(#range{range = empty}) -> true; range__is_empty(#range{range = {_,_}}) -> false. --spec remove_point_types(#range{}, [#range{}]) -> #range{}. +-spec remove_point_types(range(), [range()]) -> range(). remove_point_types(Range, Ranges) -> Sorted = lists:sort(Ranges), @@ -939,7 +941,7 @@ remove_point_types(Range, Ranges) -> Range1 = lists:foldl(FoldFun, Range, Sorted), lists:foldl(FoldFun, Range1, lists:reverse(Sorted)). --spec range__remove_constant(#range{}, #range{}) -> #range{}. +-spec range__remove_constant(range(), range()) -> range(). range__remove_constant(#range{range = {C, C}} = R, #range{range = {C, C}}) -> R#range{range = empty}; @@ -952,22 +954,22 @@ range__remove_constant(#range{} = R, #range{range = {C,C}}) -> range__remove_constant(#range{} = R, _) -> R. --spec any_type() -> #range{}. +-spec any_type() -> range(). any_type() -> #range{range = any_r(), other = true}. --spec any_range() -> #range{}. +-spec any_range() -> range(). any_range() -> #range{range = any_r(), other = false}. --spec none_range() -> #range{}. +-spec none_range() -> range(). none_range() -> #range{range = empty, other = true}. --spec none_type() -> #range{}. +-spec none_type() -> range(). none_type() -> #range{range = empty, other = false}. @@ -976,12 +978,12 @@ none_type() -> any_r() -> {neg_inf, pos_inf}. --spec get_range_from_args([argument()]) -> [#range{}]. +-spec get_range_from_args([argument()]) -> [range()]. get_range_from_args(Args) -> [get_range_from_arg(Arg) || Arg <- Args]. --spec get_range_from_arg(argument()) -> #range{}. +-spec get_range_from_arg(argument()) -> range(). get_range_from_arg(Arg) -> case hipe_icode:is_const(Arg) of @@ -1012,7 +1014,7 @@ get_range_from_arg(Arg) -> %% inf([R1,R2|Rest]) -> %% inf([inf(R1,R2)|Rest]). --spec inf(#range{}, #range{}) -> #range{}. +-spec inf(range(), range()) -> range(). inf(#range{range=R1, other=O1}, #range{range=R2, other=O2}) -> #range{range=range_inf(R1,R2), other=other_inf(O1,O2)}. @@ -1035,14 +1037,14 @@ range_inf({Min1,Max1}, {Min2,Max2}) -> other_inf(O1, O2) -> O1 and O2. --spec sup([#range{},...]) -> #range{}. +-spec sup([range(),...]) -> range(). sup([R]) -> R; sup([R1,R2|Rest]) -> sup([sup(R1, R2)|Rest]). --spec sup(#range{}, #range{}) -> #range{}. +-spec sup(range(), range()) -> range(). sup(#range{range=R1,other=O1}, #range{range=R2,other=O2}) -> #range{range=range_sup(R1,R2), other=other_sup(O1,O2)}. @@ -1063,7 +1065,7 @@ other_sup(O1, O2) -> O1 or O2. %%== Call Support ============================================================= -spec analyse_call_or_enter_fun(fun_name(), [argument()], - icode_call_type(), call_fun()) -> [#range{}]. + icode_call_type(), call_fun()) -> [range()]. analyse_call_or_enter_fun(Fun, Args, CallType, LookupFun) -> %%io:format("Fun: ~p~n Args: ~p~n CT: ~p~n LF: ~p~n", [Fun, Args, CallType, LookupFun]), @@ -1111,8 +1113,8 @@ analyse_call_or_enter_fun(Fun, Args, CallType, LookupFun) -> range_from_type(Type) end. --type bin_operation() :: fun((#range{},#range{}) -> #range{}). --type unary_operation() :: fun((#range{}) -> #range{}). +-type bin_operation() :: fun((range(), range()) -> range()). +-type unary_operation() :: fun((range()) -> range()). -spec basic_type(fun_name()) -> 'not_int' | 'not_analysed' | {'bin', bin_operation()} @@ -1214,7 +1216,7 @@ analyse_bs_get_integer(Size, Flags, false) when is_integer(Size), %% Arithmetic --spec range_add(#range{}, #range{}) -> #range{}. +-spec range_add(range(), range()) -> range(). range_add(Range1, Range2) -> NewMin = inf_add(range__min(Range1), range__min(Range2)), @@ -1222,7 +1224,7 @@ range_add(Range1, Range2) -> Other = other(Range1) orelse other(Range2), range_init({NewMin, NewMax}, Other). --spec range_sub(#range{}, #range{}) -> #range{}. +-spec range_sub(range(), range()) -> range(). range_sub(Range1, Range2) -> Min_sub = inf_min([inf_inv(range__max(Range2)), @@ -1234,7 +1236,7 @@ range_sub(Range1, Range2) -> Other = other(Range1) orelse other(Range2), range_init({NewMin, NewMax}, Other). --spec range_mult(#range{}, #range{}) -> #range{}. +-spec range_mult(range(), range()) -> range(). range_mult(#range{range=empty, other=true}, _Range2) -> range_init(empty, true); @@ -1274,7 +1276,7 @@ range_mult(Range1, Range2) -> Other = other(Range1) orelse other(Range2), range_init(Range, Other). --spec extreme_divisors(#range{}) -> range_tuple(). +-spec extreme_divisors(range()) -> range_tuple(). extreme_divisors(#range{range={0,0}}) -> {0,0}; extreme_divisors(#range{range={0,Max}}) -> {1,Max}; @@ -1289,7 +1291,7 @@ extreme_divisors(#range{range={Min,Max}}) -> end end. --spec range_div(#range{}, #range{}) -> #range{}. +-spec range_div(range(), range()) -> range(). %% this is div, not /. range_div(_, #range{range={0,0}}) -> @@ -1306,7 +1308,7 @@ range_div(Range1, Den) -> inf_div(Max1, Min2), inf_div(Max1, Max2)], range_init({inf_min(Min_max_list), inf_max(Min_max_list)}, false). --spec range_rem(#range{}, #range{}) -> #range{}. +-spec range_rem(range(), range()) -> range(). range_rem(Range1, Range2) -> %% Range1 desides the sign of the answer. @@ -1332,7 +1334,7 @@ range_rem(Range1, Range2) -> %%--- Bit operations ---------------------------- --spec range_bsr(#range{}, #range{}) -> #range{}. +-spec range_bsr(range(), range()) -> range(). range_bsr(Range1, Range2=#range{range={Min, Max}}) -> New_Range2 = range_init({inf_inv(Max), inf_inv(Min)}, other(Range2)), @@ -1340,7 +1342,7 @@ range_bsr(Range1, Range2=#range{range={Min, Max}}) -> %% io:format("bsr res:~w~nInput:= ~w~n", [Ans, {Range1,Range2}]), Ans. --spec range_bsl(#range{}, #range{}) -> #range{}. +-spec range_bsl(range(), range()) -> range(). range_bsl(Range1, Range2) -> Min1 = range__min(Range1), @@ -1359,7 +1361,7 @@ range_bsl(Range1, Range2) -> end, range_init(MinMax, false). --spec range_bnot(#range{}) -> #range{}. +-spec range_bnot(range()) -> range(). range_bnot(Range) -> Minus_one = range_init({-1,-1}, false), @@ -1389,7 +1391,7 @@ negwidth(X, N) -> false -> negwidth(X, N+1) end. --spec range_band(#range{}, #range{}) -> #range{}. +-spec range_band(range(), range()) -> range(). range_band(R1, R2) -> {_Min1, Max1} = MM1 = range(R1), @@ -1423,7 +1425,7 @@ range_band(R1, R2) -> end, range_init(Range, false). --spec range_bor(#range{}, #range{}) -> #range{}. +-spec range_bor(range(), range()) -> range(). range_bor(R1, R2) -> {Min1, _Max1} = MM1 = range(R1), @@ -1457,7 +1459,7 @@ range_bor(R1, R2) -> end, range_init(Range, false). --spec classify_range(#range{}) -> 'minus_minus' | 'minus_plus' | 'plus_plus'. +-spec classify_range(range()) -> 'minus_minus' | 'minus_plus' | 'plus_plus'. classify_range(Range) -> case range(Range) of @@ -1480,7 +1482,7 @@ classify_int_range(_Number1, Number2) when Number2 < 0 -> classify_int_range(_Number1, _Number2) -> minus_plus. --spec range_bxor(#range{}, #range{}) -> #range{}. +-spec range_bxor(range(), range()) -> range(). range_bxor(R1, R2) -> {Min1, Max1} = MM1 = range(R1), @@ -1895,7 +1897,7 @@ convert_ann_to_types(#ann{range=#range{other=true}, type=Type}) -> %% Icode Coordinator Callbacks %%===================================================================== --spec replace_nones([#range{}]) -> [#range{}]. +-spec replace_nones([range()]) -> [range()]. replace_nones(Args) -> [replace_none(Arg) || Arg <- Args]. @@ -1905,7 +1907,7 @@ replace_none(Arg) -> false -> Arg end. --spec update__info([#range{}], [#range{}]) -> {boolean(), [#ann{}]}. +-spec update__info([range()], [range()]) -> {boolean(), [ann()]}. update__info(NewRanges, OldRanges) -> SupFun = fun (Ann, Range) -> join_info(Ann, Range, fun safe_widen/3) @@ -1915,19 +1917,19 @@ update__info(NewRanges, OldRanges) -> Change = lists:zipwith(EqFun, ResRanges, OldRanges), {lists:all(fun (X) -> X end, Change), ResRanges}. --spec new__info/1 :: ([#range{}]) -> [#ann{}]. +-spec new__info([range()]) -> [ann()]. new__info(NewRanges) -> [#ann{range=Range,count=1,type=t_any()} || Range <- NewRanges]. --spec return__info/1 :: ([#ann{}]) -> [#range{}]. +-spec return__info([ann()]) -> [range()]. return__info(Ranges) -> [Range || #ann{range=Range} <- Ranges]. --spec return_none/0 :: () -> [#range{},...]. +-spec return_none() -> [range(),...]. return_none() -> [none_type()]. --spec return_none_args/2 :: (#cfg{}, mfa()) -> [#range{}]. +-spec return_none_args(cfg(), mfa()) -> [range()]. return_none_args(Cfg, {_M,_F,A}) -> NoArgs = case hipe_icode_cfg:is_closure(Cfg) of @@ -1936,7 +1938,7 @@ return_none_args(Cfg, {_M,_F,A}) -> end, lists:duplicate(NoArgs, none_type()). --spec return_any_args/2 :: (#cfg{}, mfa()) -> [#range{}]. +-spec return_any_args(cfg(), mfa()) -> [range()]. return_any_args(Cfg, {_M,_F,A}) -> NoArgs = case hipe_icode_cfg:is_closure(Cfg) of -- cgit v1.2.3 From 5ee6233265d6d8e6a3d2e079908dd9f12235fe70 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Tue, 15 Feb 2011 12:46:53 +0100 Subject: Updated light weight tests. --- lib/orber/test/multi_ORB_SUITE.erl | 4 ++-- lib/orber/test/orber_test_lib.erl | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/orber/test/multi_ORB_SUITE.erl b/lib/orber/test/multi_ORB_SUITE.erl index d1931f5393..810e09836f 100644 --- a/lib/orber/test/multi_ORB_SUITE.erl +++ b/lib/orber/test/multi_ORB_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -1372,7 +1372,7 @@ light_orber2_api(_Config) -> LocalHost = net_adm:localhost(), {ok, Node, _Host} = ?match({ok,_,_}, orber_test_lib:js_node([], - {lightweigth, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]})), + {lightweight, ["iiop://"++LocalHost++":"++integer_to_list(orber:iiop_port())]})), ?match(ok, orber:info(io)), ?match([_], orber_test_lib:remote_apply(Node, orber_env, get_lightweight_nodes,[])), diff --git a/lib/orber/test/orber_test_lib.erl b/lib/orber/test/orber_test_lib.erl index b95cf4b0ec..e22e3bdb0a 100644 --- a/lib/orber/test/orber_test_lib.erl +++ b/lib/orber/test/orber_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -287,9 +287,11 @@ start_ssl(true, Node) -> start_ssl(_, _) -> ok. -start_orber({lightweigth, Options}, Node) -> +start_orber({lightweight, Options}, Node) -> + ok = rpc:call(Node, mnesia, start, []), ok = rpc:call(Node, orber, start_lightweight, [Options]); start_orber(lightweight, Node) -> + ok = rpc:call(Node, mnesia, start, []), ok = rpc:call(Node, orber, start_lightweight, []); start_orber(_, Node) -> ok = rpc:call(Node, orber, jump_start, []). -- cgit v1.2.3 From cd8c12a5c1e7ecb4bef85f23629bd1efe6a5968a Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 17 Feb 2011 10:33:14 +0100 Subject: Removed spec:s that wasn't needed. --- lib/orber/src/corba.erl | 4 ++-- lib/orber/src/orber.erl | 24 +++++++++++------------- lib/orber/src/orber_socket.erl | 12 ++---------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/lib/orber/src/corba.erl b/lib/orber/src/corba.erl index f4a17c10e9..ecec768544 100644 --- a/lib/orber/src/corba.erl +++ b/lib/orber/src/corba.erl @@ -621,7 +621,7 @@ get_pid(Objkey) -> %% Description: %%---------------------------------------------------------------------- %% To avoid dialyzer warnings due to the use of exit/throw. --spec(raise/1 :: (_) -> no_return()). +-spec raise(term()) -> no_return(). raise(E) -> throw({'EXCEPTION', E}). @@ -632,7 +632,7 @@ raise(E) -> %% Description: %%---------------------------------------------------------------------- %% To avoid dialyzer warnings due to the use of exit/throw. --spec(raise_with_state/2 :: (_, _) -> no_return()). +-spec raise_with_state(term(), term()) -> no_return(). raise_with_state(E, State) -> throw({reply, {'EXCEPTION', E}, State}). diff --git a/lib/orber/src/orber.erl b/lib/orber/src/orber.erl index f0820811f5..665b3cb383 100644 --- a/lib/orber/src/orber.erl +++ b/lib/orber/src/orber.erl @@ -95,13 +95,7 @@ -define(DEBUG_LEVEL, 5). -define(FORMAT(_F, _A), lists:flatten(io_lib:format(_F, _A))). --define(EFORMAT(_F, _A), do_exit(lists:flatten(io_lib:format(_F, _A)))). - - -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(do_exit/1 :: (_) -> no_return()). -do_exit(Reason) -> - exit(Reason). +-define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). %%----------------------------------------------------------------- @@ -1033,12 +1027,18 @@ remove_node(Node) when is_atom(Node) -> remove_tables(Tables, Node) -> - remove_tables(Tables, Node, []). + case remove_tables(Tables, Node, []) of + ok -> + ok; + {error, Node, Failed} -> + ?EFORMAT("orber:remove_node(~p) failed. Unable to remove table(s): ~p", + [Node, Failed]) + end. -remove_tables([], _, []) -> ok; +remove_tables([], _, []) -> + ok; remove_tables([], Node, Failed) -> - ?EFORMAT("orber:remove_node(~p) failed. Unable to remove table(s): ~p", - [Node, Failed]); + {error, Node, Failed}; remove_tables([T1|Trest], Node, Failed) -> case mnesia:del_table_copy(T1, Node) of {atomic, ok} -> @@ -1047,8 +1047,6 @@ remove_tables([T1|Trest], Node, Failed) -> remove_tables(Trest, Node, [{T1, Reason}|Failed]) end. - - %%----------------------------------------------------------------- %% Internal interface functions %%----------------------------------------------------------------- diff --git a/lib/orber/src/orber_socket.erl b/lib/orber/src/orber_socket.erl index 84ed193ebb..ec2cf8f42a 100644 --- a/lib/orber/src/orber_socket.erl +++ b/lib/orber/src/orber_socket.erl @@ -2,7 +2,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 @@ -37,7 +37,7 @@ %%----------------------------------------------------------------- -export([start/0, connect/4, listen/3, listen/4, accept/2, accept/3, write/3, controlling_process/3, close/2, peername/2, sockname/2, - peerdata/2, peercert/2, peercert/3, sockdata/2, setopts/3, + peerdata/2, peercert/2, sockdata/2, setopts/3, clear/2, shutdown/3, post_accept/2, post_accept/3]). %%----------------------------------------------------------------- @@ -366,14 +366,6 @@ peercert(Type, _Socket) -> [?LINE, Type], ?DEBUG_LEVEL), {error, ebadsocket}. -peercert(ssl, Socket, Opts) -> - ssl:peercert(Socket, Opts); -peercert(Type, _Socket, Opts) -> - orber:dbg("[~p] orber_socket:peercert(~p, ~p);~n" - "Only available for SSL sockets.", - [?LINE, Type, Opts], ?DEBUG_LEVEL), - {error, ebadsocket}. - %%----------------------------------------------------------------- %% Get peerdata %% -- cgit v1.2.3 From f5a6e678c9044896782230368ff8de266bfd9415 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 17 Feb 2011 12:28:17 +0100 Subject: Removed more spec:s that wasn't needed. --- lib/cosEvent/src/cosEventApp.erl | 44 ++++++++++++++++++-------------- lib/cosTime/src/cosTime.erl | 54 +++++++++++++++++++++++++--------------- lib/orber/test/csiv2_SUITE.erl | 10 ++++---- 3 files changed, 65 insertions(+), 43 deletions(-) diff --git a/lib/cosEvent/src/cosEventApp.erl b/lib/cosEvent/src/cosEventApp.erl index 373e2d170b..143c241448 100644 --- a/lib/cosEvent/src/cosEventApp.erl +++ b/lib/cosEvent/src/cosEventApp.erl @@ -66,26 +66,31 @@ %% Effect : Install necessary data in the IFR DB %%------------------------------------------------------------ install() -> - install_loop(?IDL_MODULES, []). + case install_loop(?IDL_MODULES, []) of + ok -> + ok; + {error, Reason} -> + exit(Reason) + end. install_loop([], _) -> ok; install_loop([H|T], Accum) -> case catch H:'oe_register'() of {'EXIT',{unregistered,App}} -> - ?write_ErrorMsg("Unable to register '~p'; application ~p not registered. -Trying to unregister ~p~n", [H,App,Accum]), + ?write_ErrorMsg("Unable to register '~p'; application ~p not registered.\n" + "Trying to unregister ~p~n", [H,App,Accum]), uninstall_loop(Accum, {exit, register}); {'EXCEPTION',_} -> - ?write_ErrorMsg("Unable to register '~p'; propably already registered. -You are adviced to confirm this. -Trying to unregister ~p~n", [H,Accum]), + ?write_ErrorMsg("Unable to register '~p'; propably already registered.\n" + "You are adviced to confirm this.\n" + "Trying to unregister ~p~n", [H,Accum]), uninstall_loop(Accum, {exit, register}); ok -> install_loop(T, [H|Accum]); _ -> - ?write_ErrorMsg("Unable to register '~p'; reason unknown. -Trying to unregister ~p~n", [H,Accum]), + ?write_ErrorMsg("Unable to register '~p'; reason unknown.\n" + "Trying to unregister ~p~n", [H,Accum]), uninstall_loop(Accum, {exit, register}) end. @@ -96,29 +101,32 @@ Trying to unregister ~p~n", [H,Accum]), %% Effect : Remove data related to cosEvent from the IFR DB %%------------------------------------------------------------ uninstall() -> - uninstall_loop(lists:reverse(?IDL_MODULES), ok). + case uninstall_loop(lists:reverse(?IDL_MODULES), ok) of + ok -> + ok; + {error, Reason} -> + exit(Reason) + end. -%% To avoid dialyzer warnings due to the use of exit(..). --spec(uninstall_loop/2 :: (_, _) -> no_return()). uninstall_loop([],ok) -> ok; uninstall_loop([],{exit, register}) -> - exit({?MODULE, "oe_register failed"}); + {error, {?MODULE, "oe_register failed"}}; uninstall_loop([],{exit, unregister}) -> - exit({?MODULE, "oe_unregister failed"}); + {error, {?MODULE, "oe_unregister failed"}}; uninstall_loop([],{exit, both}) -> - exit({?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}); + {error, {?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}}; uninstall_loop([H|T], Status) -> case catch H:'oe_unregister'() of ok -> uninstall_loop(T, Status); _ when Status == ok -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered. -You are adviced to confirm this.~n",[H]), + ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" + "You are adviced to confirm this.\n",[H]), uninstall_loop(T, {exit, unregister}); _ -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered. -You are adviced to confirm this.~n",[H]), + ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" + "You are adviced to confirm this.\n",[H]), uninstall_loop(T, {exit, both}) end. diff --git a/lib/cosTime/src/cosTime.erl b/lib/cosTime/src/cosTime.erl index b02cb72509..f7d03650af 100644 --- a/lib/cosTime/src/cosTime.erl +++ b/lib/cosTime/src/cosTime.erl @@ -71,29 +71,39 @@ %%------------------------------------------------------------ install_time() -> - install_loop(?IDL_TIME_MODULES,[]). + case install_loop(?IDL_TIME_MODULES,[]) of + ok -> + ok; + {error, Reason} -> + exit(Reason) + end. install_timerevent() -> - install_loop(?IDL_TIMEREVENT_MODULES,[]). + case install_loop(?IDL_TIMEREVENT_MODULES,[]) of + ok -> + ok; + {error, Reason} -> + exit(Reason) + end. install_loop([], _) -> ok; install_loop([H|T], Accum) -> case catch H:'oe_register'() of {'EXIT',{unregistered,App}} -> - ?write_ErrorMsg("Unable to register '~p'; application ~p not registered. -Trying to unregister ~p~n", [H,App,Accum]), + ?write_ErrorMsg("Unable to register '~p'; application ~p not registered.\n" + "Trying to unregister ~p\n", [H,App,Accum]), uninstall_loop(Accum, {exit, register}); {'EXCEPTION',_} -> - ?write_ErrorMsg("Unable to register '~p'; propably already registered. -You are adviced to confirm this. -Trying to unregister ~p~n", [H,Accum]), + ?write_ErrorMsg("Unable to register '~p'; propably already registered.\n" + "You are adviced to confirm this.\n" + "Trying to unregister ~p\n", [H,Accum]), uninstall_loop(Accum, {exit, register}); ok -> install_loop(T, [H|Accum]); _ -> - ?write_ErrorMsg("Unable to register '~p'; reason unknown. -Trying to unregister ~p~n", [H,Accum]), + ?write_ErrorMsg("Unable to register '~p'; reason unknown.\n" + "Trying to unregister ~p\n", [H,Accum]), uninstall_loop(Accum, {exit, register}) end. @@ -105,19 +115,29 @@ Trying to unregister ~p~n", [H,Accum]), %%------------------------------------------------------------ uninstall_time() -> - uninstall_loop(lists:reverse(?IDL_TIME_MODULES),ok). + case uninstall_loop(lists:reverse(?IDL_TIME_MODULES),ok) of + ok -> + ok; + {error, Reason} -> + exit(Reason) + end. uninstall_timerevent() -> - uninstall_loop(lists:reverse(?IDL_TIMEREVENT_MODULES),ok). + case uninstall_loop(lists:reverse(?IDL_TIMEREVENT_MODULES),ok) of + ok -> + ok; + {error, Reason} -> + exit(Reason) + end. uninstall_loop([],ok) -> ok; uninstall_loop([],{exit, register}) -> - do_exit({?MODULE, "oe_register failed"}); + {error, {?MODULE, "oe_register failed"}}; uninstall_loop([],{exit, unregister}) -> - do_exit({?MODULE, "oe_unregister failed"}); + {error, {?MODULE, "oe_unregister failed"}}; uninstall_loop([],{exit, both}) -> - do_exit({?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}); + {error, {?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}}; uninstall_loop([H|T], Status) -> case catch H:'oe_unregister'() of ok -> @@ -132,12 +152,6 @@ uninstall_loop([H|T], Status) -> uninstall_loop(T, {exit, both}) end. - -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(do_exit/1 :: (_) -> no_return()). -do_exit(Reason) -> - exit(Reason). - %%------------------------------------------------------------ %% function : start/stop %% Arguments: diff --git a/lib/orber/test/csiv2_SUITE.erl b/lib/orber/test/csiv2_SUITE.erl index 8103fd81ac..855c1b6b3f 100644 --- a/lib/orber/test/csiv2_SUITE.erl +++ b/lib/orber/test/csiv2_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -694,8 +694,8 @@ ssl_server_peercert_api(_Config) -> {ok, Socket} = ?match({ok, _}, fake_client_ORB(ssl, ServerHost, ServerPort, SSLOptions)), {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)), - ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), - ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), +%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), +%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), % ?match({ok, #'Certificate'{}}, % 'OrberCSIv2':decode('Certificate', PeerCert)), destroy_fake_ORB(ssl, Socket), @@ -734,8 +734,8 @@ ssl_client_peercert_api(_Config) -> ?match(ok, ssl:ssl_accept(Socket)), {ok, _PeerCert} = ?match({ok, _}, orber_socket:peercert(ssl, Socket)), - ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), - ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), +%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [pkix, subject])), +%% ?match({ok, {rdnSequence, _}}, orber_socket:peercert(ssl, Socket, [ssl, subject])), % ?match({ok, #'Certificate'{}}, % 'OrberCSIv2':decode('Certificate', PeerCert)), ssl:close(Socket), -- cgit v1.2.3 From cc147b3b7f9cde5a521d42e50bce8464597a4965 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 17 Feb 2011 14:09:39 +0100 Subject: More specs removed. --- .../src/CosEventDomainAdmin_EventDomain_impl.erl | 26 +++++++++++++--------- lib/cosEventDomain/src/cosEventDomainApp.erl | 13 ++++++----- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl index ddff0f8632..f5dd6d5c14 100644 --- a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl +++ b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl @@ -778,14 +778,17 @@ get_qos(_OE_This, #state{cyclic = Cyclic, diamonds = Diamonds} = State) -> %%---------------------------------------------------------------------- set_qos(_OE_This, State, NewQoS) -> QoS = cosEventDomainApp:get_qos(NewQoS), - set_qos_helper(QoS, State, []). + case set_qos_helper(QoS, State, []) of + {ok, NewState} -> + {reply, ok, NewState}; + {error, Errors} -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}) + end. -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(set_qos_helper/3 :: (_, _, _) -> no_return()). set_qos_helper([], State, []) -> - {reply, ok, State}; + {ok, State}; %{reply, ok, State}; set_qos_helper([], _, Errors) -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}); + {error, Errors}; set_qos_helper([{?DiamondDetection, Diamonds}|T], #state{diamonds = Diamonds} = State, Errors) -> set_qos_helper(T, State, Errors); @@ -830,14 +833,17 @@ set_qos_helper([{?CycleDetection, _}|T], #state{cyclic = Cyclic} = State, Errors %%---------------------------------------------------------------------- validate_qos(_OE_This, State, WantedQoS) -> QoS = cosEventDomainApp:get_qos(WantedQoS), - {reply, {ok, validate_qos_helper(QoS, State, [], [])}, State}. + case validate_qos_helper(QoS, State, [], []) of + {ok, Properties} -> + {reply, {ok, Properties}, State}; + {error, Errors} -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}) + end. -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(validate_qos_helper/4 :: (_, _, _, _) -> no_return()). validate_qos_helper([], _, Properties, []) -> - Properties; + {ok, Properties}; validate_qos_helper([], _, _, Errors) -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}); + {error, Errors}; validate_qos_helper([{?DiamondDetection, ?ForbidDiamonds}|T], State, Properties, Errors) -> case get_diamonds_helper(State, false) of diff --git a/lib/cosEventDomain/src/cosEventDomainApp.erl b/lib/cosEventDomain/src/cosEventDomainApp.erl index 3cb4055fba..734e4deccb 100644 --- a/lib/cosEventDomain/src/cosEventDomainApp.erl +++ b/lib/cosEventDomain/src/cosEventDomainApp.erl @@ -270,14 +270,17 @@ create_id() -> get_qos([]) -> []; get_qos(Properties) -> - get_qos(Properties, [], []). + case get_qos(Properties, [], []) of + {ok, Supported} -> + Supported; + {error, Unsupported} -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupported}) + end. -%% To avoid dialyzer warnings due to the use of exit/throw. --spec(get_qos/3 :: (_, _, _) -> no_return()). get_qos([], Supported, []) -> - Supported; + {ok, Supported}; get_qos([], _, Unsupported) -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupported}); + {error, Unsupported}; get_qos([#'CosNotification_Property'{name = ?CycleDetection, value= #any{value = ?AuthorizeCycles}}|T], Supported, Unsupported) -> -- cgit v1.2.3 From a31efb6b4f9581dcd3f52df68fe4704e052e9f20 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 17 Feb 2011 14:20:54 +0100 Subject: More specs removed. --- .../src/CosPropertyService_PropertySetDefFactory_impl.erl | 11 ++++++++--- .../src/CosPropertyService_PropertySetFactory_impl.erl | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl index 82bc00aa7f..202df42b61 100644 --- a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl +++ b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl @@ -152,13 +152,18 @@ create_initial_propertysetdef(_OE_This, State, PropDefs) -> %% Internal functions %%====================================================================== evaluate_propertysetdef(SetDefs) -> - evaluate_propertysetdef(SetDefs, [], []). + case evaluate_propertysetdef(SetDefs, [], []) of + {ok, NewProperties} -> + NewProperties; + {error, Exc} -> + corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}) + end. evaluate_propertysetdef([], NewProperties, []) -> %% No exceptions found. - NewProperties; + {ok, NewProperties}; evaluate_propertysetdef([], _, Exc) -> - corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}); + {error, Exc}; evaluate_propertysetdef([#'CosPropertyService_PropertyDef' {property_name = Name, property_value = Value, diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl index 1a8f83617a..4bc29b99ac 100644 --- a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl +++ b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl @@ -153,13 +153,18 @@ create_initial_propertyset(_OE_This, State, Properties) -> %% Internal functions %%====================================================================== evaluate_propertyset(Sets) -> - evaluate_propertyset(Sets, [], []). + case evaluate_propertyset(Sets, [], []) of + {ok, NewProperties} -> + NewProperties; + {error, Exc} -> + corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}) + end. evaluate_propertyset([], NewProperties, []) -> %% No exceptions found. - NewProperties; + {ok, NewProperties}; evaluate_propertyset([], _, Exc) -> - corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}); + {error, Exc}; evaluate_propertyset([#'CosPropertyService_Property' {property_name = Name, property_value = Value}|T], X, Exc) -> -- cgit v1.2.3 From ed66dca80af9f203b9e2ae26c334820586b37fa5 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 17 Feb 2011 15:51:05 +0100 Subject: More specs removed. --- lib/cosNotification/src/CosNotification_Common.erl | 44 ++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl index bcd241f3a8..d3607a5eed 100644 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ b/lib/cosNotification/src/CosNotification_Common.erl @@ -944,15 +944,19 @@ check_limits(LQS, NPR) -> %% supported. %%------------------------------------------------------------ validate_event_qos(Wanted, Curr) -> - v_e_q_helper(Wanted, Curr, []), - []. + case v_e_q_helper(Wanted, Curr, []) of + ok -> + []; + {error, Unsupp} -> + corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}) + end. v_e_q_helper([], _Curr, []) -> - %% Parsed all and foynd no conflicts. + %% Parsed all and found no conflicts. ok; v_e_q_helper([], _Curr, Unsupp) -> %% Not possible to use these requested QoS. - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}); + {error, Unsupp}; %%--- EventReliability ---%% v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability, @@ -1071,30 +1075,40 @@ v_e_q_helper(What, _, _) -> %% LQS - local representation of QoS. %% Returns : {NewOMGStyleQoS, NewLocalQoS} | #'CosNotification_UnsupportedQoS'{} %%------------------------------------------------------------ -set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> +set_properties(Wanted, Current, Type, Supported, Unsupp, NewQoS, Parent, Childs, LQS) -> + case do_set_properties(Wanted, Current, Type, Supported, Unsupp, NewQoS, Parent, Childs, LQS) of + {error, Exc} -> + corba:raise(Exc); + Result -> + Result + end. + +do_set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> merge_properties(NewQoS, Curr, LAS); -set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> +do_set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> %% set_local_qos and merge_properties are help functions found at the end of QoS %% functions. NewLQS = set_local_qos(NewQoS, LQS), merge_properties(NewQoS, Curr, NewLQS); -set_properties([], _, channelAdm, _, Unsupp, _,_,_,_) -> - corba:raise(#'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}); -set_properties([], _, _, _, Unsupp, _,_,_,_) -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}); +do_set_properties([], _, channelAdm, _, Unsupp, _,_,_,_) -> + {error, #'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}}; +% corba:raise(#'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}); +do_set_properties([], _, _, _, Unsupp, _,_,_,_) -> + {error, #'CosNotification_UnsupportedQoS'{qos_err = Unsupp}}; +%corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}); -set_properties([Req|Tail], Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) -> +do_set_properties([Req|Tail], Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) -> %% set_values and is_supported are help functions found at the end of QoS %% functions. case set_values(is_supported(Supported, Req), Req, Type, Curr, Parent, Childs,LQS) of {unsupported, U} -> - set_properties(Tail, Curr, Type, Supported, [U|Unsupp], NewQoS, Parent, Childs,LQS); + do_set_properties(Tail, Curr, Type, Supported, [U|Unsupp], NewQoS, Parent, Childs,LQS); {ok, S, NewLQS} -> - set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,NewLQS); + do_set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,NewLQS); {ok, S} -> - set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,LQS); + do_set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,LQS); ok -> - set_properties(Tail, Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) + do_set_properties(Tail, Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) end. -- cgit v1.2.3 From 4414036566181c45f592036a03a3b5898f725d95 Mon Sep 17 00:00:00 2001 From: Niclas Eklund Date: Thu, 17 Feb 2011 15:52:20 +0100 Subject: Removed code commented out. --- lib/cosNotification/src/CosNotification_Common.erl | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl index d3607a5eed..af9b2d4368 100644 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ b/lib/cosNotification/src/CosNotification_Common.erl @@ -1092,10 +1092,8 @@ do_set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> merge_properties(NewQoS, Curr, NewLQS); do_set_properties([], _, channelAdm, _, Unsupp, _,_,_,_) -> {error, #'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}}; -% corba:raise(#'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}); do_set_properties([], _, _, _, Unsupp, _,_,_,_) -> {error, #'CosNotification_UnsupportedQoS'{qos_err = Unsupp}}; -%corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}); do_set_properties([Req|Tail], Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) -> %% set_values and is_supported are help functions found at the end of QoS -- cgit v1.2.3 From 49d011c355682ce5cb5447c682684031dab82e8b Mon Sep 17 00:00:00 2001 From: Paul Guyot Date: Sun, 6 Jun 2010 22:26:08 +0200 Subject: Honor start type in .rel files when building relup files Previously, relup file always included an application:start(Application, permanent) apply instruction for every application that appear in the UpTo/DowFrom release file, whatever their start type in the release file. The new implementation fixes this bug by honoring the start type according to the rel(5) format. If the start type is none, no apply line is included in the relup. If the start type is load, the relup includes instruction to only load the application. Otherwise, the relup includes an instruction to start the application to the according type. The fix is implemented by adding a new parameter to the add_application high level appup instruction. This new parameter is documented in appup(5). --- lib/sasl/doc/src/appup.xml | 10 +++++++++- lib/sasl/src/systools_rc.erl | 28 +++++++++++++++++++++------- lib/sasl/src/systools_relup.erl | 4 ++-- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib/sasl/doc/src/appup.xml b/lib/sasl/doc/src/appup.xml index 5182889710..48d7b69885 100644 --- a/lib/sasl/doc/src/appup.xml +++ b/lib/sasl/doc/src/appup.xml @@ -174,11 +174,19 @@ remove and purge.

 {add_application, Application}
+{add_application, Application, Type}
   Application = atom()
+  Type = permanent | transient | temporary | load | none
     

Adding an application means that the modules defined by the modules key in the .app file are loaded using - add_module, then the application is started.

+ add_module.

+

Type defaults to permanent and specifies the start type + of the application. If Type = permanent | transient | temporary, + the application will be loaded and started in the corresponding way, + see application(3). If Type = load, the application will + only be loaded. If Type = none, the application will be neither + loaded nor started, although the code for its modules will be loaded.

 {remove_application, Application}
   Application = atom()
diff --git a/lib/sasl/src/systools_rc.erl b/lib/sasl/src/systools_rc.erl
index 23d1a52b66..daadb79967 100644
--- a/lib/sasl/src/systools_rc.erl
+++ b/lib/sasl/src/systools_rc.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
@@ -34,7 +34,7 @@
 %% {add_module, Mod, [Mod]}
 %% {remove_module, Mod, PrePurge, PostPurge, [Mod]}
 %% {restart_application, Appl}
-%% {add_application, Appl}
+%% {add_application, Appl, Type}
 %% {remove_application, Appl}
 %%
 %% Low-level
@@ -109,6 +109,8 @@ expand_script([I|Script]) ->
 	     {delete_module, Mod} ->
 		 [{remove, {Mod, brutal_purge, brutal_purge}},
 		  {purge, [Mod]}];
+	     {add_application, Application} ->
+		 {add_application, Application, permanent};
 	     _ ->
 		 I
 	 end,
@@ -317,14 +319,18 @@ translate_independent_instrs(Before, After, Appls, PreAppls) ->
 translate_application_instrs(Script, Appls, PreAppls) ->
     %% io:format("Appls ~n~p~n",[Appls]),
     L = lists:map(
-	  fun({add_application, Appl}) ->
+	  fun({add_application, Appl, Type}) ->
 		  case lists:keysearch(Appl, #application.name, Appls) of
 		      {value, Application} ->
 			  Mods =
 			      remove_vsn(Application#application.modules),
+			  ApplyL = case Type of
+			      none -> [];
+			      load -> [{apply, {application, load, [Appl]}}];
+			      _ -> [{apply, {application, start, [Appl, Type]}}]
+			  end,
 			  [{add_module, M, []} || M <- Mods] ++
-			      [{apply, {application, start,
-					[Appl, permanent]}}];
+			      ApplyL;
 		      false ->
 			  throw({error, {no_such_application, Appl}})
 		  end;
@@ -750,8 +756,9 @@ check_op({remove_module, Mod, PrePurge, PostPurge, Mods}) ->
     lists:foreach(fun(M) -> check_mod(M) end, Mods);
 check_op({remove_application, Appl}) ->
     check_appl(Appl);
-check_op({add_application, Appl}) ->
-    check_appl(Appl);
+check_op({add_application, Appl, Type}) ->
+    check_appl(Appl),
+    check_start_type(Type);
 check_op({restart_application, Appl}) ->
     check_appl(Appl);
 check_op(restart) -> ok;
@@ -839,6 +846,13 @@ check_node(Node) -> throw({error, {bad_node, Node}}).
 check_appl(Appl) when is_atom(Appl) -> ok;
 check_appl(Appl) -> throw({error, {bad_application, Appl}}).
 
+check_start_type(none) -> ok;
+check_start_type(load) -> ok;
+check_start_type(temporary) -> ok;
+check_start_type(transient) -> ok;
+check_start_type(permanent) -> ok;
+check_start_type(T) -> throw({error, {bad_start_type, T}}).
+
 check_func(Func) when is_atom(Func) -> ok;
 check_func(Func) -> throw({error, {bad_func, Func}}).
 
diff --git a/lib/sasl/src/systools_relup.erl b/lib/sasl/src/systools_relup.erl
index 177d50be80..71bd3ca491 100644
--- a/lib/sasl/src/systools_relup.erl
+++ b/lib/sasl/src/systools_relup.erl
@@ -370,10 +370,10 @@ collect_appup_scripts(_, [], _, Ws, RUs) -> {RUs, Ws}.
 %% ToApps = [#application]
 %%
 create_add_app_scripts(FromRel, ToRel, RU0s, W0s) -> 
-    AddedNs = [N || {N, _V, _T} <- ToRel#release.applications,
+    AddedNs = [{N, T} || {N, _V, T} <- ToRel#release.applications,
 		    not lists:keymember(N, 1, FromRel#release.applications)],
     %% io:format("Added apps: ~p~n", [AddedNs]),
-    RUs = [[{add_application, N}] || N <- AddedNs],
+    RUs = [[{add_application, N, T}] || {N, T} <- AddedNs],
     {RUs ++ RU0s, W0s}.
 
 
-- 
cgit v1.2.3


From feb08b2bc629530ab593c6497d2476e37d8a9251 Mon Sep 17 00:00:00 2001
From: Micael Karlberg 
Date: Fri, 25 Feb 2011 17:56:59 +0100
Subject: First batch of attempts to deal with dialyzer issues...

---
 lib/megaco/Makefile                                |  34 ++++-
 lib/megaco/doc/src/notes.xml                       |  86 ++++++++++--
 lib/megaco/src/app/megaco.appup.src                |  50 +++----
 .../src/binary/megaco_binary_encoder_lib.erl       |  31 +++-
 lib/megaco/src/engine/depend.mk                    |   4 +-
 lib/megaco/src/engine/megaco_config.erl            | 156 +++++++--------------
 lib/megaco/src/engine/megaco_config_misc.erl       | 113 +++++++++++++++
 lib/megaco/src/engine/megaco_filter.erl            |  33 ++---
 lib/megaco/src/engine/megaco_sdp.erl               |   6 +-
 lib/megaco/src/engine/megaco_timer.erl             |  14 +-
 lib/megaco/src/engine/modules.mk                   |   3 +-
 lib/megaco/src/flex/megaco_flex_scanner.erl        |  18 +--
 lib/megaco/vsn.mk                                  |  25 +++-
 13 files changed, 365 insertions(+), 208 deletions(-)
 create mode 100644 lib/megaco/src/engine/megaco_config_misc.erl

diff --git a/lib/megaco/Makefile b/lib/megaco/Makefile
index d4698eb558..10efaf667f 100644
--- a/lib/megaco/Makefile
+++ b/lib/megaco/Makefile
@@ -1,7 +1,7 @@
 # 
 # %CopyrightBegin%
 # 
-# Copyright Ericsson AB 1999-2009. All Rights Reserved.
+# Copyright Ericsson AB 1999-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
@@ -97,12 +97,19 @@ endif
 CONFIGURE_OPTS = $(FLEX_SCANNER_LINENO_ENABLER) $(FLEX_SCANNER_REENTRANT_ENABLER)
 
 
+MEGACO_DIA_PLT     = ./priv/megaco.plt
+MEGACO_DIA_PLT_LOG = $(basename $(MEGACO_DIA_PLT)).dialyzer_plt_log
+MEGACO_DIA_LOG     = $(basename $(MEGACO_DIA_PLT)).dialyzer_log
+
 
 # ----------------------------------------------------
 # Default Subdir Targets
 # ----------------------------------------------------
 include $(ERL_TOP)/make/otp_subdir.mk
 
+.PHONY: reconf conf dconf econf configure setup info version \
+	app_install dialyzer
+
 reconf:
 	(cd $(ERL_TOP) && \
 		./otp_build autoconf && \
@@ -132,6 +139,10 @@ info:
 	@echo "APP_TAR_FILE:    $(APP_TAR_FILE)"
 	@echo "OTP_INSTALL_DIR: $(OTP_INSTALL_DIR)"
 	@echo "APP_INSTALL_DIR: $(APP_INSTALL_DIR)"
+	@echo ""
+	@echo "MEGACO_PLT     = $(MEGACO_PLT)"
+	@echo "MEGACO_DIA_LOG = $(MEGACO_DIA_LOG)"
+	@echo ""
 
 version:
 	@echo "$(VSN)"
@@ -190,9 +201,18 @@ tar: $(APP_TAR_FILE)
 $(APP_TAR_FILE): $(APP_DIR)
 	(cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME))
 
-dialyzer: 
-	(cd ./ebin; \
-         dialyzer --build_plt \
-                  --output_plt ../priv/megaco.plt \
-                  -r ../../megaco/ebin \
-                  --verbose)
+dialyzer_plt: $(MEGACO_DIA_PLT)
+
+$(MEGACO_DIA_PLT): 
+	@echo "Building megaco plt file"
+	@dialyzer --build_plt \
+                  --output_plt $@ \
+                  -r ../megaco/ebin \
+                  -o $(MEGACO_DIA_PLT_LOG) \
+                  --verbose
+
+dialyzer: $(MEGACO_DIA_PLT)
+	(dialyzer --plt $< \
+                  -o $(MEGACO_DIA_LOG) \
+                  ../megaco/ebin \
+                  && (shell cat $(MEGACO_DIA_LOG)))
diff --git a/lib/megaco/doc/src/notes.xml b/lib/megaco/doc/src/notes.xml
index 81c9305542..4f678a2a1b 100644
--- a/lib/megaco/doc/src/notes.xml
+++ b/lib/megaco/doc/src/notes.xml
@@ -1,10 +1,10 @@
-
+
 
 
 
   
- 20002010 + 20002011 Ericsson AB. All Rights Reserved. @@ -35,22 +35,90 @@ thus constitutes one section in this document. The title of each section is the version number of Megaco.

+ +
Megaco 3.15.1 + +

Version 3.15.1 supports code replacement in runtime from/to + version 3.15, 3.14.1.1, 3.14.1 and 3.14.

+ +
+ Improvements and new features + +

-

+ + + +
+ +
+ Fixed bugs and malfunctions + + + + + +

Fixing miscellaneous things detected by dialyzer.

+

Own Id: OTP-9075

+ +
+ +
+ +
+ +
+ +
Megaco 3.15
Improvements and New Features - + + + + + +

Fixing auto-import issues.

+

Own Id: OTP-8842

+
+
+
+ +
+ Fixed bugs and malfunctions +

-

+ + +
-
+
-
+ +
Megaco 3.14.1.1

Version 3.14.1.1 supports code replacement in runtime from/to diff --git a/lib/megaco/src/app/megaco.appup.src b/lib/megaco/src/app/megaco.appup.src index 66068f650f..495a9ec9ae 100644 --- a/lib/megaco/src/app/megaco.appup.src +++ b/lib/megaco/src/app/megaco.appup.src @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-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 @@ -133,50 +133,34 @@ %% | %% v %% 3.15 +%% | +%% v +%% 3.15.1 %% %% {"%VSN%", [ - {"3.14.1.1", + {"3.15", [ - {load_module, megaco_binary_transformer_prev3a, soft_purge, soft_purge, []}, - {load_module, megaco_binary_transformer_prev3b, soft_purge, soft_purge, []}, - {load_module, megaco_binary_transformer_prev3c, soft_purge, soft_purge, []}, + {load_module, megaco_flex_scanner, soft_purge, soft_purge, []}, {load_module, megaco_sdp, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_v1, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_v1, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_v2, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_v2, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_prev3a, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_prev3a, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_prev3b, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_prev3b, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_prev3c, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_prev3c, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_v3, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_v3, soft_purge, soft_purge, []} + {load_module, megaco_filter, soft_purge, soft_purge, []}, + {load_module, megaco_timer, soft_purge, soft_purge, [megaco_config_misc]}, + {update, megaco_config, soft, soft_purge, soft_purge, + [megaco_timer, megaco_config_misc]}, + {add_module, megaco_config_misc} ] } ], [ - {"3.14.1.1", + {"3.15", [ - {load_module, megaco_binary_transformer_prev3a, soft_purge, soft_purge, []}, - {load_module, megaco_binary_transformer_prev3b, soft_purge, soft_purge, []}, - {load_module, megaco_binary_transformer_prev3c, soft_purge, soft_purge, []}, + {load_module, megaco_flex_scanner, soft_purge, soft_purge, []}, {load_module, megaco_sdp, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_v1, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_v1, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_v2, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_v2, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_prev3a, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_prev3a, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_prev3b, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_prev3b, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_prev3c, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_prev3c, soft_purge, soft_purge, []}, - {load_module, megaco_compact_text_encoder_v3, soft_purge, soft_purge, []}, - {load_module, megaco_pretty_text_encoder_v3, soft_purge, soft_purge, []} + {load_module, megaco_filter, soft_purge, soft_purge, []}, + {load_module, megaco_timer, soft_purge, soft_purge, [megaco_config]}, + {update, megaco_config, soft, soft_purge, soft_purge, []}, + {delete_module, megaco_config_misc} ] } ] diff --git a/lib/megaco/src/binary/megaco_binary_encoder_lib.erl b/lib/megaco/src/binary/megaco_binary_encoder_lib.erl index 842d6b70d1..967ee93935 100644 --- a/lib/megaco/src/binary/megaco_binary_encoder_lib.erl +++ b/lib/megaco/src/binary/megaco_binary_encoder_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -134,6 +134,12 @@ encode_transaction(EC, {Tag, _} = Trans, AsnMod, TransMod, Type) encode_transaction(_EC, T, _AsnMod, _TransMod, _Type) -> {error, {no_megaco_transaction, T}}. +-spec do_encode_transaction(EC :: list(), + Trans :: tuple(), + AnsMod :: atom(), + TransMod :: atom(), + Type :: atom()) -> + {'ok', binary()} | {'error', any()}. do_encode_transaction([native], _Trans, _AsnMod, _TransMod, binary) -> %% asn1rt:encode(AsnMod, element(1, T), T); {error, not_implemented}; @@ -160,6 +166,12 @@ do_encode_transaction(EC, _Trans, _AsnMod, _TransMod, _Type) -> %% Convert a list of ActionRequest record's into a binary %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- +-spec encode_action_requests(EC :: list(), + ARs :: list(), + AnsMod :: atom(), + TransMod :: atom(), + Type :: atom()) -> + {'ok', binary()} | {'error', any()}. encode_action_requests([native], _ARs, _AsnMod, _TransMod, binary) -> %% asn1rt:encode(AsnMod, element(1, T), T); {error, not_implemented}; @@ -183,13 +195,20 @@ encode_action_requests(EC, _ARs, _AsnMod, _TransMod, _Type) -> %% Convert a ActionRequest record into a binary %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- -encode_action_request([native], _ARs, _AsnMod, _TransMod, binary) -> + +-spec encode_action_request(EC :: list(), + AR :: tuple(), + AnsMod :: atom(), + TransMod :: atom(), + Type :: atom()) -> + {'ok', binary()} | {'error', any()}. +encode_action_request([native], _AR, _AsnMod, _TransMod, binary) -> %% asn1rt:encode(AsnMod, element(1, T), T); {error, not_implemented}; -encode_action_request(_EC, _ARs0, _AsnMod, _TransMod, binary) -> +encode_action_request(_EC, _AR, _AsnMod, _TransMod, binary) -> {error, not_implemented}; -encode_action_request(EC, ARs, AsnMod, TransMod, io_list) -> - case encode_action_request(EC, ARs, AsnMod, TransMod, binary) of +encode_action_request(EC, AR, AsnMod, TransMod, io_list) -> + case encode_action_request(EC, AR, AsnMod, TransMod, binary) of {ok, Bin} when is_binary(Bin) -> {ok, Bin}; {ok, DeepIoList} -> @@ -198,7 +217,7 @@ encode_action_request(EC, ARs, AsnMod, TransMod, io_list) -> {error, Reason} -> {error, Reason} end; -encode_action_request(EC, _ARs, _AsnMod, _TransMod, _Type) -> +encode_action_request(EC, _AR, _AsnMod, _TransMod, _Type) -> {error, {bad_encoding_config, EC}}. diff --git a/lib/megaco/src/engine/depend.mk b/lib/megaco/src/engine/depend.mk index 8d8c83e923..935eb813e5 100644 --- a/lib/megaco/src/engine/depend.mk +++ b/lib/megaco/src/engine/depend.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2003-2009. All Rights Reserved. +# Copyright Ericsson AB 2003-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 @@ -17,6 +17,8 @@ # # %CopyrightEnd% +$(EBIN)/megaco_config_misc.$(EMULATOR): megaco_config_misc.erl + $(EBIN)/megaco_config.$(EMULATOR): megaco_config.erl \ ../../include/megaco.hrl \ ../app/megaco_internal.hrl diff --git a/lib/megaco/src/engine/megaco_config.erl b/lib/megaco/src/engine/megaco_config.erl index 6805db790d..b65ddbe232 100644 --- a/lib/megaco/src/engine/megaco_config.erl +++ b/lib/megaco/src/engine/megaco_config.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -46,10 +46,10 @@ %% Verification functions verify_val/2, - verify_strict_uint/1, - verify_strict_int/1, verify_strict_int/2, - verify_uint/1, - verify_int/1, verify_int/2, +%% verify_strict_uint/1, +%% verify_strict_int/1, verify_strict_int/2, +%% verify_uint/1, +%% verify_int/1, verify_int/2, %% Reply limit counter @@ -1501,28 +1501,37 @@ verify_val(Item, Val) -> mid -> true; local_mid -> true; remote_mid -> true; - min_trans_id -> verify_strict_uint(Val, 4294967295); % uint32 - max_trans_id -> verify_uint(Val, 4294967295); % uint32 + min_trans_id -> + megaco_config_misc:verify_strict_uint(Val, 4294967295); % uint32 + max_trans_id -> + megaco_config_misc:verify_uint(Val, 4294967295); % uint32 request_timer -> verify_timer(Val); long_request_timer -> verify_timer(Val); - auto_ack -> verify_bool(Val); + auto_ack -> + megaco_config_misc:verify_bool(Val); - trans_ack -> verify_bool(Val); - trans_ack_maxcount -> verify_uint(Val); + trans_ack -> + megaco_config_misc:verify_bool(Val); + trans_ack_maxcount -> + megaco_config_misc:verify_uint(Val); - trans_req -> verify_bool(Val); - trans_req_maxcount -> verify_uint(Val); - trans_req_maxsize -> verify_uint(Val); + trans_req -> + megaco_config_misc:verify_bool(Val); + trans_req_maxcount -> + megaco_config_misc:verify_uint(Val); + trans_req_maxsize -> + megaco_config_misc:verify_uint(Val); - trans_timer -> verify_timer(Val) and (Val >= 0); - trans_sender when Val == undefined -> true; + trans_timer -> + verify_timer(Val) and (Val >= 0); + trans_sender when Val =:= undefined -> true; pending_timer -> verify_timer(Val); - sent_pending_limit -> verify_uint(Val) andalso - (Val > 0); - recv_pending_limit -> verify_uint(Val) andalso - (Val > 0); + sent_pending_limit -> + megaco_config_misc:verify_uint(Val) andalso (Val > 0); + recv_pending_limit -> + megaco_config_misc:verify_uint(Val) andalso (Val > 0); reply_timer -> verify_timer(Val); control_pid when is_pid(Val) -> true; monitor_ref -> true; % Internal usage only @@ -1530,110 +1539,43 @@ verify_val(Item, Val) -> send_handle -> true; encoding_mod when is_atom(Val) -> true; encoding_config when is_list(Val) -> true; - protocol_version -> verify_strict_uint(Val); + protocol_version -> + megaco_config_misc:verify_strict_uint(Val); auth_data -> true; user_mod when is_atom(Val) -> true; user_args when is_list(Val) -> true; reply_data -> true; - threaded -> verify_bool(Val); - strict_version -> verify_bool(Val); - long_request_resend -> verify_bool(Val); - call_proxy_gc_timeout -> verify_strict_uint(Val); - cancel -> verify_bool(Val); + threaded -> + megaco_config_misc:verify_bool(Val); + strict_version -> + megaco_config_misc:verify_bool(Val); + long_request_resend -> + megaco_config_misc:verify_bool(Val); + call_proxy_gc_timeout -> + megaco_config_misc:verify_strict_uint(Val); + cancel -> + megaco_config_misc:verify_bool(Val); resend_indication -> verify_resend_indication(Val); - segment_reply_ind -> verify_bool(Val); - segment_recv_acc -> verify_bool(Val); + segment_reply_ind -> + megaco_config_misc:verify_bool(Val); + segment_recv_acc -> + megaco_config_misc:verify_bool(Val); segment_recv_timer -> verify_timer(Val); segment_send -> verify_segmentation_window(Val); segment_send_timer -> verify_timer(Val); - max_pdu_size -> verify_int(Val) andalso (Val > 0); + max_pdu_size -> + megaco_config_misc:verify_int(Val) andalso (Val > 0); request_keep_alive_timeout -> - (verify_uint(Val) orelse (Val =:= plain)); + (megaco_config_misc:verify_uint(Val) orelse (Val =:= plain)); _ -> false end. -verify_bool(true) -> true; -verify_bool(false) -> true; -verify_bool(_) -> false. - verify_resend_indication(flag) -> true; -verify_resend_indication(Val) -> verify_bool(Val). - --spec verify_strict_int(Int :: integer()) -> boolean(). -verify_strict_int(Int) when is_integer(Int) -> true; -verify_strict_int(_) -> false. - --spec verify_strict_int(Int :: integer(), - Max :: integer() | 'infinity') -> boolean(). -verify_strict_int(Int, infinity) -> - verify_strict_int(Int); -verify_strict_int(Int, Max) -> - verify_strict_int(Int) andalso verify_strict_int(Max) andalso (Int =< Max). - --spec verify_strict_uint(Int :: non_neg_integer()) -> boolean(). -verify_strict_uint(Int) when is_integer(Int) andalso (Int >= 0) -> true; -verify_strict_uint(_) -> false. - --spec verify_strict_uint(Int :: non_neg_integer(), - Max :: non_neg_integer() | 'infinity') -> boolean(). -verify_strict_uint(Int, infinity) -> - verify_strict_uint(Int); -verify_strict_uint(Int, Max) -> - verify_strict_int(Int, 0, Max). - --spec verify_uint(Val :: non_neg_integer() | 'infinity') -> boolean(). -verify_uint(infinity) -> true; -verify_uint(Val) -> verify_strict_uint(Val). - --spec verify_int(Val :: integer() | 'infinity') -> boolean(). -verify_int(infinity) -> true; -verify_int(Val) -> verify_strict_int(Val). - --spec verify_int(Int :: integer() | 'infinity', - Max :: integer() | 'infinity') -> boolean(). -verify_int(Int, infinity) -> - verify_int(Int); -verify_int(infinity, _Max) -> - true; -verify_int(Int, Max) -> - verify_strict_int(Int) andalso verify_strict_int(Max) andalso (Int =< Max). - --spec verify_uint(Int :: non_neg_integer() | 'infinity', - Max :: non_neg_integer() | 'infinity') -> boolean(). -verify_uint(Int, infinity) -> - verify_uint(Int); -verify_uint(infinity, _Max) -> - true; -verify_uint(Int, Max) -> - verify_strict_int(Int, 0, Max). - --spec verify_strict_int(Int :: integer(), - Min :: integer(), - Max :: integer()) -> boolean(). -verify_strict_int(Val, Min, Max) - when (is_integer(Val) andalso - is_integer(Min) andalso - is_integer(Max) andalso - (Val >= Min) andalso - (Val =< Max)) -> - true; -verify_strict_int(_Val, _Min, _Max) -> - false. - --spec verify_int(Val :: integer() | 'infinity', - Min :: integer(), - Max :: integer() | 'infinity') -> boolean(). -verify_int(infinity, Min, infinity) -> - verify_strict_int(Min); -verify_int(Val, Min, infinity) -> - verify_strict_int(Val) andalso - verify_strict_int(Min) andalso (Val >= Min); -verify_int(Int, Min, Max) -> - verify_strict_int(Int, Min, Max). +verify_resend_indication(Val) -> megaco_config_misc:verify_bool(Val). verify_timer(Timer) -> megaco_timer:verify(Timer). @@ -1641,7 +1583,7 @@ verify_timer(Timer) -> verify_segmentation_window(none) -> true; verify_segmentation_window(K) -> - verify_int(K, 1, infinity). + megaco_config_misc:verify_int(K, 1, infinity). handle_stop_user(UserMid) -> case catch user_info(UserMid, mid) of diff --git a/lib/megaco/src/engine/megaco_config_misc.erl b/lib/megaco/src/engine/megaco_config_misc.erl new file mode 100644 index 0000000000..0a1601c766 --- /dev/null +++ b/lib/megaco/src/engine/megaco_config_misc.erl @@ -0,0 +1,113 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2011-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% +%% + +%% +%%---------------------------------------------------------------------- +%% Purpose: Utility module for megaco_config +%%---------------------------------------------------------------------- +%% + +-module(megaco_config_misc). + +%% Application internal exports +-export([ + verify_bool/1, + + verify_int/1, verify_int/2, verify_int/3, + verify_strict_int/1, verify_strict_int/2, verify_strict_int/3, + + verify_uint/1, verify_uint/2, + verify_strict_uint/1, verify_strict_uint/2 + ]). + + +%%%---------------------------------------------------------------------- +%%% API +%%%---------------------------------------------------------------------- + +verify_bool(true) -> true; +verify_bool(false) -> true; +verify_bool(_) -> false. + + +%% verify_int(Val) -> boolean() +verify_int(infinity) -> true; +verify_int(Val) -> verify_strict_int(Val). + +%% verify_int(Val, Max) -> boolean() +verify_int(Int, infinity) -> + verify_int(Int); +verify_int(infinity, _Max) -> + true; +verify_int(Int, Max) -> + verify_strict_int(Int) andalso verify_strict_int(Max) andalso (Int =< Max). + +%% verify_int(Val, Min, Max) -> boolean() +verify_int(infinity, Min, infinity) -> + verify_strict_int(Min); +verify_int(Val, Min, infinity) -> + verify_strict_int(Val) andalso + verify_strict_int(Min) andalso (Val >= Min); +verify_int(Int, Min, Max) -> + verify_strict_int(Int, Min, Max). + +%% verify_strict_int(Val) -> boolean() +verify_strict_int(Int) when is_integer(Int) -> true; +verify_strict_int(_) -> false. + +%% verify_strict_int(Val, Max) -> boolean() +verify_strict_int(Int, infinity) -> + verify_strict_int(Int); +verify_strict_int(Int, Max) -> + verify_strict_int(Int) andalso verify_strict_int(Max) andalso (Int =< Max). + +%% verify_strict_int(Val, Min, Max) -> boolean() +verify_strict_int(Val, Min, Max) + when (is_integer(Val) andalso + is_integer(Min) andalso + is_integer(Max) andalso + (Val >= Min) andalso + (Val =< Max)) -> + true; +verify_strict_int(_Val, _Min, _Max) -> + false. + + +%% verify_uint(Val) -> boolean() +verify_uint(infinity) -> true; +verify_uint(Val) -> verify_strict_uint(Val). + +%% verify_uint(Val, Max) -> boolean() +verify_uint(Int, infinity) -> + verify_uint(Int); +verify_uint(infinity, _Max) -> + true; +verify_uint(Int, Max) -> + verify_strict_int(Int, 0, Max). + +%% verify_strict_uint(Val) -> boolean() +verify_strict_uint(Int) when is_integer(Int) andalso (Int >= 0) -> true; +verify_strict_uint(_) -> false. + +%% verify_strict_uint(Val, Max) -> boolean() +verify_strict_uint(Int, infinity) -> + verify_strict_uint(Int); +verify_strict_uint(Int, Max) -> + verify_strict_int(Int, 0, Max). + diff --git a/lib/megaco/src/engine/megaco_filter.erl b/lib/megaco/src/engine/megaco_filter.erl index 9df752789c..fb0c700a82 100644 --- a/lib/megaco/src/engine/megaco_filter.erl +++ b/lib/megaco/src/engine/megaco_filter.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -21,6 +21,7 @@ %%---------------------------------------------------------------------- %% Purpose : Megaco/H.248 customization of the Event Tracer tool %%---------------------------------------------------------------------- +%% -module(megaco_filter). @@ -33,6 +34,7 @@ -include_lib("megaco/src/app/megaco_internal.hrl"). -include_lib("et/include/et.hrl"). + %%---------------------------------------------------------------------- %% BUGBUG: There are some opportunities for improvements: %% @@ -43,7 +45,8 @@ %% records that already are defined in megaco_message_{v1,v2,v3}.hrl. %% * The records megaco_udp and megaco_tcp are copied from the files %% megaco_udp.hrl and megaco_tcp.hrl respectively, as we cannot include -%% both header files. They both defines the macros HEAP_SIZE and GC_MSG_LIMIT. +%% both header files. +%% They both defines the macros HEAP_SIZE and GC_MSG_LIMIT. %%-include("megaco_message_internal.hrl"). -record('megaco_transaction_reply', @@ -76,6 +79,8 @@ module = megaco, serialize = false % false: Spawn a new process for each message }). + + %%---------------------------------------------------------------------- start() -> @@ -360,28 +365,24 @@ pretty(_ConnData, MegaMsg) when is_record(MegaMsg, 'MegacoMessage') -> {ok, Bin} = megaco_pretty_text_encoder:encode_message([], MegaMsg), term_to_string(Bin); pretty(_ConnData, CmdReq) when is_record(CmdReq, 'CommandRequest') -> - {ok, IoList} = megaco_pretty_text_encoder:encode_command_request(CmdReq), - term_to_string(lists:flatten(IoList)); + {ok, Bin} = megaco_pretty_text_encoder:encode_command_request(CmdReq), + term_to_string(Bin); pretty(_ConnData, {complete_success, ContextId, RepList}) -> ActRep = #'ActionReply'{contextId = ContextId, commandReply = RepList}, - {ok, IoList} = megaco_pretty_text_encoder:encode_action_reply(ActRep), - term_to_string(lists:flatten(IoList)); + {ok, Bin} = megaco_pretty_text_encoder:encode_action_reply(ActRep), + term_to_string(Bin); pretty(_ConnData, AR) when is_record(AR, 'ActionReply') -> - {ok, IoList} = megaco_pretty_text_encoder:encode_action_reply(AR), - term_to_string(lists:flatten(IoList)); + {ok, Bin} = megaco_pretty_text_encoder:encode_action_reply(AR), + term_to_string(Bin); pretty(_ConnData, {partial_failure, ContextId, RepList}) -> ActRep = #'ActionReply'{contextId = ContextId, commandReply = RepList}, - {ok, IoList} = megaco_pretty_text_encoder:encode_action_reply(ActRep), - term_to_string(lists:flatten(IoList)); + {ok, Bin} = megaco_pretty_text_encoder:encode_action_reply(ActRep), + term_to_string(Bin); pretty(_ConnData, {trans, Trans}) -> - case megaco_pretty_text_encoder:encode_transaction(Trans) of - {ok, Bin} when is_binary(Bin) -> - term_to_string(binary_to_list(Bin)); - {ok, IoList} -> - term_to_string(lists:flatten(IoList)) - end; + {ok, Bin} = megaco_pretty_text_encoder:encode_transaction(Trans), + term_to_string(Bin); pretty(__ConnData, Other) -> term_to_string(Other). diff --git a/lib/megaco/src/engine/megaco_sdp.erl b/lib/megaco/src/engine/megaco_sdp.erl index 37f28cac59..96732584fb 100644 --- a/lib/megaco/src/engine/megaco_sdp.erl +++ b/lib/megaco/src/engine/megaco_sdp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-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 @@ -877,9 +877,7 @@ decode_bandwidth_bwt("CT") -> decode_bandwidth_bwt("AS") -> as; decode_bandwidth_bwt(BwType) when is_list(BwType) -> - BwType; -decode_bandwidth_bwt(BadBwType) -> - error({invalid_bandwidth_bwtype, BadBwType}). + BwType. encode_bandwidth_bwt(ct) -> "CT"; diff --git a/lib/megaco/src/engine/megaco_timer.erl b/lib/megaco/src/engine/megaco_timer.erl index 9f524523a8..1336be0b5b 100644 --- a/lib/megaco/src/engine/megaco_timer.erl +++ b/lib/megaco/src/engine/megaco_timer.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2009. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -42,7 +42,7 @@ %% NewTimer = megaco_timer() %% TimeoutTime = infinity | integer() %% -init(SingleWaitFor) when SingleWaitFor == infinity -> +init(SingleWaitFor) when SingleWaitFor =:= infinity -> {SingleWaitFor, timeout}; init(SingleWaitFor) when is_integer(SingleWaitFor) and (SingleWaitFor >= 0) -> {SingleWaitFor, timeout}; @@ -76,17 +76,17 @@ verify(#megaco_incr_timer{wait_for = WaitFor, factor = Factor, incr = Incr, max_retries = MaxRetries}) -> - (megaco_config:verify_strict_uint(WaitFor) and - megaco_config:verify_strict_uint(Factor) and - megaco_config:verify_strict_int(Incr) and + (megaco_config_misc:verify_strict_uint(WaitFor) and + megaco_config_misc:verify_strict_uint(Factor) and + megaco_config_misc:verify_strict_int(Incr) and verify_max_retries(MaxRetries)); verify(Timer) -> - megaco_config:verify_uint(Timer). + megaco_config_misc:verify_uint(Timer). verify_max_retries(infinity_restartable) -> true; verify_max_retries(Val) -> - megaco_config:verify_uint(Val). + megaco_config_misc:verify_uint(Val). %%----------------------------------------------------------------- diff --git a/lib/megaco/src/engine/modules.mk b/lib/megaco/src/engine/modules.mk index 44bcadc37b..4bc57cd63e 100644 --- a/lib/megaco/src/engine/modules.mk +++ b/lib/megaco/src/engine/modules.mk @@ -2,7 +2,7 @@ # %CopyrightBegin% # -# Copyright Ericsson AB 2001-2009. All Rights Reserved. +# Copyright Ericsson AB 2001-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 @@ -24,6 +24,7 @@ BEHAVIOUR_MODULES = \ MODULES = \ $(BEHAVIOUR_MODULES) \ + megaco_config_misc \ megaco_config \ megaco_digit_map \ megaco_erl_dist_encoder \ diff --git a/lib/megaco/src/flex/megaco_flex_scanner.erl b/lib/megaco/src/flex/megaco_flex_scanner.erl index e471412c13..508f8905e7 100644 --- a/lib/megaco/src/flex/megaco_flex_scanner.erl +++ b/lib/megaco/src/flex/megaco_flex_scanner.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2009. All Rights Reserved. +%% Copyright Ericsson AB 2001-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 @@ -30,21 +30,11 @@ -define(SCHED_ID(), erlang:system_info(scheduler_id)). -define(SMP_SUPPORT_DEFAULT(), erlang:system_info(smp_support)). -is_enabled() -> - case ?ENABLE_MEGACO_FLEX_SCANNER of - true -> - true; - _ -> - false - end. +is_enabled() -> + (true =:= ?ENABLE_MEGACO_FLEX_SCANNER). is_reentrant_enabled() -> - case ?MEGACO_REENTRANT_FLEX_SCANNER of - true -> - true; - _ -> - false - end. + (true =:= ?MEGACO_REENTRANT_FLEX_SCANNER). is_scanner_port(Port, Port) when is_port(Port) -> true; diff --git a/lib/megaco/vsn.mk b/lib/megaco/vsn.mk index 9fc0e0f2fa..5f71712360 100644 --- a/lib/megaco/vsn.mk +++ b/lib/megaco/vsn.mk @@ -1,4 +1,23 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2011. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved 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% + APPLICATION = megaco -MEGACO_VSN = 3.15 -PRE_VSN = -APP_VSN = "$(APPLICATION)-$(MEGACO_VSN)$(PRE_VSN)" +MEGACO_VSN = 3.15.1 +PRE_VSN = +APP_VSN = "$(APPLICATION)-$(MEGACO_VSN)$(PRE_VSN)" -- cgit v1.2.3 From 9671856faa243ee4567f4059fba28fd85b5d9baa Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 25 Feb 2011 18:14:00 +0100 Subject: No auto import of error/1,2. --- lib/megaco/test/megaco_appup_test.erl | 3 ++- lib/megaco/test/megaco_codec_v1_test.erl | 6 +++++- lib/megaco/test/megaco_test_generator.erl | 6 +++++- lib/megaco/test/megaco_test_megaco_generator.erl | 4 +++- lib/megaco/test/megaco_test_msg_prev3a_lib.erl | 6 +++++- lib/megaco/test/megaco_test_msg_prev3b_lib.erl | 6 +++++- lib/megaco/test/megaco_test_msg_prev3c_lib.erl | 6 +++++- lib/megaco/test/megaco_test_msg_v1_lib.erl | 6 +++++- lib/megaco/test/megaco_test_msg_v2_lib.erl | 6 +++++- lib/megaco/test/megaco_test_msg_v3_lib.erl | 6 +++++- lib/megaco/test/megaco_test_tcp_generator.erl | 4 +++- lib/megaco/test/megaco_timer_test.erl | 4 +++- 12 files changed, 51 insertions(+), 12 deletions(-) diff --git a/lib/megaco/test/megaco_appup_test.erl b/lib/megaco/test/megaco_appup_test.erl index a49ab0a968..40eebcae86 100644 --- a/lib/megaco/test/megaco_appup_test.erl +++ b/lib/megaco/test/megaco_appup_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-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 @@ -24,6 +24,7 @@ -module(megaco_appup_test). -compile(export_all). +-compile({no_auto_import,[error/1]}). -include("megaco_test_lib.hrl"). diff --git a/lib/megaco/test/megaco_codec_v1_test.erl b/lib/megaco/test/megaco_codec_v1_test.erl index 7068d005da..8190407aec 100644 --- a/lib/megaco/test/megaco_codec_v1_test.erl +++ b/lib/megaco/test/megaco_codec_v1_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -26,6 +26,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco.hrl"). -include_lib("megaco/include/megaco_message_v1.hrl"). -include("megaco_test_lib.hrl"). diff --git a/lib/megaco/test/megaco_test_generator.erl b/lib/megaco/test/megaco_test_generator.erl index a021d2451b..4fbc86262e 100644 --- a/lib/megaco/test/megaco_test_generator.erl +++ b/lib/megaco/test/megaco_test_generator.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -26,6 +26,10 @@ -behaviour(gen_server). +-compile({no_auto_import,[error/2]}). + +%% ---- + -export([ start_link/3, start_link/4, diff --git a/lib/megaco/test/megaco_test_megaco_generator.erl b/lib/megaco/test/megaco_test_megaco_generator.erl index 21b33e4abc..f0c723d2cf 100644 --- a/lib/megaco/test/megaco_test_megaco_generator.erl +++ b/lib/megaco/test/megaco_test_megaco_generator.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -26,6 +26,8 @@ -behaviour(megaco_test_generator). +-compile({no_auto_import,[error/1]}). + %% API -export([ start_link/1, start_link/2, diff --git a/lib/megaco/test/megaco_test_msg_prev3a_lib.erl b/lib/megaco/test/megaco_test_msg_prev3a_lib.erl index 2fb0752865..fad7f29831 100644 --- a/lib/megaco/test/megaco_test_msg_prev3a_lib.erl +++ b/lib/megaco/test/megaco_test_msg_prev3a_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -26,6 +26,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco_message_prev3a.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_test_msg_prev3b_lib.erl b/lib/megaco/test/megaco_test_msg_prev3b_lib.erl index 6e042080b7..2f1a093728 100644 --- a/lib/megaco/test/megaco_test_msg_prev3b_lib.erl +++ b/lib/megaco/test/megaco_test_msg_prev3b_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -26,6 +26,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco_message_prev3b.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_test_msg_prev3c_lib.erl b/lib/megaco/test/megaco_test_msg_prev3c_lib.erl index c768105194..884e2f2bad 100644 --- a/lib/megaco/test/megaco_test_msg_prev3c_lib.erl +++ b/lib/megaco/test/megaco_test_msg_prev3c_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -26,6 +26,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco_message_prev3c.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_test_msg_v1_lib.erl b/lib/megaco/test/megaco_test_msg_v1_lib.erl index 424a66b7c9..76665cb575 100644 --- a/lib/megaco/test/megaco_test_msg_v1_lib.erl +++ b/lib/megaco/test/megaco_test_msg_v1_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -28,6 +28,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco_message_v1.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_test_msg_v2_lib.erl b/lib/megaco/test/megaco_test_msg_v2_lib.erl index b29920006d..66e423284a 100644 --- a/lib/megaco/test/megaco_test_msg_v2_lib.erl +++ b/lib/megaco/test/megaco_test_msg_v2_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-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 @@ -26,6 +26,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco_message_v2.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_test_msg_v3_lib.erl b/lib/megaco/test/megaco_test_msg_v3_lib.erl index fee61542b7..24492167ff 100644 --- a/lib/megaco/test/megaco_test_msg_v3_lib.erl +++ b/lib/megaco/test/megaco_test_msg_v3_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2006-2010. All Rights Reserved. +%% Copyright Ericsson AB 2006-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 @@ -26,6 +26,10 @@ %% ---- +-compile({no_auto_import,[error/1]}). + +%% ---- + -include_lib("megaco/include/megaco_message_v3.hrl"). -include_lib("megaco/include/megaco.hrl"). diff --git a/lib/megaco/test/megaco_test_tcp_generator.erl b/lib/megaco/test/megaco_test_tcp_generator.erl index 416d56d742..3ed4c49bab 100644 --- a/lib/megaco/test/megaco_test_tcp_generator.erl +++ b/lib/megaco/test/megaco_test_tcp_generator.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -26,6 +26,8 @@ -behaviour(megaco_test_generator). +-compile({no_auto_import,[error/1]}). + %% API -export([ start_link/1, start_link/2, diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl index cccf4651ab..9b9103c40b 100644 --- a/lib/megaco/test/megaco_timer_test.erl +++ b/lib/megaco/test/megaco_timer_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -23,6 +23,8 @@ %%---------------------------------------------------------------------- -module(megaco_timer_test). +-compile({no_auto_import,[error/1]}). + -export([ t/0, t/1, init_per_testcase/2, end_per_testcase/2, -- cgit v1.2.3 From 58426a1d5a75af9743eeeb57d30d2a2272d60de7 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 28 Feb 2011 11:53:31 +0100 Subject: Fixed end date in copyright note. --- erts/emulator/beam/beam_emu.c | 2 +- erts/emulator/beam/erl_alloc.c | 2 +- erts/emulator/beam/erl_alloc.h | 2 +- erts/emulator/beam/erl_alloc_util.c | 2 +- erts/emulator/beam/erl_alloc_util.h | 2 +- erts/emulator/beam/erl_process.c | 2 +- erts/emulator/utils/loaded | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index af7ed064d3..34ea35edfe 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -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 diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index 323c422c6d..775f4435a9 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2002-2010. All Rights Reserved. + * Copyright Ericsson AB 2002-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 diff --git a/erts/emulator/beam/erl_alloc.h b/erts/emulator/beam/erl_alloc.h index dd4cc22171..17ff9c3b03 100644 --- a/erts/emulator/beam/erl_alloc.h +++ b/erts/emulator/beam/erl_alloc.h @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2002-2010. All Rights Reserved. + * Copyright Ericsson AB 2002-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 diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c index c09f0bbd77..1394b7e829 100644 --- a/erts/emulator/beam/erl_alloc_util.c +++ b/erts/emulator/beam/erl_alloc_util.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2002-2010. All Rights Reserved. + * Copyright Ericsson AB 2002-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 diff --git a/erts/emulator/beam/erl_alloc_util.h b/erts/emulator/beam/erl_alloc_util.h index 5a8db5e29e..d296081714 100644 --- a/erts/emulator/beam/erl_alloc_util.h +++ b/erts/emulator/beam/erl_alloc_util.h @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2002-2010. All Rights Reserved. + * Copyright Ericsson AB 2002-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 diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index e4a871fd7e..fde69aa470 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -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 diff --git a/erts/emulator/utils/loaded b/erts/emulator/utils/loaded index 99a66e7fdb..d124a64a78 100644 --- a/erts/emulator/utils/loaded +++ b/erts/emulator/utils/loaded @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 -- cgit v1.2.3 From 38fc7a0eb46167a27ebac41452ecd1fb0de8803c Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 21 Feb 2011 10:02:16 +0100 Subject: Fix slow parsing of crashdumps This is a first attempt at fixing the problem described in seq11783 - crashdump_viewer is very slow at parsing big crashdumps. To open the first page for a dump of 17M takes about 2 minutes and a dump of 280M takes 1.5-2 hours. The main problmem is that the cdv_dump_index_table, which holds all tags read from the dump, is a bag. Profiling shows that ~95% of the time is spent in ets:insert. The table is now changed to an ordered_set. A second problem occured when a page with many table rows was opened. These pages were sent to inet in one chunk, causing both crashdump_viewer_server and the inets (mod_esi) process to grow very much in memory usage. To overcome this, the pages are now sent to inets in chunks of 1000 rows, and the data is coverted to binaries to avoid data copying between the two processes. Also, some new information in the crashdump was not recognized by the crashdump_viewer. This has been fixed. --- lib/observer/src/crashdump_viewer.erl | 1014 +++++++++++++++----------- lib/observer/src/crashdump_viewer.hrl | 185 ++--- lib/observer/src/crashdump_viewer_html.erl | 584 +++++++-------- lib/observer/test/crashdump_viewer_SUITE.erl | 33 +- 4 files changed, 997 insertions(+), 819 deletions(-) diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index 978541e470..8b96769224 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -23,7 +23,7 @@ %% the server started by webtool and the API for the crashdump viewer tool. %% %% All functions in the API except configData/0 and start_link/0 are -%% called from HTML pages via erl_scheme. +%% called from HTML pages via erl_scheme (mod_esi). %% %% Tables %% ------ @@ -34,18 +34,21 @@ %% %% cdv_dump_index_table: This table holds all tags read from the crashdump. %% Each tag indicates where the information about a specific item starts. -%% The table entry for a tag includes the start and end positions for -%% this item-information. All tags start with a "=" at the beginning of +%% The table entry for a tag includes the start position for this +%% item-information. All tags start with a "=" at the beginning of %% a line. %% %% Process state %% ------------- %% file: The name of the crashdump currently viewed. %% procs_summary: Process summary represented by a list of -%% #proc records. This is used for efficiency reasons when sorting -%% the process summary table instead of reading all processes from -%% the dump again. -%% sorted: atom(), indicated what item was last sorted in process summary. +%% #proc records. This is used for efficiency reasons when sorting the +%% process summary table instead of reading all processes from the +%% dump again. Note that if the dump contains more than +%% ?max_sort_process_num processes, the sort functionality is not +%% available, and the procs_summary field in the state will have the +%% value 'too_many'. +%% sorted: string(), indicated what item was last sorted in process summary. %% This is needed so reverse sorting can be done. %% shared_heap: 'true' if crashdump comes from a system running shared heap, %% else 'false'. @@ -68,26 +71,27 @@ initial_info_frame/2, toggle/2, general_info/2, - processes/2, + processes/3, proc_details/2, - ports/2, - ets_tables/2, - timers/2, - fun_table/2, - atoms/2, + port/2, + ports/3, + ets_tables/3, + internal_ets_tables/2, + timers/3, + fun_table/3, + atoms/3, dist_info/2, - loaded_modules/2, + loaded_modules/3, loaded_mod_details/2, memory/2, allocated_areas/2, allocator_info/2, hash_tables/2, index_tables/2, - sort_procs/2, + sort_procs/3, expand/2, expand_binary/2, - expand_memory/2, - next/2]). + expand_memory/2]). %% gen_server callbacks @@ -113,24 +117,49 @@ % this, it must be explicitly expanded. -define(max_display_binary_size,50). % max size of a binary that will be % directly displayed. +-define(max_sort_process_num,1000). % Max number of processes that allows + % sorting. If more than this number of + % processes exist, they will be displayed + % in the order they are found in the log. +-define(items_chunk_size,?max_sort_process_num). % Number of items per chunk + % when page of many items + % is displayed, e.g. processes, + % timers, funs... + % Must be equal to + % ?max_sort_process_num! + +%% All possible tags - use macros in order to avoid misspelling in the code +-define(allocated_areas,allocated_areas). +-define(allocator,allocator). +-define(atoms,atoms). +-define(binary,binary). +-define(debug_proc_dictionary,debug_proc_dictionary). +-define(ende,ende). +-define(erl_crash_dump,erl_crash_dump). +-define(ets,ets). +-define(fu,fu). +-define(hash_table,hash_table). +-define(hidden_node,hidden_node). +-define(index_table,index_table). +-define(instr_data,instr_data). +-define(internal_ets,internal_ets). +-define(loaded_modules,loaded_modules). +-define(memory,memory). +-define(mod,mod). +-define(no_distribution,no_distribution). +-define(node,node). +-define(not_connected,not_connected). +-define(num_atoms,num_atoms). +-define(old_instr_data,old_instr_data). +-define(port,port). +-define(proc,proc). +-define(proc_dictionary,proc_dictionary). +-define(proc_heap,proc_heap). +-define(proc_messages,proc_messages). +-define(proc_stack,proc_stack). +-define(timer,timer). +-define(visible_node,visible_node). --define(initial_proc_record(Pid), - #proc{pid=Pid, - %% msg_q_len, reds and stack_heap are integers because it must - %% be possible to sort on them. All other fields are strings - msg_q_len=0,reds=0,stack_heap=0, - %% for old dumps start_time, parent and number of heap frament - %% does not exist - start_time="unknown", - parent="unknown", - num_heap_frag="unknown", - %% current_func can be both "current function" and - %% "last scheduled in for" - current_func={"Current Function",?space}, - %% stack_dump, message queue and dictionaries should only be - %% displayed as a link to "Expand" (if dump is from OTP R9B - %% or newer) - _=?space}). -record(state,{file,procs_summary,sorted,shared_heap=false, wordsize=4,num_atoms="unknown",binaries,bg_status}). @@ -266,22 +295,24 @@ toggle(_Env,Input) -> %%% The following functions are called when menu items are clicked. general_info(_Env,_Input) -> call(general_info). -processes(_Env,_Input) -> - call(procs_summary). -ports(_Env,Input) -> % this is also called when a link to a port is clicked - call({ports,Input}). -ets_tables(_Env,Input) -> - call({ets_tables,Input}). -timers(_Env,Input) -> - call({timers,Input}). -fun_table(_Env,_Input) -> - call(funs). -atoms(_Env,_Input) -> - call(atoms). +processes(SessionId,_Env,_Input) -> + call({procs_summary,SessionId}). +ports(SessionId,_Env,_Input) -> + call({ports,SessionId}). +ets_tables(SessionId,_Env,Input) -> + call({ets_tables,SessionId,Input}). +internal_ets_tables(_Env,_Input) -> + call(internal_ets_tables). +timers(SessionId,_Env,Input) -> + call({timers,SessionId,Input}). +fun_table(SessionId,_Env,_Input) -> + call({funs,SessionId}). +atoms(SessionId,_Env,_Input) -> + call({atoms,SessionId}). dist_info(_Env,_Input) -> call(dist_info). -loaded_modules(_Env,_Input) -> - call(loaded_mods). +loaded_modules(SessionId,_Env,_Input) -> + call({loaded_mods,SessionId}). loaded_mod_details(_Env,Input) -> call({loaded_mod_details,Input}). memory(_Env,_Input) -> @@ -303,8 +334,13 @@ proc_details(_Env,Input) -> %%%----------------------------------------------------------------- %%% Called when one of the headings in the process summary table are %%% clicked. It sorts the processes by the clicked heading. -sort_procs(_Env,Input) -> - call({sort_procs,Input}). +sort_procs(SessionId,_Env,Input) -> + call({sort_procs,SessionId,Input}). + +%%%----------------------------------------------------------------- +%%% Called when a link to a port is clicked. +port(_Env,Input) -> + call({port,Input}). %%%----------------------------------------------------------------- %%% Called when the "Expand" link in a call stack (Last Calls) is @@ -324,11 +360,6 @@ expand_memory(_Env,Input) -> expand_binary(_Env,Input) -> call({expand_binary,Input}). -%%%----------------------------------------------------------------- -%%% Called when the "Next" link under atoms is clicked. -next(_Env,Input) -> - call({next,Input}). - %%%----------------------------------------------------------------- %%% Called on regular intervals while waiting for a dump to be read redirect(_Env,_Input) -> @@ -348,7 +379,7 @@ redirect(_Env,_Input) -> %%-------------------------------------------------------------------- init([]) -> ets:new(cdv_menu_table,[set,named_table,{keypos,#menu_item.index},public]), - ets:new(cdv_dump_index_table,[bag,named_table,public]), + ets:new(cdv_dump_index_table,[ordered_set,named_table,public]), {ok, #state{}}. %%-------------------------------------------------------------------- @@ -399,8 +430,17 @@ handle_call(initial_info_frame,_From,State=#state{file=File}) -> GenInfo = general_info(File), NumAtoms = GenInfo#general_info.num_atoms, {WS,SH} = parse_vsn_str(GenInfo#general_info.system_vsn,4,false), + NumProcs = list_to_integer(GenInfo#general_info.num_procs), + ProcsSummary = + if NumProcs > ?max_sort_process_num -> too_many; + true -> State#state.procs_summary + end, + NewState = State#state{shared_heap=SH, + wordsize=WS, + num_atoms=NumAtoms, + procs_summary=ProcsSummary}, Reply = crashdump_viewer_html:general_info(GenInfo), - {reply,Reply,State#state{shared_heap=SH,wordsize=WS,num_atoms=NumAtoms}}; + {reply,Reply,NewState}; handle_call({toggle,Input},_From,State) -> {ok,Index} = get_value("index",httpd:parse_query(Input)), do_toggle(list_to_integer(Index)), @@ -429,7 +469,7 @@ handle_call({expand,Input},_From,State=#state{file=File}) -> handle_call({expand_memory,Input},_From,State=#state{file=File,binaries=B}) -> [{"pid",Pid},{"what",What}] = httpd:parse_query(Input), Reply = - case truncated_warning([{"=proc",Pid}]) of + case truncated_warning([{?proc,Pid}]) of [] -> Expanded = expand_memory(File,What,Pid,B), crashdump_viewer_html:expanded_memory(What,Expanded); @@ -450,149 +490,129 @@ handle_call({expand_binary,Input},_From,State=#state{file=File}) -> close(Fd), Reply=crashdump_viewer_html:expanded_binary(io_lib:format("~p",[Bin])), {reply,Reply,State}; -handle_call({next,Input},_From,State=#state{file=File}) -> - [{"pos",Pos},{"num",N},{"start",Start},{"what",What}] = - httpd:parse_query(Input), - Tags = related_tags(What), - TW = truncated_warning(Tags), - Next = get_next(File,list_to_integer(Pos),list_to_integer(N), - list_to_integer(Start),What), - Reply = crashdump_viewer_html:next(Next,TW), - {reply,Reply,State}; handle_call(general_info,_From,State=#state{file=File}) -> GenInfo=general_info(File), Reply = crashdump_viewer_html:general_info(GenInfo), {reply,Reply,State}; -handle_call(procs_summary,_From,State=#state{file=File,shared_heap=SH}) -> - ProcsSummary = - case State#state.procs_summary of - undefined -> procs_summary(File); - PS -> PS - end, - TW = truncated_warning(["=proc"]), - Reply = crashdump_viewer_html:procs_summary("pid",ProcsSummary,TW,SH), - {reply,Reply,State#state{procs_summary=ProcsSummary,sorted="pid"}}; -handle_call({sort_procs,Input}, _From, State=#state{shared_heap=SH}) -> +handle_call({procs_summary,SessionId},_From,State) -> + TW = truncated_warning([?proc]), + NewState = procs_summary(SessionId,TW,"pid",State#state{sorted=undefined}), + {reply,ok,NewState}; +handle_call({sort_procs,SessionId,Input}, _From, State) -> {ok,Sort} = get_value("sort",httpd:parse_query(Input)), - {ProcsSummary,Sorted} = do_sort_procs(Sort, - State#state.procs_summary, - State#state.sorted), - TW = truncated_warning(["=proc"]), - Reply = crashdump_viewer_html:procs_summary(Sort,ProcsSummary,TW,SH), - {reply,Reply,State#state{sorted=Sorted}}; + TW = truncated_warning([?proc]), + NewState = procs_summary(SessionId,TW,Sort,State), + {reply,ok,NewState}; handle_call({proc_details,Input},_From,State=#state{file=File,shared_heap=SH}) -> {ok,Pid} = get_value("pid",httpd:parse_query(Input)), Reply = case get_proc_details(File,Pid) of {ok,Proc} -> - TW = truncated_warning([{"=proc",Pid}]), + TW = truncated_warning([{?proc,Pid}]), crashdump_viewer_html:proc_details(Pid,Proc,TW,SH); {other_node,Node} -> - TW = truncated_warning(["=visible_node", - "=hidden_node", - "=not_connected"]), + TW = truncated_warning([?visible_node, + ?hidden_node, + ?not_connected]), crashdump_viewer_html:nods(Node,TW); not_found -> crashdump_viewer_html:info_page(["Could not find process: ", Pid],?space) end, {reply, Reply, State}; -handle_call({ports,Input},_From,State=#state{file=File}) -> +handle_call({port,Input},_From,State=#state{file=File}) -> + {ok,P} = get_value("port",httpd:parse_query(Input)), + Id = [$#|P], Reply = - case get_value("port",httpd:parse_query(Input)) of - {ok,P} -> - Id = [$#|P], - case get_port(File,Id) of - {ok,PortInfo} -> - TW = truncated_warning([{"=port",Id}]), - crashdump_viewer_html:ports(Id,[PortInfo],TW); - {other_node,Node} -> - TW = truncated_warning(["=visible_node", - "=hidden_node", - "=not_connected"]), - crashdump_viewer_html:nods(Node,TW); - not_found -> - crashdump_viewer_html:info_page( - ["Could not find port: ",Id],?space) - end; - error -> % no port identity in Input - get all ports - Ports=get_ports(File), - TW = truncated_warning(["=port"]), - crashdump_viewer_html:ports("Port Information",Ports,TW) + case get_port(File,Id) of + {ok,PortInfo} -> + TW = truncated_warning([{?port,Id}]), + crashdump_viewer_html:port(Id,PortInfo,TW); + {other_node,Node} -> + TW = truncated_warning([?visible_node, + ?hidden_node, + ?not_connected]), + crashdump_viewer_html:nods(Node,TW); + not_found -> + crashdump_viewer_html:info_page( + ["Could not find port: ",Id],?space) end, {reply,Reply,State}; -handle_call({ets_tables,Input},_From,State=#state{file=File,wordsize=WS}) -> - {Pid,Heading,InternalEts} = +handle_call({ports,SessionId},_From,State=#state{file=File}) -> + TW = truncated_warning([?port]), + get_ports(SessionId,File,TW), + {reply,ok,State}; +handle_call({ets_tables,SessionId,Input},_From,State=#state{file=File,wordsize=WS}) -> + {Pid,Heading} = case get_value("pid",httpd:parse_query(Input)) of {ok,P} -> - {P,["ETS Tables for Process ",P],[]}; + {P,["ETS Tables for Process ",P]}; error -> - I = get_internal_ets_tables(File,WS), - {'_',"ETS Table Information",I} + {'$2',"ETS Table Information"} end, - EtsTables = get_ets_tables(File,Pid,WS), - TW = truncated_warning(["=ets"]), - Reply = crashdump_viewer_html:ets_tables(Heading,EtsTables,InternalEts,TW), + TW = truncated_warning([?ets]), + get_ets_tables(SessionId,File,Heading,TW,Pid,WS), + {reply,ok,State}; +handle_call(internal_ets_tables,_From,State=#state{file=File,wordsize=WS}) -> + InternalEts = get_internal_ets_tables(File,WS), + TW = truncated_warning([?internal_ets]), + Reply = crashdump_viewer_html:internal_ets_tables(InternalEts,TW), {reply,Reply,State}; -handle_call({timers,Input},_From,State=#state{file=File}) -> +handle_call({timers,SessionId,Input},_From,State=#state{file=File}) -> {Pid,Heading} = case get_value("pid",httpd:parse_query(Input)) of {ok,P} -> {P,["Timers for Process ",P]}; - error -> {'_',"Timer Information"} + error -> {'$2',"Timer Information"} end, - Timers=get_timers(File,Pid), - TW = truncated_warning(["=timer"]), - Reply = crashdump_viewer_html:timers(Heading,Timers,TW), - {reply,Reply,State}; + TW = truncated_warning([?timer]), + get_timers(SessionId,File,Heading,TW,Pid), + {reply,ok,State}; handle_call(dist_info,_From,State=#state{file=File}) -> Nods=nods(File), - TW = truncated_warning(["=visible_node","=hidden_node","=not_connected"]), + TW = truncated_warning([?visible_node,?hidden_node,?not_connected]), Reply = crashdump_viewer_html:nods(Nods,TW), {reply,Reply,State}; -handle_call(loaded_mods,_From,State=#state{file=File}) -> - LoadedMods=loaded_mods(File), - TW = truncated_warning(["=mod"]), - Reply = crashdump_viewer_html:loaded_mods(LoadedMods,TW), - {reply,Reply,State}; +handle_call({loaded_mods,SessionId},_From,State=#state{file=File}) -> + TW = truncated_warning([?mod]), + loaded_mods(SessionId,File,TW), + {reply,ok,State}; handle_call({loaded_mod_details,Input},_From,State=#state{file=File}) -> {ok,Mod} = get_value("mod",httpd:parse_query(Input)), ModInfo = get_loaded_mod_details(File,Mod), - TW = truncated_warning([{"=mod",Mod}]), + TW = truncated_warning([{?mod,Mod}]), Reply = crashdump_viewer_html:loaded_mod_details(ModInfo,TW), {reply,Reply,State}; -handle_call(funs,_From,State=#state{file=File}) -> - Funs=funs(File), - TW = truncated_warning(["=fun"]), - Reply = crashdump_viewer_html:funs(Funs,TW), - {reply,Reply,State}; -handle_call(atoms,_From,State=#state{file=File,num_atoms=Num}) -> - Atoms=atoms(File), - TW = truncated_warning(["=atoms","=num_atoms"]), - Reply = crashdump_viewer_html:atoms(Atoms,Num,TW), - {reply,Reply,State}; +handle_call({funs,SessionId},_From,State=#state{file=File}) -> + TW = truncated_warning([?fu]), + funs(SessionId,File,TW), + {reply,ok,State}; +handle_call({atoms,SessionId},_From,State=#state{file=File,num_atoms=Num}) -> + TW = truncated_warning([?atoms,?num_atoms]), + atoms(SessionId,File,TW,Num), + {reply,ok,State}; handle_call(memory,_From,State=#state{file=File}) -> Memory=memory(File), - TW = truncated_warning(["=memory"]), + TW = truncated_warning([?memory]), Reply = crashdump_viewer_html:memory(Memory,TW), {reply,Reply,State}; handle_call(allocated_areas,_From,State=#state{file=File}) -> AllocatedAreas=allocated_areas(File), - TW = truncated_warning(["=allocated_areas"]), + TW = truncated_warning([?allocated_areas]), Reply = crashdump_viewer_html:allocated_areas(AllocatedAreas,TW), {reply,Reply,State}; handle_call(allocator_info,_From,State=#state{file=File}) -> SlAlloc=allocator_info(File), - TW = truncated_warning(["=allocator"]), + TW = truncated_warning([?allocator]), Reply = crashdump_viewer_html:allocator_info(SlAlloc,TW), {reply,Reply,State}; handle_call(hash_tables,_From,State=#state{file=File}) -> HashTables=hash_tables(File), - TW = truncated_warning(["=hash_table","=index_table"]), + TW = truncated_warning([?hash_table,?index_table]), Reply = crashdump_viewer_html:hash_tables(HashTables,TW), {reply,Reply,State}; handle_call(index_tables,_From,State=#state{file=File}) -> IndexTables=index_tables(File), - TW = truncated_warning(["=hash_table","=index_table"]), + TW = truncated_warning([?hash_table,?index_table]), Reply = crashdump_viewer_html:index_tables(IndexTables,TW), {reply,Reply,State}. @@ -682,9 +702,9 @@ truncated_here(Tag) -> %% Check if the dump was truncated with the same tag, but earlier id. -%% Eg if this is {"=proc","<0.30.0>"}, we should warn if the dump was -%% truncated in {"=proc","<0.29.0>"} or earlier -truncated_earlier({"=proc",Pid}) -> +%% Eg if this is {?proc,"<0.30.0>"}, we should warn if the dump was +%% truncated in {?proc,"<0.29.0>"} or earlier +truncated_earlier({?proc,Pid}) -> compare_pid(Pid,get(truncated_proc)); truncated_earlier(_Tag) -> false. @@ -718,9 +738,37 @@ open(File) -> close(Fd) -> erase(chunk), file:close(Fd). + +%% Set position relative to beginning of file +%% If position is within the already read Chunk, then adjust 'chunk' +%% and 'pos' in process dictionary. Else set position in file. pos_bof(Fd,Pos) -> + case get(pos) of + undefined -> + hard_pos_bof(Fd,Pos); + OldPos when Pos>=OldPos -> + case get(chunk) of + undefined -> + hard_pos_bof(Fd,Pos); + Chunk -> + ChunkSize = byte_size(Chunk), + ChunkEnd = OldPos+ChunkSize, + if Pos= + Diff = Pos-OldPos, + put(pos,Pos), + put(chunk,binary:part(Chunk,Diff,ChunkEnd-Pos)); + true -> + hard_pos_bof(Fd,Pos) + end + end; + _ -> + hard_pos_bof(Fd,Pos) + end. + +hard_pos_bof(Fd,Pos) -> reset_chunk(), - file:position(Fd,{bof,Pos}). + file:position(Fd,{bof,Pos}). + get_chunk(Fd) -> case erase(chunk) of @@ -829,6 +877,10 @@ get_rest_of_line_1(Fd, <<$\n:8,Bin/binary>>, Acc) -> lists:reverse(Acc); get_rest_of_line_1(Fd, <<$\r:8,Rest/binary>>, Acc) -> get_rest_of_line_1(Fd, Rest, Acc); +%% get_rest_of_line_1(Fd, <<$<:8,Rest/binary>>, Acc) -> +%% get_rest_of_line_1(Fd, Rest, [$;,$t,$l,$&|Acc]); +%% get_rest_of_line_1(Fd, <<$>:8,Rest/binary>>, Acc) -> +%% get_rest_of_line_1(Fd, Rest, [$;,$t,$g,$&|Acc]); get_rest_of_line_1(Fd, <>, Acc) -> get_rest_of_line_1(Fd, Rest, [Char|Acc]); get_rest_of_line_1(Fd, <<>>, Acc) -> @@ -979,7 +1031,9 @@ initial_menu() -> [menu_item(0, {"./general_info","General information"},0), menu_item(0, {"./processes","Processes"}, 0), menu_item(0, {"./ports","Ports"}, 0), - menu_item(0, {"./ets_tables","ETS tables"}, 0), + menu_item(2, "ETS tables", 0), + menu_item(0, {"./ets_tables","ETS tables"}, 1), + menu_item(0, {"./internal_ets_tables","Internal ETS tables"}, 1), menu_item(0, {"./timers","Timers"}, 0), menu_item(0, {"./fun_table","Fun table"}, 0), menu_item(0, {"./atoms","Atoms"}, 0), @@ -1066,9 +1120,9 @@ read_file(File) -> {ok,<<$=:8,TagAndRest/binary>>} -> {Tag,Id,Rest,N1} = tag(Fd,TagAndRest,1), case Tag of - "=erl_crash_dump" -> - ets:delete_all_objects(cdv_dump_index_table), - ets:insert(cdv_dump_index_table,{Tag,Id,N1+1}), + ?erl_crash_dump -> + reset_index_table(), + insert_index(Tag,Id,N1+1), put(last_tag,{Tag,""}), Status = background_status(processing,File), background_status(Status), @@ -1107,34 +1161,35 @@ read_file(File) -> background_done({R,undefined,undefined}) end. -indexify(Fd,<<"\n=",TagAndRest/binary>>,N) -> - {Tag,Id,Rest,N1} = tag(Fd,TagAndRest,N+2), - ets:insert(cdv_dump_index_table,{Tag,Id,N1+1}), % +1 to get past newline - put(last_tag,{Tag,Id}), - indexify(Fd,Rest,N1); -indexify(Fd,<<>>,N) -> - case read(Fd) of - {ok,Chunk} when is_binary(Chunk) -> - indexify(Fd,Chunk,N); - eof -> - eof - end; -indexify(Fd,<<$\n>>,N) -> - %% This clause is needed in case the chunk ends with a newline and - %% the next chunk starts with a tag (i.e. "\n=....") - case read(Fd) of - {ok,Chunk} when is_binary(Chunk) -> - indexify(Fd,<<$\n,Chunk/binary>>,N); - eof -> - eof - end; -indexify(Fd,<<_Char:8,Rest/binary>>,N) -> - indexify(Fd,Rest,N+1). +indexify(Fd,Bin,N) -> + case binary:match(Bin,<<"\n=">>) of + {Start,Len} -> + Pos = Start+Len, + <<_:Pos/binary,TagAndRest/binary>> = Bin, + {Tag,Id,Rest,N1} = tag(Fd,TagAndRest,N+Pos), + insert_index(Tag,Id,N1+1), % +1 to get past newline + put(last_tag,{Tag,Id}), + indexify(Fd,Rest,N1); + nomatch -> + case read(Fd) of + {ok,Chunk0} when is_binary(Chunk0) -> + {Chunk,N1} = + case binary:last(Bin) of + $\n -> + {<<$\n,Chunk0/binary>>,N+size(Bin)-1}; + _ -> + {Chunk0,N+size(Bin)} + end, + indexify(Fd,Chunk,N1); + eof -> + eof + end + end. tag(Fd,Bin,N) -> tag(Fd,Bin,N,[],[],tag). tag(_Fd,<<$\n:8,_/binary>>=Rest,N,Gat,Di,_Now) -> - {[$=|lists:reverse(Gat)],lists:reverse(Di),Rest,N}; + {tag_to_atom(lists:reverse(Gat)),lists:reverse(Di),Rest,N}; tag(Fd,<<$\r:8,Rest/binary>>,N,Gat,Di,Now) -> tag(Fd,Rest,N+1,Gat,Di,Now); tag(Fd,<<$::8,IdAndRest/binary>>,N,Gat,Di,tag) -> @@ -1148,12 +1203,12 @@ tag(Fd,<<>>,N,Gat,Di,Now) -> {ok,Chunk} when is_binary(Chunk) -> tag(Fd,Chunk,N,Gat,Di,Now); eof -> - {[$=|lists:reverse(Gat)],lists:reverse(Di),<<>>,N} + {tag_to_atom(lists:reverse(Gat)),lists:reverse(Di),<<>>,N} end. check_if_truncated() -> case get(last_tag) of - {"=end",_} -> + {?ende,_} -> put(truncated,false), put(truncated_proc,false); TruncatedTag -> @@ -1161,32 +1216,29 @@ check_if_truncated() -> find_truncated_proc(TruncatedTag) end. -find_truncated_proc({"=atom",_Id}) -> +find_truncated_proc({?atoms,_Id}) -> put(truncated_proc,false); find_truncated_proc({Tag,Pid}) -> case is_proc_tag(Tag) of true -> put(truncated_proc,Pid); false -> - %% This means that the dump is truncated between "=proc" and - %% "=proc_heap" => memory info is missing for all procs. + %% This means that the dump is truncated between ?proc and + %% ?proc_heap => memory info is missing for all procs. put(truncated_proc,"<0.0.0>") end. -is_proc_tag(Tag) when Tag=="=proc"; - Tag=="=proc_dictionary"; - Tag=="=proc_messages"; - Tag=="=proc_dictionary"; - Tag=="=debug_proc_dictionary"; - Tag=="=proc_stack"; - Tag=="=proc_heap" -> +is_proc_tag(Tag) when Tag==?proc; + Tag==?proc_dictionary; + Tag==?proc_messages; + Tag==?proc_dictionary; + Tag==?debug_proc_dictionary; + Tag==?proc_stack; + Tag==?proc_heap -> true; is_proc_tag(_) -> false. -related_tags("Atoms") -> - ["=atoms","=num_atoms"]. - %%% Inform the crashdump_viewer_server that a background job is completed. background_done(Result) -> Dict = get(), @@ -1198,8 +1250,7 @@ background_status(Status) -> %%%----------------------------------------------------------------- %%% Functions for reading information from the dump general_info(File) -> - [{"=erl_crash_dump",_Id,Start}] = - ets:lookup(cdv_dump_index_table,"=erl_crash_dump"), + [{_Id,Start}] = lookup_index(?erl_crash_dump), Fd = open(File), pos_bof(Fd,Start), Created = case get_rest_of_line(Fd) of @@ -1207,15 +1258,15 @@ general_info(File) -> WholeLine -> WholeLine end, - GI0 = get_general_info(Fd,#general_info{created=Created,_=?space}), + GI0 = get_general_info(Fd,#general_info{created=Created}), GI = case GI0#general_info.num_atoms of ?space -> GI0#general_info{num_atoms=get_num_atoms(Fd)}; _ -> GI0 end, {MemTot,MemMax} = - case ets:lookup(cdv_dump_index_table,"=memory") of - [{"=memory",_,MemStart}] -> + case lookup_index(?memory) of + [{_,MemStart}] -> pos_bof(Fd,MemStart), Memory = get_meminfo(Fd,[]), Tot = case lists:keysearch("total",1,Memory) of @@ -1232,33 +1283,34 @@ general_info(File) -> end, close(Fd), - {NumProcs,NumEts,NumFuns} = count(), + {NumProcs,NumEts,NumFuns,NumTimers} = count(), NodeName = - case ets:lookup(cdv_dump_index_table,"=node") of - [{"=node",N,_Start}] -> + case lookup_index(?node) of + [{N,_Start}] -> N; [] -> - case ets:lookup(cdv_dump_index_table,"=no_distribution") of + case lookup_index(?no_distribution) of [_] -> "nonode@nohost"; [] -> "unknown" end end, InstrInfo = - case ets:member(cdv_dump_index_table,"=old_instr_data") of - true -> - old_instr_data; - false -> - case ets:member(cdv_dump_index_table,"=instr_data") of - true -> - instr_data; - false -> - false - end + case lookup_index(?old_instr_data) of + [] -> + case lookup_index(?instr_data) of + [] -> + false; + _ -> + instr_data + end; + _ -> + old_instr_data end, GI#general_info{node_name=NodeName, num_procs=integer_to_list(NumProcs), num_ets=integer_to_list(NumEts), + num_timers=integer_to_list(NumTimers), num_fun=integer_to_list(NumFuns), mem_tot=MemTot, mem_max=MemMax, @@ -1285,8 +1337,8 @@ get_general_info(Fd,GenInfo) -> end. get_num_atoms(Fd) -> - case ets:match(cdv_dump_index_table,{"=hash_table","atom_tab",'$1'}) of - [[Pos]] -> + case lookup_index(?hash_table,"atom_tab") of + [{_,Pos}] -> pos_bof(Fd,Pos), skip_rest_of_line(Fd), % size skip_rest_of_line(Fd), % used @@ -1300,10 +1352,10 @@ get_num_atoms(Fd) -> get_num_atoms2() end. get_num_atoms2() -> - case ets:lookup(cdv_dump_index_table,"=num_atoms") of + case lookup_index(?num_atoms) of [] -> ?space; - [{"=num_atoms",NA,_Pos}] -> + [{NA,_Pos}] -> %% If dump is translated this will exist case get(truncated) of true -> @@ -1314,43 +1366,70 @@ get_num_atoms2() -> end. count() -> - {ets:select_count(cdv_dump_index_table,count_ms("=proc")), - ets:select_count(cdv_dump_index_table,count_ms("=ets")), - ets:select_count(cdv_dump_index_table,count_ms("=fun"))}. + {count_index(?proc),count_index(?ets),count_index(?fu),count_index(?timer)}. -count_ms(Tag) -> - [{{Tag,'_','_'},[],[true]}]. +%%----------------------------------------------------------------- +%% Page with all processes +%% +%% If there are less than ?max_sort_process_num processes in the dump, +%% we will store the list of processes in the server state in order to +%% allow sorting according to the different columns of the +%% table. Since ?max_sort_process_num=:=?items_chunk_size, there will +%% never be more than one chunk in this case. +%% +%% If there are more than ?max_sort_process_num processes in the dump, +%% no sorting will be allowed, and the processes must be read (chunk +%% by chunk) from the file each time the page is opened. This is to +%% avoid really big data in the server state. +procs_summary(SessionId,TW,_,State=#state{procs_summary=too_many}) -> + chunk_page(SessionId,State#state.file,TW,?proc,processes, + {no_sort,State#state.shared_heap},procs_summary_parsefun()), + State; +procs_summary(SessionId,TW,SortOn,State) -> + ProcsSummary = + case State#state.procs_summary of + undefined -> % first time - read from file + Fd = open(State#state.file), + {PS,_}=lookup_and_parse_index_chunk(first_chunk_pointer(?proc), + Fd,procs_summary_parsefun()), + close(Fd), + PS; + PS -> + PS + end, + {SortedPS,NewSorted} = do_sort_procs(SortOn,ProcsSummary,State#state.sorted), + HtmlInfo = + crashdump_viewer_html:chunk_page(processes,SessionId,TW, + {SortOn,State#state.shared_heap}, + SortedPS), + crashdump_viewer_html:chunk(SessionId,done,HtmlInfo), + State#state{procs_summary=ProcsSummary,sorted=NewSorted}. -procs_summary(File) -> - AllProcs = ets:lookup(cdv_dump_index_table,"=proc"), - Fd = open(File), - R = lists:map(fun({"=proc",Pid,Start}) -> - pos_bof(Fd,Start), - get_procinfo(Fd,fun main_procinfo/4, - ?initial_proc_record(Pid)) - end, - AllProcs), - close(Fd), - R. +procs_summary_parsefun() -> + fun(Fd,Pid) -> + get_procinfo(Fd,fun main_procinfo/4,#proc{pid=Pid}) + end. +%%----------------------------------------------------------------- +%% Page with one process get_proc_details(File,Pid) -> - DumpVsn = ets:lookup_element(cdv_dump_index_table,"=erl_crash_dump",2), - case ets:match(cdv_dump_index_table,{"=proc",Pid,'$1'}) of - [[Start]] -> + [{DumpVsn,_}] = lookup_index(?erl_crash_dump), + case lookup_index(?proc,Pid) of + [{_,Start}] -> Fd = open(File), pos_bof(Fd,Start), Proc0 = case DumpVsn of "0.0" -> %% Old version (translated) - ?initial_proc_record(Pid); + #proc{pid=Pid}; _ -> - (?initial_proc_record(Pid))#proc{ - stack_dump=if_exist("=proc_stack",Pid), - msg_q=if_exist("=proc_messages",Pid), - dict=if_exist("=proc_dictionary",Pid), - debug_dict=if_exist("=debug_proc_dictionary",Pid)} + #proc{pid=Pid, + stack_dump=if_exist(?proc_stack,Pid), + msg_q=if_exist(?proc_messages,Pid), + dict=if_exist(?proc_dictionary,Pid), + debug_dict=if_exist(?debug_proc_dictionary,Pid)} end, Proc = get_procinfo(Fd,fun all_procinfo/4,Proc0), close(Fd), @@ -1368,11 +1447,11 @@ get_proc_details(File,Pid) -> end. if_exist(Tag,Key) -> - case ets:select_count(cdv_dump_index_table,[{{Tag,Key,'_'},[],[true]}]) of + case count_index(Tag,Key) of 0 -> Tag1 = case is_proc_tag(Tag) of - true -> "=proc"; + true -> ?proc; false -> Tag end, case truncated_here({Tag1,Key}) of @@ -1523,13 +1602,14 @@ maybe_other_node(File,Id) -> N end, Ms = ets:fun2ms( - fun({Tag,Id,Start}) when Tag=:="=visible_node", Id=:=Channel -> + fun({{Tag,Start},Ch}) when Tag=:=?visible_node, Ch=:=Channel -> {"Visible Node",Start}; - ({Tag,Id,Start}) when Tag=:="=hidden_node", Id=:=Channel -> + ({{Tag,Start},Ch}) when Tag=:=?hidden_node, Ch=:=Channel -> {"Hidden Node",Start}; - ({Tag,Id,Start}) when Tag=:="=not_connected", Id=:=Channel -> + ({{Tag,Start},Ch}) when Tag=:=?not_connected, Ch=:=Channel -> {"Not Connected Node",Start} end), + case ets:select(cdv_dump_index_table,Ms) of [] -> not_found; @@ -1540,6 +1620,7 @@ maybe_other_node(File,Id) -> {other_node,Type,NodeInfo} end. + expand_memory(File,What,Pid,Binaries) -> Fd = open(File), put(fd,Fd), @@ -1548,8 +1629,8 @@ expand_memory(File,What,Pid,Binaries) -> case What of "StackDump" -> read_stack_dump(Fd,Pid,Dict); "MsgQueue" -> read_messages(Fd,Pid,Dict); - "Dictionary" -> read_dictionary(Fd,"=proc_dictionary",Pid,Dict); - "DebugDictionary" -> read_dictionary(Fd,"=debug_proc_dictionary",Pid,Dict) + "Dictionary" -> read_dictionary(Fd,?proc_dictionary,Pid,Dict); + "DebugDictionary" -> read_dictionary(Fd,?debug_proc_dictionary,Pid,Dict) end, erase(fd), close(Fd), @@ -1559,10 +1640,10 @@ expand_memory(File,What,Pid,Binaries) -> %%% Read binaries. %%% read_binaries(Fd) -> - AllBinaries = ets:match(cdv_dump_index_table,{"=binary",'$1','$2'}), + AllBinaries = lookup_index(?binary), read_binaries(Fd,AllBinaries, gb_trees:empty()). -read_binaries(Fd,[[Addr0,Pos]|Bins],Dict0) -> +read_binaries(Fd,[{Addr0,Pos}|Bins],Dict0) -> pos_bof(Fd,Pos), {Addr,_} = get_hex(Addr0), Dict = @@ -1603,15 +1684,15 @@ parse_binary(Addr, Line0, Dict) -> %%% read_stack_dump(Fd,Pid,Dict) -> - case ets:match(cdv_dump_index_table,{"=proc_stack",Pid,'$1'}) of - [[Start]] -> + case lookup_index(?proc_stack,Pid) of + [{_,Start}] -> pos_bof(Fd,Start), read_stack_dump1(Fd,Dict,[]); [] -> [] end. read_stack_dump1(Fd,Dict,Acc) -> - %% This function is never called if the dump is truncated in "=proc_heap:Pid" + %% This function is never called if the dump is truncated in {?proc_heap,Pid} case val(Fd) of "=" ++ _next_tag -> lists:reverse(Acc); @@ -1631,15 +1712,15 @@ parse_top(Line0, D) -> %%% read_messages(Fd,Pid,Dict) -> - case ets:match(cdv_dump_index_table,{"=proc_messages",Pid,'$1'}) of - [[Start]] -> + case lookup_index(?proc_messages,Pid) of + [{_,Start}] -> pos_bof(Fd,Start), read_messages1(Fd,Dict,[]); [] -> [] end. read_messages1(Fd,Dict,Acc) -> - %% This function is never called if the dump is truncated in "=proc_heap:Pid" + %% This function is never called if the dump is truncated in {?proc_heap,Pid} case val(Fd) of "=" ++ _next_tag -> lists:reverse(Acc); @@ -1659,15 +1740,15 @@ parse_message(Line0, D) -> %%% read_dictionary(Fd,Tag,Pid,Dict) -> - case ets:match(cdv_dump_index_table,{Tag,Pid,'$1'}) of - [[Start]] -> + case lookup_index(Tag,Pid) of + [{_,Start}] -> pos_bof(Fd,Start), read_dictionary1(Fd,Dict,[]); [] -> [] end. read_dictionary1(Fd,Dict,Acc) -> - %% This function is never called if the dump is truncated in "=proc_heap:Pid" + %% This function is never called if the dump is truncated in {?proc_heap,Pid} case val(Fd) of "=" ++ _next_tag -> lists:reverse(Acc); @@ -1686,8 +1767,8 @@ parse_dictionary(Line0, D) -> %%% read_heap(Fd,Pid,Dict0) -> - case ets:match(cdv_dump_index_table,{"=proc_heap",Pid,'$2'}) of - [[Pos]] -> + case lookup_index(?proc_heap,Pid) of + [{_,Pos}] -> pos_bof(Fd,Pos), read_heap(Dict0); [] -> @@ -1695,7 +1776,7 @@ read_heap(Fd,Pid,Dict0) -> end. read_heap(Dict0) -> - %% This function is never called if the dump is truncated in "=proc_heap:Pid" + %% This function is never called if the dump is truncated in {?proc_heap,Pid} case get(fd) of end_of_heap -> Dict0; @@ -1761,12 +1842,14 @@ do_sort_procs("name",Procs,Sorted) -> _ -> {Result,"name"} end. - +%%----------------------------------------------------------------- +%% Page with one port get_port(File,Port) -> - case ets:match(cdv_dump_index_table,{"=port",Port,'$1'}) of - [[Start]] -> + case lookup_index(?port,Port) of + [{_,Start}] -> Fd = open(File), - R = get_portinfo(Fd,Port,Start), + pos_bof(Fd,Start), + R = get_portinfo(Fd,#port{id=Port}), close(Fd), {ok,R}; [] -> @@ -1781,18 +1864,11 @@ get_port(File,Port) -> end end. -get_ports(File) -> - Ports = ets:lookup(cdv_dump_index_table,"=port"), - Fd = open(File), - R = lists:map(fun({"=port",Id,Start}) -> get_portinfo(Fd,Id,Start) end, - Ports), - close(Fd), - R. - - -get_portinfo(Fd,Id,Start) -> - pos_bof(Fd,Start), - get_portinfo(Fd,#port{id=Id,_=?space}). +%%----------------------------------------------------------------- +%% Page with all ports +get_ports(SessionId,File,TW) -> + ParseFun = fun(Fd,Id) -> get_portinfo(Fd,#port{id=Id}) end, + chunk_page(SessionId,File,TW,?port,ports,[],ParseFun). get_portinfo(Fd,Port) -> case line_head(Fd) of @@ -1802,6 +1878,10 @@ get_portinfo(Fd,Port) -> get_portinfo(Fd,Port#port{connected=val(Fd)}); "Links" -> get_portinfo(Fd,Port#port{links=val(Fd)}); + "Registered as" -> + get_portinfo(Fd,Port#port{name=val(Fd)}); + "Monitors" -> + get_portinfo(Fd,Port#port{monitors=val(Fd)}); "Port controls linked-in driver" -> get_portinfo(Fd,Port#port{controls=["Linked in driver: " | val(Fd)]}); @@ -1820,30 +1900,12 @@ get_portinfo(Fd,Port) -> Port end. -get_ets_tables(File,Pid,WS) -> - EtsTables = ets:match_object(cdv_dump_index_table,{"=ets",Pid,'_'}), - Fd = open(File), - R = lists:map(fun({"=ets",P,Start}) -> - get_etsinfo(Fd,P,Start,WS) - end, - EtsTables), - close(Fd), - R. -get_internal_ets_tables(File,WS) -> - InternalEts = ets:match_object(cdv_dump_index_table, - {"=internal_ets",'_','_'}), - Fd = open(File), - R = lists:map(fun({"=internal_ets",Descr,Start}) -> - {Descr,get_etsinfo(Fd,undefined,Start,WS)} - end, - InternalEts), - close(Fd), - R. - -get_etsinfo(Fd,Pid,Start,WS) -> - pos_bof(Fd,Start), - get_etsinfo(Fd,#ets_table{pid=Pid,type="hash",_=?space},WS). +%%----------------------------------------------------------------- +%% Page with external ets tables +get_ets_tables(SessionId,File,Heading,TW,Pid,WS) -> + ParseFun = fun(Fd,Id) -> get_etsinfo(Fd,#ets_table{pid=Id},WS) end, + chunk_page(SessionId,File,TW,{?ets,Pid},ets_tables,Heading,ParseFun). get_etsinfo(Fd,EtsTable,WS) -> case line_head(Fd) of @@ -1875,26 +1937,32 @@ get_etsinfo(Fd,EtsTable,WS) -> EtsTable end. -get_timers(File,Pid) -> - Timers = ets:match_object(cdv_dump_index_table,{"=timer",Pid,'$1'}), + +%% Internal ets table page +get_internal_ets_tables(File,WS) -> + InternalEts = lookup_index(?internal_ets), Fd = open(File), - R = lists:map(fun({"=timer",P,Start}) -> - get_timerinfo(Fd,P,Start) - end, - Timers), + R = lists:map( + fun({Descr,Start}) -> + pos_bof(Fd,Start), + {Descr,get_etsinfo(Fd,#ets_table{},WS)} + end, + InternalEts), close(Fd), R. -get_timerinfo(Fd,Pid,Start) -> - pos_bof(Fd,Start), - get_timerinfo(Fd,#timer{pid=Pid,_=?space}). +%%----------------------------------------------------------------- +%% Page with list of all timers +get_timers(SessionId,File,Heading,TW,Pid) -> + ParseFun = fun(Fd,Id) -> get_timerinfo_1(Fd,#timer{pid=Id}) end, + chunk_page(SessionId,File,TW,{?timer,Pid},timers,Heading,ParseFun). -get_timerinfo(Fd,Timer) -> +get_timerinfo_1(Fd,Timer) -> case line_head(Fd) of "Message" -> - get_timerinfo(Fd,Timer#timer{msg=val(Fd)}); + get_timerinfo_1(Fd,Timer#timer{msg=val(Fd)}); "Time left" -> - get_timerinfo(Fd,Timer#timer{time=val(Fd)}); + get_timerinfo_1(Fd,Timer#timer{time=val(Fd)}); "=" ++ _next_tag -> Timer; Other -> @@ -1902,25 +1970,27 @@ get_timerinfo(Fd,Timer) -> Timer end. +%%----------------------------------------------------------------- +%% Page with information about the erlang distribution nods(File) -> - case ets:lookup(cdv_dump_index_table,"=no_distribution") of + case lookup_index(?no_distribution) of [] -> - V = ets:lookup(cdv_dump_index_table,"=visible_node"), - H = ets:lookup(cdv_dump_index_table,"=hidden_node"), - N = ets:lookup(cdv_dump_index_table,"=not_connected"), + V = lookup_index(?visible_node), + H = lookup_index(?hidden_node), + N = lookup_index(?not_connected), Fd = open(File), Visible = lists:map( - fun({"=visible_node",Channel,Start}) -> + fun({Channel,Start}) -> get_nodeinfo(Fd,Channel,Start) end, V), Hidden = lists:map( - fun({"=hidden_node",Channel,Start}) -> + fun({Channel,Start}) -> get_nodeinfo(Fd,Channel,Start) end, H), NotConnected = lists:map( - fun({"=not_connected",Channel,Start}) -> + fun({Channel,Start}) -> get_nodeinfo(Fd,Channel,Start) end, N), @@ -1932,7 +2002,7 @@ nods(File) -> get_nodeinfo(Fd,Channel,Start) -> pos_bof(Fd,Start), - get_nodeinfo(Fd,#nod{channel=Channel,_=?space}). + get_nodeinfo(Fd,#nod{channel=Channel}). get_nodeinfo(Fd,Nod) -> case line_head(Fd) of @@ -1963,26 +2033,37 @@ get_nodeinfo(Fd,Nod) -> Nod end. -loaded_mods(File) -> - case ets:lookup(cdv_dump_index_table,"=loaded_modules") of - [{"=loaded_modules",_,StartTotal}] -> - Fd = open(File), - pos_bof(Fd,StartTotal), - {CC,OC} = get_loaded_mod_totals(Fd,{"unknown","unknown"}), - - Mods = ets:lookup(cdv_dump_index_table,"=mod"), - LM = lists:map(fun({"=mod",M,Start}) -> - pos_bof(Fd,Start), - InitLM = #loaded_mod{mod=M,_=?space}, - get_loaded_mod_info(Fd,InitLM, - fun main_modinfo/3) - end, - Mods), - close(Fd), - {CC,OC,LM}; - [] -> - {"unknown","unknown",[]} - end. +%%----------------------------------------------------------------- +%% Page with details about one loaded modules +get_loaded_mod_details(File,Mod) -> + [{_,Start}] = lookup_index(?mod,Mod), + Fd = open(File), + pos_bof(Fd,Start), + InitLM = #loaded_mod{mod=Mod,old_size="No old code exists"}, + ModInfo = get_loaded_mod_info(Fd,InitLM,fun all_modinfo/3), + close(Fd), + ModInfo. + +%%----------------------------------------------------------------- +%% Page with list of all loaded modules +loaded_mods(SessionId,File,TW) -> + ParseFun = + fun(Fd,Id) -> + get_loaded_mod_info(Fd,#loaded_mod{mod=Id}, + fun main_modinfo/3) + end, + {CC,OC} = + case lookup_index(?loaded_modules) of + [{_,StartTotal}] -> + Fd = open(File), + pos_bof(Fd,StartTotal), + R = get_loaded_mod_totals(Fd,{"unknown","unknown"}), + close(Fd), + R; + [] -> + {"unknown","unknown"} + end, + chunk_page(SessionId,File,TW,?mod,loaded_mods,{CC,OC},ParseFun). get_loaded_mod_totals(Fd,{CC,OC}) -> case line_head(Fd) of @@ -1997,16 +2078,6 @@ get_loaded_mod_totals(Fd,{CC,OC}) -> {CC,OC} % truncated file end. -get_loaded_mod_details(File,Mod) -> - [[Start]] = ets:match(cdv_dump_index_table,{"=mod",Mod,'$1'}), - Fd = open(File), - pos_bof(Fd,Start), - InitLM = #loaded_mod{mod=Mod,old_size="No old code exists", - _="No information available"}, - ModInfo = get_loaded_mod_info(Fd,InitLM,fun all_modinfo/3), - close(Fd), - ModInfo. - get_loaded_mod_info(Fd,LM,Fun) -> case line_head(Fd) of "Current size" -> @@ -2073,39 +2144,26 @@ hex_to_dec("A") -> 10; hex_to_dec(N) -> list_to_integer(N). +%%----------------------------------------------------------------- +%% Page with list of all funs +funs(SessionId,File,TW) -> + ParseFun = fun(Fd,_Id) -> get_funinfo(Fd,#fu{}) end, + chunk_page(SessionId,File,TW,?fu,funs,[],ParseFun). -funs(File) -> - case ets:lookup(cdv_dump_index_table,"=fun") of - [] -> - []; - AllFuns -> - Fd = open(File), - R = lists:map(fun({"=fun",_,Start}) -> - get_funinfo(Fd,Start) - end, - AllFuns), - close(Fd), - R - end. - -get_funinfo(Fd,Start) -> - pos_bof(Fd,Start), - get_funinfo1(Fd,#fu{_=?space}). - -get_funinfo1(Fd,Fu) -> +get_funinfo(Fd,Fu) -> case line_head(Fd) of "Module" -> - get_funinfo1(Fd,Fu#fu{module=val(Fd)}); + get_funinfo(Fd,Fu#fu{module=val(Fd)}); "Uniq" -> - get_funinfo1(Fd,Fu#fu{uniq=val(Fd)}); + get_funinfo(Fd,Fu#fu{uniq=val(Fd)}); "Index" -> - get_funinfo1(Fd,Fu#fu{index=val(Fd)}); + get_funinfo(Fd,Fu#fu{index=val(Fd)}); "Address" -> - get_funinfo1(Fd,Fu#fu{address=val(Fd)}); + get_funinfo(Fd,Fu#fu{address=val(Fd)}); "Native_address" -> - get_funinfo1(Fd,Fu#fu{native_address=val(Fd)}); + get_funinfo(Fd,Fu#fu{native_address=val(Fd)}); "Refc" -> - get_funinfo1(Fd,Fu#fu{refc=val(Fd)}); + get_funinfo(Fd,Fu#fu{refc=val(Fd)}); "=" ++ _next_tag -> Fu; Other -> @@ -2113,28 +2171,44 @@ get_funinfo1(Fd,Fu) -> Fu end. -atoms(File) -> - case ets:lookup(cdv_dump_index_table,"=atoms") of - [{_atoms,_Id,Start}] -> +%%----------------------------------------------------------------- +%% Page with list of all atoms +atoms(SessionId,File,TW,Num) -> + case lookup_index(?atoms) of + [{_Id,Start}] -> Fd = open(File), pos_bof(Fd,Start), - R = case get_n_lines_of_tag(Fd,100) of - {all,N,Lines} -> - {n_lines,1,N,"Atoms",Lines}; - {part,100,Lines} -> - {n_lines,1,100,"Atoms",Lines,get(pos)}; - empty -> - [] - end, - close(Fd), - R; + {Atoms,Cont} = get_atoms(Fd,1000), + crashdump_viewer_html:atoms(SessionId,TW,Num,Atoms), + atoms_chunks(Fd,SessionId,Cont); _ -> - [] + crashdump_viewer_html:atoms(SessionId,TW,Num,done) end. +get_atoms(Fd,Number) -> + case get_n_lines_of_tag(Fd,Number) of + {all,_,Lines} -> + {Lines,done}; + {part,_,Lines} -> + {Lines,Number}; + empty -> + {[],done} + end. + +atoms_chunks(Fd,SessionId,done) -> + close(Fd), + crashdump_viewer_html:atoms_chunk(SessionId,done); +atoms_chunks(Fd,SessionId,Number) -> + {Atoms,Cont} = get_atoms(Fd,Number), + crashdump_viewer_html:atoms_chunk(SessionId,Atoms), + atoms_chunks(Fd,SessionId,Cont). + + +%%----------------------------------------------------------------- +%% Page with memory information memory(File) -> - case ets:lookup(cdv_dump_index_table,"=memory") of - [{"=memory",_,Start}] -> + case lookup_index(?memory) of + [{_,Start}] -> Fd = open(File), pos_bof(Fd,Start), R = get_meminfo(Fd,[]), @@ -2153,10 +2227,12 @@ get_meminfo(Fd,Acc) -> Key -> get_meminfo(Fd,[{Key,val(Fd)}|Acc]) end. - + +%%----------------------------------------------------------------- +%% Page with information about allocated areas allocated_areas(File) -> - case ets:lookup(cdv_dump_index_table,"=allocated_areas") of - [{"=allocated_areas",_,Start}] -> + case lookup_index(?allocated_areas) of + [{_,Start}] -> Fd = open(File), pos_bof(Fd,Start), R = get_allocareainfo(Fd,[]), @@ -2183,14 +2259,16 @@ get_allocareainfo(Fd,Acc) -> end, get_allocareainfo(Fd,[AllocInfo|Acc]) end. - + +%%----------------------------------------------------------------- +%% Page with information about allocators allocator_info(File) -> - case ets:lookup(cdv_dump_index_table,"=allocator") of + case lookup_index(?allocator) of [] -> []; AllAllocators -> Fd = open(File), - R = lists:map(fun({"=allocator",Heading,Start}) -> + R = lists:map(fun({Heading,Start}) -> {Heading,get_allocatorinfo(Fd,Start)} end, AllAllocators), @@ -2220,14 +2298,15 @@ get_all_vals([],Acc) -> get_all_vals([Char|Rest],Acc) -> get_all_vals(Rest,[Char|Acc]). - +%%----------------------------------------------------------------- +%% Page with hash table information hash_tables(File) -> - case ets:lookup(cdv_dump_index_table,"=hash_table") of + case lookup_index(?hash_table) of [] -> []; AllHashTables -> Fd = open(File), - R = lists:map(fun({"=hash_table",Name,Start}) -> + R = lists:map(fun({Name,Start}) -> get_hashtableinfo(Fd,Name,Start) end, AllHashTables), @@ -2237,7 +2316,7 @@ hash_tables(File) -> get_hashtableinfo(Fd,Name,Start) -> pos_bof(Fd,Start), - get_hashtableinfo1(Fd,#hash_table{name=Name,_=?space}). + get_hashtableinfo1(Fd,#hash_table{name=Name}). get_hashtableinfo1(Fd,HashTable) -> case line_head(Fd) of @@ -2256,13 +2335,15 @@ get_hashtableinfo1(Fd,HashTable) -> HashTable end. +%%----------------------------------------------------------------- +%% Page with index table information index_tables(File) -> - case ets:lookup(cdv_dump_index_table,"=index_table") of + case lookup_index(?index_table) of [] -> []; AllIndexTables -> Fd = open(File), - R = lists:map(fun({"=index_table",Name,Start}) -> + R = lists:map(fun({Name,Start}) -> get_indextableinfo(Fd,Name,Start) end, AllIndexTables), @@ -2272,7 +2353,7 @@ index_tables(File) -> get_indextableinfo(Fd,Name,Start) -> pos_bof(Fd,Start), - get_indextableinfo1(Fd,#index_table{name=Name,_=?space}). + get_indextableinfo1(Fd,#index_table{name=Name}). get_indextableinfo1(Fd,IndexTable) -> case line_head(Fd) of @@ -2284,6 +2365,8 @@ get_indextableinfo1(Fd,IndexTable) -> get_indextableinfo1(Fd,IndexTable#index_table{limit=val(Fd)}); "rate" -> get_indextableinfo1(Fd,IndexTable#index_table{rate=val(Fd)}); + "entries" -> + get_indextableinfo1(Fd,IndexTable#index_table{entries=val(Fd)}); "=" ++ _next_tag -> IndexTable; Other -> @@ -2295,6 +2378,8 @@ get_indextableinfo1(Fd,IndexTable) -> +%%----------------------------------------------------------------- +%% Expand a set of data which was shown in a truncated form on get_expanded(File,Pos,Size) -> Fd = open(File), R = case file:pread(Fd,Pos,Size) of @@ -2307,20 +2392,6 @@ get_expanded(File,Pos,Size) -> R. -get_next(File,Pos,N0,Start,What) -> - Fd = open(File), - pos_bof(Fd,Pos), - R = case get_n_lines_of_tag(Fd,N0) of - {all,N,Lines} -> - {n_lines,Start,N,What,Lines}; - {part,N,Lines} -> - {n_lines,Start,N,What,Lines,get(pos)} - end, - close(Fd), - R. - - - replace_all(From,To,[From|Rest],Acc) -> replace_all(From,To,Rest,[To|Acc]); replace_all(From,To,[Char|Rest],Acc) -> @@ -2567,3 +2638,110 @@ get_binary(_N, [], _Acc) -> cdvbin(Sz,Pos) -> "#CDVBin<"++integer_to_list(Sz)++","++integer_to_list(Pos)++">". + + +%%----------------------------------------------------------------- +%% Functions for accessing the cdv_dump_index_table +reset_index_table() -> + ets:delete_all_objects(cdv_dump_index_table). + +insert_index(Tag,Id,Pos) -> + ets:insert(cdv_dump_index_table,{{Tag,Pos},Id}). + +lookup_index(Tag) -> + lookup_index(Tag,'$2'). +lookup_index(Tag,Id) -> + ets:select(cdv_dump_index_table,[{{{Tag,'$1'},Id},[],[{{Id,'$1'}}]}]). + +lookup_index_chunk({'#CDVFirstChunk',Tag,Id}) -> + ets:select(cdv_dump_index_table, + [{{{Tag,'$1'},Id},[],[{{Id,'$1'}}]}], + ?items_chunk_size); +lookup_index_chunk(Cont) -> + ets:select(Cont). + +%% Create a tag which can be used instead of an ets Continuation for +%% the first call to lookup_index_chunk. +first_chunk_pointer({Tag,Id}) -> + {'#CDVFirstChunk',Tag,Id}; +first_chunk_pointer(Tag) -> + first_chunk_pointer({Tag,'$2'}). + +count_index(Tag) -> + ets:select_count(cdv_dump_index_table,[{{{Tag,'_'},'_'},[],[true]}]). +count_index(Tag,Id) -> + ets:select_count(cdv_dump_index_table,[{{{Tag,'_'},Id},[],[true]}]). + + +%%----------------------------------------------------------------- +%% Convert tags read from crashdump to atoms used as first part of key +%% in cdv_dump_index_table +tag_to_atom("allocated_areas") -> ?allocated_areas; +tag_to_atom("allocator") -> ?allocator; +tag_to_atom("atoms") -> ?atoms; +tag_to_atom("binary") -> ?binary; +tag_to_atom("debug_proc_dictionary") -> ?debug_proc_dictionary; +tag_to_atom("end") -> ?ende; +tag_to_atom("erl_crash_dump") -> ?erl_crash_dump; +tag_to_atom("ets") -> ?ets; +tag_to_atom("fun") -> ?fu; +tag_to_atom("hash_table") -> ?hash_table; +tag_to_atom("hidden_node") -> ?hidden_node; +tag_to_atom("index_table") -> ?index_table; +tag_to_atom("instr_data") -> ?instr_data; +tag_to_atom("internal_ets") -> ?internal_ets; +tag_to_atom("loaded_modules") -> ?loaded_modules; +tag_to_atom("memory") -> ?memory; +tag_to_atom("mod") -> ?mod; +tag_to_atom("no_distribution") -> ?no_distribution; +tag_to_atom("node") -> ?node; +tag_to_atom("not_connected") -> ?not_connected; +tag_to_atom("num_atoms") -> ?num_atoms; +tag_to_atom("old_instr_data") -> ?old_instr_data; +tag_to_atom("port") -> ?port; +tag_to_atom("proc") -> ?proc; +tag_to_atom("proc_dictionary") -> ?proc_dictionary; +tag_to_atom("proc_heap") -> ?proc_heap; +tag_to_atom("proc_messages") -> ?proc_messages; +tag_to_atom("proc_stack") -> ?proc_stack; +tag_to_atom("timer") -> ?timer; +tag_to_atom("visible_node") -> ?visible_node; +tag_to_atom(UnknownTag) -> + io:format("WARNING: Found unexpected tag:~s~n",[UnknownTag]), + list_to_atom(UnknownTag). + +%%%----------------------------------------------------------------- +%%% Create a page by sending chunk by chunk to crashdump_viewer_html +chunk_page(SessionId,File,TW,What,HtmlCB,HtmlExtra,ParseFun) -> + Fd = open(File), + case lookup_and_parse_index_chunk(first_chunk_pointer(What),Fd,ParseFun) of + done -> + crashdump_viewer_html:chunk_page(HtmlCB,SessionId,TW,HtmlExtra,done); + {Chunk,Cont} -> + HtmlInfo = crashdump_viewer_html:chunk_page( + HtmlCB, + SessionId,TW,HtmlExtra,Chunk), + chunk_page_1(Fd,HtmlInfo,SessionId,ParseFun, + lookup_and_parse_index_chunk(Cont,Fd,ParseFun)) + end. + +chunk_page_1(Fd,HtmlInfo,SessionId,_ParseFun,done) -> + crashdump_viewer_html:chunk(SessionId,done,HtmlInfo), + close(Fd); +chunk_page_1(Fd,HtmlInfo,SessionId,ParseFun,{Chunk,Cont}) -> + crashdump_viewer_html:chunk(SessionId,Chunk,HtmlInfo), + chunk_page_1(Fd,HtmlInfo,SessionId,ParseFun, + lookup_and_parse_index_chunk(Cont,Fd,ParseFun)). + +lookup_and_parse_index_chunk(Pointer,Fd,ParseFun) -> + case lookup_index_chunk(Pointer) of + '$end_of_table' -> + done; + {Chunk,Cont} -> + R = lists:map(fun({Id,Start}) -> + pos_bof(Fd,Start), + ParseFun(Fd,Id) + end, + Chunk), + {R,Cont} + end. diff --git a/lib/observer/src/crashdump_viewer.hrl b/lib/observer/src/crashdump_viewer.hrl index 6ce727cd3e..466f33b63b 100644 --- a/lib/observer/src/crashdump_viewer.hrl +++ b/lib/observer/src/crashdump_viewer.hrl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -17,117 +17,136 @@ %% %CopyrightEnd% %% -define(space, " "). +-define(unknown, "unknown"). -record(menu_item,{index,picture,text,depth,children,state,target}). -record(general_info, {created, - slogan, - system_vsn, - compile_time, - taints, - node_name, - num_atoms, - num_procs, - num_ets, - num_fun, - mem_tot, - mem_max, - instr_info}). + slogan=?space, + system_vsn=?space, + compile_time=?space, + taints=?space, + node_name=?space, + num_atoms=?space, + num_procs=?space, + num_ets=?space, + num_timers=?space, + num_fun=?space, + mem_tot=?space, + mem_max=?space, + instr_info=?space}). -record(proc, + %% Initial data according to the follwoing: + %% + %% msg_q_len, reds and stack_heap are integers because it must + %% be possible to sort on them. All other fields are strings + %% + %% for old dumps start_time, parent and number of heap frament + %% does not exist + %% + %% current_func can be both "current function" and + %% "last scheduled in for" + %% + %% stack_dump, message queue and dictionaries should only be + %% displayed as a link to "Expand" (if dump is from OTP R9B + %% or newer) {pid, - name, - init_func, - parent, - start_time, - state, - current_func, - msg_q_len, - msg_q, - last_calls, - links, - prog_count, - cp, - arity, - dict, - debug_dict, - reds, - num_heap_frag, - heap_frag_data, - stack_heap, - old_heap, - heap_unused, - old_heap_unused, - new_heap_start, - new_heap_top, - stack_top, - stack_end, - old_heap_start, - old_heap_top, - old_heap_end, - stack_dump}). + name=?space, + init_func=?space, + parent=?unknown, + start_time=?unknown, + state=?space, + current_func={"Current Function",?space}, + msg_q_len=0, + msg_q=?space, + last_calls=?space, + links=?space, + prog_count=?space, + cp=?space, + arity=?space, + dict=?space, + debug_dict=?space, + reds=0, + num_heap_frag=?unknown, + heap_frag_data=?space, + stack_heap=0, + old_heap=?space, + heap_unused=?space, + old_heap_unused=?space, + new_heap_start=?space, + new_heap_top=?space, + stack_top=?space, + stack_end=?space, + old_heap_start=?space, + old_heap_top=?space, + old_heap_end=?space, + stack_dump=?space}). -record(port, {id, - slot, - connected, - links, - controls}). + slot=?space, + connected=?space, + links=?space, + name=?space, + monitors=?space, + controls=?space}). -record(ets_table, {pid, - slot, - id, - name, - type, - buckets, - size, - memory}). + slot=?space, + id=?space, + name=?space, + type="hash", + buckets=?space, + size=?space, + memory=?space}). -record(timer, {pid, - msg, - time}). + msg=?space, + time=?space}). -record(fu, - {module, - uniq, - index, - address, - native_address, - refc}). + {module=?space, + uniq=?space, + index=?space, + address=?space, + native_address=?space, + refc=?space}). -record(nod, - {name, + {name=?space, channel, - controller, - creation, - remote_links, - remote_mon, - remote_mon_by, - error}). + controller=?space, + creation=?space, + remote_links=?space, + remote_mon=?space, + remote_mon_by=?space, + error=?space}). -record(loaded_mod, {mod, - current_size, - current_attrib, - current_comp_info, - old_size, - old_attrib, - old_comp_info}). + current_size=?space, + current_attrib=?space, + current_comp_info=?space, + old_size=?space, + old_attrib=?space, + old_comp_info=?space}). -record(hash_table, {name, - size, - used, - objs, - depth}). + size=?space, + used=?space, + objs=?space, + depth=?space}). -record(index_table, {name, - size, - used, - limit, - rate}). + size=?space, + used=?space, + limit=?space, + rate=?space, + entries=?space}). diff --git a/lib/observer/src/crashdump_viewer_html.erl b/lib/observer/src/crashdump_viewer_html.erl index 5e7bbf62a0..0d70c9b86f 100644 --- a/lib/observer/src/crashdump_viewer_html.erl +++ b/lib/observer/src/crashdump_viewer_html.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2009. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -32,25 +32,23 @@ general_info/1, pretty_info_page/2, info_page/2, - procs_summary/4, proc_details/4, expanded_memory/2, expanded_binary/1, - next/2, - ports/3, - timers/3, - ets_tables/4, + port/3, + internal_ets_tables/2, nods/2, - loaded_mods/2, loaded_mod_details/2, - funs/2, - atoms/3, + atoms/4, + atoms_chunk/2, memory/2, allocated_areas/2, allocator_info/2, hash_tables/2, index_tables/2, - error/2]). + error/2, + chunk_page/5, + chunk/3]). -include("crashdump_viewer.hrl"). @@ -235,6 +233,8 @@ general_info_body(Heading,GenInfo) -> td(GenInfo#general_info.num_procs)]), tr([th("ALIGN=left BGCOLOR=\"#8899AA\"","ETS tables"), td(GenInfo#general_info.num_ets)]), + tr([th("ALIGN=left BGCOLOR=\"#8899AA\"","Timers"), + td(GenInfo#general_info.num_timers)]), tr([th("ALIGN=left BGCOLOR=\"#8899AA\"","Funs"), td(GenInfo#general_info.num_fun)])]), case GenInfo#general_info.instr_info of @@ -294,60 +294,6 @@ pretty_info_body(Heading,Info) -> [h1(Heading), pre(pretty_format(Info))]. -%%%----------------------------------------------------------------- -%%% Make table with summary of process information -procs_summary(Sorted,ProcsSummary,TW,SharedHeap) -> - Heading = "Process Information", - header(Heading, - body( - procs_summary_body(Heading,ProcsSummary,TW,Sorted,SharedHeap))). - -procs_summary_body(Heading,[],TW,_Sorted,_SharedHeap) -> - [h1(Heading), - warn(TW), - "No processes were found\n"]; -procs_summary_body(Heading,ProcsSummary,TW,Sorted,SharedHeap) -> - MemHeading = - if SharedHeap -> - "Stack"; - true -> - "Stack+heap" - end, - - [heading(Heading,"processes"), - warn(TW), - table( - "BORDER=4 CELLPADDING=4", - [tr( - [summary_table_head("pid","Pid",Sorted), - summary_table_head("name_func","Name/Spawned as",Sorted), - summary_table_head("state","State",Sorted), - summary_table_head("reds","Reductions",Sorted), - summary_table_head("mem",MemHeading,Sorted), - summary_table_head("msg_q_len","MsgQ Length",Sorted)]) | - lists:map(fun(Proc) -> procs_summary_table(Proc) end,ProcsSummary)])]. - -summary_table_head(Sorted,Text,Sorted) -> - %% Mark the sorted column (bigger and italic) - th(font("SIZE=\"+1\"",em(href("./sort_procs?sort="++Sorted,Text)))); -summary_table_head(SortOn,Text,_Sorted) -> - th(href("./sort_procs?sort="++SortOn,Text)). - -procs_summary_table(Proc) -> - #proc{pid=Pid,name=Name,state=State, - reds=Reds,stack_heap=Mem0,msg_q_len=MsgQLen}=Proc, - Mem = case Mem0 of - -1 -> "unknown"; - _ -> integer_to_list(Mem0) - end, - tr( - [td(href(["./proc_details?pid=",Pid],Pid)), - td(Name), - td(State), - td("ALIGN=right",integer_to_list(Reds)), - td("ALIGN=right",Mem), - td("ALIGN=right",integer_to_list(MsgQLen))]). - %%%----------------------------------------------------------------- %%% Print details for one process proc_details(Pid,Proc,TW,SharedHeap) -> @@ -594,80 +540,30 @@ expanded_binary_body(Heading,Bin) -> href("javascript:history.go(-1)","BACK")]. %%%----------------------------------------------------------------- -%%% Print table of ports -ports(Heading,Ports,TW) -> - header(Heading,body(ports_body(Heading,Ports,TW))). +%%% Print info for one port +port(Heading,Port,TW) -> + header(Heading,body(port_body(Heading,Port,TW))). -ports_body(Heading,[],TW) -> - [h1(Heading), - warn(TW), - "No ports were found\n"]; -ports_body(Heading,Ports,TW) -> +port_body(Heading,Port,TW) -> [heading(Heading,"ports"), warn(TW), table( "BORDER=4 CELLPADDING=4", - [tr( - [th("Id"), - th("Slot"), - th("Connected"), - th("Links"), - th("Controls")]) | - lists:map(fun(Port) -> ports_table(Port) end, Ports)])]. + [tr([th(Head) || Head <- port_table_head()]), ports_table(Port)])]. -ports_table(Port) -> - #port{id=Id,slot=Slot,connected=Connected,links=Links, - controls=Controls}=Port, - tr( - [td(Id), - td("ALIGHT=right",Slot), - td(href_proc_port(Connected)), - td(href_proc_port(Links)), - td(Controls)]). - %%%----------------------------------------------------------------- -%%% Print table of ETS tables -ets_tables(Heading,EtsTables,InternalEts,TW) -> - header(Heading,body(ets_tables_body(Heading,EtsTables,InternalEts,TW))). +%%% Print table of internal ETS tables +internal_ets_tables(InternalEts,TW) -> + Heading = "Internal ETS tables", + header(Heading,body(internal_ets_tables_body(Heading,InternalEts,TW))). -ets_tables_body(Heading,[],InternalEts,TW) -> +internal_ets_tables_body(Heading,[],TW) -> [h1(Heading), warn(TW), - "No ETS tables were found\n" | - internal_ets_tables_table(InternalEts)]; -ets_tables_body(Heading,EtsTables,InternalEts,TW) -> - [heading(Heading,"ets_tables"), + "No internal ETS tables were found\n"]; +internal_ets_tables_body(Heading,InternalEts,TW) -> + [heading(Heading,"internal_ets_tables"), warn(TW), - table( - "BORDER=4 CELLPADDING=4", - [tr( - [th("Owner"), - th("Slot"), - th("Id"), - th("Name"), - th("Type"), - th("Buckets"), - th("Objects"), - th("Memory (bytes)")]) | - lists:map(fun(EtsTable) -> ets_tables_table(EtsTable) end, - EtsTables)]) | - internal_ets_tables_table(InternalEts)]. - -ets_tables_table(EtsTable) -> - #ets_table{pid=Pid,slot=Slot,id=Id,name=Name,type=Type, - buckets=Buckets,size=Size,memory=Memory} = EtsTable, - tr( - [td(href_proc_port(Pid)), - td(Slot), - td(Id), - td(Name), - td(Type), - td("ALIGN=right",Buckets), - td("ALIGN=right",Size), - td("ALIGN=right",Memory)]). - -internal_ets_tables_table(InternalEtsTables) -> - [h2("Internal ETS tables"), table( "BORDER=4 CELLPADDING=4", [tr( @@ -681,7 +577,7 @@ internal_ets_tables_table(InternalEtsTables) -> lists:map(fun(InternalEtsTable) -> internal_ets_tables_table1(InternalEtsTable) end, - InternalEtsTables)])]. + InternalEts)])]. internal_ets_tables_table1({Descr,InternalEtsTable}) -> #ets_table{id=Id,name=Name,type=Type,buckets=Buckets, @@ -695,33 +591,6 @@ internal_ets_tables_table1({Descr,InternalEtsTable}) -> td("ALIGN=right",Size), td("ALIGN=right",Memory)]). -%%%----------------------------------------------------------------- -%%% Print table of timers -timers(Heading,Timers,TW) -> - header(Heading,body(timers_body(Heading,Timers,TW))). - -timers_body(Heading,[],TW) -> - [h1(Heading), - warn(TW), - "No timers were found\n"]; -timers_body(Heading,Timers,TW) -> - [heading(Heading,"timers"), - warn(TW), - table( - "BORDER=4 CELLPADDING=4", - [tr( - [th("Owner"), - th("Message"), - th("Time left")]) | - lists:map(fun(Timer) -> timers_table(Timer) end, Timers)])]. - -timers_table(Timer) -> - #timer{pid=Pid,msg=Msg,time=Time}=Timer, - tr( - [td(href_proc_port(Pid)), - td(Msg), - td("ALIGN=right",Time)]). - %%%----------------------------------------------------------------- %%% Print table of nodes in distribution nods(Nods,TW) -> @@ -826,33 +695,6 @@ format_extra_info(Error) -> ?space -> ""; _ -> font("COLOR=\"#FF0000\"",["ERROR: ",Error,"\n"]) end. -%%%----------------------------------------------------------------- -%%% Print loaded modules information -loaded_mods({CC,OC,LM},TW) -> - Heading = "Loaded Modules Information", - header(Heading,body(loaded_mods_body(Heading,CC,OC,LM,TW))). - -loaded_mods_body(Heading,"unknown","unknown",[],TW) -> - [h1(Heading), - warn(TW), - "No loaded modules information was found\n"]; -loaded_mods_body(Heading,CC,OC,LM,TW) -> - [heading(Heading,"loaded_modules"), - warn(TW), - p([b("Current code: "),CC," bytes",br(), - b("Old code: "),OC," bytes"]), - table( - "BORDER=4 CELLPADDING=4", - [tr([th("Module"), - th("Current size (bytes)"), - th("Old size (bytes)")]) | - lists:map(fun(Mod) -> loaded_mods_table(Mod) end,LM)])]. - -loaded_mods_table(#loaded_mod{mod=Mod,current_size=CS,old_size=OS}) -> - tr([td(href(["loaded_mod_details?mod=",Mod],Mod)), - td("ALIGN=right",CS), - td("ALIGN=right",OS)]). - %%%----------------------------------------------------------------- %%% Print detailed information about one module @@ -881,108 +723,33 @@ loaded_mod_details_body(ModInfo,TW) -> td(pre(OCI))])])]. -%%%----------------------------------------------------------------- -%%% Print table of funs -funs(Funs,TW) -> - Heading = "Fun Information", - header(Heading,body(funs_body(Heading,Funs,TW))). - -funs_body(Heading,[],TW) -> - [h1(Heading), - warn(TW), - "No Fun information was found\n"]; -funs_body(Heading,Funs,TW) -> - [heading(Heading,"funs"), - warn(TW), - table( - "BORDER=4 CELLPADDING=4", - [tr( - [th("Module"), - th("Uniq"), - th("Index"), - th("Address"), - th("Native_address"), - th("Refc")]) | - lists:map(fun(Fun) -> funs_table(Fun) end, Funs)])]. - -funs_table(Fu) -> - #fu{module=Module,uniq=Uniq,index=Index,address=Address, - native_address=NativeAddress,refc=Refc}=Fu, - tr( - [td(Module), - td("ALIGN=right",Uniq), - td("ALIGN=right",Index), - td(Address), - td(NativeAddress), - td("ALIGN=right",Refc)]). - %%%----------------------------------------------------------------- %%% Print atoms -atoms(Atoms,Num,TW) -> +atoms(SessionId,TW,Num,FirstChunk) -> Heading = "Atoms", - header(Heading,body(atoms_body(Heading,Atoms,Num,TW))). - -atoms_body(Heading,[],Num,TW) -> - [h1(Heading), - warn(TW), - "No atoms were found in log",br(), - "Total number of atoms in node was ", Num, br()]; -atoms_body(Heading,Atoms,Num,TW) -> - [heading(Heading,"atoms"), - warn(TW), - "Total number of atoms in node was ", Num, - br(), - "The last created atom is shown first", - br(),br() | - n_first(Atoms)]. - -n_first({n_lines,Start,N,What,Lines,Pos}) -> - NextHref = next_href(N,What,Pos,Start), - [What," number ",integer_to_list(Start),"-",integer_to_list(Start+N-1), - br(), - NextHref, - pre(Lines), - NextHref]; -n_first({n_lines,_Start,_N,_What,Lines}) -> - [pre(Lines)]. - -%%%----------------------------------------------------------------- -%%% Print next N lines of "something" -next(NLines,TW) -> - header(element(4,NLines),body(next_body(NLines,TW))). - -next_body({n_lines,Start,N,What,Lines,Pos},TW) -> - PrefHref = prev_href(), - NextHref = next_href(N,What,Pos,Start), - [warn(TW), - What," number ",integer_to_list(Start),"-",integer_to_list(Start+N-1), - br(), - PrefHref, - ?space, - NextHref, - pre(Lines), - PrefHref, - ?space, - NextHref]; -next_body({n_lines,Start,N,What,Lines},TW) -> - PrefHref = prev_href(), - [warn(TW), - What," number ",integer_to_list(Start),"-",integer_to_list(Start+N-1), - br(), - PrefHref, - pre(Lines), - PrefHref]. - - -prev_href() -> - href("javascript:history.back()",["Previous"]). - -next_href(N,What,Pos,Start) -> - href(["./next?pos=",integer_to_list(Pos), - "&num=",integer_to_list(N), - "&start=",integer_to_list(Start+N), - "&what=",What], - "Next"). + case FirstChunk of + done -> + deliver_first(SessionId,[h1(Heading), + warn(TW), + "No atoms were found in log",br(), + "Total number of atoms in node was ", Num, + br()]); + _ -> + deliver_first(SessionId,[start_html_page(Heading), + heading(Heading,"atoms"), + warn(TW), + "Total number of atoms in node was ", Num, + br(), + "The last created atom is shown first", + br(), + start_pre()]), + atoms_chunk(SessionId,FirstChunk) + end. + +atoms_chunk(SessionId,done) -> + deliver(SessionId,[stop_pre(),stop_html_page()]); +atoms_chunk(SessionId,Atoms) -> + deliver(SessionId,Atoms). %%%----------------------------------------------------------------- %%% Print memory information @@ -1120,52 +887,93 @@ index_tables_body(Heading,IndexTables,TW) -> th("Size"), th("Limit"), th("Used"), - th("Rate")]) | + th("Rate"), + th("Entries")]) | lists:map(fun(IndexTable) -> index_tables_table(IndexTable) end, IndexTables)])]. index_tables_table(IndexTable) -> - #index_table{name=Name,size=Size,limit=Limit,used=Used,rate=Rate} = - IndexTable, + #index_table{name=Name,size=Size,limit=Limit,used=Used, + rate=Rate,entries=Entries} = IndexTable, tr( [td(Name), td("ALIGN=right",Size), td("ALIGN=right",Limit), td("ALIGN=right",Used), - td("ALIGN=right",Rate)]). + td("ALIGN=right",Rate), + td("ALIGN=right",Entries)]). %%%----------------------------------------------------------------- %%% Internal library +start_html_page(Title) -> + [only_http_header(), + start_html(), + only_html_header(Title), + start_html_body()]. + +stop_html_page() -> + [stop_html_body(), + stop_html()]. + +only_http_header() -> + ["Pragma:no-cache\r\n", + "Content-type: text/html\r\n\r\n"]. + +only_html_header(Title) -> + only_html_header(Title,""). +only_html_header(Title,JavaScript) -> + ["\n", + "", Title, "\n", + JavaScript, + "\n"]. + +start_html() -> + "\n". +stop_html() -> + "". +start_html_body() -> + "\n". +stop_html_body() -> + "\n". + header(Body) -> header("","",Body). header(Title,Body) -> header(Title,"",Body). header(Title,JavaScript,Body) -> - ["Pragma:no-cache\r\n", - "Content-type: text/html\r\n\r\n", + [only_http_header(), html_header(Title,JavaScript,Body)]. html_header(Title,JavaScript,Body) -> - ["\n", - "\n", - "", Title, "\n", - JavaScript, - "\n", + [start_html(), + only_html_header(Title,JavaScript), Body, - ""]. + stop_html()]. body(Text) -> - ["\n", + [start_html_body(), Text, - "<\BODY>\n"]. + stop_html_body()]. frameset(Args,Frames) -> ["\n", Frames, "\n\n"]. frame(Args) -> ["\n"]. +start_visible_table() -> + start_table("BORDER=\"4\" CELLPADDING=\"4\" WIDTH=\"100%\""). +% start_table("BORDER=\"4\" CELLPADDING=\"4\""). +start_visible_table(ColTitles) -> + [start_visible_table(), + tr([th(ColTitle) || ColTitle <- ColTitles])]. + +start_table(Args) -> + ["\n"]. +stop_table() -> + "
\n". + table(Args,Text) -> - ["\n", Text, "\n
\n"]. + [start_table(Args), Text, stop_table()]. tr(Text) -> ["\n", Text, "\n\n"]. tr(Args,Text) -> @@ -1183,8 +991,12 @@ b(Text) -> ["",Text,""]. em(Text) -> ["",Text,"\n"]. +start_pre() -> + "

".
+stop_pre() ->
+    "
". pre(Text) -> - ["
",Text,"
"]. + [start_pre(),Text,stop_pre()]. href(Link,Text) -> ["",Text,""]. href(Args,Link,Text) -> @@ -1199,8 +1011,6 @@ input(Args) -> ["\n"]. h1(Text) -> ["

",Text,"

\n"]. -h2(Text) -> - ["

",Text,"

\n"]. font(Args,Text) -> ["\n",Text,"\n\n"]. p(Text) -> @@ -1223,7 +1033,7 @@ href_proc_port([$#,$F,$u,$n,$<|T],Acc) -> href_proc_port([$#,$P,$o,$r,$t,$<|T],Acc) -> {[$#|Port]=HashPort,Rest} = to_gt(T,[$;,$t,$l,$&,$t,$r,$o,$P,$#]), href_proc_port(Rest,[href("TARGET=\"main\"", - ["./ports?port=",Port],HashPort)|Acc]); + ["./port?port=",Port],HashPort)|Acc]); href_proc_port([$<,$<|T],Acc) -> %% No links to binaries href_proc_port(T,[$;,$t,$l,$&,$;,$t,$l,$&|Acc]); @@ -1243,7 +1053,7 @@ href_proc_port([$",$#,$C,$D,$V,$P,$o,$r,$t,$<|T],Acc) -> %% Port written by crashdump_viewer:parse_term(...) {[$#|Port]=HashPort,[$"|Rest]} = to_gt(T,[$;,$t,$l,$&,$t,$r,$o,$P,$#]), href_proc_port(Rest,[href("TARGET=\"main\"", - ["./ports?port=",Port],HashPort)|Acc]); + ["./port?port=",Port],HashPort)|Acc]); href_proc_port([$",$#,$C,$D,$V,$P,$i,$d,$<|T],Acc) -> %% Pid written by crashdump_viewer:parse_term(...) {Pid,[$"|Rest]} = to_gt(T,[$;,$t,$l,$&]), @@ -1422,7 +1232,7 @@ replace_insrt("'trsni$'"++Rest,[H|T],Acc) -> % the list is reversed here! "<" ++ _Pid -> href("TARGET=\"main\"",["./proc_details?pid=",H],H); "#Port<" ++ Port -> - href("TARGET=\"main\"",["./ports?port=","Port<"++Port],H); + href("TARGET=\"main\"",["./port?port=","Port<"++Port],H); "#" ++ _other -> H end, @@ -1431,3 +1241,173 @@ replace_insrt([H|T],Insrt,Acc) -> replace_insrt(T,Insrt,[H|Acc]); replace_insrt([],[],Acc) -> Acc. + +%%%----------------------------------------------------------------- +%%% Create a page with one table by delivering chunk by chunk to +%%% inets. crashdump_viewer first calls chunk_page/5 once, then +%%% chunk/3 multiple times until all data is delivered. +chunk_page(processes,SessionId,TW,{Sorted,SharedHeap},FirstChunk) -> + Columns = procs_summary_table_head(Sorted,SharedHeap), + chunk_page(SessionId, "Process Information", TW, FirstChunk, + "processes", Columns, fun procs_summary_table/1); +chunk_page(ports,SessionId,TW,_,FirstChunk) -> + chunk_page(SessionId, "Port Information", TW, FirstChunk, + "ports", port_table_head(), fun ports_table/1); +chunk_page(ets_tables,SessionId,TW,Heading,FirstChunk) -> + Columns = ["Owner", + "Slot", + "Id", + "Name", + "Type", + "Buckets", + "Objects", + "Memory (bytes)"], + chunk_page(SessionId, Heading, TW, FirstChunk, + "ets_tables", Columns, fun ets_tables_table/1); +chunk_page(timers,SessionId,TW,Heading,FirstChunk) -> + chunk_page(SessionId, Heading, TW, FirstChunk, "timers", + ["Owner","Message","Time left"], fun timers_table/1); +chunk_page(loaded_mods,SessionId,TW,{CC,OC},FirstChunk) -> + TotalsInfo = p([b("Current code: "),CC," bytes",br(), + b("Old code: "),OC," bytes"]), + Columns = ["Module","Current size (bytes)","Old size (bytes)"], + chunk_page(SessionId, "Loaded Modules Information", TW, FirstChunk, + "loaded_modules", TotalsInfo,Columns, fun loaded_mods_table/1); +chunk_page(funs,SessionId, TW, _, FirstChunk) -> + Columns = ["Module", + "Uniq", + "Index", + "Address", + "Native_address", + "Refc"], + chunk_page(SessionId, "Fun Information", TW, FirstChunk, + "funs", Columns, fun funs_table/1). + +chunk_page(SessionId,Heading,TW,FirstChunk,Type,TableColumns,TableFun) -> + chunk_page(SessionId,Heading,TW,FirstChunk,Type,[],TableColumns,TableFun). +chunk_page(SessionId,Heading,TW,done,Type,_TotalsInfo,_TableColumns,_TableFun) -> + no_info_found(SessionId,Heading,TW,Type); +chunk_page(SessionId,Heading,TW,FirstChunk,Type,TotalsInfo,TableColumns,TableFun) -> + deliver_first(SessionId,[start_html_page(Heading), + heading(Heading,Type), + warn(TW), + TotalsInfo, + start_visible_table(TableColumns)]), + chunk(SessionId,FirstChunk,TableFun), + TableFun. + +no_info_found(SessionId, Heading, TW, Type) -> + Info = ["No ", Type, " were found\n"], + deliver_first(SessionId,[start_html_page(Heading), + h1(Heading), + warn(TW), + Info, + stop_html_page()]). + +chunk(SessionId, done, _TableFun) -> + deliver(SessionId,[stop_table(),stop_html_page()]); +chunk(SessionId, Items, TableFun) -> + deliver(SessionId, [lists:map(TableFun, Items), + stop_table(), %! Will produce an empty table at the end + start_visible_table()]). % of the page :( + +%%%----------------------------------------------------------------- +%%% Deliver part of a page to inets +%%% The first part, which includes the HTTP header, must always be +%%% delivered as a string (i.e. no binaries). The rest of the page is +%%% better delivered as binaries in order to avoid data copying. +deliver_first(SessionId,String) -> + mod_esi:deliver(SessionId,String). +deliver(SessionId,IoList) -> + mod_esi:deliver(SessionId,[list_to_binary(IoList)]). + + +%%%----------------------------------------------------------------- +%%% Page specific stuff for chunk pages +procs_summary_table_head(Sorted,SharedHeap) -> + MemHeading = + if SharedHeap -> + "Stack"; + true -> + "Stack+heap" + end, + [procs_summary_table_head("pid","Pid",Sorted), + procs_summary_table_head("name_func","Name/Spawned as",Sorted), + procs_summary_table_head("state","State",Sorted), + procs_summary_table_head("reds","Reductions",Sorted), + procs_summary_table_head("mem",MemHeading,Sorted), + procs_summary_table_head("msg_q_len","MsgQ Length",Sorted)]. + +procs_summary_table_head(_,Text,no_sort) -> + Text; +procs_summary_table_head(Sorted,Text,Sorted) -> + %% Mark the sorted column (bigger and italic) + font("SIZE=\"+1\"",em(href("./sort_procs?sort="++Sorted,Text))); +procs_summary_table_head(SortOn,Text,_Sorted) -> + href("./sort_procs?sort="++SortOn,Text). + +procs_summary_table(Proc) -> + #proc{pid=Pid,name=Name,state=State, + reds=Reds,stack_heap=Mem0,msg_q_len=MsgQLen}=Proc, + Mem = case Mem0 of + -1 -> "unknown"; + _ -> integer_to_list(Mem0) + end, + tr( + [td(href(["./proc_details?pid=",Pid],Pid)), + td(Name), + td(State), + td("ALIGN=right",integer_to_list(Reds)), + td("ALIGN=right",Mem), + td("ALIGN=right",integer_to_list(MsgQLen))]). + +port_table_head() -> + ["Id","Slot","Connected","Links","Name","Monitors","Controls"]. + +ports_table(Port) -> + #port{id=Id,slot=Slot,connected=Connected,links=Links,name=Name, + monitors=Monitors,controls=Controls}=Port, + tr( + [td(Id), + td("ALIGN=right",Slot), + td(href_proc_port(Connected)), + td(href_proc_port(Links)), + td(Name), + td(href_proc_port(Monitors)), + td(Controls)]). + +ets_tables_table(EtsTable) -> + #ets_table{pid=Pid,slot=Slot,id=Id,name=Name,type=Type, + buckets=Buckets,size=Size,memory=Memory} = EtsTable, + tr( + [td(href_proc_port(Pid)), + td(Slot), + td(Id), + td(Name), + td(Type), + td("ALIGN=right",Buckets), + td("ALIGN=right",Size), + td("ALIGN=right",Memory)]). + +timers_table(Timer) -> + #timer{pid=Pid,msg=Msg,time=Time}=Timer, + tr( + [td(href_proc_port(Pid)), + td(Msg), + td("ALIGN=right",Time)]). + +loaded_mods_table(#loaded_mod{mod=Mod,current_size=CS,old_size=OS}) -> + tr([td(href(["loaded_mod_details?mod=",Mod],Mod)), + td("ALIGN=right",CS), + td("ALIGN=right",OS)]). + +funs_table(Fu) -> + #fu{module=Module,uniq=Uniq,index=Index,address=Address, + native_address=NativeAddress,refc=Refc}=Fu, + tr( + [td(Module), + td("ALIGN=right",Uniq), + td("ALIGN=right",Index), + td(Address), + td(NativeAddress), + td("ALIGN=right",Refc)]). diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl index 1a7e6f61fe..c547b997d1 100644 --- a/lib/observer/test/crashdump_viewer_SUITE.erl +++ b/lib/observer/test/crashdump_viewer_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-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 @@ -414,16 +414,17 @@ special(Port,File) -> _ -> ok end; - ".250atoms" -> - Html1 = contents(Port,"atoms"), - NextLink1 = next_link(Html1), - "Atoms" = title(Html1), - Html2 = contents(Port,NextLink1), - NextLink2 = next_link(Html2), - "Atoms" = title(Html2), - Html3 = contents(Port,NextLink2), - "" = next_link(Html3), - "Atoms" = title(Html3); + %%! No longer needed - all atoms are shown on one page!! + %% ".250atoms" -> + %% Html1 = contents(Port,"atoms"), + %% NextLink1 = next_link(Html1), + %% "Atoms" = title(Html1), + %% Html2 = contents(Port,NextLink1), + %% NextLink2 = next_link(Html2), + %% "Atoms" = title(Html2), + %% Html3 = contents(Port,NextLink2), + %% "" = next_link(Html3), + %% "Atoms" = title(Html3); _ -> ok end, @@ -509,14 +510,14 @@ next_link(Html) -> toggle_menu(Port) -> - Html = contents(Port,"toggle?index=10"), + Html = contents(Port,"toggle?index=4"), check_toggle(Html). check_toggle(Html) -> case Html of - " + " collapsed; - " + " exploded; [_H|T] -> check_toggle(T) @@ -543,10 +544,10 @@ expand_link(Html) -> port_details(Port) -> - Port1 = contents(Port,"ports?port=Port<0.1>"), + Port1 = contents(Port,"port?port=Port<0.1>"), "#Port<0.1>" = title(Port1), - Port0 = contents(Port,"ports?port=Port<0.0>"), + Port0 = contents(Port,"port?port=Port<0.0>"), "Could not find port: #Port<0.0>" = title(Port0). is_truncated(File) -> -- cgit v1.2.3 From 7405f353d3f06f2a4207f382d91435adbe9c9160 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 23 Feb 2011 15:58:42 +0100 Subject: Add shell script and .bat file to start crashdump_viewer Since browsers no longer can provide the full path of a file selected with a file-type input field (browse button), the input field for loading a crashdump is now changed to a plain text input field. Since this reduces the user-friendlyness, a shell script (and a .bat file) has instead been added so the crashdump_viewer can be started directly from the command line - and thus normal tab completion can be used for selecting the crashdump file. Usage: cdv file [ browser ] --- lib/observer/priv/bin/cdv | 4 ++ lib/observer/priv/bin/cdv.bat | 2 + lib/observer/src/Makefile | 6 +- lib/observer/src/crashdump_viewer.erl | 104 ++++++++++++++++++++++++----- lib/observer/src/crashdump_viewer_html.erl | 20 +++--- 5 files changed, 106 insertions(+), 30 deletions(-) create mode 100755 lib/observer/priv/bin/cdv create mode 100644 lib/observer/priv/bin/cdv.bat diff --git a/lib/observer/priv/bin/cdv b/lib/observer/priv/bin/cdv new file mode 100755 index 0000000000..1c44785ac2 --- /dev/null +++ b/lib/observer/priv/bin/cdv @@ -0,0 +1,4 @@ +#!/bin/sh + +erl -sname cdv -noinput -s crashdump_viewer script_start $@ + diff --git a/lib/observer/priv/bin/cdv.bat b/lib/observer/priv/bin/cdv.bat new file mode 100644 index 0000000000..efa8bf8687 --- /dev/null +++ b/lib/observer/priv/bin/cdv.bat @@ -0,0 +1,2 @@ +@ECHO OFF +CALL werl -sname cdv -s crashdump_viewer script_start %* diff --git a/lib/observer/src/Makefile b/lib/observer/src/Makefile index b4eb518dd7..2d06cb6bc4 100644 --- a/lib/observer/src/Makefile +++ b/lib/observer/src/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2002-2009. All Rights Reserved. +# Copyright Ericsson AB 2002-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 @@ -59,8 +59,10 @@ BINDIR= $(PRIVDIR)/bin EXECUTABLES= \ $(BINDIR)/etop \ $(BINDIR)/getop \ + $(BINDIR)/cdv \ $(BINDIR)/etop.bat \ - $(BINDIR)/getop.bat + $(BINDIR)/getop.bat \ + $(BINDIR)/cdv.bat CDVDIR= $(PRIVDIR)/crashdump_viewer GIF_FILES= \ $(CDVDIR)/collapsd.gif \ diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index 8b96769224..29e24655eb 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -57,7 +57,7 @@ %% %% User API --export([start/0,stop/0]). +-export([start/0,stop/0,script_start/0,script_start/1]). %% Webtool API -export([configData/0, @@ -117,7 +117,7 @@ % this, it must be explicitly expanded. -define(max_display_binary_size,50). % max size of a binary that will be % directly displayed. --define(max_sort_process_num,1000). % Max number of processes that allows +-define(max_sort_process_num,10000). % Max number of processes that allows % sorting. If more than this number of % processes exist, they will be displayed % in the order they are found in the log. @@ -205,6 +205,85 @@ stop() -> webtool:stop_tools([],"app=crashdump_viewer"), webtool:stop(). +%%%----------------------------------------------------------------- +%%% Start crashdump_viewer via the cdv script located in +%%% $OBSERVER_PRIV_DIR/bin +script_start() -> + usage(). +script_start([File]) -> + DefaultBrowser = + case os:type() of + {win32,_} -> iexplore; + _ -> firefox + end, + script_start([File,DefaultBrowser]); +script_start([FileAtom,Browser]) -> + File = atom_to_list(FileAtom), + case filelib:is_regular(File) of + true -> + io:format("Starting crashdump_viewer...\n"), + start(), + io:format("Reading crashdump..."), + read_file(File), + redirect([],[]), + io:format("done\n"), + start_browser(Browser); + false -> + io:format("cdv error: the given file does not exist\n"), + usage() + end. + +start_browser(Browser) -> + PortStr = integer_to_list(gen_server:call(web_tool,get_port)), + Url = "http://localhost:" ++ PortStr ++ ?START_PAGE, + {OSType,_} = os:type(), + case Browser of + none -> + ok; + iexplore when OSType == win32-> + io:format("Starting internet explorer...\n"), + {ok,R} = win32reg:open(""), + Key="\\local_machine\\SOFTWARE\\Microsoft\\IE Setup\\Setup", + win32reg:change_key(R,Key), + {ok,Val} = win32reg:value(R,"Path"), + IExplore=filename:join(win32reg:expand(Val),"iexplore.exe"), + os:cmd("\"" ++ IExplore ++ "\" " ++ Url); + _ when OSType == win32 -> + io:format("Starting ~w...\n",[Browser]), + os:cmd("\"" ++ atom_to_list(Browser) ++ "\" " ++ Url); + B when B==firefox; B==mozilla -> + io:format("Sending URL to ~w...",[Browser]), + BStr = atom_to_list(Browser), + SendCmd = BStr ++ " -raise -remote \'openUrl(" ++ Url ++ ")\'", + Port = open_port({spawn,SendCmd},[exit_status]), + receive + {Port,{exit_status,0}} -> + io:format("done\n"); + {Port,{exit_status,_Error}} -> + io:format(" not running, starting ~w...\n",[Browser]), + os:cmd(BStr ++ " " ++ Url) + after 5000 -> + io:format(" failed, starting ~w...\n",[Browser]), + erlang:port_close(Port), + os:cmd(BStr ++ " " ++ Url) + end; + _ -> + io:format("Starting ~w...\n",[Browser]), + os:cmd(atom_to_list(Browser) ++ " " ++ Url) + end, + ok. + +usage() -> + io:format( + "\nusage: cdv file [ browser ]\n" + "\tThe \'file\' must be an existing erlang crash dump.\n" + "\tDefault browser is \'iexplore\' (Internet Explorer) on Windows\n" + "\tor else \'firefox\'.\n", + []). + + + + %%%----------------------------------------------------------------- %%% Return config data used by webtool configData() -> @@ -404,16 +483,7 @@ handle_call(start_page, _From, State) -> Reply = crashdump_viewer_html:start_page(), {reply,Reply,State}; handle_call({read_file,Input}, _From, _State) -> - {ok,File0} = get_value("path",httpd:parse_query(Input)), - File = - case File0 of - [$"|FileAndSome] -> - %% Opera adds \"\" around the filename! - [$"|Elif] = lists:reverse(FileAndSome), - lists:reverse(Elif); - _ -> - File0 - end, + {ok,File} = get_value("path",httpd:parse_query(Input)), spawn_link(fun() -> read_file(File) end), Status = background_status(reading,File), Reply = crashdump_viewer_html:redirect(Status), @@ -877,10 +947,12 @@ get_rest_of_line_1(Fd, <<$\n:8,Bin/binary>>, Acc) -> lists:reverse(Acc); get_rest_of_line_1(Fd, <<$\r:8,Rest/binary>>, Acc) -> get_rest_of_line_1(Fd, Rest, Acc); -%% get_rest_of_line_1(Fd, <<$<:8,Rest/binary>>, Acc) -> -%% get_rest_of_line_1(Fd, Rest, [$;,$t,$l,$&|Acc]); -%% get_rest_of_line_1(Fd, <<$>:8,Rest/binary>>, Acc) -> -%% get_rest_of_line_1(Fd, Rest, [$;,$t,$g,$&|Acc]); +get_rest_of_line_1(Fd, <<$<:8,Rest/binary>>, Acc) -> + get_rest_of_line_1(Fd, Rest, [$;,$t,$l,$&|Acc]); +get_rest_of_line_1(Fd, <<$>:8,Rest/binary>>, Acc) -> + get_rest_of_line_1(Fd, Rest, [$;,$t,$g,$&|Acc]); +get_rest_of_line_1(Fd, <<$&:8,Rest/binary>>, Acc) -> + get_rest_of_line_1(Fd, Rest, [$;,$p,$m,$a,$&|Acc]); get_rest_of_line_1(Fd, <>, Acc) -> get_rest_of_line_1(Fd, Rest, [Char|Acc]); get_rest_of_line_1(Fd, <<>>, Acc) -> diff --git a/lib/observer/src/crashdump_viewer_html.erl b/lib/observer/src/crashdump_viewer_html.erl index 0d70c9b86f..d49023f9f6 100644 --- a/lib/observer/src/crashdump_viewer_html.erl +++ b/lib/observer/src/crashdump_viewer_html.erl @@ -77,23 +77,20 @@ read_file_frame() -> read_file_frame_body() -> - Entry = - case webtool:is_localhost() of - true -> [input("TYPE=file NAME=browse SIZE=40"), - input("TYPE=hidden NAME=path")]; - false -> input("TYPE=text NAME=path SIZE=60") - end, + %% Using a plain text input field instead of a file input field + %% (e.g. ) because most + %% browsers can not forward the full path from this dialog even if + %% the browser is running on localhost (Ref 'fakepath'-problem) + Entry = input("TYPE=text NAME=path SIZE=60"), Form = form( - "NAME=read_file_form METHOD=post ACTION= \"./read_file\"", + "NAME=read_file_form METHOD=post ACTION=\"./read_file\"", table( "BORDER=0", [tr(td("COLSPAN=2","Enter file to analyse")), tr( [td(Entry), - td("ALIGN=center", - input("TYPE=submit onClick=\"path.value=browse.value;\"" - "VALUE=Ok"))])])), + td("ALIGN=center",input("TYPE=submit VALUE=Ok"))])])), table( "WIDTH=100% HEIGHT=60%", tr("VALIGN=middle", @@ -961,8 +958,7 @@ frame(Args) -> ["\n"]. start_visible_table() -> - start_table("BORDER=\"4\" CELLPADDING=\"4\" WIDTH=\"100%\""). -% start_table("BORDER=\"4\" CELLPADDING=\"4\""). + start_table("BORDER=\"4\" CELLPADDING=\"4\""). start_visible_table(ColTitles) -> [start_visible_table(), tr([th(ColTitle) || ColTitle <- ColTitles])]. -- cgit v1.2.3 From fda63b0568f052cf61b21e2a8e950b7dba1024e3 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 24 Feb 2011 13:23:45 +0100 Subject: Document new cdv script and cdv.bat file for starting crashdump viewer --- lib/observer/doc/src/crashdump.xml | 6 ++++- lib/observer/doc/src/crashdump_help.html | 4 +-- lib/observer/doc/src/crashdump_ug.xml | 44 ++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/lib/observer/doc/src/crashdump.xml b/lib/observer/doc/src/crashdump.xml index f8d7641524..b6056c2ed1 100644 --- a/lib/observer/doc/src/crashdump.xml +++ b/lib/observer/doc/src/crashdump.xml @@ -5,7 +5,7 @@
2003 - 2007 + 2011 Ericsson AB, All Rights Reserved @@ -38,6 +38,10 @@

The Crashdump Viewer is an HTML based tool for browsing Erlang crashdumps. Crashdump Viewer runs under the WebTool application.

+ +

See the user's guide + for more information about how to get started with the Crashdump + Viewer.

diff --git a/lib/observer/doc/src/crashdump_help.html b/lib/observer/doc/src/crashdump_help.html index 736a024288..268b9495d6 100644 --- a/lib/observer/doc/src/crashdump_help.html +++ b/lib/observer/doc/src/crashdump_help.html @@ -131,7 +131,7 @@ SRC="min_head.gif">
- +

ETS tables

The ETS table information page shows all ETS table @@ -304,4 +304,4 @@ Copyright © 1991-2003 - \ No newline at end of file + diff --git a/lib/observer/doc/src/crashdump_ug.xml b/lib/observer/doc/src/crashdump_ug.xml index 9913b30e38..dc65fe5b39 100644 --- a/lib/observer/doc/src/crashdump_ug.xml +++ b/lib/observer/doc/src/crashdump_ug.xml @@ -4,7 +4,7 @@

- 20032009 + 20032011 Ericsson AB. All Rights Reserved. @@ -38,12 +38,31 @@
Getting Started -

From an erlang node, start Crashdump Viewer by calling - crashdump_viewer:start(). This will automatically start - WebTool and display the web address where WebTool can be - found. See the documentation for the WebTool application for - further information about how to use WebTool. -

+ +

The easiest way to start Crashdump Viewer is to use the + provided shell script named cdv with the full path to the + erlang crashdump as an argument. The script can be found in the + priv directory of the observer application. This starts + WebTool, Crashdump Viewer and a web browser, and loads the given + file. The browser should then display a page named General + Information which shows a short summary of the information in + the crashdump.

+ +

The default browser is Internet Explorer on Windows or else + Firefox. To use another browser, give the browser's start command + as the second argument to cdv. If the given browser name is + not known to Crashdump Viewer, the browser argument is executed as + a command with the start URL as the only argument.

+ +

Under Windows the batch file cdv.bat can be used.

+ +

It is also possible to start the Crashdump Viewer from within + an erlang node by calling crashdump_viewer:start/0. This + will automatically start WebTool and display the web address where + WebTool can be found. See the documentation for the WebTool + application for further information about how to use WebTool.

+

Point your web browser to the address displayed, and you should now see the start page of WebTool. At the top of the page, you will see a link to "CrashDumpViewer". Click this link to get to @@ -52,15 +71,12 @@ connection to the internet, or you must set no proxy for localhost.)

-

You can also start WebTool, Crashdump Viewer and a browser in - one go by running the start_webtool script found in the - priv directory of the WebTool application, e.g. -

->start_webtool crashdump_viewer

From the start page of Crashdump Viewer, push the "Load Crashdump" button to load a crashdump into the tool. Then enter - the filename of the crashdump in the entry field and push the "Ok" - button. + the filename of the crashdump in the entry field and push the + "Ok" button. This will bring you to the General Information + page, i.e. the same page as the cdv script will open in + the browser.

Crashdumps generated by OTP R9C and later are loaded directly into the Crashdump Viewer, while dumps from earlier releases first -- cgit v1.2.3 From 386a4db00c8c1664d98215f0c1350b890a336d30 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 24 Feb 2011 13:53:06 +0100 Subject: Minor bugfix related to improved performance of crashdump_viewer --- lib/observer/src/crashdump_viewer.erl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index 29e24655eb..353a2db544 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -947,12 +947,6 @@ get_rest_of_line_1(Fd, <<$\n:8,Bin/binary>>, Acc) -> lists:reverse(Acc); get_rest_of_line_1(Fd, <<$\r:8,Rest/binary>>, Acc) -> get_rest_of_line_1(Fd, Rest, Acc); -get_rest_of_line_1(Fd, <<$<:8,Rest/binary>>, Acc) -> - get_rest_of_line_1(Fd, Rest, [$;,$t,$l,$&|Acc]); -get_rest_of_line_1(Fd, <<$>:8,Rest/binary>>, Acc) -> - get_rest_of_line_1(Fd, Rest, [$;,$t,$g,$&|Acc]); -get_rest_of_line_1(Fd, <<$&:8,Rest/binary>>, Acc) -> - get_rest_of_line_1(Fd, Rest, [$;,$p,$m,$a,$&|Acc]); get_rest_of_line_1(Fd, <>, Acc) -> get_rest_of_line_1(Fd, Rest, [Char|Acc]); get_rest_of_line_1(Fd, <<>>, Acc) -> -- cgit v1.2.3 From 910a25b6502150014ccbd71080d1363461406618 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 28 Feb 2011 17:51:24 +0100 Subject: Fix file descriptor leak in crashdump_viewer:chunk_page Also, remove compiler warnings for crashdump_viewer_SUITE and fix Makefile in test directory so Emakefile does not grow. --- lib/observer/src/crashdump_viewer.erl | 6 +++--- lib/observer/test/Makefile | 2 +- lib/observer/test/crashdump_viewer_SUITE.erl | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index 353a2db544..bf4910445b 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -2791,9 +2791,8 @@ chunk_page(SessionId,File,TW,What,HtmlCB,HtmlExtra,ParseFun) -> lookup_and_parse_index_chunk(Cont,Fd,ParseFun)) end. -chunk_page_1(Fd,HtmlInfo,SessionId,_ParseFun,done) -> - crashdump_viewer_html:chunk(SessionId,done,HtmlInfo), - close(Fd); +chunk_page_1(_Fd,HtmlInfo,SessionId,_ParseFun,done) -> + crashdump_viewer_html:chunk(SessionId,done,HtmlInfo); chunk_page_1(Fd,HtmlInfo,SessionId,ParseFun,{Chunk,Cont}) -> crashdump_viewer_html:chunk(SessionId,Chunk,HtmlInfo), chunk_page_1(Fd,HtmlInfo,SessionId,ParseFun, @@ -2802,6 +2801,7 @@ chunk_page_1(Fd,HtmlInfo,SessionId,ParseFun,{Chunk,Cont}) -> lookup_and_parse_index_chunk(Pointer,Fd,ParseFun) -> case lookup_index_chunk(Pointer) of '$end_of_table' -> + close(Fd), done; {Chunk,Cont} -> R = lists:map(fun({Id,Start}) -> diff --git a/lib/observer/test/Makefile b/lib/observer/test/Makefile index e15bde7346..6073e6ea00 100644 --- a/lib/observer/test/Makefile +++ b/lib/observer/test/Makefile @@ -53,7 +53,7 @@ EBIN = . make_emakefile: $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) \ - $(MODULES) >> $(EMAKEFILE) + $(MODULES) > $(EMAKEFILE) tests debug opt: make_emakefile cd $(ERL_TOP)/lib/test_server/src && \ diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl index c547b997d1..8449e8a7c4 100644 --- a/lib/observer/test/crashdump_viewer_SUITE.erl +++ b/lib/observer/test/crashdump_viewer_SUITE.erl @@ -68,7 +68,7 @@ init_per_suite(doc) -> init_per_suite(Config) when is_list(Config) -> Dog = ?t:timetrap(?default_timeout), application:start(inets), % will be using the http client later - http:set_options([{ipv6,disabled}]), + httpc:set_options([{ipfamily,inet6fb4}]), DataDir = ?config(data_dir,Config), Rels = [R || R <- [r12b,r13b], ?t:is_release_available(R)] ++ [current], io:format("Creating crash dumps for the following releases: ~p", [Rels]), @@ -112,7 +112,7 @@ start(Config) when is_list(Config) -> undefined = whereis(crashdump_viewer_server), undefined = whereis(web_tool), Url = cdv_url(Port,"start_page"), - {error,_} = http:request(get,{Url,[]},[],[]), + {error,_} = httpc:request(Url), % exit(whereis(httpc_manager),kill), ?t:timetrap_cancel(AngryDog), ok. @@ -246,7 +246,7 @@ cdv_url(Port,Link) -> "http://localhost:" ++ Port ++ "/cdv_erl/crashdump_viewer/" ++ Link. request_sync(Method,HTTPReqCont) -> - case http:request(Method, + case httpc:request(Method, HTTPReqCont, [{timeout,30000}], [{full_result, false}]) of @@ -254,13 +254,13 @@ request_sync(Method,HTTPReqCont) -> Html; {ok,{Code,Html}} -> io:format("~s\n", [Html]), - io:format("Received ~w from http:request(...) with\nMethod=~w\n" + io:format("Received ~w from httpc:request(...) with\nMethod=~w\n" "HTTPReqCont=~p\n", [Code,Method,HTTPReqCont]), ?t:fail(); Other -> io:format( - "Received ~w from http:request(...) with\nMethod=~w\n" + "Received ~w from httpc:request(...) with\nMethod=~w\n" "HTTPReqCont=~p\n", [Other,Method,HTTPReqCont]), ?t:fail() @@ -497,15 +497,15 @@ expand_binary_link(Html) -> end. -next_link(Html) -> - case Html of - " - "next?pos=" ++ string:sub_word(Rest,1,$"); - [_H|T] -> - next_link(T); - [] -> - [] - end. +%% next_link(Html) -> +%% case Html of +%% " +%% "next?pos=" ++ string:sub_word(Rest,1,$"); +%% [_H|T] -> +%% next_link(T); +%% [] -> +%% [] +%% end. -- cgit v1.2.3 From a33afe6f8f92f63c487cfdfaeacca4eadab45c11 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 1 Mar 2011 10:48:00 +0100 Subject: Added new module (megaco_config_misc). --- lib/megaco/src/app/megaco.app.src | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/megaco/src/app/megaco.app.src b/lib/megaco/src/app/megaco.app.src index 503fcd7176..c0d8218ac8 100644 --- a/lib/megaco/src/app/megaco.app.src +++ b/lib/megaco/src/app/megaco.app.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -67,6 +67,7 @@ megaco_compact_text_encoder_prev3c, megaco_compact_text_encoder_v3, megaco_config, + megaco_config_misc, megaco_digit_map, megaco_encoder, megaco_edist_compress, -- cgit v1.2.3 From 85395e3bb931d1936c7fdd0a64a8cb448a21da6e Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 1 Mar 2011 10:49:55 +0100 Subject: Fixed megacos own test server again. Now added suite init and end. Also some cosmetic stuff (indenting). --- lib/megaco/test/megaco_SUITE.erl | 77 +++++----- lib/megaco/test/megaco_app_test.erl | 14 +- lib/megaco/test/megaco_codec_v1_test.erl | 182 ++++++++++++++--------- lib/megaco/test/megaco_test_lib.erl | 238 +++++++++++++++++++++---------- 4 files changed, 333 insertions(+), 178 deletions(-) diff --git a/lib/megaco/test/megaco_SUITE.erl b/lib/megaco/test/megaco_SUITE.erl index 4faa6736e6..007677ba4d 100644 --- a/lib/megaco/test/megaco_SUITE.erl +++ b/lib/megaco/test/megaco_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-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 @@ -46,42 +46,53 @@ init() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Top test case -suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,1}]}]}]. +suite() -> [{ct_hooks, [{ts_install_cth, [{nodenames,1}]}]}]. all() -> - [{group, app_test}, {group, appup_test}, - {group, config}, {group, flex}, {group, udp}, - {group, tcp}, {group, examples}, {group, digit_map}, - {group, mess}, {group, measure}, - {group, binary_term_id}, {group, codec}, {group, sdp}, - {group, mib}, {group, trans}, {group, actions}, - {group, load}, {group, pending_limit}, - {group, segmented}, {group, timer}]. + [{group, app_test}, + {group, appup_test}, + {group, config}, + {group, flex}, + {group, udp}, + {group, tcp}, + {group, examples}, + {group, digit_map}, + {group, mess}, + {group, measure}, + {group, binary_term_id}, + {group, codec}, + {group, sdp}, + {group, mib}, + {group, trans}, + {group, actions}, + {group, load}, + {group, pending_limit}, + {group, segmented}, + {group, timer}]. groups() -> - [{tickets, [], [{group, mess}, {group, codec}]}, - {app_test, [], [{megaco_app_test, all}]}, - {appup_test, [], [{megaco_appup_test, all}]}, - {config, [], [{megaco_config_test, all}]}, - {call_flow, [], [{megaco_call_flow_test, all}]}, - {digit_map, [], [{megaco_digit_map_test, all}]}, - {mess, [], [{megaco_mess_test, all}]}, - {udp, [], [{megaco_udp_test, all}]}, - {tcp, [], [{megaco_tcp_test, all}]}, - {examples, [], [{megaco_examples_test, all}]}, - {measure, [], [{megaco_measure_test, all}]}, - {binary_term_id, [], - [{megaco_binary_term_id_test, all}]}, - {codec, [], [{megaco_codec_test, all}]}, - {sdp, [], [{megaco_sdp_test, all}]}, - {mib, [], [{megaco_mib_test, all}]}, - {trans, [], [{megaco_trans_test, all}]}, - {actions, [], [{megaco_actions_test, all}]}, - {load, [], [{megaco_load_test, all}]}, - {pending_limit, [], [{megaco_pending_limit_test, all}]}, - {segmented, [], [{megaco_segment_test, all}]}, - {timer, [], [{megaco_timer_test, all}]}, - {flex, [], [{megaco_flex_test, all}]}]. + [{tickets, [], [{group, mess}, {group, codec}]}, + {app_test, [], [{megaco_app_test, all}]}, + {appup_test, [], [{megaco_appup_test, all}]}, + {config, [], [{megaco_config_test, all}]}, + {call_flow, [], [{megaco_call_flow_test, all}]}, + {digit_map, [], [{megaco_digit_map_test, all}]}, + {mess, [], [{megaco_mess_test, all}]}, + {udp, [], [{megaco_udp_test, all}]}, + {tcp, [], [{megaco_tcp_test, all}]}, + {examples, [], [{megaco_examples_test, all}]}, + {measure, [], [{megaco_measure_test, all}]}, + {binary_term_id, [], [{megaco_binary_term_id_test, all}]}, + {codec, [], [{megaco_codec_test, all}]}, + {sdp, [], [{megaco_sdp_test, all}]}, + {mib, [], [{megaco_mib_test, all}]}, + {trans, [], [{megaco_trans_test, all}]}, + {actions, [], [{megaco_actions_test, all}]}, + {load, [], [{megaco_load_test, all}]}, + {pending_limit, [], [{megaco_pending_limit_test, all}]}, + {segmented, [], [{megaco_segment_test, all}]}, + {timer, [], [{megaco_timer_test, all}]}, + {flex, [], [{megaco_flex_test, all}]}]. init_per_suite(Config) -> Config. diff --git a/lib/megaco/test/megaco_app_test.erl b/lib/megaco/test/megaco_app_test.erl index 0bfa388ef6..00f7b7fb68 100644 --- a/lib/megaco/test/megaco_app_test.erl +++ b/lib/megaco/test/megaco_app_test.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-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 @@ -42,11 +42,17 @@ init_per_testcase(Case, Config) -> end_per_testcase(Case, Config) -> megaco_test_lib:end_per_testcase(Case, Config). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% all() -> - [fields, modules, exportall, app_depend, - undef_funcs]. + [ + fields, + modules, + exportall, + app_depend, + undef_funcs + ]. groups() -> []. @@ -112,7 +118,7 @@ fields(doc) -> []; fields(Config) when is_list(Config) -> AppFile = key1search(app_file, Config), - Fields = [vsn, description, modules, registered, applications], + Fields = [vsn, description, modules, registered, applications], case check_fields(Fields, AppFile, []) of [] -> ok; diff --git a/lib/megaco/test/megaco_codec_v1_test.erl b/lib/megaco/test/megaco_codec_v1_test.erl index 8190407aec..3a548c4d9e 100644 --- a/lib/megaco/test/megaco_codec_v1_test.erl +++ b/lib/megaco/test/megaco_codec_v1_test.erl @@ -462,76 +462,122 @@ end_per_testcase(Case, Config) -> %% Top test case all() -> - [{group, text}, {group, binary}, {group, erl_dist}, - {group, tickets}]. + [ + {group, text}, + {group, binary}, + {group, erl_dist}, + {group, tickets} + ]. groups() -> - [{text, [], - [{group, pretty}, {group, flex_pretty}, - {group, compact}, {group, flex_compact}]}, - {binary, [], - [{group, bin}, {group, ber}, {group, ber_bin}, - {group, per}, {group, per_bin}]}, - {erl_dist, [], [{group, erl_dist_m}]}, - {pretty, [], [pretty_test_msgs]}, - {compact, [], [compact_test_msgs]}, - {flex_pretty, [], flex_pretty_cases()}, - {flex_compact, [], flex_compact_cases()}, - {bin, [], [bin_test_msgs]}, {ber, [], [ber_test_msgs]}, - {ber_bin, [], [ber_bin_test_msgs]}, - {per, [], [per_test_msgs]}, - {per_bin, [], [per_bin_test_msgs]}, - {erl_dist_m, [], [erl_dist_m_test_msgs]}, - {tickets, [], - [{group, compact_tickets}, {group, pretty_tickets}, - {group, flex_compact_tickets}, - {group, flex_pretty_tickets}]}, - {compact_tickets, [], - [compact_otp4011_msg1, compact_otp4011_msg2, - compact_otp4011_msg3, compact_otp4013_msg1, - compact_otp4085_msg1, compact_otp4085_msg2, - compact_otp4280_msg1, compact_otp4299_msg1, - compact_otp4299_msg2, compact_otp4359_msg1, - compact_otp4920_msg0, compact_otp4920_msg1, - compact_otp4920_msg2, compact_otp4920_msg3, - compact_otp4920_msg4, compact_otp4920_msg5, - compact_otp4920_msg6, compact_otp4920_msg7, - compact_otp4920_msg8, compact_otp4920_msg9, - compact_otp4920_msg10, compact_otp4920_msg11, - compact_otp4920_msg12, compact_otp4920_msg20, - compact_otp4920_msg21, compact_otp4920_msg22, - compact_otp4920_msg23, compact_otp4920_msg24, - compact_otp4920_msg25, compact_otp5186_msg01, - compact_otp5186_msg02, compact_otp5186_msg03, - compact_otp5186_msg04, compact_otp5186_msg05, - compact_otp5186_msg06, compact_otp5793_msg01, - compact_otp5993_msg01, compact_otp5993_msg02, - compact_otp5993_msg03, compact_otp6017_msg01, - compact_otp6017_msg02, compact_otp6017_msg03]}, - {flex_compact_tickets, [], - flex_compact_tickets_cases()}, - {pretty_tickets, [], - [pretty_otp4632_msg1, pretty_otp4632_msg2, - pretty_otp4632_msg3, pretty_otp4632_msg4, - pretty_otp4710_msg1, pretty_otp4710_msg2, - pretty_otp4945_msg1, pretty_otp4945_msg2, - pretty_otp4945_msg3, pretty_otp4945_msg4, - pretty_otp4945_msg5, pretty_otp4945_msg6, - pretty_otp4949_msg1, pretty_otp4949_msg2, - pretty_otp4949_msg3, pretty_otp5042_msg1, - pretty_otp5068_msg1, pretty_otp5085_msg1, - pretty_otp5085_msg2, pretty_otp5085_msg3, - pretty_otp5085_msg4, pretty_otp5085_msg5, - pretty_otp5085_msg6, pretty_otp5085_msg7, - pretty_otp5600_msg1, pretty_otp5600_msg2, - pretty_otp5601_msg1, pretty_otp5793_msg01, - pretty_otp5882_msg01, pretty_otp6490_msg01, - pretty_otp6490_msg02, pretty_otp6490_msg03, - pretty_otp6490_msg04, pretty_otp6490_msg05, - pretty_otp6490_msg06, pretty_otp7671_msg01, - pretty_otp7671_msg02, pretty_otp7671_msg03, - pretty_otp7671_msg04, pretty_otp7671_msg05]}, - {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. + [{text, [], [{group, pretty}, + {group, flex_pretty}, + {group, compact}, + {group, flex_compact}]}, + {binary, [], [{group, bin}, + {group, ber}, + {group, ber_bin}, + {group, per}, + {group, per_bin}]}, + {erl_dist, [], [{group, erl_dist_m}]}, + {pretty, [], [pretty_test_msgs]}, + {compact, [], [compact_test_msgs]}, + {flex_pretty, [], flex_pretty_cases()}, + {flex_compact, [], flex_compact_cases()}, + {bin, [], [bin_test_msgs]}, + {ber, [], [ber_test_msgs]}, + {ber_bin, [], [ber_bin_test_msgs]}, + {per, [], [per_test_msgs]}, + {per_bin, [], [per_bin_test_msgs]}, + {erl_dist_m, [], [erl_dist_m_test_msgs]}, + {tickets, [], [{group, compact_tickets}, + {group, pretty_tickets}, + {group, flex_compact_tickets}, + {group, flex_pretty_tickets}]}, + {compact_tickets, [], [compact_otp4011_msg1, + compact_otp4011_msg2, + compact_otp4011_msg3, + compact_otp4013_msg1, + compact_otp4085_msg1, + compact_otp4085_msg2, + compact_otp4280_msg1, + compact_otp4299_msg1, + compact_otp4299_msg2, + compact_otp4359_msg1, + compact_otp4920_msg0, + compact_otp4920_msg1, + compact_otp4920_msg2, + compact_otp4920_msg3, + compact_otp4920_msg4, + compact_otp4920_msg5, + compact_otp4920_msg6, + compact_otp4920_msg7, + compact_otp4920_msg8, + compact_otp4920_msg9, + compact_otp4920_msg10, + compact_otp4920_msg11, + compact_otp4920_msg12, + compact_otp4920_msg20, + compact_otp4920_msg21, + compact_otp4920_msg22, + compact_otp4920_msg23, + compact_otp4920_msg24, + compact_otp4920_msg25, + compact_otp5186_msg01, + compact_otp5186_msg02, + compact_otp5186_msg03, + compact_otp5186_msg04, + compact_otp5186_msg05, + compact_otp5186_msg06, + compact_otp5793_msg01, + compact_otp5993_msg01, + compact_otp5993_msg02, + compact_otp5993_msg03, + compact_otp6017_msg01, + compact_otp6017_msg02, + compact_otp6017_msg03]}, + {flex_compact_tickets, [], flex_compact_tickets_cases()}, + {pretty_tickets, [], [pretty_otp4632_msg1, + pretty_otp4632_msg2, + pretty_otp4632_msg3, + pretty_otp4632_msg4, + pretty_otp4710_msg1, + pretty_otp4710_msg2, + pretty_otp4945_msg1, + pretty_otp4945_msg2, + pretty_otp4945_msg3, + pretty_otp4945_msg4, + pretty_otp4945_msg5, + pretty_otp4945_msg6, + pretty_otp4949_msg1, + pretty_otp4949_msg2, + pretty_otp4949_msg3, + pretty_otp5042_msg1, + pretty_otp5068_msg1, + pretty_otp5085_msg1, + pretty_otp5085_msg2, + pretty_otp5085_msg3, + pretty_otp5085_msg4, + pretty_otp5085_msg5, + pretty_otp5085_msg6, + pretty_otp5085_msg7, + pretty_otp5600_msg1, + pretty_otp5600_msg2, + pretty_otp5601_msg1, + pretty_otp5793_msg01, + pretty_otp5882_msg01, + pretty_otp6490_msg01, + pretty_otp6490_msg02, + pretty_otp6490_msg03, + pretty_otp6490_msg04, + pretty_otp6490_msg05, + pretty_otp6490_msg06, + pretty_otp7671_msg01, + pretty_otp7671_msg02, + pretty_otp7671_msg03, + pretty_otp7671_msg04, + pretty_otp7671_msg05]}, + {flex_pretty_tickets, [], flex_pretty_tickets_cases()}]. init_per_group(flex_pretty_tickets, Config) -> flex_pretty_init(Config); diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl index 0d2b4a3f4e..41f6c2c4cb 100644 --- a/lib/megaco/test/megaco_test_lib.erl +++ b/lib/megaco/test/megaco_test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2010. All Rights Reserved. +%% Copyright Ericsson AB 1999-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 @@ -146,28 +146,28 @@ tickets(Mod, Func, Config) -> end, lists:map(Map, Cases); - {req, _, {conf, Init, Cases, Finish}} -> - case (catch Mod:Init(Config)) of - Conf when is_list(Conf) -> - io:format("Expand: ~p:~p ...~n", [Mod, Func]), - Map = fun({M,_}) when is_atom(M) -> - tickets(M, tickets, Config); - (F) when is_atom(F) -> - tickets(Mod, F, Config); - (Case) -> Case - end, - Res = lists:map(Map, Cases), - (catch Mod:Finish(Conf)), - Res; +%% {req, _, {conf, Init, Cases, Finish}} -> +%% case (catch Mod:Init(Config)) of +%% Conf when is_list(Conf) -> +%% io:format("Expand: ~p:~p ...~n", [Mod, Func]), +%% Map = fun({M,_}) when is_atom(M) -> +%% tickets(M, tickets, Config); +%% (F) when is_atom(F) -> +%% tickets(Mod, F, Config); +%% (Case) -> Case +%% end, +%% Res = lists:map(Map, Cases), +%% (catch Mod:Finish(Conf)), +%% Res; - {'EXIT', {skipped, Reason}} -> - io:format(" => skipping: ~p~n", [Reason]), - [{skipped, {Mod, Func}, Reason}]; +%% {'EXIT', {skipped, Reason}} -> +%% io:format(" => skipping: ~p~n", [Reason]), +%% [{skipped, {Mod, Func}, Reason}]; - Error -> - io:format(" => init failed: ~p~n", [Error]), - [{failed, {Mod, Func}, Error}] - end; +%% Error -> +%% io:format(" => init failed: ~p~n", [Error]), +%% [{failed, {Mod, Func}, Error}] +%% end; {'EXIT', {undef, _}} -> io:format("Undefined: ~p~n", [{Mod, Func}]), @@ -252,6 +252,8 @@ alloc_instance_mem_info(Key, InstanceInfo) -> end. +t([Case]) when is_atom(Case) -> + t(Case); t(Case) -> process_flag(trap_exit, true), MEM = fun() -> case (catch erlang:memory()) of @@ -266,11 +268,65 @@ t(Case) -> Res = lists:flatten(t(Case, default_config())), Alloc2 = alloc_info(), Mem2 = MEM(), - %% io:format("Res: ~p~n", [Res]), display_result(Res, Alloc1, Mem1, Alloc2, Mem2), Res. -t({Mod, Fun}, Config) when is_atom(Mod) andalso is_atom(Fun) -> + +groups(Mod) when is_atom(Mod) -> + try Mod:groups() of + Groups when is_list(Groups) -> + Groups; + BadGroups -> + exit({bad_groups, Mod, BadGroups}) + catch + _:_ -> + [] + end. + +init_suite(Mod, Config) -> + Mod:init_per_suite(Config). + +end_suite(Mod, Config) -> + Mod:end_per_suite(Config). + +init_group(Mod, Group, Config) -> + Mod:init_per_group(Group, Config). + +end_group(Mod, Group, Config) -> + Mod:init_per_group(Group, Config). + +%% This is for sub-SUITEs +t({_Mod, {NewMod, all}, _Groups}, _Config) when is_atom(NewMod) -> + t(NewMod); +t({Mod, {group, Name} = Group, Groups}, Config) + when is_atom(Mod) andalso is_atom(Name) andalso is_list(Groups) -> + case lists:keysearch(Name, 1, Groups) of + {value, {Name, _Props, GroupsAndCases}} -> + try init_group(Mod, Name, Config) of + Config2 when is_list(Config2) -> + Res = [t({Mod, Case, Groups}, Config2) || + Case <- GroupsAndCases], + (catch end_group(Mod, Name, Config2)), + Res; + Error -> + io:format(" => group (~w) init failed: ~p~n", + [Name, Error]), + [{failed, {Mod, Group}, Error}] + catch + exit:{skipped, SkipReason} -> + io:format(" => skipping group: ~p~n", [SkipReason]), + [{skipped, {Mod, Group}, SkipReason, 0}]; + exit:{undef, _} -> + [t({Mod, Case, Groups}, Config) || + Case <- GroupsAndCases]; + T:E -> + [{failed, {Mod, Group}, {T,E}, 0}] + end; + false -> + exit({unknown_group, Mod, Name, Groups}) + end; +t({Mod, Fun, _}, Config) + when is_atom(Mod) andalso is_atom(Fun) -> case catch apply(Mod, Fun, [suite]) of [] -> io:format("Eval: ~p:", [{Mod, Fun}]), @@ -286,26 +342,6 @@ t({Mod, Fun}, Config) when is_atom(Mod) andalso is_atom(Fun) -> end, t(lists:map(Map, Cases), Config); - {req, _, {conf, Init, Cases, Finish}} -> - case (catch apply(Mod, Init, [Config])) of - Conf when is_list(Conf) -> - io:format("Expand: ~p ...~n", [{Mod, Fun}]), - Map = fun(Case) when is_atom(Case) -> {Mod, Case}; - (Case) -> Case - end, - Res = t(lists:map(Map, Cases), Conf), - (catch apply(Mod, Finish, [Conf])), - Res; - - {'EXIT', {skipped, Reason}} -> - io:format(" => skipping: ~p~n", [Reason]), - [{skipped, {Mod, Fun}, Reason, 0}]; - - Error -> - io:format(" => failed: ~p~n", [Error]), - [{failed, {Mod, Fun}, Error, 0}] - end; - {'EXIT', {undef, _}} -> io:format("Undefined: ~p~n", [{Mod, Fun}]), [{nyi, {Mod, Fun}, ok, 0}]; @@ -315,10 +351,38 @@ t({Mod, Fun}, Config) when is_atom(Mod) andalso is_atom(Fun) -> [{failed, {Mod, Fun}, Error, 0}] end; t(Mod, Config) when is_atom(Mod) -> - Res = t({Mod, all}, Config), - Res; -t(Cases, Config) when is_list(Cases) -> - [t(Case, Config) || Case <- Cases]; + %% This is assumed to be a test suite, so we start by calling + %% the top test suite function(s) (all/0 and groups/0). + case (catch Mod:all()) of + Cases when is_list(Cases) -> + %% The list may contain atoms (actual test cases) and + %% group-tuples (a tuple naming a group of test cases). + %% A group is defined by the (optional) groups/0 function. + Groups = groups(Mod), + try init_suite(Mod, Config) of + Config2 when is_list(Config2) -> + Res = [t({Mod, Case, Groups}, Config2) || Case <- Cases], + (catch end_suite(Mod, Config2)), + Res; + Error -> + io:format(" => suite init failed: ~p~n", [Error]), + [{failed, {Mod, init_per_suite}, Error}] + catch + exit:{skipped, SkipReason} -> + io:format(" => skipping suite: ~p~n", [SkipReason]), + [{skipped, {Mod, init_per_suite}, SkipReason, 0}]; + exit:{undef, _} -> + [t({Mod, Case, Groups}, Config) || Case <- Cases]; + T:E -> + [{failed, {Mod, init_per_suite}, {T,E}, 0}] + end; + {'EXIT', {undef, _}} -> + io:format("Undefined: ~p~n", [{Mod, all}]), + [{nyi, {Mod, all}, ok, 0}]; + + Crap -> + Crap + end; t(Bad, _Config) -> [{badarg, Bad, ok, 0}]. @@ -495,28 +559,56 @@ do_display_memory([{Key, Mem1}|MemInfo1], MemInfo2) -> display_result([]) -> io:format("OK~n", []); display_result(Res) when is_list(Res) -> - Ok = [{MF, Time} || {ok, MF, _, Time} <- Res], - Nyi = [MF || {nyi, MF, _, _Time} <- Res], - Skipped = [{MF, Reason} || {skipped, MF, Reason, _Time} <- Res], - Failed = [{MF, Reason} || {failed, MF, Reason, _Time} <- Res], - Crashed = [{MF, Reason} || {crashed, MF, Reason, _Time} <- Res], - display_summery(Ok, Nyi, Skipped, Failed, Crashed), + Ok = [{MF, Time} || {ok, MF, _, Time} <- Res], + Nyi = [MF || {nyi, MF, _, _Time} <- Res], + SkippedGrps = [{{M,G}, Reason} || + {skipped, {M, {group, G}}, Reason, _Time} <- Res], + SkippedCases = [{MF, Reason} || + {skipped, {_M, F} = MF, Reason, _Time} <- Res, + is_atom(F)], + FailedGrps = [{{M,G}, Reason} || + {failed, {M, {group, G}}, Reason, _Time} <- Res], + FailedCases = [{MF, Reason} || + {failed, {_M, F} = MF, Reason, _Time} <- Res, + is_atom(F)], + Crashed = [{MF, Reason} || {crashed, MF, Reason, _Time} <- Res], + display_summery(Ok, Nyi, + SkippedGrps, SkippedCases, + FailedGrps, FailedCases, + Crashed), display_ok(Ok), - display_skipped(Skipped), - display_failed(Failed), + display_skipped("groups", SkippedGrps), + display_skipped("test cases", SkippedCases), + display_failed("groups", FailedGrps), + display_failed("test cases", FailedCases), display_crashed(Crashed). -display_summery(Ok, Nyi, Skipped, Failed, Crashed) -> +display_summery(Ok, Nyi, + SkippedGrps, SkippedCases, + FailedGrps, FailedCases, + Crashed) -> io:format("~nTest case summery:~n", []), - display_summery(Ok, "successfull"), - display_summery(Nyi, "not yet implemented"), - display_summery(Skipped, "skipped"), - display_summery(Failed, "failed"), - display_summery(Crashed, "crashed"), + display_summery(Ok, "test case", "successfull"), + display_summery(Nyi, "test case", "not yet implemented"), + display_summery(SkippedGrps, "group", "skipped"), + display_summery(SkippedCases, "test case", "skipped"), + display_summery(FailedGrps, "group", "failed"), + display_summery(FailedCases, "test case", "failed"), + display_summery(Crashed, "test case", "crashed"), io:format("~n", []). -display_summery(Res, Info) -> - io:format(" ~w test cases ~s~n", [length(Res), Info]). + +display_summery(Res, Kind, Info) -> + Len = length(Res), + if + Len =:= 1 -> + display_summery(Len, Kind ++ " " ++ Info); + true -> + display_summery(Len, Kind ++ "s " ++ Info) + end. + +display_summery(Len, Info) -> + io:format(" ~w ~s~n", [Len, Info]). display_ok([]) -> ok; @@ -528,20 +620,20 @@ display_ok(Ok) -> lists:foreach(F, Ok), io:format("~n", []). -display_skipped([]) -> +display_skipped(_, []) -> ok; -display_skipped(Skipped) -> - io:format("Skipped test cases:~n", []), - F = fun({MF, Reason}) -> io:format(" ~p => ~p~n", [MF, Reason]) end, +display_skipped(Pre, Skipped) -> + io:format("Skipped ~s:~n", [Pre]), + F = fun({X, Reason}) -> io:format(" ~p => ~p~n", [X, Reason]) end, lists:foreach(F, Skipped), io:format("~n", []). -display_failed([]) -> +display_failed(_, []) -> ok; -display_failed(Failed) -> - io:format("Failed test cases:~n", []), - F = fun({MF, Reason}) -> io:format(" ~p => ~p~n", [MF, Reason]) end, +display_failed(Pre, Failed) -> + io:format("Failed ~s:~n", [Pre]), + F = fun({X, Reason}) -> io:format(" ~p => ~p~n", [X, Reason]) end, lists:foreach(F, Failed), io:format("~n", []). @@ -837,5 +929,5 @@ start_nodes([Node | Nodes], File, Line) -> start_nodes([], _File, _Line) -> ok. -p(F,A) -> - io:format("~p" ++ F ++ "~n", [self()|A]). +p(F, A) -> + io:format("~p~w:" ++ F ++ "~n", [self(), ?MODULE |A]). -- cgit v1.2.3 From c4241524ea42871f6cb601783ea56e18449f7cc1 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 1 Mar 2011 11:29:57 +0100 Subject: Wrong remove instruction. --- lib/megaco/src/app/megaco.appup.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/megaco/src/app/megaco.appup.src b/lib/megaco/src/app/megaco.appup.src index 495a9ec9ae..01b070d79f 100644 --- a/lib/megaco/src/app/megaco.appup.src +++ b/lib/megaco/src/app/megaco.appup.src @@ -160,7 +160,7 @@ {load_module, megaco_filter, soft_purge, soft_purge, []}, {load_module, megaco_timer, soft_purge, soft_purge, [megaco_config]}, {update, megaco_config, soft, soft_purge, soft_purge, []}, - {delete_module, megaco_config_misc} + {remove, {megaco_config_misc, soft_purge, brutal_purge}} ] } ] -- cgit v1.2.3 From ebcc15d9b60c0372b2b676f0fe013b19a7e669fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Tue, 1 Mar 2011 16:33:15 +0100 Subject: Add font edoc type spec for egd --- lib/percept/src/egd.erl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl index 4fb5b6c46a..63e5c30572 100644 --- a/lib/percept/src/egd.erl +++ b/lib/percept/src/egd.erl @@ -42,6 +42,7 @@ %%========================================================================== %% @type egd_image() +%% @type font() %% @type point() = {integer(), integer()} %% @type color() %% @type render_option() = {render_engine, opaque} | {render_engine, alpha} -- cgit v1.2.3 From 435a89b9d156f3f6d88416dedb8e75b0489eba80 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 1 Mar 2011 16:47:09 +0100 Subject: Fix three dialyzer warnings in kernel Joint effort by Kostis, pan, egil & sverker --- erts/preloaded/src/erlang.erl | 16 +++++----------- erts/preloaded/src/prim_inet.erl | 4 ++-- lib/kernel/src/net_kernel.erl | 31 +++++++++++++------------------ 3 files changed, 20 insertions(+), 31 deletions(-) diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 935c2de253..d6dc070436 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -427,17 +427,11 @@ delay_trap(Result, Timeout) -> receive after Timeout -> Result end. %% have to reflect that, which we cannot forsee. %% set_cookie(Node, C) when Node =/= nonode@nohost, is_atom(Node) -> - Res = case C of - _ when is_atom(C) -> - auth:set_cookie(Node, C); - {CI,CO} when is_atom(CI), is_atom(CO) -> - auth:set_cookie(Node, {CI, CO}); - _ -> - error - end, - case Res of - error -> exit(badarg); - Other -> Other + case is_atom(C) of + true -> + auth:set_cookie(Node, C); + false -> + error(badarg) end. -spec get_cookie() -> atom(). diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl index 446656e45f..2e4a2866e6 100644 --- a/erts/preloaded/src/prim_inet.erl +++ b/erts/preloaded/src/prim_inet.erl @@ -1518,7 +1518,7 @@ enc_value_2(addr, {IP,Port}) when tuple_size(IP) =:= 4 -> [?INET_AF_INET,?int16(Port)|ip4_to_bytes(IP)]; enc_value_2(addr, {IP,Port}) when tuple_size(IP) =:= 8 -> [?INET_AF_INET6,?int16(Port)|ip6_to_bytes(IP)]; -enc_value_2(ether, [X1,X2,X3,X4,X5,X6]) -> [X1,X2,X3,X4,X5,X6]; +enc_value_2(ether, [_,_,_,_,_,_]=Xs) -> Xs; enc_value_2(sockaddr, any) -> [?INET_AF_ANY]; enc_value_2(sockaddr, loopback) -> @@ -1572,7 +1572,7 @@ dec_value(time, [X3,X2,X1,X0|T]) -> Val -> {Val, T} end; dec_value(ip, [A,B,C,D|T]) -> {{A,B,C,D}, T}; -dec_value(ether,[X1,X2,X3,X4,X5,X6|T]) -> {[X1,X2,X3,X4,X5,X6],T}; +%% dec_value(ether, [X1,X2,X3,X4,X5,X6|T]) -> {[X1,X2,X3,X4,X5,X6],T}; dec_value(sockaddr, [X|T]) -> get_ip(X, T); dec_value(linkaddr, [X1,X0|T]) -> diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl index f5e2820bbe..23db85e1f4 100644 --- a/lib/kernel/src/net_kernel.erl +++ b/lib/kernel/src/net_kernel.erl @@ -322,24 +322,19 @@ init({Name, LongOrShortNames, TickT}) -> process_flag(priority, max), Ticktime = to_integer(TickT), Ticker = spawn_link(net_kernel, ticker, [self(), Ticktime]), - case auth:get_cookie(Node) of - Cookie when is_atom(Cookie) -> - {ok, #state{name = Name, - node = Node, - type = LongOrShortNames, - tick = #tick{ticker = Ticker, time = Ticktime}, - connecttime = connecttime(), - connections = - ets:new(sys_dist,[named_table, - protected, - {keypos, 2}]), - listen = Listeners, - allowed = [], - verbose = 0 - }}; - _ELSE -> - {stop, {error,{bad_cookie, Node}}} - end; + {ok, #state{name = Name, + node = Node, + type = LongOrShortNames, + tick = #tick{ticker = Ticker, time = Ticktime}, + connecttime = connecttime(), + connections = + ets:new(sys_dist,[named_table, + protected, + {keypos, 2}]), + listen = Listeners, + allowed = [], + verbose = 0 + }}; Error -> {stop, Error} end. -- cgit v1.2.3 From e83fc28ced34c954f65eaa884e093fdd733f8992 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 1 Mar 2011 17:02:18 +0100 Subject: Update preloaded modules --- erts/preloaded/ebin/erl_prim_loader.beam | Bin 50384 -> 50384 bytes erts/preloaded/ebin/erlang.beam | Bin 24320 -> 24144 bytes erts/preloaded/ebin/init.beam | Bin 44876 -> 44876 bytes erts/preloaded/ebin/otp_ring0.beam | Bin 1432 -> 1432 bytes erts/preloaded/ebin/prim_file.beam | Bin 31552 -> 31548 bytes erts/preloaded/ebin/prim_inet.beam | Bin 65060 -> 64888 bytes erts/preloaded/ebin/prim_zip.beam | Bin 22432 -> 22432 bytes erts/preloaded/ebin/zlib.beam | Bin 10616 -> 10616 bytes 8 files changed, 0 insertions(+), 0 deletions(-) diff --git a/erts/preloaded/ebin/erl_prim_loader.beam b/erts/preloaded/ebin/erl_prim_loader.beam index 87ff5119fd..bff3f7f9de 100644 Binary files a/erts/preloaded/ebin/erl_prim_loader.beam and b/erts/preloaded/ebin/erl_prim_loader.beam differ diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam index 6b0d96ff8e..5d2f187435 100644 Binary files a/erts/preloaded/ebin/erlang.beam and b/erts/preloaded/ebin/erlang.beam differ diff --git a/erts/preloaded/ebin/init.beam b/erts/preloaded/ebin/init.beam index 8a7a9a1314..7e492057da 100644 Binary files a/erts/preloaded/ebin/init.beam and b/erts/preloaded/ebin/init.beam differ diff --git a/erts/preloaded/ebin/otp_ring0.beam b/erts/preloaded/ebin/otp_ring0.beam index 5d544ff4aa..c443866671 100644 Binary files a/erts/preloaded/ebin/otp_ring0.beam and b/erts/preloaded/ebin/otp_ring0.beam differ diff --git a/erts/preloaded/ebin/prim_file.beam b/erts/preloaded/ebin/prim_file.beam index 3ed02ecd44..4a75e43e73 100644 Binary files a/erts/preloaded/ebin/prim_file.beam and b/erts/preloaded/ebin/prim_file.beam differ diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam index 79a8d22366..30bbfb0943 100644 Binary files a/erts/preloaded/ebin/prim_inet.beam and b/erts/preloaded/ebin/prim_inet.beam differ diff --git a/erts/preloaded/ebin/prim_zip.beam b/erts/preloaded/ebin/prim_zip.beam index 3cc8c6b8be..6681466767 100644 Binary files a/erts/preloaded/ebin/prim_zip.beam and b/erts/preloaded/ebin/prim_zip.beam differ diff --git a/erts/preloaded/ebin/zlib.beam b/erts/preloaded/ebin/zlib.beam index 3f9e867542..593bb8dbed 100644 Binary files a/erts/preloaded/ebin/zlib.beam and b/erts/preloaded/ebin/zlib.beam differ -- cgit v1.2.3 From 9b3fd5946a4689f7403e1910ebe9e4a713710df7 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Wed, 23 Feb 2011 14:30:27 +0100 Subject: Mnesia dialyzer fixes With help from Kostis --- lib/mnesia/src/mnesia.erl | 9 +++++---- lib/mnesia/src/mnesia_bup.erl | 7 ++++++- lib/mnesia/src/mnesia_frag.erl | 26 +++++++++++++++----------- lib/mnesia/src/mnesia_index.erl | 2 +- lib/mnesia/src/mnesia_lib.erl | 5 +++-- lib/mnesia/src/mnesia_locker.erl | 3 ++- lib/mnesia/src/mnesia_recover.erl | 2 +- lib/mnesia/src/mnesia_snmp_hook.erl | 2 +- lib/mnesia/src/mnesia_tm.erl | 4 +++- 9 files changed, 37 insertions(+), 23 deletions(-) diff --git a/lib/mnesia/src/mnesia.erl b/lib/mnesia/src/mnesia.erl index fb29007780..025b32f506 100644 --- a/lib/mnesia/src/mnesia.erl +++ b/lib/mnesia/src/mnesia.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 @@ -302,7 +302,7 @@ ms() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Activity mgt --spec(abort/1 :: (_) -> no_return()). +-spec abort(_) -> no_return(). abort(Reason) -> exit({aborted, Reason}). @@ -1835,6 +1835,7 @@ do_dirty_rpc(Tab, Node, M, F, Args) -> %% Info %% Info about one table +-spec table_info(atom(), any()) -> any(). table_info(Tab, Item) -> case get(mnesia_activity_state) of undefined -> @@ -1868,7 +1869,7 @@ any_table_info(Tab, Item) when is_atom(Tab) -> type -> case ?catch_val({Tab, setorbag}) of {'EXIT', _} -> - bad_info_reply(Tab, Item); + abort({no_exists, Tab, Item}); Val -> Val end; @@ -1886,7 +1887,7 @@ any_table_info(Tab, Item) when is_atom(Tab) -> _ -> case ?catch_val({Tab, Item}) of {'EXIT', _} -> - bad_info_reply(Tab, Item); + abort({no_exists, Tab, Item}); Val -> Val end diff --git a/lib/mnesia/src/mnesia_bup.erl b/lib/mnesia/src/mnesia_bup.erl index 37a8258d74..47dcdad7ac 100644 --- a/lib/mnesia/src/mnesia_bup.erl +++ b/lib/mnesia/src/mnesia_bup.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 @@ -65,6 +65,8 @@ default_op = keep_tables }). +-type fallback_args() :: #fallback_args{}. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Backup iterator @@ -108,6 +110,7 @@ iter(R, Header, Schema, Fun, Acc, BupItems) -> Acc2 = Fun(BupItems, Header, Schema, Acc), iter(R, Header, Schema, Fun, Acc2, []). +-spec safe_apply(#restore{}, atom(), list()) -> tuple(). safe_apply(R, write, [_, Items]) when Items =:= [] -> R; safe_apply(R, What, Args) -> @@ -570,6 +573,7 @@ fallback_bup() -> mnesia_lib:dir(fallback_name()). fallback_tmp_name() -> "FALLBACK.TMP". %% fallback_full_tmp_name() -> mnesia_lib:dir(fallback_tmp_name()). +-spec fallback_receiver(pid(), fallback_args()) -> no_return(). fallback_receiver(Master, FA) -> process_flag(trap_exit, true), @@ -981,6 +985,7 @@ do_uninstall_fallback(FA) -> {error, Reason} end. +-spec uninstall_fallback_master(pid(), fallback_args()) -> no_return(). uninstall_fallback_master(ClientPid, FA) -> process_flag(trap_exit, true), diff --git a/lib/mnesia/src/mnesia_frag.erl b/lib/mnesia/src/mnesia_frag.erl index a2958ab461..6cc16c80fd 100644 --- a/lib/mnesia/src/mnesia_frag.erl +++ b/lib/mnesia/src/mnesia_frag.erl @@ -1,7 +1,7 @@ %%% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -448,13 +448,15 @@ do_remote_select(_ReplyTo, _Ref, [], _MatchSpec) -> local_collect(Ref, Pid, Type, LocalMatch, OldSelectFun) -> receive - {local_select, Ref, LocalRes} -> - remote_collect(Ref, Type, LocalRes, LocalMatch, OldSelectFun); + {local_select, Ref, ok} -> + remote_collect_ok(Ref, Type, LocalMatch, OldSelectFun); + {local_select, Ref, {error, Reason}} -> + remote_collect_error(Ref, Type, Reason, OldSelectFun); {'EXIT', Pid, Reason} -> - remote_collect(Ref, Type, {error, Reason}, [], OldSelectFun) + remote_collect_error(Ref, Type, Reason, OldSelectFun) end. -remote_collect(Ref, Type, LocalRes = ok, Acc, OldSelectFun) -> +remote_collect_ok(Ref, Type, Acc, OldSelectFun) -> receive {remote_select, Ref, Node, RemoteRes} -> case RemoteRes of @@ -463,19 +465,21 @@ remote_collect(Ref, Type, LocalRes = ok, Acc, OldSelectFun) -> ordered_set -> lists:merge(RemoteMatch, Acc); _ -> RemoteMatch ++ Acc end, - remote_collect(Ref, Type, LocalRes, Matches, OldSelectFun); + remote_collect_ok(Ref, Type, Matches, OldSelectFun); _ -> - remote_collect(Ref, Type, {error, {node_not_running, Node}}, [], OldSelectFun) + Reason = {node_not_running, Node}, + remote_collect_error(Ref, Type, Reason, OldSelectFun) end after 0 -> Acc - end; -remote_collect(Ref, Type, LocalRes = {error, Reason}, _Acc, OldSelectFun) -> + end. + +remote_collect_error(Ref, Type, Reason, OldSelectFun) -> receive {remote_select, Ref, _Node, _RemoteRes} -> - remote_collect(Ref, Type, LocalRes, [], OldSelectFun) + remote_collect_error(Ref, Type, Reason, OldSelectFun) after 0 -> - mnesia:abort(Reason) + mnesia:abort({error, Reason}) end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/mnesia/src/mnesia_index.erl b/lib/mnesia/src/mnesia_index.erl index 4e6e8a997c..61210d7e55 100644 --- a/lib/mnesia/src/mnesia_index.erl +++ b/lib/mnesia/src/mnesia_index.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 diff --git a/lib/mnesia/src/mnesia_lib.erl b/lib/mnesia/src/mnesia_lib.erl index 3da3dd2f5c..558eda467c 100644 --- a/lib/mnesia/src/mnesia_lib.erl +++ b/lib/mnesia/src/mnesia_lib.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 @@ -390,6 +390,7 @@ set(Var, Val) -> unset(Var) -> ?ets_delete(mnesia_gvar, Var). +-spec other_val(_, _) -> no_return(). other_val(Var, Other) -> case Var of {_, where_to_read} -> nowhere; @@ -399,7 +400,7 @@ other_val(Var, Other) -> pr_other(Var, Other) end. --spec(pr_other/2 :: (_,_) -> no_return()). +-spec pr_other(_,_) -> no_return(). pr_other(Var, Other) -> Why = diff --git a/lib/mnesia/src/mnesia_locker.erl b/lib/mnesia/src/mnesia_locker.erl index 6b5770d91e..ca0cc79c45 100644 --- a/lib/mnesia/src/mnesia_locker.erl +++ b/lib/mnesia/src/mnesia_locker.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 @@ -1104,6 +1104,7 @@ do_stop() -> system_continue(_Parent, _Debug, State) -> loop(State). +-spec system_terminate(_, _, _, _) -> no_return(). system_terminate(_Reason, _Parent, _Debug, _State) -> do_stop(). diff --git a/lib/mnesia/src/mnesia_recover.erl b/lib/mnesia/src/mnesia_recover.erl index 7435b6896a..b3eed1de6e 100644 --- a/lib/mnesia/src/mnesia_recover.erl +++ b/lib/mnesia/src/mnesia_recover.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 diff --git a/lib/mnesia/src/mnesia_snmp_hook.erl b/lib/mnesia/src/mnesia_snmp_hook.erl index 8b4b5231e1..893b39f3c0 100644 --- a/lib/mnesia/src/mnesia_snmp_hook.erl +++ b/lib/mnesia/src/mnesia_snmp_hook.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 diff --git a/lib/mnesia/src/mnesia_tm.erl b/lib/mnesia/src/mnesia_tm.erl index f3ffac5493..bb8e788b40 100644 --- a/lib/mnesia/src/mnesia_tm.erl +++ b/lib/mnesia/src/mnesia_tm.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 @@ -1604,6 +1604,7 @@ tell_participants([Pid | Pids], Msg) -> tell_participants([], _Msg) -> ok. +-spec commit_participant(_, _, _, _, _) -> no_return(). %% Trap exit because we can get a shutdown from application manager commit_participant(Coord, Tid, Bin, DiscNs, RamNs) when is_binary(Bin) -> process_flag(trap_exit, true), @@ -2279,6 +2280,7 @@ fixtable(Tab, Lock, Me) -> system_continue(_Parent, _Debug, State) -> doit_loop(State). +-spec system_terminate(_, _, _, _) -> no_return(). system_terminate(_Reason, _Parent, _Debug, State) -> do_stop(State). -- cgit v1.2.3 From fea31e77b0bf8d8134377ff90d801504bfdb4a0a Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 24 Feb 2011 13:29:06 +0100 Subject: Fix debugger warnings --- lib/debugger/src/dbg_ui_view.erl | 13 ++++++++----- lib/debugger/src/dbg_wx_view.erl | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/debugger/src/dbg_ui_view.erl b/lib/debugger/src/dbg_ui_view.erl index 7350a830a8..be998f22ff 100644 --- a/lib/debugger/src/dbg_ui_view.erl +++ b/lib/debugger/src/dbg_ui_view.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2009. All Rights Reserved. +%% Copyright Ericsson AB 1998-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 @@ -42,6 +42,9 @@ start(GS, Mod) -> false -> spawn(fun () -> init(GS, Mod, Title) end) end. +-spec stop() -> no_return(). +stop() -> + exit(stop). %%==================================================================== %% Main loop and message handling @@ -90,7 +93,7 @@ loop(State) -> dbg_ui_winman:update_windows_menu(Data), loop(State); {dbg_ui_winman, destroy} -> - exit(stop); + stop(); %% Help window termination -- ignore {'EXIT', _Pid, _Reason} -> @@ -104,7 +107,7 @@ gui_cmd(ignore, State) -> gui_cmd({win, Win}, State) -> State#state{win=Win}; gui_cmd(stopped, _State) -> - exit(stop); + stop(); gui_cmd({coords, Coords}, State) -> State#state{coords=Coords}; @@ -115,8 +118,8 @@ gui_cmd({shortcut, Key}, State) -> end; %% File menu -gui_cmd('Close', State) -> - gui_cmd(stopped, State); +gui_cmd('Close', _State) -> + stop(); %% Edit menu gui_cmd('Go To Line...', State) -> diff --git a/lib/debugger/src/dbg_wx_view.erl b/lib/debugger/src/dbg_wx_view.erl index 8ff89a4847..6242b9d0e0 100644 --- a/lib/debugger/src/dbg_wx_view.erl +++ b/lib/debugger/src/dbg_wx_view.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -46,6 +46,9 @@ start(GS, Mod) -> spawn_link(fun () -> init(GS, Env, Mod, Title) end) end. +-spec stop() -> no_return(). +stop() -> + exit(normal). %%==================================================================== %% Main loop and message handling @@ -113,13 +116,13 @@ loop(State) -> end. %%--Commands from the GUI--------------------------------------------- - + gui_cmd(ignore, State) -> State; gui_cmd({win, Win}, State) -> State#state{win=Win}; gui_cmd(stopped, _State) -> - exit(normal); + stop(); gui_cmd({coords, Coords}, State) -> State#state{coords=Coords}; @@ -132,7 +135,7 @@ gui_cmd({shortcut, Key}, State) -> %% File menu gui_cmd('Close', State) -> dbg_wx_trace_win:stop(State#state.win), - gui_cmd(stopped, State); + stop(); %% Edit menu gui_cmd('Go To Line', State) -> -- cgit v1.2.3 From 728d949df2ce88587371d353b4379e3d349b0066 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Wed, 2 Mar 2011 08:13:39 +0100 Subject: Remove wrong spec --- lib/mnesia/src/mnesia_lib.erl | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/mnesia/src/mnesia_lib.erl b/lib/mnesia/src/mnesia_lib.erl index 558eda467c..36bcfe8de9 100644 --- a/lib/mnesia/src/mnesia_lib.erl +++ b/lib/mnesia/src/mnesia_lib.erl @@ -390,7 +390,6 @@ set(Var, Val) -> unset(Var) -> ?ets_delete(mnesia_gvar, Var). --spec other_val(_, _) -> no_return(). other_val(Var, Other) -> case Var of {_, where_to_read} -> nowhere; -- cgit v1.2.3 From 804bb7f78fcf94609f31a9d429b82c37d1f1173b Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Wed, 2 Mar 2011 09:32:09 +0200 Subject: Document exiting and garbage_collecting process statuses --- erts/doc/src/erlang.xml | 3 ++- lib/hipe/cerl/erl_bif_types.erl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index 78d58a1e56..c3f06982f5 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -3980,7 +3980,8 @@ os_prompt% {status, Status}

Status is the status of the process. Status - is waiting (waiting for a message), running, + is exiting, garbage_collecting, + waiting (for a message), running, runnable (ready to run, but another process is running), or suspended (suspended on a "busy" port or by the erlang:suspend_process/[1,2] BIF).

diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 309c118107..6c6a207b3c 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -4807,7 +4807,8 @@ t_process_priority_level() -> t_sup([t_atom('max'), t_atom('high'), t_atom('normal'), t_atom('low')]). t_process_status() -> - t_sup([t_atom('runnable'), t_atom('running'), + t_sup([t_atom('exiting'), t_atom('garbage_collecting'), + t_atom('runnable'), t_atom('running'), t_atom('suspended'), t_atom('waiting')]). t_raise_errorclass() -> -- cgit v1.2.3 From a3a4dbb5f8b11a04f4ac1530cfd96478f881763b Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 2 Mar 2011 10:24:54 +0100 Subject: Fix bug where failing to make a testcase caused an errornous failure reason --- lib/test_server/src/ts_install_cth.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test_server/src/ts_install_cth.erl b/lib/test_server/src/ts_install_cth.erl index f8b4e5a4f8..d1a24525ab 100644 --- a/lib/test_server/src/ts_install_cth.erl +++ b/lib/test_server/src/ts_install_cth.erl @@ -112,7 +112,7 @@ pre_init_per_suite(_Suite,Config,State) -> catch Error:Reason -> Stack = erlang:get_stacktrace(), ct:pal("~p failed! ~p:{~p,~p}",[?MODULE,Error,Reason,Stack]), - {fail,{?MODULE,{Error,Reason, Stack}}} + {{fail,{?MODULE,{Error,Reason, Stack}}},State} end. %% @doc Called after init_per_suite. -- cgit v1.2.3 From be3218dc1bf7dec1217bcac82492a5550da7ee17 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 2 Mar 2011 12:00:19 +0100 Subject: Fix dialyzer warning in os:start_port_srv_loop Rewrote the code a bit to silence dialyzer. Seems dialyzer can't handle a function that either returns or loops forever depending on function argument. --- lib/kernel/src/os.erl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index ce8c581e08..95a2f71ec0 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -231,9 +231,13 @@ start_port_srv(Request) -> catch error:_ -> false end, - start_port_srv_loop(Request, StayAlive). + start_port_srv_handle(Request), + case StayAlive of + true -> start_port_srv_loop(); + false -> exiting + end. -start_port_srv_loop({Ref,Client}, StayAlive) -> +start_port_srv_handle({Ref,Client}) -> Reply = try open_port({spawn, ?SHELL},[stream]) of Port when is_port(Port) -> (catch port_connect(Port, Client)), @@ -243,20 +247,18 @@ start_port_srv_loop({Ref,Client}, StayAlive) -> error:Reason -> {Reason,erlang:get_stacktrace()} end, - Client ! {Ref,Reply}, - case StayAlive of - true -> start_port_srv_loop(get_open_port_request(), true); - false -> exiting - end. + Client ! {Ref,Reply}. -get_open_port_request() -> + +start_port_srv_loop() -> receive {Ref, Client} = Request when is_reference(Ref), is_pid(Client) -> - Request; + start_port_srv_handle(Request); _Junk -> - get_open_port_request() - end. + ignore + end, + start_port_srv_loop(). %% %% unix_get_data(Port) -> Result -- cgit v1.2.3 From c971c489dc8318ca4e92e9ba40d739dc4ee50982 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Wed, 2 Mar 2011 14:23:22 +0100 Subject: Remove race in main thread stealing due to reading and writing to pipe from same thread --- erts/emulator/beam/erl_drv_thread.c | 3 ++- erts/emulator/sys/unix/sys.c | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/erts/emulator/beam/erl_drv_thread.c b/erts/emulator/beam/erl_drv_thread.c index 08a35387f2..39bbe9633b 100644 --- a/erts/emulator/beam/erl_drv_thread.c +++ b/erts/emulator/beam/erl_drv_thread.c @@ -698,6 +698,7 @@ erl_drv_thread_join(ErlDrvTid tid, void **respp) #if defined(__DARWIN__) && defined(USE_THREADS) && defined(ERTS_SMP) extern int erts_darwin_main_thread_pipe[2]; +extern int erts_darwin_main_thread_result_pipe[2]; int @@ -709,7 +710,7 @@ erl_drv_stolen_main_thread_join(ErlDrvTid tid, void **respp) x = &dummy; else x = respp; - read(erts_darwin_main_thread_pipe[0],x,sizeof(void *)); + read(erts_darwin_main_thread_result_pipe[0],x,sizeof(void *)); return 0; } diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index 5f38d73359..bafbbb0f6c 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -2997,10 +2997,12 @@ init_smp_sig_notify(void) #ifdef __DARWIN__ int erts_darwin_main_thread_pipe[2]; +int erts_darwin_main_thread_result_pipe[2]; -static void initialize_darwin_main_thread_pipe(void) +static void initialize_darwin_main_thread_pipes(void) { - if (pipe(erts_darwin_main_thread_pipe) < 0) { + if (pipe(erts_darwin_main_thread_pipe) < 0 || + pipe(erts_darwin_main_thread_result_pipe) < 0) { erl_exit(1,"Fatal error initializing Darwin main thread stealing"); } } @@ -3011,7 +3013,7 @@ erts_sys_main_thread(void) { erts_thread_disable_fpe(); #ifdef __DARWIN__ - initialize_darwin_main_thread_pipe(); + initialize_darwin_main_thread_pipes(); #endif /* Become signal receiver thread... */ #ifdef ERTS_ENABLE_LOCK_CHECK @@ -3039,7 +3041,7 @@ erts_sys_main_thread(void) read(erts_darwin_main_thread_pipe[0],&func,sizeof(void* (*)(void*))); read(erts_darwin_main_thread_pipe[0],&arg, sizeof(void*)); resp = (*func)(arg); - write(erts_darwin_main_thread_pipe[1],&resp,sizeof(void *)); + write(erts_darwin_main_thread_result_pipe[1],&resp,sizeof(void *)); } #else #ifdef DEBUG -- cgit v1.2.3 From 01873381c2288a12e93b4bdb13b68c8f80039988 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 2 Mar 2011 14:55:57 +0100 Subject: Update unavailable test case to do setup and teardown --- lib/os_mon/test/disksup_SUITE.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/os_mon/test/disksup_SUITE.erl b/lib/os_mon/test/disksup_SUITE.erl index 6e015ef74a..a3c6c7782d 100644 --- a/lib/os_mon/test/disksup_SUITE.erl +++ b/lib/os_mon/test/disksup_SUITE.erl @@ -41,10 +41,16 @@ end_per_suite(Config) when is_list(Config) -> ?line ok = application:stop(os_mon), Config. +init_per_testcase(unavailable, Config) -> + terminate(Config), + init_per_testcase(dummy, Config); init_per_testcase(_Case, Config) -> Dog = ?t:timetrap(?default_timeout), [{watchdog,Dog} | Config]. +end_per_testcase(unavailable, Config) -> + restart(Config), + end_per_testcase(dummy, Config); end_per_testcase(_Case, Config) -> Dog = ?config(watchdog, Config), ?t:timetrap_cancel(Dog), -- cgit v1.2.3 From 7c94e6f3a69462968cfd352fb40389454bd42e7e Mon Sep 17 00:00:00 2001 From: Imre Horvath Date: Tue, 14 Dec 2010 23:03:44 +0100 Subject: Add ISO week number calculation functions to the calendar module in stdlib This new feature adds the missing week number function to the calendar module of the stdlib application. The implementation conforms to the ISO 8601 standard. The new feature has been implemented tested and documented. --- lib/stdlib/doc/src/calendar.xml | 32 +++++++++++++++++++++++ lib/stdlib/src/calendar.erl | 53 ++++++++++++++++++++++++++++++++++++++ lib/stdlib/test/calendar_SUITE.erl | 22 +++++++++++++--- 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/lib/stdlib/doc/src/calendar.xml b/lib/stdlib/doc/src/calendar.xml index 36f0c03162..f90d8308b6 100644 --- a/lib/stdlib/doc/src/calendar.xml +++ b/lib/stdlib/doc/src/calendar.xml @@ -63,6 +63,14 @@ given as local time, they must be converted to universal time, in order to get the correct value of the elapsed time between epochs. Use of the function time_difference/2 is discouraged.

+

There exists different definitions for the week of the year. + The calendar module contains a week of the year implementation + which conforms to the ISO 8601 standard. Since the week number for + a given date can fall on the previous, the current or on the next + year it is important to provide the information which year is it + together with the week number. The function iso_week_number/0 + and iso_week_number/1 returns a tuple of the year and the + week number.

@@ -153,6 +161,30 @@ time() = {Hour, Minute, Second}

This function checks if a year is a leap year.

+ + iso_week_number() -> IsoWeekNumber + Compute the iso week number for the actual date + + IsoWeekNumber = {int(), int()} + + +

This function returns the tuple {Year, WeekNum} representing + the iso week number for the actual date. For determining the + actual date, the function local_time/0 is used.

+
+
+ + iso_week_number(Date) -> IsoWeekNumber + Compute the iso week number for the given date + + Date = date() + IsoWeekNumber = {int(), int()} + + +

This function returns the tuple {Year, WeekNum} representing + the iso week number for the given date.

+
+
last_day_of_the_month(Year, Month) -> int() Compute the number of days in a month diff --git a/lib/stdlib/src/calendar.erl b/lib/stdlib/src/calendar.erl index ddc0666f77..57b7c28dee 100644 --- a/lib/stdlib/src/calendar.erl +++ b/lib/stdlib/src/calendar.erl @@ -28,6 +28,8 @@ gregorian_days_to_date/1, gregorian_seconds_to_datetime/1, is_leap_year/1, + iso_week_number/0, + iso_week_number/1, last_day_of_the_month/2, local_time/0, local_time_to_universal_time/1, @@ -70,6 +72,7 @@ -type second() :: 0..59. -type daynum() :: 1..7. -type ldom() :: 28 | 29 | 30 | 31. % last day of month +-type weeknum() :: 1..53. -type t_now() :: {non_neg_integer(),non_neg_integer(),non_neg_integer()}. @@ -77,6 +80,7 @@ -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()}. %%---------------------------------------------------------------------- @@ -172,6 +176,42 @@ is_leap_year1(Year) when Year rem 400 =:= 0 -> is_leap_year1(_) -> false. +%% +%% Calculates the iso week number for the current date. +%% +-spec iso_week_number() -> t_yearweeknum(). +iso_week_number() -> + {Date, _} = local_time(), + iso_week_number(Date). + + +%% +%% Calculates the iso week number for the given date. +%% +-spec iso_week_number(t_date()) -> t_yearweeknum(). +iso_week_number({Year, Month, Day}) -> + D = date_to_gregorian_days({Year, Month, Day}), + W01_1_Year = gregorian_days_of_iso_w01_1(Year), + W01_1_NextYear = gregorian_days_of_iso_w01_1(Year + 1), + if W01_1_Year =< D andalso D < W01_1_NextYear -> + % Current Year Week 01..52(,53) + {Year, (D - W01_1_Year) div 7 + 1}; + D < W01_1_Year -> + % Previous Year 52 or 53 + PWN = case day_of_the_week(Year - 1, 1, 1) of + 4 -> 53; + _ -> case day_of_the_week(Year - 1, 12, 31) of + 4 -> 53; + _ -> 52 + end + end, + {Year - 1, PWN}; + W01_1_NextYear =< D -> + % Next Year, Week 01 + {Year + 1, 1} + end. + + %% last_day_of_the_month(Year, Month) %% %% Returns the number of days in a month. @@ -377,6 +417,19 @@ dty(Y, D1, D2) when D1 < D2 -> dty(Y, _D1, D2) -> {Y, D2}. +%% +%% The Gregorian days of the iso week 01 day 1 for a given year. +%% +-spec gregorian_days_of_iso_w01_1(year()) -> non_neg_integer(). +gregorian_days_of_iso_w01_1(Year) -> + D0101 = date_to_gregorian_days(Year, 1, 1), + DOW = day_of_the_week(Year, 1, 1), + if DOW =< 4 -> + D0101 - DOW + 1; + true -> + D0101 + 7 - DOW + 1 + end. + %% year_day_to_date(Year, DayOfYear) = {Month, DayOfMonth} %% %% Note: 1 is the first day of the month. diff --git a/lib/stdlib/test/calendar_SUITE.erl b/lib/stdlib/test/calendar_SUITE.erl index 81b0299118..8192d035ca 100644 --- a/lib/stdlib/test/calendar_SUITE.erl +++ b/lib/stdlib/test/calendar_SUITE.erl @@ -28,7 +28,8 @@ day_of_the_week_calibrate/1, leap_years/1, last_day_of_the_month/1, - local_time_to_universal_time_dst/1]). + local_time_to_universal_time_dst/1, + iso_week_number/1]). -define(START_YEAR, 1947). -define(END_YEAR, 2012). @@ -38,7 +39,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [gregorian_days, gregorian_seconds, day_of_the_week, day_of_the_week_calibrate, leap_years, - last_day_of_the_month, local_time_to_universal_time_dst]. + last_day_of_the_month, local_time_to_universal_time_dst, iso_week_number]. groups() -> []. @@ -55,7 +56,6 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. - gregorian_days(doc) -> "Tests that date_to_gregorian_days and gregorian_days_to_date " "are each others inverses from ?START_YEAR-01-01 up to ?END_YEAR-01-01. " @@ -170,6 +170,15 @@ local_time_to_universal_time_dst_x(Config) when is_list(Config) -> {comment,"Bug in mktime() in this OS"} end. +iso_week_number(doc) -> + "Test the iso week number calculation for all three possibilities." + " When the date falls on the last week of the previous year," + " when the date falls on a week within the given year and finally," + " when the date falls on the first week of the next year."; +iso_week_number(suite) -> + []; +iso_week_number(Config) when is_list(Config) -> + ?line check_iso_week_number(). %% %% LOCAL FUNCTIONS @@ -259,7 +268,12 @@ check_last_day_of_the_month({SYr, SMon}, {EYr, EMon}) when SYr < EYr -> check_last_day_of_the_month(_, _) -> ok. - +%% check_iso_week_number +%% +check_iso_week_number() -> + ?line {2004, 53} = calendar:iso_week_number({2005, 1, 1}), + ?line {2007, 1} = calendar:iso_week_number({2007, 1, 1}), + ?line {2009, 1} = calendar:iso_week_number({2008, 12, 29}). -- cgit v1.2.3 From 24c45e5d18eafbc8fc85b0c49622980dac3f6fe2 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 2 Mar 2011 16:23:04 +0100 Subject: * On some windows machines dirs seem to vanish sometime between the call to init_per_testcase (when they are created) and the call to the actual test case (when they are used). * Try to handle systems where crypto is not built better. This *is* handled by application, but the test case snmp_app_test:undef_funcs could do a better job (which it hopefully does now :). --- lib/snmp/test/snmp_app_test.erl | 44 ++++++++++-- lib/snmp/test/snmp_manager_config_test.erl | 105 +++++++++++++++++++---------- 2 files changed, 106 insertions(+), 43 deletions(-) diff --git a/lib/snmp/test/snmp_app_test.erl b/lib/snmp/test/snmp_app_test.erl index 64dd638f83..27a7b4af2e 100644 --- a/lib/snmp/test/snmp_app_test.erl +++ b/lib/snmp/test/snmp_app_test.erl @@ -300,6 +300,25 @@ undef_funcs(Config) when is_list(Config) -> xref:stop(XRef), analyze_undefined_function_calls(Undefs, Mods, []). +valid_undef(crypto = CalledMod) -> + case (catch CalledMod:version()) of + Version when is_list(Version) -> + %% The called module was crypto and the version + %% function returns a valid value. + %% This means that the function is + %% actually undefined... + true; + _ -> + %% The called module was crypto but the version + %% function does *not* return a valid value. + %% This means the crypto was not actually not + %% build, which is an case snmp handles. + false + end; +valid_undef(_) -> + true. + + analyze_undefined_function_calls([], _, []) -> ok; analyze_undefined_function_calls([], _, AppUndefs) -> @@ -312,14 +331,25 @@ analyze_undefined_function_calls([{{Mod, _F, _A}, _C} = AppUndef|Undefs], {Calling,Called} = AppUndef, {Mod1,Func1,Ar1} = Calling, {Mod2,Func2,Ar2} = Called, - io:format("undefined function call: " - "~n ~w:~w/~w calls ~w:~w/~w~n", - [Mod1,Func1,Ar1,Mod2,Func2,Ar2]), - analyze_undefined_function_calls(Undefs, AppModules, - [AppUndef|AppUndefs]); + %% If the called module is crypto, then we will *not* + %% fail if crypto is not built (since crypto is actually + %% not built for all platforms) + case valid_undef(Mod2) of + true -> + io:format("undefined function call: " + "~n ~w:~w/~w calls ~w:~w/~w~n", + [Mod1,Func1,Ar1,Mod2,Func2,Ar2]), + analyze_undefined_function_calls( + Undefs, AppModules, [AppUndef|AppUndefs]); + false -> + io:format("skipping ~p (calling ~w:~w/~w)~n", + [Mod, Mod2, Func2, Ar2]), + analyze_undefined_function_calls(Undefs, + AppModules, AppUndefs) + end; false -> - io:format("dropping ~p~n", [Mod]), - analyze_undefined_function_calls(Undefs, AppModules, AppUndefs) + io:format("dropping ~p~n", [Mod]), + analyze_undefined_function_calls(Undefs, AppModules, AppUndefs) end. %% This function is used simply to avoid cut-and-paste errors later... diff --git a/lib/snmp/test/snmp_manager_config_test.erl b/lib/snmp/test/snmp_manager_config_test.erl index a72dd0cc22..e38a99d413 100644 --- a/lib/snmp/test/snmp_manager_config_test.erl +++ b/lib/snmp/test/snmp_manager_config_test.erl @@ -169,36 +169,41 @@ all() -> groups() -> [{start_and_stop, [], - [simple_start_and_stop, start_without_mandatory_opts1, - start_without_mandatory_opts2, - start_with_all_valid_opts, start_with_unknown_opts, - start_with_incorrect_opts, - start_with_invalid_manager_conf_file1, - start_with_invalid_users_conf_file1, - start_with_invalid_agents_conf_file1, - start_with_invalid_usm_conf_file1]}, - {normal_op, [], - [{group, system}, {group, agents}, {group, users}, - {group, usm_users}, {group, counter}, - {group, stats_counter}]}, - {system, [], [simple_system_op]}, - {users, [], - [register_user_using_file, register_user_using_function, - register_user_failed_using_function1]}, - {agents, [], - [register_agent_using_file, - register_agent_using_function, - register_agent_failed_using_function1]}, - {usm_users, [], - [register_usm_user_using_file, - register_usm_user_using_function, - register_usm_user_failed_using_function1, - update_usm_user_info]}, - {counter, [], [create_and_increment]}, - {stats_counter, [], [stats_create_and_increment]}, - {tickets, [], [otp_7219, {group, otp_8395}]}, - {otp_8395, [], - [otp_8395_1, otp_8395_2, otp_8395_3, otp_8395_4]}]. + [simple_start_and_stop, + start_without_mandatory_opts1, + start_without_mandatory_opts2, + start_with_all_valid_opts, start_with_unknown_opts, + start_with_incorrect_opts, + start_with_invalid_manager_conf_file1, + start_with_invalid_users_conf_file1, + start_with_invalid_agents_conf_file1, + start_with_invalid_usm_conf_file1]}, + {normal_op, [], + [{group, system}, + {group, agents}, + {group, users}, + {group, usm_users}, + {group, counter}, + {group, stats_counter}]}, + {system, [], [simple_system_op]}, + {users, [], + [register_user_using_file, + register_user_using_function, + register_user_failed_using_function1]}, + {agents, [], + [register_agent_using_file, + register_agent_using_function, + register_agent_failed_using_function1]}, + {usm_users, [], + [register_usm_user_using_file, + register_usm_user_using_function, + register_usm_user_failed_using_function1, + update_usm_user_info]}, + {counter, [], [create_and_increment]}, + {stats_counter, [], [stats_create_and_increment]}, + {tickets, [], [otp_7219, {group, otp_8395}]}, + {otp_8395, [], + [otp_8395_1, otp_8395_2, otp_8395_3, otp_8395_4]}]. init_per_group(_GroupName, Config) -> Config. @@ -816,7 +821,10 @@ start_with_invalid_users_conf_file1(Conf) when is_list(Conf) -> p("start"), process_flag(trap_exit, true), ConfDir = ?config(manager_conf_dir, Conf), - DbDir = ?config(manager_db_dir, Conf), + DbDir = ?config(manager_db_dir, Conf), + + verify_dir_existing(conf, ConfDir), + verify_dir_existing(db, DbDir), Opts = [{versions, [v1]}, {config, [{verbosity, trace}, {dir, ConfDir}, {db_dir, DbDir}]}], @@ -917,7 +925,10 @@ start_with_invalid_agents_conf_file1(Conf) when is_list(Conf) -> p("start"), process_flag(trap_exit, true), ConfDir = ?config(manager_conf_dir, Conf), - DbDir = ?config(manager_db_dir, Conf), + DbDir = ?config(manager_db_dir, Conf), + + verify_dir_existing(conf, ConfDir), + verify_dir_existing(db, DbDir), Opts = [{versions, [v1]}, {config, [{verbosity, trace}, {dir, ConfDir}, {db_dir, DbDir}]}], @@ -2022,7 +2033,6 @@ register_usm_user_using_file(Conf) when is_list(Conf) -> %% -- p("done"), ok. -%% ?SKIP(not_yet_implemented). %% @@ -2651,9 +2661,21 @@ write_usm_conf2(Dir, Str) -> write_conf_file(Dir, File, Str) -> - ?line {ok, Fd} = file:open(filename:join(Dir, File), write), - ?line ok = io:format(Fd, "~s", [Str]), - file:close(Fd). + case file:open(filename:join(Dir, File), write) of + {ok, Fd} -> + ?line ok = io:format(Fd, "~s", [Str]), + file:close(Fd); + {error, Reason} -> + Info = + [{dir, Dir, case (catch file:read_file_info(Dir)) of + {ok, FI} -> + FI; + _ -> + undefined + end}, + {file, File}], + exit({failed_writing_conf_file, Info, Reason}) + end. maybe_start_crypto() -> @@ -2677,6 +2699,17 @@ maybe_stop_crypto() -> end. +%% ------ + +verify_dir_existing(DirName, Dir) -> + case file:read_file_info(Dir) of + {ok, _} -> + ok; + {error, Reason} -> + exit({non_existing_dir, DirName, Dir, Reason}) + end. + + %% ------ str(X) -> -- cgit v1.2.3 From 748dbeb1524122229373c5964334a8d8f18a525d Mon Sep 17 00:00:00 2001 From: Christian von Roques Date: Wed, 15 Dec 2010 17:36:09 -0400 Subject: inets/httpc: Polish documentation * Assure store_cookies (and verify_cookies) is documented instead of the nonexistent store_cookie and verify_cookie. * Make sure the cookies option is not called cookie in comments. * Sprinkle ... arround symbols and code snippets in text. * Grammar, wording, and punctuation fixes. * Formalize See gen_tcp:connect/3,4 using . --- lib/inets/doc/src/http_client.xml | 8 ++-- lib/inets/doc/src/httpc.xml | 88 ++++++++++++++++++------------------- lib/inets/src/http_client/httpc.erl | 2 +- lib/kernel/doc/src/gen_tcp.xml | 1 + 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/lib/inets/doc/src/http_client.xml b/lib/inets/doc/src/http_client.xml index 672ea3fa98..4542211d71 100644 --- a/lib/inets/doc/src/http_client.xml +++ b/lib/inets/doc/src/http_client.xml @@ -42,10 +42,10 @@ dynamically in runtime. Each client profile will spawn a new process to handle each request unless there is a possibility to use a persistent connection with or without pipelining. - The client will add a host header and an empty - te header if there are no such headers present in the request.

+ The client will add a host header and an empty + te header if there are no such headers present in the request.

-

The clients supports ipv6 as long as the underlying mechanisms also do +

The client supports ipv6 as long as the underlying mechanisms also do so.

@@ -87,7 +87,7 @@ httpc:request("http://www.erlang.org").

An ordinary asynchronous request. The result will be sent - to the calling process on the form {http, {ReqestId, Result}}

+ to the calling process in the form {http, {ReqestId, Result}}

5 > {ok, RequestId} = httpc:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]). diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 69e1009bc2..5d1f027e24 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -117,7 +117,7 @@ ssl_options() = {verify, code()} | application or started dynamically in runtime by calling the inets application API inets:start(httpc, ServiceConfig), or inets:start(httpc, ServiceConfig, How) - see inets(3) Below follows a + see inets(3). Below follows a description of the available configuration options.

{profile, profile()} @@ -129,8 +129,8 @@ ssl_options() = {verify, code()} | as session cookies. -

The client can be stopped using inets:stop(httpc, Pid) or - inets:stop(httpc, Profile).

+

The client can be stopped using inets:stop(httpc, Pid) or + inets:stop(httpc, Profile).

@@ -148,7 +148,7 @@ ssl_options() = {verify, code()} | Reason = term() -

Equivalent to httpc:request(get, {Url, []}, [], []).

+

Equivalent to httpc:request(get, {Url, []}, [], []).

@@ -201,7 +201,7 @@ ssl_options() = {verify, code()} |

Sends a HTTP-request. The function can be both synchronous and asynchronous. In the later case the function will return - {ok, RequestId} and later on the information will be delivered + {ok, RequestId} and later on the information will be delivered to the receiver depending on that value.

Http option (http_option()) details:

@@ -267,12 +267,12 @@ ssl_options() = {verify, code()} | HTTP/0.9 client. By default this is an HTTP/1.1 client. When using HTTP/1.0 persistent connections will not be used.

-

Defaults to the trsing "HTTP/1.1".

+

Defaults to the string "HTTP/1.1".

-

If set to true workarounds for known server deviations from +

If set to true workarounds for known server deviations from the HTTP-standard are enabled.

Defaults to false.

@@ -297,20 +297,20 @@ ssl_options() = {verify, code()} |

Streams the body of a 200 or 206 response to the calling process or to a file. When streaming to the calling process using the option self the following stream messages - will be sent to that process: {http, {RequestId, + will be sent to that process: {http, {RequestId, stream_start, Headers}, {http, {RequestId, stream, - BinBodyPart}, {http, {RequestId, stream_end, Headers}. When - streaming to the calling processes using the option + BinBodyPart}, {http, {RequestId, stream_end, Headers}. When + streaming to to the calling processes using the option {self, once} the first message will have an additional - element e.i. {http, {RequestId, stream_start, Headers, Pid}, + element e.i. {http, {RequestId, stream_start, Headers, Pid}, this is the process id that should be used as an argument to - http:stream_next/1 to trigger the next message to be sent to + http:stream_next/1 to trigger the next message to be sent to the calling process.

Note that it is possible that chunked encoding will add - headers so that there are more headers in the stream_end - message than in the stream_start. + headers so that there are more headers in the stream_end + message than in the stream_start. When streaming to a file and the request is asynchronous the - message {http, {RequestId, saved_to_file}} will be sent.

+ message {http, {RequestId, saved_to_file}} will be sent.

Defaults to none.

@@ -358,13 +358,13 @@ ssl_options() = {verify, code()} | request handler.

By default the socket options set by the set_options/1,2 - function are used when establishing the connection.

+ function are used when establishing a connection.

-

Defines how the client will deliver the result for an - asynchronous request (sync has the value +

Defines how the client will deliver the result of an + asynchroneous request (sync has the value false).

@@ -395,7 +395,7 @@ apply(Module, Function, [ReplyInfo | Args])
-

In all cases above, ReplyInfo has the following +

In all of the above cases, ReplyInfo has the following structure:

@@ -470,46 +470,46 @@ apply(Module, Function, [ReplyInfo | Args])
         IpDesc = string()
         ex: "134.138" or "[FEDC:BA98" (all IP-addresses starting with 134.138 or FEDC:BA98), "66.35.250.150" or "[2010:836B:4179::836B:4179]" (a complete IP-address).
         MaxSessions = integer() 
-        Default is 2. 
+        Default is 2.
           Maximum number of persistent connections to a host.
 	MaxKeepAlive = integer() 
-        Default is 5. 
+        Default is 5.
           Maximum number of outstanding requests on the same connection to 
           a host.
         KeepAliveTimeout = integer() 
-        Default is 120000 (= 2 min). 
+        Default is 120000 (= 2 min).
           If a persistent connection is idle longer than the 
-          keep_alive_timeout the client will close the connection. 
-          The server may also have such a timeout but you should
+          keep_alive_timeout the client will close the connection.
+          The server may also have such a time out but you should
           not count on it!
 	MaxPipeline = integer() 
-        Default is 2. 
+        Default is 2.
           Maximum number of outstanding requests on a pipelined connection to a host.
         PipelineTimeout = integer() 
-        Default is 0, 
+        Default is 0,
           which will result in pipelining not being used. 
           If a persistent connection is idle longer than the 
-          pipeline_timeout the client will close the connection. 
+          pipeline_timeout the client will close the connection. 
         CookieMode = enabled | disabled | verify 
-        Default is disabled. 
+        Default is disabled.
           If Cookies are enabled all valid cookies will automatically be 
           saved in the client manager's cookie database. 
-          If the option verify is used the function http:verify_cookie/2 
-          has to be called for the cookie to be saved.
+          If the option verify is used the function store_cookies/2
+          has to be called for the cookies to be saved.
         IpFamily = inet | inet6 | inet6fb4 
-        By default inet. 
+        By default inet.
           When it is set to inet6fb4 you can use both ipv4 and ipv6. 
           It first tries inet6 and if that does not works falls back to inet. 
           The option is here to provide a workaround for buggy ipv6 stacks to ensure that 
           ipv4 will always work.
 	IpAddress = ip_address() 
         If the host has several network interfaces, this option specifies which one to use. 
-          See gen_tcp:connect/3,4 for more info. 
+          See gen_tcp:connect/3,4 for more info. 
 	Port = integer() 
         Specify which local port number to use. 
-          See gen_tcp:connect/3,4 for more info. 
+          See gen_tcp:connect/3,4 for more info. 
         VerboseMode = false | verbose | debug | trace 
-        Default is false. 
+        Default is false.
           This option is used to switch on (or off) 
           different levels of erlang trace on the client. 
           It is a debug feature.
@@ -523,14 +523,14 @@ apply(Module, Function, [ReplyInfo | Args])
             alive and use persistent connections
 	    with  or without pipeline depending on configuration
 	    and current circumstances. The HTTP/1.1 specification does not
-            provide a guideline for how many requests that would be
+            provide a guideline for how many requests would be
             ideal to be sent on a persistent connection,
 	    this very much depends on the
             application. Note that a very long queue of requests may cause a
             user perceived delay as earlier requests may take a long time
             to complete. The HTTP/1.1 specification does suggest a
             limit of 2 persistent connections per server, which is the
-            default value of the max_sessions option. 

+ default value of the max_sessions option.

@@ -549,14 +549,14 @@ apply(Module, Function, [ReplyInfo | Args])

Triggers the next message to be streamed, e.i. same behavior as active once for sockets.

- - + + - store_cookie(SetCookieHeaders, Url) -> - store_cookie(SetCookieHeaders, Url, Profile) -> ok | {error, Reason} + store_cookies(SetCookieHeaders, Url) -> + store_cookies(SetCookieHeaders, Url, Profile) -> ok | {error, Reason} Saves the cookies defined in SetCookieHeaders in the client profile's cookie database. SetCookieHeaders = headers() - where field = "set-cookie" @@ -566,7 +566,7 @@ apply(Module, Function, [ReplyInfo | Args])

Saves the cookies defined in SetCookieHeaders in the client profile's cookie database. You need to - call this function if you set the option cookies to verify. + call this function if you have set the option cookies to verify. If no profile is specified the default profile will be used.

@@ -578,14 +578,14 @@ apply(Module, Function, [ReplyInfo | Args]) cookie_header(Url) -> cookie_header(Url, Profile) -> header() | {error, Rason} Returns the cookie header that would be sent when - making a request to Url using the profile Profile. + making a request to Url using the profile Profile. Url = url() Profile = profile()

Returns the cookie header that would be sent - when making a request to Url using the profile Profile. + when making a request to Url using the profile Profile. If no profile is specified the default profile will be used.

@@ -602,7 +602,7 @@ apply(Module, Function, [ReplyInfo | Args]) Profile = profile()
-

Resets (clears) the cookie database for the specified Profile. +

Resets (clears) the cookie database for the specified Profile. If no profile is specified the default profile will be used.

diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index ae754fab94..04fae13b20 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -252,7 +252,7 @@ set_option(Key, Value, Profile) -> %% Description: Store the cookies from %% in the cookie database %% for the profile . This function shall be used when the option -%% cookie is set to verify. +%% cookies is set to verify. %%------------------------------------------------------------------------- store_cookies(SetCookieHeaders, Url) -> store_cookies(SetCookieHeaders, Url, default_profile()). diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 8e7192a496..aa171c77c2 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -74,6 +74,7 @@ posix() socket() as returned by accept/1,2 and connect/3,4
+
-- cgit v1.2.3 From e38a935df26ca0f37fa17c6df771430de18f9043 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sun, 9 Jan 2011 18:09:29 +0100 Subject: Fix typo in httpc documentation --- lib/inets/doc/src/httpc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 5d1f027e24..bcdd2913e0 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -576,7 +576,7 @@ apply(Module, Function, [ReplyInfo | Args]) cookie_header(Url) -> - cookie_header(Url, Profile) -> header() | {error, Rason} + cookie_header(Url, Profile) -> header() | {error, Reason} Returns the cookie header that would be sent when making a request to Url using the profile Profile. -- cgit v1.2.3 From 5186790d6df4ec0616721f730203e63fc0b627fd Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 3 Mar 2011 17:20:23 +0100 Subject: Bugfix: Never deliver empty chunk to inets --- lib/observer/src/crashdump_viewer.erl | 31 +++++++++++++++++++----------- lib/observer/src/crashdump_viewer_html.erl | 3 ++- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index bf4910445b..3b8d17c7d9 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -1242,9 +1242,9 @@ indexify(Fd,Bin,N) -> {Chunk,N1} = case binary:last(Bin) of $\n -> - {<<$\n,Chunk0/binary>>,N+size(Bin)-1}; + {<<$\n,Chunk0/binary>>,N+byte_size(Bin)-1}; _ -> - {Chunk0,N+size(Bin)} + {Chunk0,N+byte_size(Bin)} end, indexify(Fd,Chunk,N1); eof -> @@ -2244,9 +2244,13 @@ atoms(SessionId,File,TW,Num) -> [{_Id,Start}] -> Fd = open(File), pos_bof(Fd,Start), - {Atoms,Cont} = get_atoms(Fd,1000), - crashdump_viewer_html:atoms(SessionId,TW,Num,Atoms), - atoms_chunks(Fd,SessionId,Cont); + case get_atoms(Fd,?items_chunk_size) of + {Atoms,Cont} -> + crashdump_viewer_html:atoms(SessionId,TW,Num,Atoms), + atoms_chunks(Fd,SessionId,Cont); + done -> + crashdump_viewer_html:atoms(SessionId,TW,Num,done) + end; _ -> crashdump_viewer_html:atoms(SessionId,TW,Num,done) end. @@ -2254,20 +2258,25 @@ atoms(SessionId,File,TW,Num) -> get_atoms(Fd,Number) -> case get_n_lines_of_tag(Fd,Number) of {all,_,Lines} -> + close(Fd), {Lines,done}; {part,_,Lines} -> {Lines,Number}; empty -> - {[],done} + close(Fd), + done end. -atoms_chunks(Fd,SessionId,done) -> - close(Fd), +atoms_chunks(_Fd,SessionId,done) -> crashdump_viewer_html:atoms_chunk(SessionId,done); atoms_chunks(Fd,SessionId,Number) -> - {Atoms,Cont} = get_atoms(Fd,Number), - crashdump_viewer_html:atoms_chunk(SessionId,Atoms), - atoms_chunks(Fd,SessionId,Cont). + case get_atoms(Fd,Number) of + {Atoms,Cont} -> + crashdump_viewer_html:atoms_chunk(SessionId,Atoms), + atoms_chunks(Fd,SessionId,Cont); + done -> + atoms_chunks(Fd,SessionId,done) + end. %%----------------------------------------------------------------- diff --git a/lib/observer/src/crashdump_viewer_html.erl b/lib/observer/src/crashdump_viewer_html.erl index d49023f9f6..24a80b1916 100644 --- a/lib/observer/src/crashdump_viewer_html.erl +++ b/lib/observer/src/crashdump_viewer_html.erl @@ -726,7 +726,8 @@ atoms(SessionId,TW,Num,FirstChunk) -> Heading = "Atoms", case FirstChunk of done -> - deliver_first(SessionId,[h1(Heading), + deliver_first(SessionId,[start_html_page(Heading), + h1(Heading), warn(TW), "No atoms were found in log",br(), "Total number of atoms in node was ", Num, -- cgit v1.2.3 From 92b2fd6b18d052cd49e8921626ad0abbcedc0b0b Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 3 Mar 2011 18:32:59 +0100 Subject: Added documentation file (snmpc_cmd.xml) for the snmpc command line tool. Also updated the central .gitignore file. --- .gitignore | 1 + lib/snmp/doc/src/snmpc_cmd.xml | 191 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 lib/snmp/doc/src/snmpc_cmd.xml diff --git a/.gitignore b/.gitignore index 54bfadea9a..0bd5e1ff2c 100644 --- a/.gitignore +++ b/.gitignore @@ -303,6 +303,7 @@ make/win32/ # snmp /lib/snmp/bin/snmp-v2tov1 +/lib/snmp/bin/snmpc /lib/snmp/examples/ex1/EX1-MIB.bin /lib/snmp/mibs/Makefile /lib/snmp/mibs/v1/OTP-SNMPEA-MIB.mib.v1 diff --git a/lib/snmp/doc/src/snmpc_cmd.xml b/lib/snmp/doc/src/snmpc_cmd.xml new file mode 100644 index 0000000000..18ff71631c --- /dev/null +++ b/lib/snmp/doc/src/snmpc_cmd.xml @@ -0,0 +1,191 @@ + + + + +
+ + 20112011 + Ericsson AB. 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. + + + + snmpc + + + + + + + + snmpc_cmd.xml +
+ snmpc + SNMP MIB compiler frontend + +

The program provides a way to run + the SNMP MIB compiler of the Erlang system.

+
+ + + + snmpc [options] file.mib | file.bin + Compile MIBs + +

compile a SNMP MIB file, + see compile/1,2 for + more info.

+

It can also be used to generate a header file (.hrl) + with definitions of Erlang constants for the objects in + the MIB, see + mib_to_hrl/1.

+
+
+
+ +
+ Compiler options +

The following options are supported (note that most of these relate + to the compilation of the MIB file):

+ + --help + +

Prints help info.

+
+ + --version + +

Prints application and mib format version.

+
+ + --verbosity verbosity + +

Print debug info.

+

verbosity = trace | debug | log | info | silence

+

Defaults to silence.

+
+ + --warnings + +

Print warning messages.

+
+ + --o directory + +

The directory where the compiler should place the output files. + If not specified, output files will be placed in the current working + directory.

+
+ + --i Directory + +

Specifies the path to search for imported (compiled) MIB files. + By default, the current working directory is always included.

+

This option can be present several times, each time specifying + one path.

+
+ + --il Directory + +

This option (include_lib), specifies a list of directories to + search for imported MIBs. It assumes that the first element in + the directory name corresponds to an OTP application. The compiler + will find the current installed version. For example, the value + ["snmp/mibs/"] will be replaced by ["snmp-3.1.1/mibs/"] (or what + the current version may be in the system). The current directory + and the "snmp-home"/priv/mibs/ are always listed last in the + include path.

+
+ + --sgc + +

This option (skip group check), if present, disables the + group check of the mib compiler. + That is, should the OBJECT-GROUP and the NOTIFICATION-GROUP + macro(s) be checked for correctness or not.

+
+ + --dep + +

Keep deprecated definition(s). + If not specified the compiler will ignore deprecated definitions.

+
+ + --desc + +

The DESCRIPTION field will be included.

+
+ + --ref + +

The REFERENCE field will be included.

+
+ + --imp + +

The IMPORTS field will be included.

+
+ + --mi + +

The MODULE-IDENTITY field will be included.

+
+ + --mc + +

The MODULE-COMPLIANCE field will be included.

+
+ + --ac + +

The AGENT-CAPABILITIES field will be included.

+
+ + --mod module + +

The module which implements all the instrumentation functions.

+

The name of all instrumentation functions must be the + same as the corresponding managed object it implements.

+
+ + --nd + +

The default instrumentation functions will not be + used if a managed object have no instrumentation function. + Instead this will be reported as an error, and the compilation + aborts.

+
+ + --rrnac + +

This option, if present, specifies that the row name assign check + shall not be done strictly according to the SMI (which allows only + the value 1).

+

With this option, all values greater than zero is allowed (>= 1). + This means that the error will be converted to a warning.

+

By default it is not included, but if this option is present + it will be.

+
+ +
+
+ +
+ SEE ALSO +

erlc(1), + compile(3), + snmpc(3)

+
+
+ -- cgit v1.2.3 From 22cfda86e15600f8b3622c7ed4101366199e1843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 4 Mar 2011 14:10:39 +0100 Subject: erts: Initialize register that may be referenced by garbage collection The call_fun() function in the BEAM emulator is supposed to to put the fun term in the x register following the actual arguments and environment for the fun. But if the fun is not loaded and a call to the error_handler:undefined_lambda/3 function is set up, the x(3) register will not be initialized. The lack of initialization is very unlikely to cause a problem in practice, because all of the following things must happen: 1) An unloaded fun must be called (i.e. the fun must have been received from another node or from a file or dets table). 2) The process must be scheduled out before the call to the error_handler:undefined_lambda/3 function can take place. 3) The process must be garbage collected before the process is scheduled in. 4) The x(3) register must contain a stale cons or box pointer that happens to point into the the heap of the currently executing process. (Because of the literal pool, the GC will never copy anything that is outside of the heap.) I was not able to write a test case that would force an emulator crash. --- erts/emulator/beam/beam_emu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index a4fb454481..e96014c665 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -6398,6 +6398,7 @@ call_fun(Process* p, /* Current process. */ reg[0] = module; reg[1] = fun; reg[2] = args; + reg[3] = NIL; return ep->address; } } -- cgit v1.2.3 From e98f3bded140a81a47667b37b6d879ee56fa0f8d Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 4 Mar 2011 15:00:32 +0100 Subject: Wait longer than 5 sec instead of 2.5 sec for crashdump to be created in test --- lib/observer/test/crashdump_viewer_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl index 8449e8a7c4..fdc4a2f1ff 100644 --- a/lib/observer/test/crashdump_viewer_SUITE.erl +++ b/lib/observer/test/crashdump_viewer_SUITE.erl @@ -669,7 +669,7 @@ rename(From,To) -> end. check_complete(File) -> - check_complete1(File,5). + check_complete1(File,10). check_complete1(_File,0) -> {error,enoent}; -- cgit v1.2.3 From e4d6273ea3c73d705286776b248562fbbe985866 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Sat, 5 Mar 2011 19:07:08 +0100 Subject: Improve documentation for etop --- lib/observer/doc/src/etop.xml | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/lib/observer/doc/src/etop.xml b/lib/observer/doc/src/etop.xml index 1ea67e6864..78047caab3 100644 --- a/lib/observer/doc/src/etop.xml +++ b/lib/observer/doc/src/etop.xml @@ -5,7 +5,7 @@
2002 - 2007 + 2011 Ericsson AB, All Rights Reserved @@ -26,27 +26,33 @@ etop Siri hansen - 1 + - 2002-03-27 - PA1 - etop.sgml + + +
etop Erlang Top is a tool for presenting information about erlang processes similar to the information presented by "top" in UNIX. +

etop should be started with the provided scripts etop and getop for text based and graphical - presentation respectively. Under Windows the batch files - etop.bat and getop.bat can be used. -

-

All interaction with etop when running the graphical - presentation should happen via the menus. For the text based - presentation the functions described below can be used. -

-

The following configuration parameters exist for etop. -

+ presentation respectively. This will start a hidden erlang node + which connects to the node to be measured. The measured node is + given with the -node option. If the measured node has a + different cookie than the default cookie for the user who + invokes the script, the cookie must be explicitly given witht + the -setcookie option.

+ +

Under Windows the batch files etop.bat and + getop.bat can be used.

+ +

The following configuration parameters exist for the + etop tool. When executing the etop or getop + scripts, these parameters can be given as command line options, + e.g. getop -node testnode@myhost -setcookie MyCookie.

node The measured node. @@ -96,6 +102,15 @@ Default: runtime (reductions if Value: on | off

Default: on
+ +

All interaction with etop when running the graphical + presentation should happen via the menus. For the text based + presentation the functions described below can be used. +

+ +

See the user's guide for + more information about the etop tool.

+
-- cgit v1.2.3 From 7d45e56bbe2d084756fceb4e9b8065f74d1a503b Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Mon, 7 Mar 2011 10:02:06 +0100 Subject: Workaround for application:start(crypto) inconsistency --- lib/public_key/test/pkits_SUITE.erl | 6 +++--- lib/public_key/test/public_key_SUITE.erl | 6 +++--- lib/ssl/test/old_ssl_dist_SUITE.erl | 10 ++++++++-- lib/ssl/test/old_transport_accept_SUITE.erl | 10 ++++++++-- lib/ssl/test/ssl_basic_SUITE.erl | 6 +++--- lib/ssl/test/ssl_packet_SUITE.erl | 6 +++--- lib/ssl/test/ssl_payload_SUITE.erl | 6 +++--- lib/ssl/test/ssl_session_cache_SUITE.erl | 6 +++--- lib/ssl/test/ssl_to_openssl_SUITE.erl | 6 +++--- 9 files changed, 37 insertions(+), 25 deletions(-) diff --git a/lib/public_key/test/pkits_SUITE.erl b/lib/public_key/test/pkits_SUITE.erl index fd976cb2f3..660af4e8ab 100644 --- a/lib/public_key/test/pkits_SUITE.erl +++ b/lib/public_key/test/pkits_SUITE.erl @@ -585,10 +585,10 @@ end_per_testcase(_Func, Config) -> Config. init_per_suite(Config) -> - case application:start(crypto) of + try crypto:start() of ok -> - Config; - _ -> + Config + catch _:_ -> {skip, "Crypto did not start"} end. diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl index d130196c15..6c482f9c30 100644 --- a/lib/public_key/test/public_key_SUITE.erl +++ b/lib/public_key/test/public_key_SUITE.erl @@ -41,10 +41,10 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - case application:start(crypto) of + try crypto:start() of ok -> - Config; - _ -> + Config + catch _:_ -> {skip, "Crypto did not start"} end. %%-------------------------------------------------------------------- diff --git a/lib/ssl/test/old_ssl_dist_SUITE.erl b/lib/ssl/test/old_ssl_dist_SUITE.erl index 6a072c9d98..4544fb616a 100644 --- a/lib/ssl/test/old_ssl_dist_SUITE.erl +++ b/lib/ssl/test/old_ssl_dist_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -62,9 +62,15 @@ end_per_group(_GroupName, Config) -> init_per_suite(Config) -> - add_ssl_opts_config(Config). + try crypto:start() of + ok -> + add_ssl_opts_config(Config) + catch _:_ -> + {skip, "Crypto did not start"} + end. end_per_suite(Config) -> + application:stop(crypto), Config. init_per_testcase(Case, Config) when list(Config) -> diff --git a/lib/ssl/test/old_transport_accept_SUITE.erl b/lib/ssl/test/old_transport_accept_SUITE.erl index 21ee0690b1..6f0c8e456b 100644 --- a/lib/ssl/test/old_transport_accept_SUITE.erl +++ b/lib/ssl/test/old_transport_accept_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2010. All Rights Reserved. +%% Copyright Ericsson AB 2007-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 @@ -57,9 +57,15 @@ groups() -> []. init_per_suite(Config) -> - Config. + try crypto:start() of + ok -> + Config + catch _:_ -> + {skip, "Crypto did not start"} + end. end_per_suite(_Config) -> + application:stop(crypto), ok. init_per_group(_GroupName, Config) -> diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index 87d5fc8d71..8495ddb1d7 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -48,7 +48,7 @@ %%-------------------------------------------------------------------- init_per_suite(Config0) -> Dog = ssl_test_lib:timetrap(?LONG_TIMEOUT *2), - case application:start(crypto) of + try crypto:start() of ok -> application:start(public_key), ssl:start(), @@ -61,8 +61,8 @@ init_per_suite(Config0) -> Config1 = ssl_test_lib:make_dsa_cert(Config0), Config = ssl_test_lib:cert_options(Config1), - [{watchdog, Dog} | Config]; - _ -> + [{watchdog, Dog} | Config] + catch _:_ -> {skip, "Crypto did not start"} end. %%-------------------------------------------------------------------- diff --git a/lib/ssl/test/ssl_packet_SUITE.erl b/lib/ssl/test/ssl_packet_SUITE.erl index 1ecf55d6e8..d22d5d2954 100644 --- a/lib/ssl/test/ssl_packet_SUITE.erl +++ b/lib/ssl/test/ssl_packet_SUITE.erl @@ -53,7 +53,7 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - case application:start(crypto) of + try crypto:start() of ok -> application:start(public_key), ssl:start(), @@ -61,8 +61,8 @@ init_per_suite(Config) -> (catch make_certs:all(?config(data_dir, Config), ?config(priv_dir, Config))), test_server:format("Make certs ~p~n", [Result]), - ssl_test_lib:cert_options(Config); - _ -> + ssl_test_lib:cert_options(Config) + catch _:_ -> {skip, "Crypto did not start"} end. %%-------------------------------------------------------------------- diff --git a/lib/ssl/test/ssl_payload_SUITE.erl b/lib/ssl/test/ssl_payload_SUITE.erl index f57d7fa0e8..24e86b3913 100644 --- a/lib/ssl/test/ssl_payload_SUITE.erl +++ b/lib/ssl/test/ssl_payload_SUITE.erl @@ -37,13 +37,13 @@ %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - case application:start(crypto) of + try crypto:start() of ok -> application:start(public_key), ssl:start(), make_certs:all(?config(data_dir, Config), ?config(priv_dir, Config)), - ssl_test_lib:cert_options(Config); - _ -> + ssl_test_lib:cert_options(Config) + catch _:_ -> {skip, "Crypto did not start"} end. %%-------------------------------------------------------------------- diff --git a/lib/ssl/test/ssl_session_cache_SUITE.erl b/lib/ssl/test/ssl_session_cache_SUITE.erl index b47efe0941..a43b9ab586 100644 --- a/lib/ssl/test/ssl_session_cache_SUITE.erl +++ b/lib/ssl/test/ssl_session_cache_SUITE.erl @@ -47,7 +47,7 @@ %%-------------------------------------------------------------------- init_per_suite(Config0) -> Dog = ssl_test_lib:timetrap(?LONG_TIMEOUT *2), - case application:start(crypto) of + try crypto:start() of ok -> application:start(public_key), ssl:start(), @@ -60,8 +60,8 @@ init_per_suite(Config0) -> Config1 = ssl_test_lib:make_dsa_cert(Config0), Config = ssl_test_lib:cert_options(Config1), - [{watchdog, Dog} | Config]; - _ -> + [{watchdog, Dog} | Config] + catch _:_ -> {skip, "Crypto did not start"} end. diff --git a/lib/ssl/test/ssl_to_openssl_SUITE.erl b/lib/ssl/test/ssl_to_openssl_SUITE.erl index 4ab8fe3273..64a6a9eaf8 100644 --- a/lib/ssl/test/ssl_to_openssl_SUITE.erl +++ b/lib/ssl/test/ssl_to_openssl_SUITE.erl @@ -50,7 +50,7 @@ init_per_suite(Config0) -> false -> {skip, "Openssl not found"}; _ -> - case application:start(crypto) of + try crypto:start() of ok -> application:start(public_key), ssl:start(), @@ -60,8 +60,8 @@ init_per_suite(Config0) -> test_server:format("Make certs ~p~n", [Result]), Config1 = ssl_test_lib:make_dsa_cert(Config0), Config = ssl_test_lib:cert_options(Config1), - [{watchdog, Dog} | Config]; - _ -> + [{watchdog, Dog} | Config] + catch _:_ -> {skip, "Crypto did not start"} end end. -- cgit v1.2.3 From 4e53ce0e53a74750a2d70b8c5c582211d7963e4b Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Wed, 23 Feb 2011 09:55:24 +0100 Subject: Subsections below level 2 where not handled correct when generating html and pdf. --- lib/erl_docgen/doc/src/notes.xml | 27 +++++++++++++++++++++------ lib/erl_docgen/priv/xsl/db_html.xsl | 8 +++----- lib/erl_docgen/priv/xsl/db_pdf.xsl | 20 ++++++++++++++++++-- lib/erl_docgen/vsn.mk | 3 ++- system/doc/top/src/erl_html_tools.erl | 14 +++++++------- 5 files changed, 51 insertions(+), 21 deletions(-) diff --git a/lib/erl_docgen/doc/src/notes.xml b/lib/erl_docgen/doc/src/notes.xml index c7a7926c40..7c8a2c8208 100644 --- a/lib/erl_docgen/doc/src/notes.xml +++ b/lib/erl_docgen/doc/src/notes.xml @@ -4,7 +4,7 @@
- 20042009 + 20042011 Ericsson AB. All Rights Reserved. @@ -29,7 +29,22 @@ notes.xml

This document describes the changes made to the erl_docgen application.

-
Erl_Docgen 0.2.3 + +
erl_docgen 0.2.4 + +
Fixed Bugs and Malfunctions + + +

Subsections below level 2 where not handled correct when generating html and pdf.

+

+ Own Id: OTP-90730

+
+
+
+ +
+ +
erl_docgen 0.2.3
Fixed Bugs and Malfunctions @@ -56,9 +71,9 @@
-
+
-
Erl_Docgen 0.2.2 +
erl_docgen 0.2.2
Fixed Bugs and Malfunctions @@ -71,9 +86,9 @@
-
+
-
erl_docgen 0.2.1 +
erl_docgen 0.2.1
Fixed Bugs and Malfunctions diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index 732560e303..c6375ea621 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2010. All Rights Reserved. + # Copyright Ericsson AB 2009-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 @@ -556,8 +556,8 @@ - - + +

@@ -569,8 +569,6 @@ - - diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 1e80c360b8..f500cd3fee 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2010. All Rights Reserved. + # Copyright Ericsson AB 2009-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 @@ -827,7 +827,7 @@ - + @@ -844,6 +844,22 @@ + + + + + + + + + + + + + + + + diff --git a/lib/erl_docgen/vsn.mk b/lib/erl_docgen/vsn.mk index fb0f5ca0cd..29585d8520 100644 --- a/lib/erl_docgen/vsn.mk +++ b/lib/erl_docgen/vsn.mk @@ -1 +1,2 @@ -ERL_DOCGEN_VSN = 0.2.3 +ERL_DOCGEN_VSN = 0.2.4 + diff --git a/system/doc/top/src/erl_html_tools.erl b/system/doc/top/src/erl_html_tools.erl index 599268804e..bb6a9a9f0a 100644 --- a/system/doc/top/src/erl_html_tools.erl +++ b/system/doc/top/src/erl_html_tools.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% Copyright Ericsson AB 2009-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 @@ -134,10 +134,10 @@ subst_file(Group, OutFile, Template, Info) -> file:write(Stream, Text), file:close(Stream); Error -> - error("Can't write to file ~s: ~w", [OutFile,Error]) + local_error("Can't write to file ~s: ~w", [OutFile,Error]) end; Error -> - error("Can't write to file ~s: ~w", [OutFile,Error]) + local_error("Can't write to file ~s: ~w", [OutFile,Error]) end. @@ -156,7 +156,7 @@ find_templates([SearchPath | SearchPaths], AllSearchPaths) -> Result end; find_templates([], AllSearchPaths) -> - error("No templates found in ~p",[AllSearchPaths]). + local_error("No templates found in ~p",[AllSearchPaths]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -269,7 +269,7 @@ find_application_infos([{App, Vsn, AppPath, IndexURL} | Paths]) -> string:substr(G0,N+1)} end; false -> - error("No group given",[]) + local_error("No group given",[]) end, Text = case lists:keysearch("short", 1, Db) of @@ -427,7 +427,7 @@ subst_applinks_1([{G, Heading}|Gs], Info0, Group) -> end; subst_applinks_1([], [], _) -> []; subst_applinks_1([], Info, _) -> - error("Info left: ~p\n", [Info]), + local_error("Info left: ~p\n", [Info]), []. html_applinks([{Name,[{_,_,URL,_}|_]}|AppNames]) -> @@ -669,7 +669,7 @@ sub_repl([], _Fun, Acc, S, Pos) -> {string:substr(S, Pos+1), Acc}. % Error and warnings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -error(Format, Args) -> +local_error(Format, Args) -> io:format("ERROR: " ++ Format ++ "\n", Args), exit(1). -- cgit v1.2.3 From 98b64c68149e364e06031b3bd7b7d752e152c88d Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Wed, 23 Feb 2011 12:39:08 +0100 Subject: Removed dialyzer warning. --- lib/xmerl/src/xmerl_sax_parser_utf16be.erlsrc | 4 ++-- lib/xmerl/src/xmerl_sax_parser_utf16le.erlsrc | 4 ++-- lib/xmerl/src/xmerl_uri.erl | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/xmerl/src/xmerl_sax_parser_utf16be.erlsrc b/lib/xmerl/src/xmerl_sax_parser_utf16be.erlsrc index fae5346e6a..5c995a5a9c 100644 --- a/lib/xmerl/src/xmerl_sax_parser_utf16be.erlsrc +++ b/lib/xmerl/src/xmerl_sax_parser_utf16be.erlsrc @@ -2,7 +2,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -35,6 +35,6 @@ %% STRING_REST and STRING_UNBOUND_REST is only different in the list case -define(STRING_UNBOUND_REST(MatchChar, Rest), <>). --define(BYTE_ORDER_MARK_1, undefined). +-define(BYTE_ORDER_MARK_1, undefined_bom1). -define(BYTE_ORDER_MARK_2, <<16#FE>>). -define(BYTE_ORDER_MARK_REST(Rest), <<16#FE, 16#FF, Rest/binary>>). diff --git a/lib/xmerl/src/xmerl_sax_parser_utf16le.erlsrc b/lib/xmerl/src/xmerl_sax_parser_utf16le.erlsrc index 5e1f0a217c..5c6ca0caba 100644 --- a/lib/xmerl/src/xmerl_sax_parser_utf16le.erlsrc +++ b/lib/xmerl/src/xmerl_sax_parser_utf16le.erlsrc @@ -2,7 +2,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-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 @@ -35,6 +35,6 @@ %% STRING_REST and STRING_UNBOUND_REST is only different in the list case -define(STRING_UNBOUND_REST(MatchChar, Rest), <>). --define(BYTE_ORDER_MARK_1, undefined). +-define(BYTE_ORDER_MARK_1, undefined_bom1). -define(BYTE_ORDER_MARK_2, <<16#FF>>). -define(BYTE_ORDER_MARK_REST(Rest), <<16#FF, 16#FE, Rest/binary>>). diff --git a/lib/xmerl/src/xmerl_uri.erl b/lib/xmerl/src/xmerl_uri.erl index d8edb2e6e1..a0c6f1c2a7 100644 --- a/lib/xmerl/src/xmerl_uri.erl +++ b/lib/xmerl/src/xmerl_uri.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2009. All Rights Reserved. +%% Copyright Ericsson AB 2005-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 @@ -359,9 +359,9 @@ scan_host(C0) -> %% Hex4= %% {C1,lists:reverse(lists:append(IPv6address))}; {C1,Hostname,[A|_HostF]} -> - {C1,lists:reverse(lists:append(Hostname))}; - _ -> - {error,no_host} + {C1,lists:reverse(lists:append(Hostname))} +%% _ -> +%% {error,no_host} end. scan_host2([H|C0],Acc,CurF,Host,HostF) when $0= -- cgit v1.2.3 From 6a8d2c30c273f0a2adc1c623f46ae8b5366b564c Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 7 Mar 2011 13:46:29 +0100 Subject: Temporary module "name" for the module snmpc. --- lib/snmp/doc/src/files.mk | 3 +++ lib/snmp/doc/src/snmpc.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/snmp/doc/src/files.mk b/lib/snmp/doc/src/files.mk index f8462098be..c906ba0cf2 100644 --- a/lib/snmp/doc/src/files.mk +++ b/lib/snmp/doc/src/files.mk @@ -65,6 +65,9 @@ XML_MANAGER_REF3_FILES = \ snmpm_network_interface_filter.xml \ snmpm_user.xml +XML_REF1_FILES = \ + $(XML_COMP_REF1_FILES) + XML_REF3_FILES = \ $(XML_APP_REF3_FILES) \ $(XML_COMP_REF3_FILES) \ diff --git a/lib/snmp/doc/src/snmpc.xml b/lib/snmp/doc/src/snmpc.xml index 771629492d..57f00ff8b5 100644 --- a/lib/snmp/doc/src/snmpc.xml +++ b/lib/snmp/doc/src/snmpc.xml @@ -31,7 +31,7 @@ snmpc.xml - snmpc + snmpc(module) Interface Functions to the SNMP toolkit MIB compiler

The module snmpc contains interface functions to the -- cgit v1.2.3