aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/doc/src/compile.xml3
-rw-r--r--lib/kernel/doc/src/gen_tcp.xml2
-rw-r--r--lib/kernel/doc/src/gen_udp.xml4
-rw-r--r--lib/kernel/src/file.erl2
-rw-r--r--lib/kernel/src/gen_sctp.erl5
-rw-r--r--lib/kernel/src/gen_udp.erl5
-rw-r--r--lib/kernel/src/inet.erl4
-rw-r--r--lib/kernel/test/gen_tcp_misc_SUITE.erl31
-rw-r--r--lib/mnesia/test/Makefile28
-rw-r--r--lib/mnesia/test/mnesia_consistency_test.erl22
-rw-r--r--lib/observer/src/crashdump_viewer_html.erl4
-rw-r--r--lib/observer/test/crashdump_viewer_SUITE.erl42
-rw-r--r--lib/os_mon/src/disksup.erl10
-rw-r--r--lib/os_mon/src/memsup.erl2
-rw-r--r--lib/tools/src/fprof.erl23
-rw-r--r--lib/tools/vsn.mk2
-rw-r--r--lib/wx/doc/src/Makefile6
17 files changed, 138 insertions, 57 deletions
diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml
index 84e9922847..b577e5ca4f 100644
--- a/lib/compiler/doc/src/compile.xml
+++ b/lib/compiler/doc/src/compile.xml
@@ -333,7 +333,8 @@ module.beam: module.erl \
<tag><c>{d,Macro,Value}</c></tag>
<item>
<p>Defines a macro <c>Macro</c> to have the value
- <c>Value</c>. The default is <c>true</c>.</p>
+ <c>Value</c>. <c>Macro</c> is of type atom, and <c>Value</c> can be any term.
+ The default <c>Value</c> is <c>true</c>.</p>
</item>
<tag><c>{parse_transform,Module}</c></tag>
diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml
index daf26a0b63..11a0843c10 100644
--- a/lib/kernel/doc/src/gen_tcp.xml
+++ b/lib/kernel/doc/src/gen_tcp.xml
@@ -324,7 +324,7 @@ do_recv(Sock, Bs) ->
<c><anno>Socket</anno></c>. The controlling process is the process which
receives messages from the socket. If called by any other
process than the current controlling process,
- <c>{error, eperm}</c> is returned.</p>
+ <c>{error, not_owner}</c> is returned.</p>
</desc>
</func>
<func>
diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml
index 6b83dfa030..726dc30546 100644
--- a/lib/kernel/doc/src/gen_udp.xml
+++ b/lib/kernel/doc/src/gen_udp.xml
@@ -189,7 +189,9 @@
<desc>
<p>Assigns a new controlling process <c><anno>Pid</anno></c> to
<c><anno>Socket</anno></c>. The controlling process is the process which
- receives messages from the socket.</p>
+ receives messages from the socket. If called by any other
+ process than the current controlling process,
+ <c>{error, not_owner}</c> is returned.</p>
</desc>
</func>
<func>
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
index d8033ee192..cdb984c333 100644
--- a/lib/kernel/src/file.erl
+++ b/lib/kernel/src/file.erl
@@ -1258,7 +1258,7 @@ sendfile_fallback_int(File, Sock, Bytes, ChunkSize, BytesSent)
when Bytes > BytesSent; Bytes == 0 ->
Size = if Bytes == 0 ->
ChunkSize;
- (Bytes - BytesSent + ChunkSize) > 0 ->
+ (Bytes - BytesSent) < ChunkSize ->
Bytes - BytesSent;
true ->
ChunkSize
diff --git a/lib/kernel/src/gen_sctp.erl b/lib/kernel/src/gen_sctp.erl
index d8954f0cf7..8fa963ec78 100644
--- a/lib/kernel/src/gen_sctp.erl
+++ b/lib/kernel/src/gen_sctp.erl
@@ -425,9 +425,10 @@ error_string(X) ->
erlang:error(badarg, [X]).
--spec controlling_process(Socket, Pid) -> ok when
+-spec controlling_process(Socket, Pid) -> ok | {error, Reason} when
Socket :: sctp_socket(),
- Pid :: pid().
+ Pid :: pid(),
+ Reason :: closed | not_owner | inet:posix().
controlling_process(S, Pid) when is_port(S), is_pid(Pid) ->
inet:udp_controlling_process(S, Pid);
diff --git a/lib/kernel/src/gen_udp.erl b/lib/kernel/src/gen_udp.erl
index 8688799ae9..914854c65c 100644
--- a/lib/kernel/src/gen_udp.erl
+++ b/lib/kernel/src/gen_udp.erl
@@ -185,9 +185,10 @@ connect(S, Address, Port) when is_port(S) ->
Error
end.
--spec controlling_process(Socket, Pid) -> ok when
+-spec controlling_process(Socket, Pid) -> ok | {error, Reason} when
Socket :: socket(),
- Pid :: pid().
+ Pid :: pid(),
+ Reason :: closed | not_owner | inet:posix().
controlling_process(S, NewOwner) ->
inet:udp_controlling_process(S, NewOwner).
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index abaf4486dc..0bb5444dbb 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -1246,6 +1246,8 @@ udp_close(S) when is_port(S) ->
%% Set controlling process for TCP socket.
tcp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) ->
case erlang:port_info(S, connected) of
+ {connected, NewOwner} ->
+ ok;
{connected, Pid} when Pid =/= self() ->
{error, not_owner};
undefined ->
@@ -1297,6 +1299,8 @@ tcp_sync_input(S, Owner, Flag) ->
%% Set controlling process for UDP or SCTP socket.
udp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) ->
case erlang:port_info(S, connected) of
+ {connected, NewOwner} ->
+ ok;
{connected, Pid} when Pid =/= self() ->
{error, not_owner};
_ ->
diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl
index 0c53b1e85b..1592399996 100644
--- a/lib/kernel/test/gen_tcp_misc_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl
@@ -24,7 +24,8 @@
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
- controlling_process/1, no_accept/1, close_with_pending_output/1,
+ controlling_process/1, controlling_process_self/1,
+ no_accept/1, close_with_pending_output/1,
data_before_close/1, iter_max_socks/1, get_status/1,
passive_sockets/1, accept_closed_by_other_process/1,
init_per_testcase/2, end_per_testcase/2,
@@ -58,7 +59,7 @@ end_per_testcase(_Func, Config) ->
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
- [controlling_process, no_accept,
+ [controlling_process, controlling_process_self, no_accept,
close_with_pending_output, data_before_close,
iter_max_socks, passive_sockets,
accept_closed_by_other_process, otp_3924, closed_socket,
@@ -307,6 +308,32 @@ not_owner(S) ->
ok
end.
+controlling_process_self(doc) ->
+ ["Open a listen port and assign the controlling process to "
+ "it self, then exit and make sure the port is closed properly."];
+controlling_process_self(Config) when is_list(Config) ->
+ S = self(),
+ process_flag(trap_exit,true),
+ spawn_link(fun() ->
+ {ok,Sock} = gen_tcp:listen(0,[]),
+ S ! {socket, Sock},
+ ok = gen_tcp:controlling_process(Sock,self()),
+ S ! done
+ end),
+ receive
+ done ->
+ receive
+ {socket,Sock} ->
+ process_flag(trap_exit,false),
+ %% Make sure the port is invalid after process crash
+ {error,einval} = inet:port(Sock)
+ end;
+ Msg when element(1,Msg) /= socket ->
+ process_flag(trap_exit,false),
+ exit({unknown_msg,Msg})
+ end.
+
+
no_accept(doc) ->
["Open a listen port and connect to it, then close the listen port ",
"without doing any accept. The connected socket should receive ",
diff --git a/lib/mnesia/test/Makefile b/lib/mnesia/test/Makefile
index ae4c9626c7..f041fef85b 100644
--- a/lib/mnesia/test/Makefile
+++ b/lib/mnesia/test/Makefile
@@ -52,24 +52,29 @@ MODULES= \
mnesia_cost \
mnesia_dbn_meters
-MnesiaExamplesDir := ../examples
+DocExamplesDir := ../doc/src/
-ExampleModules = \
+DocExampleModules = \
company \
company_o \
- bup \
- mnesia_meter \
- mnesia_tpcb
-ExamplesHrl = \
+ bup
+
+DocExamplesHrl = \
company.hrl \
company_o.hrl
-ERL_FILES= $(MODULES:%=%.erl) $(ExampleModules:%=$(MnesiaExamplesDir)/%.erl)
+ExamplesDir := ../examples/
+
+ExampleModules = \
+ mnesia_meter \
+ mnesia_tpcb
-HRL_FILES= mnesia_test_lib.hrl $(ExamplesHrl:%=$(MnesiaExamplesDir)/%)
+ERL_FILES= $(MODULES:%=%.erl) $(DocExampleModules:%=$(DocExamplesDir)/%.erl) $(ExampleModules:%=$(ExamplesDir)/%.erl)
+
+HRL_FILES= mnesia_test_lib.hrl $(DocExamplesHrl:%=$(DocExamplesDir)/%)
TARGET_FILES= \
- $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(ExampleModules:%=$(EBIN)/%.$(EMULATOR))
+ $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(DocExampleModules:%=$(EBIN)/%.$(EMULATOR)) $(ExampleModules:%=$(EBIN)/%.$(EMULATOR))
INSTALL_PROGS= $(TARGET_FILES)
@@ -91,7 +96,10 @@ EBIN = .
tests debug opt: $(TARGET_FILES)
-$(EBIN)/%.beam: $(MnesiaExamplesDir)/%.erl
+$(EBIN)/%.beam: $(DocExamplesDir)/%.erl
+ $(ERLC) -bbeam $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
+
+$(EBIN)/%.beam: $(ExamplesDir)/%.erl
$(ERLC) -bbeam $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
clean:
diff --git a/lib/mnesia/test/mnesia_consistency_test.erl b/lib/mnesia/test/mnesia_consistency_test.erl
index f38e13f3a2..bb21723e27 100644
--- a/lib/mnesia/test/mnesia_consistency_test.erl
+++ b/lib/mnesia/test/mnesia_consistency_test.erl
@@ -100,7 +100,7 @@ groups() ->
{group, updates_during_checkpoint_iteration},
{group, load_table_with_activated_checkpoint},
{group,
- add_table_copy_to_table_with_activated_checkpoint}]},
+ add_table_copy_to_table_checkpoint}]},
{updates_during_checkpoint_activation, [],
[updates_during_checkpoint_activation_2_ram,
updates_during_checkpoint_activation_2_disc,
@@ -116,10 +116,10 @@ groups() ->
[load_table_with_activated_checkpoint_ram,
load_table_with_activated_checkpoint_disc,
load_table_with_activated_checkpoint_disc_only]},
- {add_table_copy_to_table_with_activated_checkpoint, [],
- [add_table_copy_to_table_with_activated_checkpoint_ram,
- add_table_copy_to_table_with_activated_checkpoint_disc,
- add_table_copy_to_table_with_activated_checkpoint_disc_only]},
+ {add_table_copy_to_table_checkpoint, [],
+ [add_table_copy_to_table_checkpoint_ram,
+ add_table_copy_to_table_checkpoint_disc,
+ add_table_copy_to_table_checkpoint_disc_only]},
{backup_consistency, [],
[{group, interupted_install_fallback},
{group, interupted_uninstall_fallback},
@@ -952,16 +952,16 @@ view(Source, Mod) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-add_table_copy_to_table_with_activated_checkpoint_ram(suite) -> [];
-add_table_copy_to_table_with_activated_checkpoint_ram(Config) when is_list(Config) ->
+add_table_copy_to_table_checkpoint_ram(suite) -> [];
+add_table_copy_to_table_checkpoint_ram(Config) when is_list(Config) ->
add_table_copy_to_table_with_activated_checkpoint(ram_copies, Config).
-add_table_copy_to_table_with_activated_checkpoint_disc(suite) -> [];
-add_table_copy_to_table_with_activated_checkpoint_disc(Config) when is_list(Config) ->
+add_table_copy_to_table_checkpoint_disc(suite) -> [];
+add_table_copy_to_table_checkpoint_disc(Config) when is_list(Config) ->
add_table_copy_to_table_with_activated_checkpoint(disc_copies, Config).
-add_table_copy_to_table_with_activated_checkpoint_disc_only(suite) -> [];
-add_table_copy_to_table_with_activated_checkpoint_disc_only(Config) when is_list(Config) ->
+add_table_copy_to_table_checkpoint_disc_only(suite) -> [];
+add_table_copy_to_table_checkpoint_disc_only(Config) when is_list(Config) ->
add_table_copy_to_table_with_activated_checkpoint(disc_only_copies, Config).
add_table_copy_to_table_with_activated_checkpoint(Type,Config) ->
diff --git a/lib/observer/src/crashdump_viewer_html.erl b/lib/observer/src/crashdump_viewer_html.erl
index 24a80b1916..3151b83bfb 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-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2012. 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
@@ -1394,7 +1394,7 @@ timers_table(Timer) ->
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)),
+ tr([td(href(["loaded_mod_details?mod=",http_uri:encode(Mod)],Mod)),
td("ALIGN=right",CS),
td("ALIGN=right",OS)]).
diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl
index 5bbce9d076..7478ae65a3 100644
--- a/lib/observer/test/crashdump_viewer_SUITE.erl
+++ b/lib/observer/test/crashdump_viewer_SUITE.erl
@@ -414,6 +414,10 @@ special(Port,File) ->
_ ->
ok
end;
+ ".strangemodname" ->
+ AllMods = contents(Port,"loaded_modules"),
+ open_all_modules(Port,AllMods),
+ ok;
%%! No longer needed - all atoms are shown on one page!!
%% ".250atoms" ->
%% Html1 = contents(Port,"atoms"),
@@ -496,6 +500,26 @@ expand_binary_link(Html) ->
expand_binary_link(T)
end.
+open_all_modules(Port,Modules) ->
+ case get_first_module(Modules) of
+ {Module,Rest} ->
+ ModuleDetails = contents(Port,"loaded_mod_details?mod=" ++ Module),
+ ModTitle = http_uri:decode(Module),
+ ModTitle = title(ModuleDetails),
+ open_all_modules(Port,Rest);
+ false ->
+ ok
+ end.
+
+get_first_module([]) ->
+ false;
+get_first_module(Html) ->
+ case Html of
+ "<TD><A HREF=\"loaded_mod_details?mod=" ++ Rest ->
+ {string:sub_word(Rest,1,$"),Rest};
+ [_H|T] ->
+ get_first_module(T)
+ end.
%% next_link(Html) ->
%% case Html of
@@ -590,7 +614,8 @@ do_create_dumps(DataDir,Rel) ->
case Rel of
current ->
CD3 = dump_with_args(DataDir,Rel,"instr","+Mim true"),
- {SlAllocDumps, [CD1,CD2,CD3], DosDump};
+ CD4 = dump_with_strange_module_name(DataDir,Rel,"strangemodname"),
+ {SlAllocDumps, [CD1,CD2,CD3,CD4], DosDump};
_ ->
{SlAllocDumps, [CD1,CD2], DosDump}
end.
@@ -648,7 +673,22 @@ dump_with_args(DataDir,Rel,DumpName,Args) ->
?t:stop_node(n1),
CD.
+%% This dump is added to test OTP-10090 - regarding URL encoding of
+%% module names in the module detail link.
+dump_with_strange_module_name(DataDir,Rel,DumpName) ->
+ Opt = rel_opt(Rel),
+ {ok,N1} = ?t:start_node(n1,peer,Opt),
+ Mod = '<mod ule#with?strange%name>',
+ File = atom_to_list(Mod) ++ ".erl",
+ Forms = [{attribute,1,file,{File,1}},
+ {attribute,1,module,Mod},
+ {eof,4}],
+ {ok,Mod,Bin} = rpc:call(N1,compile,forms,[Forms,[binary]]),
+ {module,Mod} = rpc:call(N1,code,load_binary,[Mod,File,Bin]),
+ CD = dump(N1,DataDir,Rel,DumpName),
+ ?t:stop_node(n1),
+ CD.
dump(Node,DataDir,Rel,DumpName) ->
rpc:call(Node,erlang,halt,[DumpName]),
diff --git a/lib/os_mon/src/disksup.erl b/lib/os_mon/src/disksup.erl
index 308cd1b7fa..c7abb7a386 100644
--- a/lib/os_mon/src/disksup.erl
+++ b/lib/os_mon/src/disksup.erl
@@ -43,24 +43,24 @@ start_link() ->
gen_server:start_link({local, disksup}, disksup, [], []).
get_disk_data() ->
- os_mon:call(disksup, get_disk_data).
+ os_mon:call(disksup, get_disk_data, infinity).
get_check_interval() ->
- os_mon:call(disksup, get_check_interval).
+ os_mon:call(disksup, get_check_interval, infinity).
set_check_interval(Minutes) ->
case param_type(disk_space_check_interval, Minutes) of
true ->
- os_mon:call(disksup, {set_check_interval, Minutes});
+ os_mon:call(disksup, {set_check_interval, Minutes}, infinity);
false ->
erlang:error(badarg)
end.
get_almost_full_threshold() ->
- os_mon:call(disksup, get_almost_full_threshold).
+ os_mon:call(disksup, get_almost_full_threshold, infinity).
set_almost_full_threshold(Float) ->
case param_type(disk_almost_full_threshold, Float) of
true ->
- os_mon:call(disksup, {set_almost_full_threshold, Float});
+ os_mon:call(disksup, {set_almost_full_threshold, Float}, infinity);
false ->
erlang:error(badarg)
end.
diff --git a/lib/os_mon/src/memsup.erl b/lib/os_mon/src/memsup.erl
index 5ef240f128..54771b4703 100644
--- a/lib/os_mon/src/memsup.erl
+++ b/lib/os_mon/src/memsup.erl
@@ -112,7 +112,7 @@ get_helper_timeout() ->
set_helper_timeout(Seconds) ->
case param_type(memsup_helper_timeout, Seconds) of
true ->
- os_mon:call(memsup, {set_helper_timeout, Seconds});
+ os_mon:call(memsup, {set_helper_timeout, Seconds}, infinity);
false ->
erlang:error(badarg)
end.
diff --git a/lib/tools/src/fprof.erl b/lib/tools/src/fprof.erl
index 8165a6c13a..4cbb910f11 100644
--- a/lib/tools/src/fprof.erl
+++ b/lib/tools/src/fprof.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2012. 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
@@ -89,9 +89,7 @@ dbg(_, _, _) ->
apply({M, F}, Args)
when is_atom(M), is_atom(F), is_list(Args) ->
- Arity = length(Args),
- Function = fun M:F/Arity,
- apply_1(Function, Args, []);
+ apply_1(M, F, Args, []);
apply(Fun, Args)
when is_function(Fun), is_list(Args) ->
apply_1(Fun, Args, []);
@@ -99,26 +97,25 @@ apply(A, B) ->
erlang:error(badarg, [A, B]).
apply(M, F, Args) when is_atom(M), is_atom(F), is_list(Args) ->
- apply_1({M, F}, Args, []);
+ apply_1(M, F, Args, []);
apply({M, F}, Args, Options)
when is_atom(M), is_atom(F), is_list(Args), is_list(Options) ->
- Arity = length(Args),
- Function = fun M:F/Arity,
- apply_1(Function, Args, Options);
+ apply_1(M, F, Args, Options);
apply(Fun, Args, Options)
when is_function(Fun), is_list(Args), is_list(Options) ->
apply_1(Fun, Args, Options);
apply(A, B, C) ->
erlang:error(badarg, [A, B, C]).
-apply(Module, Function, Args, Options)
- when is_atom(Module), is_atom(Function), is_list(Args), is_list(Options) ->
- Arity = length(Args),
- Fun = fun Module:Function/Arity,
- apply_1(Fun, Args, Options);
+apply(M, F, Args, Options)
+ when is_atom(M), is_atom(F), is_list(Args), is_list(Options) ->
+ apply_1(M, F, Args, Options);
apply(A, B, C, D) ->
erlang:error(badarg, [A, B, C, D]).
+apply_1(M, F, Args, Options) ->
+ Arity = length(Args),
+ apply_1(fun M:F/Arity, Args, Options).
apply_1(Function, Args, Options) ->
{[_, Procs, Continue], Options_1} =
diff --git a/lib/tools/vsn.mk b/lib/tools/vsn.mk
index 30a6d282fe..788ee12900 100644
--- a/lib/tools/vsn.mk
+++ b/lib/tools/vsn.mk
@@ -1 +1 @@
-TOOLS_VSN = 2.6.7
+TOOLS_VSN = 2.6.8
diff --git a/lib/wx/doc/src/Makefile b/lib/wx/doc/src/Makefile
index 834f887076..ae887b661b 100644
--- a/lib/wx/doc/src/Makefile
+++ b/lib/wx/doc/src/Makefile
@@ -95,13 +95,13 @@ ref_man.xml: ref_man.xml.src
@echo "</application>" >> ref_man.xml
@echo
-$(ErlMods:%.erl=%.xml):
+$(ErlMods:%.erl=%.xml): ../../src/$(@:%.xml=%.erl)
escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -preprocess true -sort_functions false ../../src/$(@:%.xml=%.erl)
-$(GenMods:%.erl=%.xml):
+$(GenMods:%.erl=%.xml): ../../src/gen/$(@:%.xml=%.erl)
escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -i ../../src -preprocess true -sort_functions false ../../src/gen/$(@:%.xml=%.erl)
-$(XML_CHAPTER_FILES):
+$(XML_CHAPTER_FILES): ../overview.edoc
escript $(DOCGEN)/priv/bin/xml_from_edoc.escript -def vsn $(VSN) -chapter ../overview.edoc
debug opt: