diff options
Diffstat (limited to 'lib/kernel')
99 files changed, 721 insertions, 521 deletions
diff --git a/lib/kernel/doc/src/app.xml b/lib/kernel/doc/src/app.xml index 1914844b37..7c9d6eecec 100644 --- a/lib/kernel/doc/src/app.xml +++ b/lib/kernel/doc/src/app.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE fileref SYSTEM "fileref.dtd"> <fileref> <header> <copyright> - <year>1997</year><year>2012</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/application.xml b/lib/kernel/doc/src/application.xml index 362c373c6c..da16964d61 100644 --- a/lib/kernel/doc/src/application.xml +++ b/lib/kernel/doc/src/application.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> diff --git a/lib/kernel/doc/src/auth.xml b/lib/kernel/doc/src/auth.xml index 15d9ef0fe4..72beee46f5 100644 --- a/lib/kernel/doc/src/auth.xml +++ b/lib/kernel/doc/src/auth.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2011</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/book.xml b/lib/kernel/doc/src/book.xml index caf13fd001..09123976cb 100644 --- a/lib/kernel/doc/src/book.xml +++ b/lib/kernel/doc/src/book.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE book SYSTEM "book.dtd"> <book xmlns:xi="http://www.w3.org/2001/XInclude"> <header titlestyle="normal"> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml index 6f04741f85..454ee9bcbb 100644 --- a/lib/kernel/doc/src/code.xml +++ b/lib/kernel/doc/src/code.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> diff --git a/lib/kernel/doc/src/config.xml b/lib/kernel/doc/src/config.xml index 34398e90ac..005504dbd1 100644 --- a/lib/kernel/doc/src/config.xml +++ b/lib/kernel/doc/src/config.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE fileref SYSTEM "fileref.dtd"> <fileref> <header> <copyright> - <year>1997</year><year>2009</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/disk_log.xml b/lib/kernel/doc/src/disk_log.xml index d278d54d93..27d8ab4fc1 100644 --- a/lib/kernel/doc/src/disk_log.xml +++ b/lib/kernel/doc/src/disk_log.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> <year>1997</year> - <year>2011</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/erl_boot_server.xml b/lib/kernel/doc/src/erl_boot_server.xml index 472671a80e..abaea4f695 100644 --- a/lib/kernel/doc/src/erl_boot_server.xml +++ b/lib/kernel/doc/src/erl_boot_server.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2011</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/erl_ddll.xml b/lib/kernel/doc/src/erl_ddll.xml index 26db11cfcd..7be54c8b95 100644 --- a/lib/kernel/doc/src/erl_ddll.xml +++ b/lib/kernel/doc/src/erl_ddll.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2012</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/erl_prim_loader_stub.xml b/lib/kernel/doc/src/erl_prim_loader_stub.xml index e6324b8168..485b16b91f 100644 --- a/lib/kernel/doc/src/erl_prim_loader_stub.xml +++ b/lib/kernel/doc/src/erl_prim_loader_stub.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> <year>1997</year> - <year>2009</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/erlang_stub.xml b/lib/kernel/doc/src/erlang_stub.xml index 333c4fedaf..79a041110a 100644 --- a/lib/kernel/doc/src/erlang_stub.xml +++ b/lib/kernel/doc/src/erlang_stub.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> <year>1997</year> - <year>2009</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/error_handler.xml b/lib/kernel/doc/src/error_handler.xml index 84ec3927c8..2f8f09b984 100644 --- a/lib/kernel/doc/src/error_handler.xml +++ b/lib/kernel/doc/src/error_handler.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> diff --git a/lib/kernel/doc/src/error_logger.xml b/lib/kernel/doc/src/error_logger.xml index cd86b364f6..3815b0877c 100644 --- a/lib/kernel/doc/src/error_logger.xml +++ b/lib/kernel/doc/src/error_logger.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2012</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/fascicules.xml b/lib/kernel/doc/src/fascicules.xml index 43090b4aed..fadd37eefb 100644 --- a/lib/kernel/doc/src/fascicules.xml +++ b/lib/kernel/doc/src/fascicules.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE fascicules SYSTEM "fascicules.dtd"> <fascicules> diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index 66ecba1bf2..1118a8feee 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml index 7ea58fffff..dacea7a239 100644 --- a/lib/kernel/doc/src/gen_sctp.xml +++ b/lib/kernel/doc/src/gen_sctp.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2007</year><year>2012</year> + <year>2007</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 11a0843c10..7afd73f4bf 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2012</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml index 4850278a64..faca31e928 100644 --- a/lib/kernel/doc/src/gen_udp.xml +++ b/lib/kernel/doc/src/gen_udp.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2012</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/global.xml b/lib/kernel/doc/src/global.xml index 53958c47c2..691b243443 100644 --- a/lib/kernel/doc/src/global.xml +++ b/lib/kernel/doc/src/global.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> diff --git a/lib/kernel/doc/src/global_group.xml b/lib/kernel/doc/src/global_group.xml index abf6178fc4..2c181da83a 100644 --- a/lib/kernel/doc/src/global_group.xml +++ b/lib/kernel/doc/src/global_group.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1998</year><year>2011</year> + <year>1998</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/heart.xml b/lib/kernel/doc/src/heart.xml index 3464832360..3ec33d2f18 100644 --- a/lib/kernel/doc/src/heart.xml +++ b/lib/kernel/doc/src/heart.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index 541500a300..119d7d8df9 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> @@ -559,7 +559,7 @@ fe80::204:acff:fe17:bf38 <c>[Byte1,Byte2|Binary]</c>.</p> </item> - <tag><c>{high_msgq_watermark, Size}</c> (TCP/IP sockets)</tag> + <tag><c>{high_msgq_watermark, Size}</c></tag> <item> <p>The socket message queue will be set into a busy state when the amount of data queued on the message @@ -674,7 +674,7 @@ fe80::204:acff:fe17:bf38 the flushing time-out in seconds.</p> </item> - <tag><c>{low_msgq_watermark, Size}</c> (TCP/IP sockets)</tag> + <tag><c>{low_msgq_watermark, Size}</c></tag> <item> <p>If the socket message queue is in a busy state, the socket message queue will be set in a not busy state when diff --git a/lib/kernel/doc/src/inet_res.xml b/lib/kernel/doc/src/inet_res.xml index bf73ccf13d..7880ccda05 100644 --- a/lib/kernel/doc/src/inet_res.xml +++ b/lib/kernel/doc/src/inet_res.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2009</year><year>2011</year> + <year>2009</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/init_stub.xml b/lib/kernel/doc/src/init_stub.xml index e8645458e4..5c57f8850e 100644 --- a/lib/kernel/doc/src/init_stub.xml +++ b/lib/kernel/doc/src/init_stub.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> <year>1997</year> - <year>2009</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/kernel_app.xml b/lib/kernel/doc/src/kernel_app.xml index faa8f86dbd..49a93d2c70 100644 --- a/lib/kernel/doc/src/kernel_app.xml +++ b/lib/kernel/doc/src/kernel_app.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE appref SYSTEM "appref.dtd"> <appref> <header> <copyright> - <year>1996</year><year>2012</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/net_adm.xml b/lib/kernel/doc/src/net_adm.xml index f2aac9282c..3009b1913d 100644 --- a/lib/kernel/doc/src/net_adm.xml +++ b/lib/kernel/doc/src/net_adm.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2011</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/net_kernel.xml b/lib/kernel/doc/src/net_kernel.xml index e54a427ff0..f5103136a1 100644 --- a/lib/kernel/doc/src/net_kernel.xml +++ b/lib/kernel/doc/src/net_kernel.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2011</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml index c18ae897b4..1b14d11e62 100644 --- a/lib/kernel/doc/src/notes.xml +++ b/lib/kernel/doc/src/notes.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> @@ -305,7 +305,7 @@ <p> Fixed issue where using controlling_process/2 with self() as the second argument caused the port to leak if self() - crashes. (Thanks to Ricardo Catalinas Jim�nez)</p> + crashes. (Thanks to Ricardo Catalinas Jiménez)</p> <p> Own Id: OTP-10094</p> </item> @@ -447,7 +447,7 @@ Various typographical errors corrected in documentation for the global, error_logger, etop, lists, ets and supervisor modules and in the c_portdriver and kernel_app - documentation. (Thanks to Ricardo Catalinas Jim�nez)</p> + documentation. (Thanks to Ricardo Catalinas Jiménez)</p> <p> Own Id: OTP-9987</p> </item> @@ -642,7 +642,7 @@ Fixes net_kernel:get_net_ticktime() doc</p> <p> Adds missing description when `ignored' is returned. - (Thanks to Ricardo Catalinas Jim�nez )</p> + (Thanks to Ricardo Catalinas Jiménez )</p> <p> Own Id: OTP-9713</p> </item> @@ -828,7 +828,7 @@ <item> <p> Fix typo in doc of rpc:pmap/3 (Thanks to Ricardo - Catalinas Jim�nez)</p> + Catalinas Jiménez)</p> <p> Own Id: OTP-9168</p> </item> diff --git a/lib/kernel/doc/src/notes_history.xml b/lib/kernel/doc/src/notes_history.xml index 2f6ceb9d42..58d5109774 100644 --- a/lib/kernel/doc/src/notes_history.xml +++ b/lib/kernel/doc/src/notes_history.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2006</year><year>2009</year> + <year>2006</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml index 5e182de41d..1e66f124ee 100644 --- a/lib/kernel/doc/src/os.xml +++ b/lib/kernel/doc/src/os.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2012</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/part_notes.xml b/lib/kernel/doc/src/part_notes.xml index ff43b9e007..d196878f19 100644 --- a/lib/kernel/doc/src/part_notes.xml +++ b/lib/kernel/doc/src/part_notes.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE part SYSTEM "part.dtd"> <part xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2004</year><year>2009</year> + <year>2004</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/part_notes_history.xml b/lib/kernel/doc/src/part_notes_history.xml index a73cc911b8..ec4998408e 100644 --- a/lib/kernel/doc/src/part_notes_history.xml +++ b/lib/kernel/doc/src/part_notes_history.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE part SYSTEM "part.dtd"> <part> <header> <copyright> <year>2006</year> - <year>2011</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/pg2.xml b/lib/kernel/doc/src/pg2.xml index d26ff0fc6b..5eb63c1ef6 100644 --- a/lib/kernel/doc/src/pg2.xml +++ b/lib/kernel/doc/src/pg2.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1997</year><year>2011</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/ref_man.xml b/lib/kernel/doc/src/ref_man.xml index 96604a2fa2..c1b9eac9d7 100644 --- a/lib/kernel/doc/src/ref_man.xml +++ b/lib/kernel/doc/src/ref_man.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE application SYSTEM "application.dtd"> <application xmlns:xi="http://www.w3.org/2001/XInclude"> diff --git a/lib/kernel/doc/src/rpc.xml b/lib/kernel/doc/src/rpc.xml index b01ff16c85..7026c7a07e 100644 --- a/lib/kernel/doc/src/rpc.xml +++ b/lib/kernel/doc/src/rpc.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1996</year><year>2011</year> + <year>1996</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/seq_trace.xml b/lib/kernel/doc/src/seq_trace.xml index 1ab955bd8a..45df06e0b4 100644 --- a/lib/kernel/doc/src/seq_trace.xml +++ b/lib/kernel/doc/src/seq_trace.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1998</year><year>2011</year> + <year>1998</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/specs.xml b/lib/kernel/doc/src/specs.xml index 813bb06e1f..29d52f23bb 100644 --- a/lib/kernel/doc/src/specs.xml +++ b/lib/kernel/doc/src/specs.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <specs xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="../specs/specs_application.xml"/> <xi:include href="../specs/specs_auth.xml"/> diff --git a/lib/kernel/doc/src/user.xml b/lib/kernel/doc/src/user.xml index 4d0f044321..df6dff9882 100644 --- a/lib/kernel/doc/src/user.xml +++ b/lib/kernel/doc/src/user.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> <year>1996</year> - <year>2011</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/wrap_log_reader.xml b/lib/kernel/doc/src/wrap_log_reader.xml index 6cf480b532..5227b4d01c 100644 --- a/lib/kernel/doc/src/wrap_log_reader.xml +++ b/lib/kernel/doc/src/wrap_log_reader.xml @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>1998</year><year>2011</year> + <year>1998</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/kernel/doc/src/zlib_stub.xml b/lib/kernel/doc/src/zlib_stub.xml index fa14262181..5f5bfd56db 100644 --- a/lib/kernel/doc/src/zlib_stub.xml +++ b/lib/kernel/doc/src/zlib_stub.xml @@ -1,11 +1,11 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> <year>1997</year> - <year>2009</year> + <year>2013</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl index 9ed2c7a7d9..1a4473593a 100644 --- a/lib/kernel/src/application_controller.erl +++ b/lib/kernel/src/application_controller.erl @@ -488,7 +488,7 @@ init(Init, Kernel) -> %% called during start-up of any app. case check_conf_data(ConfData) of ok -> - ets:new(ac_tab, [set, public, named_table]), + _ = ets:new(ac_tab, [set, public, named_table]), S = #state{conf_data = ConfData}, {ok, KAppl} = make_appl(Kernel), case catch load(S, KAppl) of @@ -1949,10 +1949,10 @@ test_change_apps(Apps, Conf) -> test_do_change_appl([], _, _) -> ok; test_do_change_appl([A|Apps], [], [R|Res]) -> - do_change_appl(R, #appl{name = A}, []), + _ = do_change_appl(R, #appl{name = A}, []), test_do_change_appl(Apps, [], Res); test_do_change_appl([A|Apps], [C|Conf], [R|Res]) -> - do_change_appl(R, #appl{name = A}, C), + _ = do_change_appl(R, #appl{name = A}, C), test_do_change_appl(Apps, Conf, Res). test_make_apps([], Res) -> diff --git a/lib/kernel/src/application_master.erl b/lib/kernel/src/application_master.erl index 679fefaed9..68f78c6eb8 100644 --- a/lib/kernel/src/application_master.erl +++ b/lib/kernel/src/application_master.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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 @@ -76,13 +76,8 @@ call(AppMaster, Req) -> {'DOWN', Ref, process, _, _Info} -> ok; {Tag, Res} -> - erlang:demonitor(Ref), - receive - {'DOWN', Ref, process, _, _Info} -> - Res - after 0 -> - Res - end + erlang:demonitor(Ref, [flush]), + Res end. %%%----------------------------------------------------------------- @@ -130,7 +125,7 @@ init(Parent, Starter, ApplData, Type) -> State = #state{appl_data = ApplData, gleader = OldGleader}, case start_it(State, Type) of {ok, Pid} -> % apply(M,F,A) returned ok - set_timer(ApplData#appl_data.maxT), + ok = set_timer(ApplData#appl_data.maxT), unlink(Starter), proc_lib:init_ack(Starter, {ok,self()}), main_loop(Parent, State#state{child = Pid}); @@ -423,4 +418,6 @@ kill_all_procs_1([], _, 0) -> ok; kill_all_procs_1([], _, _) -> kill_all_procs(). set_timer(infinity) -> ok; -set_timer(Time) -> timer:exit_after(Time, timeout). +set_timer(Time) -> + {ok, _} = timer:exit_after(Time, timeout), + ok. diff --git a/lib/kernel/src/auth.erl b/lib/kernel/src/auth.erl index 7d463103e3..eda35147d3 100644 --- a/lib/kernel/src/auth.erl +++ b/lib/kernel/src/auth.erl @@ -324,7 +324,7 @@ read_cookie(Name, Size) -> {ok, File} -> case file:read(File, Size) of {ok, List} -> - file:close(File), + ok = file:close(File), check_cookie(List, []); {error, Reason} -> make_error(Name, Reason) @@ -376,7 +376,7 @@ create_cookie(Name) -> case file:open(Name, [write, raw]) of {ok, File} -> R1 = file:write(File, Cookie), - file:close(File), + ok = file:close(File), R2 = file:raw_write_file_info(Name, make_info(Name)), case {R1, R2} of {ok, ok} -> diff --git a/lib/kernel/src/code.erl b/lib/kernel/src/code.erl index 03fba96d4b..0eda558ed5 100644 --- a/lib/kernel/src/code.erl +++ b/lib/kernel/src/code.erl @@ -364,7 +364,7 @@ load_code_server_prerequisites() -> lists, os, unicode], - [M = M:module_info(module) || M <- Needed], + _ = [M = M:module_info(module) || M <- Needed], ok. do_stick_dirs() -> diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl index 5d74e8620b..9358e2201e 100644 --- a/lib/kernel/src/code_server.erl +++ b/lib/kernel/src/code_server.erl @@ -153,7 +153,7 @@ loop(#state{supervisor=Supervisor}=State0) -> {code_call, Pid, Req} -> case handle_call(Req, {Pid, call}, State0) of {reply, Res, State} -> - reply(Pid, Res), + _ = reply(Pid, Res), loop(State); {noreply, State} -> loop(State); @@ -1505,13 +1505,13 @@ finish_on_load_1(Mod, File, OnLoadRes, WaitingPids, Db) -> erlang:finish_after_on_load(Mod, Keep), Res = case Keep of false -> - finish_on_load_report(Mod, OnLoadRes), + _ = finish_on_load_report(Mod, OnLoadRes), {error,on_load_failure}; true -> ets:insert(Db, {Mod,File}), {module,Mod} end, - [reply(Pid, Res) || Pid <- WaitingPids], + _ = [reply(Pid, Res) || Pid <- WaitingPids], ok. finish_on_load_report(_Mod, Atom) when is_atom(Atom) -> diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl index 0c5af2857e..9a7726cfa0 100644 --- a/lib/kernel/src/disk_log.erl +++ b/lib/kernel/src/disk_log.erl @@ -1076,13 +1076,13 @@ log_end(S, [], [], Sync) -> log_end(S, Pids, Bins, Sync) -> case do_log(get(log), rflat(Bins)) of N when is_integer(N) -> - replies(Pids, ok), + ok = replies(Pids, ok), S1 = (state_ok(S))#state{cnt = S#state.cnt+N}, log_end_sync(S1, Sync); {error, {error, {full, _Name}}, N} when Pids =:= [] -> log_end_sync(state_ok(S#state{cnt = S#state.cnt + N}), Sync); {error, Error, N} -> - replies(Pids, Error), + ok = replies(Pids, Error), state_err(S#state{cnt = S#state.cnt + N}, Error) end. @@ -1091,7 +1091,7 @@ log_end_sync(S, []) -> S; log_end_sync(S, Sync) -> Res = do_sync(get(log)), - replies(Sync, Res), + ok = replies(Sync, Res), state_err(S, Res). %% Inlined. @@ -1183,7 +1183,7 @@ do_exit(S, From, Message0, Reason) -> _ -> Message0 end, _ = disk_log_server:close(self()), - replies(From, Message), + ok = replies(From, Message), ?PROFILE(ep:done()), exit(Reason). @@ -1881,7 +1881,8 @@ replies(Pids, Reply) -> send_reply(Pids, M). send_reply(Pid, M) when is_pid(Pid) -> - Pid ! M; + Pid ! M, + ok; send_reply([Pid | Pids], M) -> Pid ! M, send_reply(Pids, M); @@ -1914,13 +1915,8 @@ multi_req(Msg, Pids) -> {'DOWN', Ref, process, Pid, _Info} -> Reply; {disk_log, Pid, _Reply} -> - erlang:demonitor(Ref), - receive - {'DOWN', Ref, process, Pid, _Reason} -> - ok - after 0 -> - ok - end + erlang:demonitor(Ref, [flush]), + ok end end, {error, nonode}, Refs). @@ -1965,13 +1961,8 @@ monitor_request(Pid, Req) -> {error, no_such_log}; {disk_log, Pid, Reply} when not is_tuple(Reply) orelse element(2, Reply) =/= disk_log_stopped -> - erlang:demonitor(Ref), - receive - {'DOWN', Ref, process, Pid, _Reason} -> - Reply - after 0 -> - Reply - end + erlang:demonitor(Ref, [flush]), + Reply end. req2(Pid, R) -> @@ -2032,7 +2023,7 @@ notify_owners(Note) -> cache_error(S, Pids) -> Error = S#state.cache_error, - replies(Pids, Error), + ok = replies(Pids, Error), state_err(S#state{cache_error = ok}, Error). state_ok(S) -> diff --git a/lib/kernel/src/disk_log_1.erl b/lib/kernel/src/disk_log_1.erl index 9d431bdd30..59f5cad001 100644 --- a/lib/kernel/src/disk_log_1.erl +++ b/lib/kernel/src/disk_log_1.erl @@ -295,12 +295,18 @@ read_chunk_ro(FdC, FileName, Pos, MaxBytes) -> pread(FdC, FileName, Pos + ?HEADSZ, MaxBytes). %% -> ok | throw(Error) -close(#cache{fd = Fd, c = []}, _FileName, read_only) -> - file:close(Fd); +close(#cache{fd = Fd, c = []}, FileName, read_only) -> + case file:close(Fd) of + ok -> ok; + Error -> file_error(FileName, Error) + end; close(#cache{fd = Fd, c = C}, FileName, read_write) -> {Reply, _NewFdC} = write_cache(Fd, FileName, C), mark(Fd, FileName, ?CLOSED), - file:close(Fd), + case file:close(Fd) of + ok -> ok; + Error -> file_error(FileName, Error) + end, if Reply =:= ok -> ok; true -> throw(Reply) end. %% Open an internal file. Head is ignored if Mode is read_only. @@ -320,7 +326,10 @@ int_open(FName, Repair, read_write, Head) -> {ok, FileHead} -> case is_head(FileHead) of yes -> - file:close(Fd), + case file:close(Fd) of + ok -> ok; + Error2 -> file_error(FName, Error2) + end, case open_update(FName) of {ok, Fd2} -> mark(Fd2, FName, ?OPENED), @@ -333,14 +342,14 @@ int_open(FName, Repair, read_write, Head) -> yes_not_closed when Repair -> repair(Fd, FName); yes_not_closed when not Repair -> - file:close(Fd), + _ = file:close(Fd), throw({error, {need_repair, FName}}); no -> - file:close(Fd), + _ = file:close(Fd), throw({error, {not_a_log_file, FName}}) end; eof -> - file:close(Fd), + _= file:close(Fd), throw({error, {not_a_log_file, FName}}); Error -> file_error_close(Fd, FName, Error) @@ -363,11 +372,11 @@ int_open(FName, _Repair, read_only, _Head) -> FdC = #cache{fd = Fd}, {ok, {existed, FdC, {0, 0}, P}}; no -> - file:close(Fd), + _= file:close(Fd), throw({error, {not_a_log_file, FName}}) end; eof -> - file:close(Fd), + _ = file:close(Fd), throw({error, {not_a_log_file, FName}}); Error -> file_error_close(Fd, FName, Error) @@ -398,7 +407,7 @@ int_log_head(Fd, Head) -> none -> {#cache{fd = Fd}, 0, 0}; Error -> - file:close(Fd), + _= file:close(Fd), throw(Error) end. @@ -450,13 +459,13 @@ ext_log_head(Fd, Head) -> none -> {#cache{fd = Fd}, {0, 0}}; Error -> - file:close(Fd), + _= file:close(Fd), throw(Error) end. %% -> _Any | throw() mark(Fd, FileName, What) -> - position_close2(Fd, FileName, 4), + {ok, _} = position_close2(Fd, FileName, 4), fwrite_close2(Fd, FileName, What). %% -> {ok, Bin} | Error @@ -560,7 +569,7 @@ scan_f2(B, FSz, Ack, No, Bad, Size, Tail) -> end. done_scan(In, Out, OutName, FName, RecoveredTerms, BadChars) -> - file:close(In), + _ = file:close(In), case catch fclose(Out, OutName) of ok -> case file:rename(OutName, FName) of @@ -574,21 +583,21 @@ done_scan(In, Out, OutName, FName, RecoveredTerms, BadChars) -> file_error(FName, Error) end; Error -> - file:delete(OutName), + _ = file:delete(OutName), file_error(FName, Error) end; Error -> - file:delete(OutName), + _ = file:delete(OutName), throw(Error) end. -spec repair_err(file:io_device(), #cache{}, file:filename(), file:filename(), {'error', file:posix()}) -> no_return(). repair_err(In, Out, OutName, ErrFileName, Error) -> - file:close(In), + _= file:close(In), catch fclose(Out, OutName), %% OutName is often the culprit, try to remove it anyway... - file:delete(OutName), + _ = file:delete(OutName), file_error(ErrFileName, Error). %% Used by wrap_log_reader. @@ -764,10 +773,10 @@ mf_int_chunk(Handle, {FileNo, Pos}, Bin, N) -> {ok, {_Alloc, FdC, _HeadSize, _FileSize}} -> case chunk(FdC, FName, Pos, Bin, N) of {NewFdC, eof} -> - file:close(NewFdC#cache.fd), + _ = file:close(NewFdC#cache.fd), mf_int_chunk(Handle, {NFileNo, 0}, [], N); {NewFdC, Other} -> - file:close(NewFdC#cache.fd), + _ = file:close(NewFdC#cache.fd), {Handle, conv(Other, FileNo)} end end. @@ -792,10 +801,10 @@ mf_int_chunk_read_only(Handle, {FileNo, Pos}, Bin, N) -> {ok, {_Alloc, FdC, _HeadSize, _FileSize}} -> case do_chunk_read_only(FdC, FName, Pos, Bin, N) of {NewFdC, eof} -> - file:close(NewFdC#cache.fd), + _ = file:close(NewFdC#cache.fd), mf_int_chunk_read_only(Handle, {NFileNo,0}, [], N); {NewFdC, Other} -> - file:close(NewFdC#cache.fd), + _ = file:close(NewFdC#cache.fd), {Handle, conv(Other, FileNo)} end end. @@ -1017,7 +1026,7 @@ ext_file_open(FName, NewFile, OldFile, OldCnt, Head, Repair, Mode) -> read_index_file(truncate, FName, MaxF) -> remove_files(FName, 2, MaxF), - file:delete(?index_file_name(FName)), + _ = file:delete(?index_file_name(FName)), {1, 0, 0, 0}; read_index_file(_, FName, _MaxF) -> read_index_file(FName). @@ -1043,7 +1052,7 @@ read_index_file(FName) -> _ErrorOrEof -> {1, 0, 0, 0} end, - file:close(Fd), + _ = file:close(Fd), R; _Error -> {1, 0, 0, 0} @@ -1096,7 +1105,7 @@ write_index_file(read_write, FName, NewFile, OldFile, OldCnt) -> %% Very old format, convert to the latest format! case file:read_file(FileName) of {ok, <<_CurF, Tail/binary>>} -> - position_close2(Fd, FileName, bof), + {ok, _} = position_close2(Fd, FileName, bof), Bin = <<0, 0:32, ?VERSION, NewFile:32>>, NewTail = to_8_bytes(Tail, [], FileName, Fd), fwrite_close2(Fd, FileName, [Bin | NewTail]), @@ -1115,7 +1124,7 @@ write_index_file(read_write, FName, NewFile, OldFile, OldCnt) -> R = file:pread(Fd, NewPos, SzSz), OldPos = Offset + (OldFile - 1)*SzSz, pwrite_close2(Fd, FileName, OldPos, OldCntBin), - file:close(Fd), + _ = file:close(Fd), case R of {ok, <<Lost:SzSz/unit:8>>} -> Lost; {ok, _} -> @@ -1125,7 +1134,7 @@ write_index_file(read_write, FName, NewFile, OldFile, OldCnt) -> end; true -> pwrite_close2(Fd, FileName, NewPos, OldCntBin), - file:close(Fd), + _ = file:close(Fd), 0 end; E -> @@ -1137,7 +1146,7 @@ to_8_bytes(<<N:32,T/binary>>, NT, FileName, Fd) -> to_8_bytes(B, NT, _FileName, _Fd) when byte_size(B) =:= 0 -> NT; to_8_bytes(_B, _NT, FileName, Fd) -> - file:close(Fd), + _ = file:close(Fd), throw({error, {invalid_index_file, FileName}}). %% -> ok | throw(FileError) @@ -1147,7 +1156,7 @@ index_file_trunc(FName, N) -> {ok, Fd} -> case file:read(Fd, 6) of eof -> - file:close(Fd), + _ = file:close(Fd), ok; {ok, <<0, 0:32, Version>>} when Version =:= ?VERSION -> truncate_index_file(Fd, FileName, 10, 8, N); @@ -1166,10 +1175,10 @@ truncate_index_file(Fd, FileName, Offset, N, SzSz) -> Pos = Offset + N*SzSz, case Pos > file_size(FileName) of true -> - file:close(Fd); + ok = file:close(Fd); false -> truncate_at_close2(Fd, FileName, {bof, Pos}), - file:close(Fd) + ok = file:close(Fd) end, ok. @@ -1412,7 +1421,8 @@ fwrite(#cache{c = []} = FdC, _FN, B, Size) -> ok; _ -> put(write_cache_timer_is_running, true), - erlang:send_after(?TIMEOUT, self(), {self(), write_cache}) + erlang:send_after(?TIMEOUT, self(), {self(), write_cache}), + ok end, {ok, FdC#cache{sz = Size, c = B}}; fwrite(#cache{sz = Sz, c = C} = FdC, _FN, B, Size) when Sz < ?MAX -> @@ -1511,7 +1521,7 @@ position_close2(Fd, FileName, Pos) -> end. truncate_at_close2(Fd, FileName, Pos) -> - position_close2(Fd, FileName, Pos), + {ok, _} = position_close2(Fd, FileName, Pos), case file:truncate(Fd) of ok -> ok; Error -> file_error_close(Fd, FileName, Error) @@ -1519,7 +1529,7 @@ truncate_at_close2(Fd, FileName, Pos) -> fclose(#cache{fd = Fd, c = C}, FileName) -> %% The cache is empty if the file was opened in read_only mode. - write_cache_close(Fd, FileName, C), + _ = write_cache_close(Fd, FileName, C), file:close(Fd). %% -> {Reply, #cache{}}; Reply = ok | Error @@ -1549,5 +1559,5 @@ file_error(FileName, {error, Error}) -> -spec file_error_close(file:fd(), file:filename(), {'error', file:posix()}) -> no_return(). file_error_close(Fd, FileName, {error, Error}) -> - file:close(Fd), + _ = file:close(Fd), throw({error, {file_error, FileName, Error}}). diff --git a/lib/kernel/src/disk_log_server.erl b/lib/kernel/src/disk_log_server.erl index 8894ed87e8..684ea5b5db 100644 --- a/lib/kernel/src/disk_log_server.erl +++ b/lib/kernel/src/disk_log_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -83,8 +83,8 @@ accessible_logs() -> init([]) -> process_flag(trap_exit, true), - ets:new(?DISK_LOG_NAME_TABLE, [named_table, set]), - ets:new(?DISK_LOG_PID_TABLE, [named_table, set]), + _ = ets:new(?DISK_LOG_NAME_TABLE, [named_table, set]), + _= ets:new(?DISK_LOG_PID_TABLE, [named_table, set]), {ok, #state{}}. handle_call({open, W, A}, From, State) -> @@ -159,15 +159,25 @@ ensure_started() -> undefined -> LogSup = {disk_log_sup, {disk_log_sup, start_link, []}, permanent, 1000, supervisor, [disk_log_sup]}, - supervisor:start_child(kernel_safe_sup, LogSup), + {ok, _} = ensure_child_started(kernel_safe_sup, LogSup), LogServer = {disk_log_server, {disk_log_server, start_link, []}, permanent, 2000, worker, [disk_log_server]}, - supervisor:start_child(kernel_safe_sup, LogServer), + {ok, _} = ensure_child_started(kernel_safe_sup, LogServer), ok; _ -> ok end. +ensure_child_started(Sup,Child) -> + case supervisor:start_child(Sup, Child) of + {ok,Pid} -> + {ok,Pid}; + {error,{already_started,Pid}} -> + {ok,Pid}; + Error -> + Error + end. + open([{Req, From} | L], State) -> State2 = case do_open(Req, From, State) of {pending, State1} -> diff --git a/lib/kernel/src/dist_ac.erl b/lib/kernel/src/dist_ac.erl index 5c62aa31e9..a4d4ae386c 100644 --- a/lib/kernel/src/dist_ac.erl +++ b/lib/kernel/src/dist_ac.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -283,7 +283,7 @@ handle_cast(init_sync, _S) -> KernelConfig ! dist_ac_took_control, %% we're really just interested in nodedowns. - net_kernel:monitor_nodes(true), + ok = net_kernel:monitor_nodes(true), {Known, NAppls, RStarted} = sync_dacs(Appls), @@ -321,7 +321,7 @@ handle_call({takeover_application, AppName, RestartType}, From, S) -> case keysearch(AppName, #appl.name, Appls) of {value, Appl} when element(1, Appl#appl.id) =:= distributed -> {distributed, Node} = Appl#appl.id, - ac_takeover(req, AppName, Node, RestartType), + _ = ac_takeover(req, AppName, Node, RestartType), NAppl = Appl#appl{id = takeover}, NAppls = keyreplace(AppName, #appl.name, Appls, NAppl), TR = S#state.t_reqs, @@ -341,10 +341,10 @@ handle_call({permit_application, AppName, Bool, LockId, StartInfo}, From, S) -> %% here, but we have to be backwards-compatible. case application_controller:get_loaded(AppName) of {true, _} when not Bool -> - ac_stop_it(AppName), + _ = ac_stop_it(AppName), {reply, ok, S}; {true, _} when Bool -> - ac_start_it(req, AppName), + _ = ac_start_it(req, AppName), {reply, ok, S}; false -> {reply, {error, {not_loaded, AppName}}, S} @@ -533,7 +533,7 @@ handle_info({dist_ac_app_started, Node, Name, Res}, S) -> %% Another node started appl. Update appl list. {distributed, Node} end, - ac_started(req, Name, Node), + _ = ac_started(req, Name, Node), NAppl = Appl#appl{id = NId}, NAppls = keyreplace(Name, #appl.name, Appls, NAppl), TmpWeights = keydelete_all(Name, 1, S#state.tmp_weights), @@ -622,7 +622,7 @@ handle_info({nodedown, Node}, S) -> true -> {true, Appl#appl{id = {failover, Node}}}; false -> - ac_not_running(Appl#appl.name), + _ = ac_not_running(Appl#appl.name), {true, Appl#appl{id = undefined}} end; (_) -> @@ -656,7 +656,8 @@ handle_info({dist_ac_app_loaded, Node, Name, HisNodes, Permission, HeKnowsMe}, %% he's a new node connecting to us. Msg = {dist_ac_app_loaded, node(), Name, Nodes, dist_is_runnable(Appls, Name), true}, - {?DIST_AC, Node} ! Msg; + {?DIST_AC, Node} ! Msg, + ok; true -> ok end, @@ -811,29 +812,29 @@ start_appl(AppName, S, Type) -> start_distributed(Appl, Name, Nodes, PermittedNodes, S, Type) -> case find_start_node(Nodes, PermittedNodes, Name, S) of {ok, Node} when Node =:= node() -> - case Appl#appl.id of - {failover, FoNode} when Type =:= req -> - ac_failover(Name, FoNode, undefined); - {distributed, Node2} when Type =:= req -> - ac_takeover(req, Name, Node2, undefined); - _ when Type =:= reply -> - case lists:keysearch(Name, 2, S#state.remote_started) of - {value, {Node3, _}} -> - ac_takeover(reply, Name, Node3, undefined); - _ -> - ac_start_it(Type, Name) - end; - _ -> - ac_start_it(Type, Name) - end, + _ = case Appl#appl.id of + {failover, FoNode} when Type =:= req -> + ac_failover(Name, FoNode, undefined); + {distributed, Node2} when Type =:= req -> + ac_takeover(req, Name, Node2, undefined); + _ when Type =:= reply -> + case lists:keysearch(Name, 2, S#state.remote_started) of + {value, {Node3, _}} -> + ac_takeover(reply, Name, Node3, undefined); + _ -> + ac_start_it(Type, Name) + end; + _ -> + ac_start_it(Type, Name) + end, {run_waiting, true}; {already_started, Node} -> - ac_started(Type, Name, Node), + _ = ac_started(Type, Name, Node), {{distributed, Node}, false}; {ok, Node} -> case keysearch(Name, #appl.name, S#state.appls) of {value, #appl{id = {distributed, Node}}} -> - ac_started(Type, Name, Node), + _ = ac_started(Type, Name, Node), {{distributed, Node}, false}; _ -> wait_dist_start(Node, Appl, Name, Nodes, @@ -842,7 +843,7 @@ start_distributed(Appl, Name, Nodes, PermittedNodes, S, Type) -> not_started -> wait_dist_start2(Appl, Name, Nodes, PermittedNodes, S, Type); no_permission -> - ac_not_started(Type, Name), + _ = ac_not_started(Type, Name), {undefined, false} end. @@ -850,11 +851,11 @@ wait_dist_start(Node, Appl, Name, Nodes, PermittedNodes, S, Type) -> monitor_node(Node, true), receive {dist_ac_app_started, Node, Name, ok} -> - ac_started(Type, Name, Node), + _ = ac_started(Type, Name, Node), monitor_node(Node, false), {{distributed, Node}, false}; {dist_ac_app_started, Node, Name, {error, R}} -> - ac_error(Type, Name, {Node, R}), + _ = ac_error(Type, Name, {Node, R}), monitor_node(Node, false), {Appl#appl.id, false}; {dist_ac_weight, Name, _Weigth, Node} -> @@ -883,10 +884,10 @@ wait_dist_start(Node, Appl, Name, Nodes, PermittedNodes, S, Type) -> wait_dist_start2(Appl, Name, Nodes, PermittedNodes, S, Type) -> receive {dist_ac_app_started, Node, Name, ok} -> - ac_started(Type, Name, Node), + _ = ac_started(Type, Name, Node), {{distributed, Node}, false}; {dist_ac_app_started, Node, Name, {error, R}} -> - ac_error(Type, Name, {Node, R}), + _ = ac_error(Type, Name, {Node, R}), {Appl#appl.id, false}; {nodedown, Node} -> %% A node went down, try to start the app again - there may not @@ -974,7 +975,7 @@ permit(false, {value, _}, AppName, From, S, _LockId) -> case dist_get_runnable_nodes(S#state.appls, AppName) of [] -> %% There is no runnable node; stop application - ac_stop_it(AppName), + _ = ac_stop_it(AppName), SReqs = [{AppName, From} | S#state.s_reqs], {noreply, S#state{s_reqs = SReqs}}; Nodes -> @@ -1155,7 +1156,8 @@ send_nodes(Nodes, Msg) -> end, FlatNodes). send_after(Time, Msg) when is_integer(Time), Time >= 0 -> - spawn_link(?MODULE, send_timeout, [self(), Time, Msg]); + _Pid = spawn_link(?MODULE, send_timeout, [self(), Time, Msg]), + ok; send_after(_,_) -> % infinity ok. @@ -1305,7 +1307,7 @@ check_waiting([{From, AppName, false, Nodes} | Reqs], S, Node, Appls, Res, SReqs) -> case lists:delete(Node, Nodes) of [] -> - ac_stop_it(AppName), + _ = ac_stop_it(AppName), NSReqs = [{AppName, From} | SReqs], check_waiting(Reqs, Node, S, Appls, Res, NSReqs); NNodes -> diff --git a/lib/kernel/src/erl_boot_server.erl b/lib/kernel/src/erl_boot_server.erl index 0d68d3e198..9a49655a9f 100644 --- a/lib/kernel/src/erl_boot_server.erl +++ b/lib/kernel/src/erl_boot_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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,7 +191,7 @@ init(Slaves) -> {ok, UPort} = inet:port(U), Ref = make_ref(), Pid = proc_lib:spawn_link(?MODULE, boot_init, [Ref]), - gen_tcp:controlling_process(L, Pid), + ok = gen_tcp:controlling_process(L, Pid), Pid ! {Ref, L}, %% We trap exit inorder to restart boot_init and udp_port process_flag(trap_exit, true), @@ -233,9 +233,19 @@ handle_info({udp, U, IP, Port, Data}, S0) -> %% erlang version as the boot server node case {Valid,Data,Token} of {true,Token,Token} -> - gen_udp:send(U,IP,Port,[?EBOOT_REPLY,S0#state.priority, - int16(S0#state.listen_port), - S0#state.version]), + case gen_udp:send(U,IP,Port,[?EBOOT_REPLY,S0#state.priority, + int16(S0#state.listen_port), + S0#state.version]) + of + ok -> ok; + {error, not_owner} -> + error_logger:error_msg("** Illegal boot server connection attempt: " + "not owner of ~w ** ~n", [U]); + {error, Reason} -> + Err = file:format_error(Reason), + error_logger:error_msg("** Illegal boot server connection attempt: " + "~w POSIX error ** ~n", [U, Err]) + end, {noreply,S0}; {false,_,_} -> error_logger:error_msg("** Illegal boot server connection attempt: " @@ -351,7 +361,14 @@ handle_command(S, PS, Msg) -> end. send_file_result(S, Cmd, Result) -> - gen_tcp:send(S, term_to_binary({Cmd,Result})). - -send_result(S, Result) -> - gen_tcp:send(S, term_to_binary(Result)). + send_result(S, {Cmd,Result}). + +send_result(S, Term) -> + case gen_tcp:send(S, term_to_binary(Term)) of + ok -> + ok; + Error -> + error_logger:error_msg("** Boot server could not send result " + "to socket: ~w** ~n", [Error]), + ok + end. diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl index 91af49f303..b4fae24ef3 100644 --- a/lib/kernel/src/erl_epmd.erl +++ b/lib/kernel/src/erl_epmd.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. 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 @@ -217,17 +217,23 @@ do_register_node(NodeName, TcpPort) -> Extra = "", Elen = length(Extra), Len = 1+2+1+1+2+2+2+length(Name)+2+Elen, - gen_tcp:send(Socket, [?int16(Len), ?EPMD_ALIVE2_REQ, - ?int16(TcpPort), - $M, - 0, - ?int16(epmd_dist_high()), - ?int16(epmd_dist_low()), - ?int16(length(Name)), - Name, - ?int16(Elen), - Extra]), - wait_for_reg_reply(Socket, []); + Packet = [?int16(Len), ?EPMD_ALIVE2_REQ, + ?int16(TcpPort), + $M, + 0, + ?int16(epmd_dist_high()), + ?int16(epmd_dist_low()), + ?int16(length(Name)), + Name, + ?int16(Elen), + Extra], + case gen_tcp:send(Socket, Packet) of + ok -> + wait_for_reg_reply(Socket, []); + Error -> + close(Socket), + Error + end; Error -> Error end. @@ -294,8 +300,14 @@ get_port(Node, EpmdAddress, Timeout) -> {ok, Socket} -> Name = to_string(Node), Len = 1+length(Name), - gen_tcp:send(Socket, [?int16(Len),?EPMD_PORT_PLEASE2_REQ, Name]), - wait_for_port_reply(Socket, []); + Msg = [?int16(Len),?EPMD_PORT_PLEASE2_REQ,Name], + case gen_tcp:send(Socket, Msg) of + ok -> + wait_for_port_reply(Socket, []); + _Error -> + ?port_please_failure2(_Error), + noport + end; _Error -> ?port_please_failure2(_Error), noport @@ -374,7 +386,7 @@ wait_for_port_reply_name(Socket, Len, Sofar) -> % io:format("data = ~p~n", _Data), wait_for_port_reply_name(Socket, Len, Sofar); {tcp_closed, Socket} -> - "foobar" + ok end. @@ -424,19 +436,24 @@ get_names(EpmdAddress) -> end. do_get_names(Socket) -> - gen_tcp:send(Socket, [?int16(1),?EPMD_NAMES]), - receive - {tcp, Socket, [P0,P1,P2,P3|T]} -> - EpmdPort = ?u32(P0,P1,P2,P3), - case get_epmd_port() of - EpmdPort -> - names_loop(Socket, T, []); - _ -> - close(Socket), - {error, address} + case gen_tcp:send(Socket, [?int16(1),?EPMD_NAMES]) of + ok -> + receive + {tcp, Socket, [P0,P1,P2,P3|T]} -> + EpmdPort = ?u32(P0,P1,P2,P3), + case get_epmd_port() of + EpmdPort -> + names_loop(Socket, T, []); + _ -> + close(Socket), + {error, address} + end; + {tcp_closed, Socket} -> + {ok, []} end; - {tcp_closed, Socket} -> - {ok, []} + _ -> + close(Socket), + {error, address} end. names_loop(Socket, Acc, Ps) -> diff --git a/lib/kernel/src/erl_reply.erl b/lib/kernel/src/erl_reply.erl index 1a61e630bc..f0be3ee654 100644 --- a/lib/kernel/src/erl_reply.erl +++ b/lib/kernel/src/erl_reply.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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,7 +32,7 @@ reply([Addr,Port,Msg]) -> P = list_to_integer(atom_to_list(Port)), M = atom_to_list(Msg), {ok, S} = gen_tcp:connect(Ip,P,[]), - gen_tcp:send(S,M), + ok = gen_tcp:send(S,M), gen_tcp:close(S), reply_done; reply(_) -> diff --git a/lib/kernel/src/error_logger.erl b/lib/kernel/src/error_logger.erl index 92c1eb80dc..b8fbf02feb 100644 --- a/lib/kernel/src/error_logger.erl +++ b/lib/kernel/src/error_logger.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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 @@ -245,16 +245,18 @@ notify(Msg) -> -spec swap_handler(Type :: swap_handler_type()) -> any(). swap_handler(tty) -> - gen_event:swap_handler(error_logger, {error_logger, swap}, - {error_logger_tty_h, []}), - simple_logger(); + R = gen_event:swap_handler(error_logger, {error_logger, swap}, + {error_logger_tty_h, []}), + ok = simple_logger(), + R; swap_handler({logfile, File}) -> - gen_event:swap_handler(error_logger, {error_logger, swap}, - {error_logger_file_h, File}), - simple_logger(); + R = gen_event:swap_handler(error_logger, {error_logger, swap}, + {error_logger_file_h, File}), + ok = simple_logger(), + R; swap_handler(silent) -> - gen_event:delete_handler(error_logger, error_logger, delete), - simple_logger(); + _ = gen_event:delete_handler(error_logger, error_logger, delete), + ok = simple_logger(); swap_handler(false) -> ok. % keep primitive event handler as-is diff --git a/lib/kernel/src/erts_debug.erl b/lib/kernel/src/erts_debug.erl index 6654cd9ee7..f7a815882b 100644 --- a/lib/kernel/src/erts_debug.erl +++ b/lib/kernel/src/erts_debug.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2012. All Rights Reserved. +%% Copyright Ericsson AB 1999-2013. 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 @@ -288,7 +288,7 @@ dff(Name, Fs) when is_list(Name) -> try dff(F, Fs) after - file:close(F) + _ = file:close(F) end; {error,Reason} -> {error,{badopen,Reason}} diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index a4c56b346f..5c0f3b7ceb 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -376,7 +376,7 @@ write_file(Name, Bin, ModeList) when is_list(ModeList) -> ok -> close(Handle); E1 -> - close(Handle), + _ = close(Handle), E1 end; E2 -> @@ -480,8 +480,7 @@ open(Item, Mode) -> Reason :: posix() | badarg | terminated. close(File) when is_pid(File) -> - R = file_request(File, close), - case wait_file_reply(File, R) of + case file_request(File, close) of {error, terminated} -> ok; Other -> @@ -503,8 +502,7 @@ close(_) -> Reason :: posix() | badarg. advise(File, Offset, Length, Advise) when is_pid(File) -> - R = file_request(File, {advise, Offset, Length, Advise}), - wait_file_reply(File, R); + file_request(File, {advise, Offset, Length, Advise}); advise(#file_descriptor{module = Module} = Handle, Offset, Length, Advise) -> Module:advise(Handle, Offset, Length, Advise); advise(_, _, _, _) -> @@ -517,8 +515,7 @@ advise(_, _, _, _) -> Length :: non_neg_integer(). allocate(File, Offset, Length) when is_pid(File) -> - R = file_request(File, {allocate, Offset, Length}), - wait_file_reply(File, R); + file_request(File, {allocate, Offset, Length}); allocate(#file_descriptor{module = Module} = Handle, Offset, Length) -> Module:allocate(Handle, Offset, Length). @@ -601,8 +598,7 @@ pread_int(_, _, _) -> Reason :: posix() | badarg | terminated. pread(File, At, Sz) when is_pid(File), is_integer(Sz), Sz >= 0 -> - R = file_request(File, {pread, At, Sz}), - wait_file_reply(File, R); + file_request(File, {pread, At, Sz}); pread(#file_descriptor{module = Module} = Handle, Offs, Sz) when is_integer(Sz), Sz >= 0 -> Module:pread(Handle, Offs, Sz); @@ -658,8 +654,7 @@ pwrite_int(_, _, _) -> Reason :: posix() | badarg | terminated. pwrite(File, At, Bytes) when is_pid(File) -> - R = file_request(File, {pwrite, At, Bytes}), - wait_file_reply(File, R); + file_request(File, {pwrite, At, Bytes}); pwrite(#file_descriptor{module = Module} = Handle, Offs, Bytes) -> Module:pwrite(Handle, Offs, Bytes); pwrite(_, _, _) -> @@ -670,8 +665,7 @@ pwrite(_, _, _) -> Reason :: posix() | badarg | terminated. datasync(File) when is_pid(File) -> - R = file_request(File, datasync), - wait_file_reply(File, R); + file_request(File, datasync); datasync(#file_descriptor{module = Module} = Handle) -> Module:datasync(Handle); datasync(_) -> @@ -682,8 +676,7 @@ datasync(_) -> Reason :: posix() | badarg | terminated. sync(File) when is_pid(File) -> - R = file_request(File, sync), - wait_file_reply(File, R); + file_request(File, sync); sync(#file_descriptor{module = Module} = Handle) -> Module:sync(Handle); sync(_) -> @@ -696,8 +689,7 @@ sync(_) -> Reason :: posix() | badarg | terminated. position(File, At) when is_pid(File) -> - R = file_request(File, {position,At}), - wait_file_reply(File, R); + file_request(File, {position,At}); position(#file_descriptor{module = Module} = Handle, At) -> Module:position(Handle, At); position(_, _) -> @@ -708,8 +700,7 @@ position(_, _) -> Reason :: posix() | badarg | terminated. truncate(File) when is_pid(File) -> - R = file_request(File, truncate), - wait_file_reply(File, R); + file_request(File, truncate); truncate(#file_descriptor{module = Module} = Handle) -> Module:truncate(Handle); truncate(_) -> @@ -779,7 +770,7 @@ copy_int({SourceName, SourceOpts}, Dest, Length) case open(Source, [read | SourceOpts]) of {ok, Handle} -> Result = copy_opened_int(Handle, Dest, Length, 0), - close(Handle), + _ = close(Handle), Result; {error, _} = Error -> Error @@ -795,9 +786,16 @@ copy_int(Source, {DestName, DestOpts}, Length) Dest -> case open(Dest, [write | DestOpts]) of {ok, Handle} -> - Result = copy_opened_int(Source, Handle, Length, 0), - close(Handle), - Result; + case copy_opened_int(Source, Handle, Length, 0) of + {ok, _} = OK -> + case close(Handle) of + ok -> OK; + Error -> Error + end; + Error -> + _ = close(Handle), + Error + end; {error, _} = Error -> Error end @@ -966,7 +964,7 @@ consult(File) -> case open(File, [read]) of {ok, Fd} -> R = consult_stream(Fd), - close(Fd), + _ = close(Fd), R; Error -> Error @@ -986,10 +984,10 @@ path_consult(Path, File) -> {ok, Fd, Full} -> case consult_stream(Fd) of {ok, List} -> - close(Fd), + _ = close(Fd), {ok, List, Full}; E1 -> - close(Fd), + _ = close(Fd), E1 end; E2 -> @@ -1014,7 +1012,7 @@ eval(File, Bs) -> case open(File, [read]) of {ok, Fd} -> R = eval_stream(Fd, ignore, Bs), - close(Fd), + _ = close(Fd), R; Error -> Error @@ -1044,10 +1042,10 @@ path_eval(Path, File, Bs) -> {ok, Fd, Full} -> case eval_stream(Fd, ignore, Bs) of ok -> - close(Fd), + _ = close(Fd), {ok, Full}; E1 -> - close(Fd), + _ = close(Fd), E1 end; E2 -> @@ -1074,7 +1072,7 @@ script(File, Bs) -> case open(File, [read]) of {ok, Fd} -> R = eval_stream(Fd, return, Bs), - close(Fd), + _ = close(Fd), R; Error -> Error @@ -1107,10 +1105,10 @@ path_script(Path, File, Bs) -> {ok,Fd,Full} -> case eval_stream(Fd, return, Bs) of {ok,R} -> - close(Fd), + _ = close(Fd), {ok, R, Full}; E1 -> - close(Fd), + _ = close(Fd), E1 end; E2 -> @@ -1256,7 +1254,7 @@ sendfile(Filename, Sock) -> {error, Reason}; {ok, Fd} -> Res = sendfile(Fd, Sock, 0, 0, []), - file:close(Fd), + _ = file:close(Fd), Res end. @@ -1307,7 +1305,7 @@ sendfile_fallback(File, Sock, Offset, Bytes, ChunkSize) -> {ok, CurrPos} = file:position(File, {cur, 0}), {ok, _NewPos} = file:position(File, {bof, Offset}), Res = sendfile_fallback_int(File, Sock, Bytes, ChunkSize, 0), - file:position(File, {bof, CurrPos}), + _ = file:position(File, {bof, CurrPos}), Res. @@ -1497,25 +1495,19 @@ check_args([]) -> ok. %%----------------------------------------------------------------- -%% Functions for communicating with a file io server. +%% Function for communicating with a file io server. %% The messages sent have the following formats: %% %% {file_request,From,ReplyAs,Request} %% {file_reply,ReplyAs,Reply} file_request(Io, Request) -> - R = erlang:monitor(process, Io), - Io ! {file_request,self(),Io,Request}, - R. - -wait_file_reply(From, Ref) -> + Ref = erlang:monitor(process, Io), + Io ! {file_request,self(),Ref,Request}, receive - {file_reply,From,Reply} -> - erlang:demonitor(Ref), - receive {'DOWN', Ref, _, _, _} -> ok after 0 -> ok end, - %% receive {'EXIT', From, _} -> ok after 0 -> ok end, + {file_reply,Ref,Reply} -> + erlang:demonitor(Ref, [flush]), Reply; {'DOWN', Ref, _, _, _} -> - %% receive {'EXIT', From, _} -> ok after 0 -> ok end, {error, terminated} end. diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl index fad2ed7fb3..0e9ff5bc0f 100644 --- a/lib/kernel/src/file_io_server.erl +++ b/lib/kernel/src/file_io_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2012. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. 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 @@ -92,8 +92,7 @@ do_start(Spawn, Owner, FileName, ModeList) -> Mref = erlang:monitor(process, Pid), receive {Ref, {error, _Reason} = Error} -> - erlang:demonitor(Mref), - receive {'DOWN', Mref, _, _, _} -> ok after 0 -> ok end, + erlang:demonitor(Mref, [flush]), Error; {Ref, ok} -> erlang:demonitor(Mref), @@ -163,29 +162,29 @@ server_loop(#state{mref = Mref} = State) -> {file_request, From, ReplyAs, Request} when is_pid(From) -> case file_request(Request, State) of {reply, Reply, NewState} -> - file_reply(From, ReplyAs, Reply), + _ = file_reply(From, ReplyAs, Reply), server_loop(NewState); {error, Reply, NewState} -> %% error is the same as reply, except that %% it breaks the io_request_loop further down - file_reply(From, ReplyAs, Reply), + _ = file_reply(From, ReplyAs, Reply), server_loop(NewState); {stop, Reason, Reply, _NewState} -> - file_reply(From, ReplyAs, Reply), + _ = file_reply(From, ReplyAs, Reply), exit(Reason) end; {io_request, From, ReplyAs, Request} when is_pid(From) -> case io_request(Request, State) of {reply, Reply, NewState} -> - io_reply(From, ReplyAs, Reply), + _ = io_reply(From, ReplyAs, Reply), server_loop(NewState); {error, Reply, NewState} -> %% error is the same as reply, except that %% it breaks the io_request_loop further down - io_reply(From, ReplyAs, Reply), + _ = io_reply(From, ReplyAs, Reply), server_loop(NewState); {stop, Reason, Reply, _NewState} -> - io_reply(From, ReplyAs, Reply), + _ = io_reply(From, ReplyAs, Reply), exit(Reason) end; {'DOWN', Mref, _, _, Reason} -> diff --git a/lib/kernel/src/file_server.erl b/lib/kernel/src/file_server.erl index 49ec6f96cc..eabf0401a3 100644 --- a/lib/kernel/src/file_server.erl +++ b/lib/kernel/src/file_server.erl @@ -78,7 +78,8 @@ init([]) -> process_flag(trap_exit, true), case ?PRIM_FILE:start() of {ok, Handle} -> - ets:new(?FILE_IO_SERVER_TABLE, [named_table]), + ?FILE_IO_SERVER_TABLE = + ets:new(?FILE_IO_SERVER_TABLE, [named_table]), {ok, Handle}; {error, Reason} -> {stop, Reason} @@ -317,8 +318,7 @@ do_start_slave(start, Filer, Name) -> SlaveMonitor = erlang:monitor(process, Slave), receive {started, Token} -> - erlang:demonitor(SlaveMonitor), - receive {'DOWN', SlaveMonitor, _, _, _} -> ok after 0 -> ok end, + erlang:demonitor(SlaveMonitor, [flush]), {ok, Slave}; {'DOWN', SlaveMonitor, _, _, Reason} -> exit(Reason) diff --git a/lib/kernel/src/gen_sctp.erl b/lib/kernel/src/gen_sctp.erl index 74ad192802..0d005eb651 100644 --- a/lib/kernel/src/gen_sctp.erl +++ b/lib/kernel/src/gen_sctp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2012. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. 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 @@ -39,7 +39,9 @@ {active, true | false | once} | {buffer, non_neg_integer()} | {dontroute, boolean()} | + {high_msgq_watermark, pos_integer()} | {linger, {boolean(), non_neg_integer()}} | + {low_msgq_watermark, pos_integer()} | {mode, list | binary} | list | binary | {priority, non_neg_integer()} | {recbuf, non_neg_integer()} | @@ -68,7 +70,9 @@ active | buffer | dontroute | + high_msgq_watermark | linger | + low_msgq_watermark | mode | priority | recbuf | @@ -270,7 +274,7 @@ do_connect(S, Addr, Port, Opts, Timeout, ConnWait) when is_port(S), is_list(Opts Mod:connect(S, IP, Port, Opts, ConnectTimer); Error -> Error after - inet:stop_timer(Timer) + _ = inet:stop_timer(Timer) end catch error:badarg -> diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl index a98ed4c238..96026aa428 100644 --- a/lib/kernel/src/gen_tcp.erl +++ b/lib/kernel/src/gen_tcp.erl @@ -139,7 +139,7 @@ connect(Address, Port, Opts) -> connect(Address, Port, Opts, Time) -> Timer = inet:start_timer(Time), Res = (catch connect1(Address,Port,Opts,Timer)), - inet:stop_timer(Timer), + _ = inet:stop_timer(Timer), case Res of {ok,S} -> {ok,S}; {error, einval} -> exit(badarg); diff --git a/lib/kernel/src/gen_udp.erl b/lib/kernel/src/gen_udp.erl index c5a1173575..fb5737f82e 100644 --- a/lib/kernel/src/gen_udp.erl +++ b/lib/kernel/src/gen_udp.erl @@ -34,6 +34,8 @@ {dontroute, boolean()} | {drop_membership, {inet:ip_address(), inet:ip_address()}} | {header, non_neg_integer()} | + {high_msgq_watermark, pos_integer()} | + {low_msgq_watermark, pos_integer()} | {mode, list | binary} | list | binary | {multicast_if, inet:ip_address()} | {multicast_loop, boolean()} | @@ -56,6 +58,8 @@ deliver | dontroute | header | + high_msgq_watermark | + low_msgq_watermark | mode | multicast_if | multicast_loop | diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl index b24a9d5eac..ef878b8d0c 100644 --- a/lib/kernel/src/global.erl +++ b/lib/kernel/src/global.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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 @@ -2069,7 +2069,8 @@ random_sleep(Times) -> case get(random_seed) of undefined -> {A1, A2, A3} = now(), - random:seed(A1, A2, A3 + erlang:phash(node(), 100000)); + _ = random:seed(A1, A2, A3 + erlang:phash(node(), 100000)), + ok; _ -> ok end, %% First time 1/4 seconds, then doubling each time up to 8 seconds max. diff --git a/lib/kernel/src/global_group.erl b/lib/kernel/src/global_group.erl index 025a9b8a5b..da8b573749 100644 --- a/lib/kernel/src/global_group.erl +++ b/lib/kernel/src/global_group.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. 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 @@ -1149,9 +1149,14 @@ do_unlink(Pid, State) -> %%%==================================================================================== %%% Send a nodeup/down messages to monitoring Pids in the own global group. %%%==================================================================================== -send_monitor([P|T], M, no_conf) -> safesend_nc(P, M), send_monitor(T, M, no_conf); -send_monitor([P|T], M, SyncState) -> safesend(P, M), send_monitor(T, M, SyncState); -send_monitor([], _, _) -> ok. +send_monitor([P|T], M, no_conf) -> + _ = safesend_nc(P, M), + send_monitor(T, M, no_conf); +send_monitor([P|T], M, SyncState) -> + _ = safesend(P, M), + send_monitor(T, M, SyncState); +send_monitor([], _, _) -> + ok. safesend(Name, {Msg, Node}) when is_atom(Name) -> case lists:member(Node, get_own_nodes()) of diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl index ff835e1047..b36dbf33dd 100644 --- a/lib/kernel/src/group.erl +++ b/lib/kernel/src/group.erl @@ -309,15 +309,17 @@ io_requests([], Stat, _) -> %% The ACK contains the return value. io_reply(From, ReplyAs, Reply) -> - From ! {io_reply,ReplyAs,Reply}. + From ! {io_reply,ReplyAs,Reply}, + ok. %% send_drv(Drv, Message) %% send_drv_reqs(Drv, Requests) send_drv(Drv, Msg) -> - Drv ! {self(),Msg}. + Drv ! {self(),Msg}, + ok. -send_drv_reqs(_Drv, []) -> []; +send_drv_reqs(_Drv, []) -> ok; send_drv_reqs(Drv, Rs) -> send_drv(Drv, {requests,Rs}). diff --git a/lib/kernel/src/heart.erl b/lib/kernel/src/heart.erl index a3790e90cf..daed6dd488 100644 --- a/lib/kernel/src/heart.erl +++ b/lib/kernel/src/heart.erl @@ -182,14 +182,14 @@ wait_ack(Port) -> end. loop(Parent, Port, Cmd) -> - send_heart_beat(Port), + _ = send_heart_beat(Port), receive {From, set_cmd, NewCmd0} -> Enc = file:native_name_encoding(), case catch unicode:characters_to_binary(NewCmd0,Enc,Enc) of NewCmd when is_binary(NewCmd), byte_size(NewCmd) < 2047 -> - send_heart_cmd(Port, NewCmd), - wait_ack(Port), + _ = send_heart_cmd(Port, NewCmd), + _ = wait_ack(Port), From ! {heart, ok}, loop(Parent, Port, NewCmd); _ -> @@ -198,8 +198,8 @@ loop(Parent, Port, Cmd) -> end; {From, clear_cmd} -> From ! {heart, ok}, - send_heart_cmd(Port, ""), - wait_ack(Port), + _ = send_heart_cmd(Port, ""), + _ = wait_ack(Port), loop(Parent, Port, ""); {From, get_cmd} -> From ! {heart, get_heart_cmd(Port)}, @@ -226,7 +226,7 @@ loop(Parent, Port, Cmd) -> -spec no_reboot_shutdown(port()) -> no_return(). no_reboot_shutdown(Port) -> - send_shutdown(Port), + _ = send_shutdown(Port), receive {'EXIT', Port, Reason} when Reason =/= badsig -> exit(normal) @@ -236,10 +236,10 @@ do_cycle_port_program(Caller, Parent, Port, Cmd) -> unregister(?HEART_PORT_NAME), case catch start_portprogram() of {ok, NewPort} -> - send_shutdown(Port), + _ = send_shutdown(Port), receive {'EXIT', Port, _Reason} -> - send_heart_cmd(NewPort, Cmd), + _ = send_heart_cmd(NewPort, Cmd), Caller ! {heart, ok}, loop(Parent, NewPort, Cmd) after @@ -247,7 +247,7 @@ do_cycle_port_program(Caller, Parent, Port, Cmd) -> %% Huh! Two heart port programs running... %% well, the old one has to be sick not to respond %% so we'll settle for the new one... - send_heart_cmd(NewPort, Cmd), + _ = send_heart_cmd(NewPort, Cmd), Caller ! {heart, {error, stop_error}}, loop(Parent, NewPort, Cmd) end; diff --git a/lib/kernel/src/hipe_unified_loader.erl b/lib/kernel/src/hipe_unified_loader.erl index e676ca997d..cc51b5ae07 100644 --- a/lib/kernel/src/hipe_unified_loader.erl +++ b/lib/kernel/src/hipe_unified_loader.erl @@ -226,14 +226,16 @@ load_common(Mod, Bin, Beam, OldReferencesToPatch) -> %% (patches the BEAM code to redirect to native.) case Beam of [] -> - export_funs(Addresses); + export_funs(Addresses), + ok; BeamBinary when is_binary(BeamBinary) -> %% Find all closures in the code. ClosurePatches = find_closure_patches(Refs), AddressesOfClosuresToPatch = calculate_addresses(ClosurePatches, CodeAddress, Addresses), export_funs(Addresses), - export_funs(Mod, BeamBinary, Addresses, AddressesOfClosuresToPatch) + export_funs(Mod, BeamBinary, Addresses, AddressesOfClosuresToPatch), + ok end, %% Redirect references to the old module to the new module's BEAM stub. patch_to_emu_step2(OldReferencesToPatch), diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl index 9670271b2e..1a1f7b8cbc 100644 --- a/lib/kernel/src/inet.erl +++ b/lib/kernel/src/inet.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2012. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -389,7 +389,7 @@ gethostbyname(Name,Family) -> gethostbyname(Name,Family,Timeout) -> Timer = start_timer(Timeout), Res = gethostbyname_tm(Name,Family,Timer), - stop_timer(Timer), + _ = stop_timer(Timer), Res. gethostbyname_tm(Name,Family,Timer) -> @@ -420,7 +420,7 @@ gethostbyaddr(Address) -> gethostbyaddr(Address,Timeout) -> Timer = start_timer(Timeout), Res = gethostbyaddr_tm(Address, Timer), - stop_timer(Timer), + _ = stop_timer(Timer), Res. gethostbyaddr_tm(Address,Timer) -> @@ -475,7 +475,7 @@ getaddr(Address, Family) -> getaddr(Address, Family, Timeout) -> Timer = start_timer(Timeout), Res = getaddr_tm(Address, Family, Timer), - stop_timer(Timer), + _ = stop_timer(Timer), Res. getaddr_tm(Address, Family, Timer) -> @@ -501,7 +501,7 @@ getaddrs(Address, Family) -> getaddrs(Address, Family, Timeout) -> Timer = start_timer(Timeout), Res = getaddrs_tm(Address, Family, Timer), - stop_timer(Timer), + _ = stop_timer(Timer), Res. -spec getservbyport(Port :: port_number(), Protocol :: atom() | string()) -> @@ -712,7 +712,8 @@ udp_options() -> [tos, priority, reuseaddr, sndbuf, recbuf, header, active, buffer, mode, deliver, ipv6_v6only, broadcast, dontroute, multicast_if, multicast_ttl, multicast_loop, - add_membership, drop_membership, read_packets,raw]. + add_membership, drop_membership, read_packets,raw, + high_msgq_watermark, low_msgq_watermark]. udp_options(Opts, Family) -> @@ -766,7 +767,7 @@ udp_add(Name, Val, R, Opts, As) -> sctp_options() -> [ % The following are generic inet options supported for SCTP sockets: mode, active, buffer, tos, priority, dontroute, reuseaddr, linger, sndbuf, - recbuf, ipv6_v6only, + recbuf, ipv6_v6only, high_msgq_watermark, low_msgq_watermark, % Other options are SCTP-specific (though they may be similar to their % TCP and UDP counter-parts): @@ -1331,7 +1332,7 @@ tcp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) -> {ok, A0} -> case A0 of false -> ok; - _ -> prim_inet:setopt(S, active, false) + _ -> ok = prim_inet:setopt(S, active, false) end, case tcp_sync_input(S, NewOwner, false) of true -> %% socket already closed, @@ -1342,7 +1343,7 @@ tcp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) -> unlink(S), %% unlink from port case A0 of false -> ok; - _ -> prim_inet:setopt(S, active, A0) + _ -> ok = prim_inet:setopt(S, active, A0) end, ok catch @@ -1385,13 +1386,12 @@ udp_controlling_process(S, NewOwner) when is_port(S), is_pid(NewOwner) -> {error, not_owner}; _ -> {ok, A0} = prim_inet:getopt(S, active), - prim_inet:setopt(S, active, false), + ok = prim_inet:setopt(S, active, false), udp_sync_input(S, NewOwner), try erlang:port_connect(S, NewOwner) of true -> unlink(S), - prim_inet:setopt(S, active, A0), - ok + ok = prim_inet:setopt(S, active, A0) catch error:Reason -> {error, Reason} diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl index 2cb0e10c87..459fdc2ad5 100644 --- a/lib/kernel/src/inet6_tcp_dist.erl +++ b/lib/kernel/src/inet6_tcp_dist.erl @@ -92,7 +92,7 @@ accept_loop(Kernel, Listen) -> case inet6_tcp:accept(Listen) of {ok, Socket} -> Kernel ! {accept,self(),Socket,inet6,tcp}, - controller(Kernel, Socket), + _ = controller(Kernel, Socket), accept_loop(Kernel, Listen); Error -> exit(Error) diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl index d4749b9756..8a2994579b 100644 --- a/lib/kernel/src/inet_db.erl +++ b/lib/kernel/src/inet_db.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -1112,7 +1112,7 @@ handle_call(Request, From, #state{db=Db}=State) -> {set_cache_refresh, Time} when is_integer(Time), Time > 0 -> Time1 = ((Time+999) div 1000)*1000, %% round up ets:insert(Db, {cache_refresh_interval, Time1}), - stop_timer(State#state.cache_timer), + _ = stop_timer(State#state.cache_timer), {reply, ok, State#state{cache_timer = init_timer()}}; clear_hosts -> @@ -1126,7 +1126,7 @@ handle_call(Request, From, #state{db=Db}=State) -> reset -> reset_db(Db), - stop_timer(State#state.cache_timer), + _ = stop_timer(State#state.cache_timer), {reply, ok, State#state{cache_timer = init_timer()}}; {add_rc_list, List} -> @@ -1176,7 +1176,7 @@ handle_info(_Info, State) -> -spec terminate(term(), state()) -> 'ok'. terminate(_Reason, State) -> - stop_timer(State#state.cache_timer), + _ = stop_timer(State#state.cache_timer), ok. %%%---------------------------------------------------------------------- @@ -1233,7 +1233,7 @@ do_add_host(Byname, Byaddr, Names, Type, IP) -> ok. do_del_host(Byname, Byaddr, IP) -> - [ets:delete_object(Byname, NIP) || NIP <- ets:lookup(Byaddr, IP)], + _ = [ets:delete_object(Byname, NIP) || NIP <- ets:lookup(Byaddr, IP)], ets:delete(Byaddr, IP), ok. diff --git a/lib/kernel/src/inet_gethost_native.erl b/lib/kernel/src/inet_gethost_native.erl index db3e44ce6f..4320987078 100644 --- a/lib/kernel/src/inet_gethost_native.erl +++ b/lib/kernel/src/inet_gethost_native.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2010. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. 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 @@ -237,7 +237,7 @@ handle_message({Port, {data, Data}}, State = #state{port = Port}) -> State; Req -> lists:foreach(fun({P,R,TR}) -> - ?CANCEL_TIMER(TR), + _= ?CANCEL_TIMER(TR), P ! {R, {ok, BinReply}} @@ -276,7 +276,7 @@ handle_message({timeout, Pid, RID}, State) -> {last, {LP,LR,_}} -> LP ! {LR, {error,timeout}}, %% Remove the whole request structure... - pick_request(State, RID), + _ = pick_request(State, RID), %% Also cancel the request to the port program... (catch port_command(State#state.port, <<RID:32,?OP_CANCEL_REQUEST>>)) @@ -503,8 +503,7 @@ getit(Req, DefaultName) -> Pid, Reason} -> {error, Reason} end, - catch erlang:demonitor(Ref2), - receive {'DOWN',Ref2,_,_,_} -> ok after 0 -> ok end, + catch erlang:demonitor(Ref2, [flush]), Res2 end. @@ -518,7 +517,7 @@ do_start(Sup, C) -> {error, {{already_started, Pid}, _Child}} when is_pid(Pid) -> ok; {error, already_present} -> - supervisor:delete_child(Sup, Child), + _ = supervisor:delete_child(Sup, Child), do_start(Sup, C) end. diff --git a/lib/kernel/src/inet_int.hrl b/lib/kernel/src/inet_int.hrl index 000119bc74..a01c733d81 100644 --- a/lib/kernel/src/inet_int.hrl +++ b/lib/kernel/src/inet_int.hrl @@ -141,8 +141,8 @@ -define(INET_LOPT_READ_PACKETS, 33). -define(INET_OPT_RAW, 34). -define(INET_LOPT_TCP_SEND_TIMEOUT_CLOSE, 35). --define(INET_LOPT_TCP_MSGQ_HIWTRMRK, 36). --define(INET_LOPT_TCP_MSGQ_LOWTRMRK, 37). +-define(INET_LOPT_MSGQ_HIWTRMRK, 36). +-define(INET_LOPT_MSGQ_LOWTRMRK, 37). % Specific SCTP options: separate range: -define(SCTP_OPT_RTOINFO, 100). -define(SCTP_OPT_ASSOCINFO, 101). diff --git a/lib/kernel/src/inet_parse.erl b/lib/kernel/src/inet_parse.erl index 619c78a6ca..d24bda0c3d 100644 --- a/lib/kernel/src/inet_parse.erl +++ b/lib/kernel/src/inet_parse.erl @@ -288,7 +288,7 @@ parse_file(_, File, Fn) -> case file:open(File, [read]) of {ok, Fd} -> Result = parse_fd(File,Fd, 1, Fn, []), - file:close(Fd), + _ = file:close(Fd), Result; Error -> Error end. diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl index 59ba408d7a..ab9cbf0617 100644 --- a/lib/kernel/src/inet_res.erl +++ b/lib/kernel/src/inet_res.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2011. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -139,7 +139,7 @@ resolve(Name, Class, Type, Opts, Timeout) -> {ok, Nm} -> Timer = inet:start_timer(Timeout), Res = res_query(Nm, Class, Type, Opts, Timer), - inet:stop_timer(Timer), + _ = inet:stop_timer(Timer), Res; Error -> Error @@ -339,7 +339,7 @@ gethostbyaddr(IP) -> gethostbyaddr_tm(IP,false). gethostbyaddr(IP,Timeout) -> Timer = inet:start_timer(Timeout), Res = gethostbyaddr_tm(IP,Timer), - inet:stop_timer(Timer), + _ = inet:stop_timer(Timer), Res. gethostbyaddr_tm({A,B,C,D} = IP, Timer) when ?ip(A,B,C,D) -> @@ -424,7 +424,7 @@ gethostbyname(Name,Family) -> gethostbyname(Name,Family,Timeout) -> Timer = inet:start_timer(Timeout), Res = gethostbyname_tm(Name,Family,Timer), - inet:stop_timer(Timer), + _ = inet:stop_timer(Timer), Res. gethostbyname_tm(Name,inet,Timer) -> @@ -483,7 +483,7 @@ getbyname(Name, Type) -> getbyname(Name, Type, Timeout) -> Timer = inet:start_timer(Timeout), Res = getbyname_tm(Name, Type, Timer), - inet:stop_timer(Timer), + _ = inet:stop_timer(Timer), Res. getbyname_tm(Name, Type, Timer) when is_list(Name) -> @@ -921,18 +921,25 @@ query_tcp(Timeout, Id, Buffer, IP, Port, Verbose) -> [{active,false},{packet,2},binary,Family], Timeout) of {ok, S} -> - gen_tcp:send(S, Buffer), - case gen_tcp:recv(S, 0, Timeout) of - {ok, Answer} -> - gen_tcp:close(S), - case decode_answer(Answer, Id, Verbose) of - {ok, _} = OK -> OK; - {error, badid} -> {error, servfail}; - Error -> Error + case gen_tcp:send(S, Buffer) of + ok -> + case gen_tcp:recv(S, 0, Timeout) of + {ok, Answer} -> + gen_tcp:close(S), + case decode_answer(Answer, Id, Verbose) of + {ok, _} = OK -> OK; + {error, badid} -> {error, servfail}; + Error -> Error + end; + Error -> + gen_tcp:close(S), + ?verbose(Verbose, "TCP server recv error: ~p\n", + [Error]), + Error end; Error -> gen_tcp:close(S), - ?verbose(Verbose, "TCP server recv error: ~p\n", + ?verbose(Verbose, "TCP server send error: ~p\n", [Error]), Error end; diff --git a/lib/kernel/src/inet_sctp.erl b/lib/kernel/src/inet_sctp.erl index 2d799d79fa..93528d305d 100644 --- a/lib/kernel/src/inet_sctp.erl +++ b/lib/kernel/src/inet_sctp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2007-2011. All Rights Reserved. +%% Copyright Ericsson AB 2007-2013. 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 @@ -135,7 +135,7 @@ connect_get_assoc(S, Addr, Port, Active, Timer) -> {sctp,S,Addr,Port,{_,#sctp_assoc_change{state=St}=Ev}} -> case Active of once -> - prim_inet:setopt(S, active, once); + ok = prim_inet:setopt(S, active, once); _ -> ok end, if St =:= comm_up -> diff --git a/lib/kernel/src/inet_tcp_dist.erl b/lib/kernel/src/inet_tcp_dist.erl index 8005eff58c..63f236b069 100644 --- a/lib/kernel/src/inet_tcp_dist.erl +++ b/lib/kernel/src/inet_tcp_dist.erl @@ -119,7 +119,7 @@ accept_loop(Kernel, Listen) -> case inet_tcp:accept(Listen) of {ok, Socket} -> Kernel ! {accept,self(),Socket,inet,tcp}, - controller(Kernel, Socket), + _ = controller(Kernel, Socket), accept_loop(Kernel, Listen); Error -> exit(Error) diff --git a/lib/kernel/src/kernel.appup.src b/lib/kernel/src/kernel.appup.src index 54628800a8..ae2666d496 100644 --- a/lib/kernel/src/kernel.appup.src +++ b/lib/kernel/src/kernel.appup.src @@ -1,7 +1,7 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1999-2011. All Rights Reserved. +%% Copyright Ericsson AB 1999-2013. 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,11 +17,11 @@ %% %CopyrightEnd% {"%VSN%", %% Up from - max two major revisions back - [{<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16 - {<<"2\\.15(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R15 - {<<"2\\.14(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R14 + [{<<"2\\.17(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17 + {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16 + {<<"2\\.15(\\.[0-9]+)*">>,[restart_new_emulator]}],%% R15 %% Down to - max two major revisions back - [{<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16 - {<<"2\\.15(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R15 - {<<"2\\.14(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R14 + [{<<"2\\.17(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R17 + {<<"2\\.16(\\.[0-9]+)*">>,[restart_new_emulator]}, %% R16 + {<<"2\\.15(\\.[0-9]+)*">>,[restart_new_emulator]}] %% R15 }. diff --git a/lib/kernel/src/kernel.erl b/lib/kernel/src/kernel.erl index 1e07620a3e..ecdb32424a 100644 --- a/lib/kernel/src/kernel.erl +++ b/lib/kernel/src/kernel.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2010. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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,8 +32,13 @@ start(_, []) -> case supervisor:start_link({local, kernel_sup}, kernel, []) of {ok, Pid} -> Type = get_error_logger_type(), - error_logger:swap_handler(Type), - {ok, Pid, []}; + case error_logger:swap_handler(Type) of + ok -> {ok, Pid, []}; + Error -> + %% Not necessary since the node will crash anyway: + exit(Pid, shutdown), + Error + end; Error -> Error end. diff --git a/lib/kernel/src/kernel_config.erl b/lib/kernel/src/kernel_config.erl index 48141cfa03..56defcb167 100644 --- a/lib/kernel/src/kernel_config.erl +++ b/lib/kernel/src/kernel_config.erl @@ -121,7 +121,7 @@ send_timeout(Timeout, Pid) -> end. wait_nodes(Mandatory, Optional) -> - net_kernel:monitor_nodes(true), + ok = net_kernel:monitor_nodes(true), lists:foreach(fun(Node) -> case net_adm:ping(Node) of pong -> self() ! {nodeup, Node}; @@ -129,7 +129,9 @@ wait_nodes(Mandatory, Optional) -> end end, Mandatory ++ Optional), - rec_nodes(Mandatory, Optional). + R = rec_nodes(Mandatory, Optional), + ok = net_kernel:monitor_nodes(false), + R. rec_nodes([], []) -> ok; rec_nodes(Mandatory, Optional) -> diff --git a/lib/kernel/src/net_adm.erl b/lib/kernel/src/net_adm.erl index 9b2dac9544..3f5eac7822 100644 --- a/lib/kernel/src/net_adm.erl +++ b/lib/kernel/src/net_adm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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,7 +133,7 @@ dns_hostname(Hostname) -> -spec ping_list([atom()]) -> [atom()]. ping_list(Nodelist) -> - net_kernel:monitor_nodes(true), + ok = net_kernel:monitor_nodes(true), Sofar = ping_first(Nodelist, nodes()), collect_new(Sofar, Nodelist). @@ -159,7 +159,7 @@ collect_new(Sofar, Nodelist) -> collect_new([Node | Sofar], Nodelist) end after 3000 -> - net_kernel:monitor_nodes(false), + ok = net_kernel:monitor_nodes(false), Sofar end. diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl index dd0071b914..04a0d94ebf 100644 --- a/lib/kernel/src/net_kernel.erl +++ b/lib/kernel/src/net_kernel.erl @@ -306,21 +306,21 @@ do_connect(Node, Type, WaitForBarred) -> %% Type = normal | hidden end. passive_connect_monitor(Parent, Node) -> - monitor_nodes(true,[{node_type,all}]), + ok = monitor_nodes(true,[{node_type,all}]), case lists:member(Node,nodes([connected])) of true -> - monitor_nodes(false,[{node_type,all}]), + ok = monitor_nodes(false,[{node_type,all}]), Parent ! {self(),true}; _ -> Ref = make_ref(), Tref = erlang:send_after(connecttime(),self(),Ref), receive Ref -> - monitor_nodes(false,[{node_type,all}]), + ok = monitor_nodes(false,[{node_type,all}]), Parent ! {self(), false}; {nodeup,Node,_} -> - monitor_nodes(false,[{node_type,all}]), - erlang:cancel_timer(Tref), + ok = monitor_nodes(false,[{node_type,all}]), + _ = erlang:cancel_timer(Tref), Parent ! {self(),true} end end. @@ -734,7 +734,7 @@ handle_info(transition_period_end, how = How}} = State) -> ?tckr_dbg(transition_period_ended), case How of - shorter -> Tckr ! {new_ticktime, T}; + shorter -> Tckr ! {new_ticktime, T}, done; _ -> done end, {noreply,State#state{tick = #tick{ticker = Tckr, time = T}}}; @@ -1573,9 +1573,10 @@ async_gen_server_reply(From, Msg) -> ok -> ok; nosuspend -> - spawn(fun() -> catch erlang:send(Pid, M, [noconnect]) end); + _ = spawn(fun() -> catch erlang:send(Pid, M, [noconnect]) end), + ok; noconnect -> ok; % The gen module takes care of this case. - {'EXIT', _}=EXIT -> - EXIT + {'EXIT', _} -> + ok end. diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index 742c000cc1..c92bb463c1 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -126,7 +126,7 @@ verify_executable(Name0, [Ext|Rest], OrigExtensions) -> end; verify_executable(Name, [], OrigExtensions) when OrigExtensions =/= [""] -> %% Windows %% Will only happen on windows, hence case insensitivity - case can_be_full_name(string:to_lower(Name),OrigExtensions) of + case can_be_full_name(string:to_lower(Name),OrigExtensions) of true -> verify_executable(Name,[""],[""]); _ -> @@ -150,7 +150,7 @@ split_path(Path) -> {win32, _} -> {ok,Curr} = file:get_cwd(), split_path(Path, $;, [], [Curr]); - _ -> + _ -> split_path(Path, $:, [], []) end. @@ -183,17 +183,25 @@ extensions() -> Command :: atom() | io_lib:chars(). cmd(Cmd) -> validate(Cmd), - case type() of - {unix, _} -> - unix_cmd(Cmd); - {win32, Wtype} -> - Command = case {os:getenv("COMSPEC"),Wtype} of - {false,windows} -> lists:concat(["command.com /c", Cmd]); - {false,_} -> lists:concat(["cmd /c", Cmd]); - {Cspec,_} -> lists:concat([Cspec," /c",Cmd]) - end, - Port = open_port({spawn, Command}, [stream, in, eof, hide]), - get_data(Port, []) + Bytes = case type() of + {unix, _} -> + unix_cmd(Cmd); + {win32, Wtype} -> + Command0 = case {os:getenv("COMSPEC"),Wtype} of + {false,windows} -> lists:concat(["command.com /c", Cmd]); + {false,_} -> lists:concat(["cmd /c", Cmd]); + {Cspec,_} -> lists:concat([Cspec," /c",Cmd]) + end, + %% open_port/2 awaits string() in Command, but io_lib:chars() can be + %% deep lists according to io_lib module description. + Command = lists:flatten(Command0), + Port = open_port({spawn, Command}, [stream, in, eof, hide]), + get_data(Port, []) + end, + String = unicode:characters_to_list(list_to_binary(Bytes)), + if %% Convert to unicode list if possible otherwise return bytes + is_list(String) -> String; + true -> Bytes end. unix_cmd(Cmd) -> @@ -213,7 +221,7 @@ unix_cmd(Cmd) -> end. %% The -s flag implies that only the positional parameters are set, -%% and the commands are read from standard input. We set the +%% and the commands are read from standard input. We set the %% $1 parameter for easy identification of the resident shell. %% -define(SHELL, "/bin/sh -s unix:cmd 2>&1"). @@ -226,7 +234,7 @@ unix_cmd(Cmd) -> -spec start_port() -> port(). start_port() -> Ref = make_ref(), - Request = {Ref,self()}, + Request = {Ref,self()}, {Pid, Mon} = case whereis(?PORT_CREATOR_NAME) of undefined -> spawn_monitor(fun() -> @@ -273,10 +281,10 @@ start_port_srv_handle({Ref,Client}) -> Port catch error:Reason -> - {Reason,erlang:get_stacktrace()} + {Reason,erlang:get_stacktrace()} end, - Client ! {Ref,Reply}. - + Client ! {Ref,Reply}, + ok. start_port_srv_loop() -> receive @@ -284,7 +292,7 @@ start_port_srv_loop() -> is_pid(Client) -> start_port_srv_handle(Request); _Junk -> - ignore + ok end, start_port_srv_loop(). @@ -334,7 +342,7 @@ mk_cmd(Cmd) when is_atom(Cmd) -> % backward comp. mk_cmd(Cmd) -> %% We insert a new line after the command, in case the command %% contains a comment character. - io_lib:format("(~ts\n) </dev/null; echo \"\^D\"\n", [Cmd]). + [$(, unicode:characters_to_binary(Cmd), "\n) </dev/null; echo \"\^D\"\n"]. validate(Atom) when is_atom(Atom) -> @@ -342,7 +350,7 @@ validate(Atom) when is_atom(Atom) -> validate(List) when is_list(List) -> validate1(List). -validate1([C|Rest]) when is_integer(C), 0 =< C, C < 256 -> +validate1([C|Rest]) when is_integer(C) -> validate1(Rest); validate1([List|Rest]) when is_list(List) -> validate1(List), @@ -355,16 +363,16 @@ get_data(Port, Sofar) -> {Port, {data, Bytes}} -> get_data(Port, [Sofar|Bytes]); {Port, eof} -> - Port ! {self(), close}, + Port ! {self(), close}, receive {Port, closed} -> true - end, + end, receive - {'EXIT', Port, _} -> + {'EXIT', Port, _} -> ok after 1 -> % force context switch ok - end, + end, lists:flatten(Sofar) end. diff --git a/lib/kernel/src/pg2.erl b/lib/kernel/src/pg2.erl index 1ff10eb303..b562d4ffd2 100644 --- a/lib/kernel/src/pg2.erl +++ b/lib/kernel/src/pg2.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2012. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. 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 @@ -45,7 +45,7 @@ start() -> -spec create(Name :: name()) -> 'ok'. create(Name) -> - ensure_started(), + _ = ensure_started(), case ets:member(pg2_table, {group, Name}) of false -> global:trans({{?MODULE, Name}, self()}, @@ -60,7 +60,7 @@ create(Name) -> -spec delete(Name :: name()) -> 'ok'. delete(Name) -> - ensure_started(), + _ = ensure_started(), global:trans({{?MODULE, Name}, self()}, fun() -> gen_server:multi_call(?MODULE, {delete, Name}) @@ -71,7 +71,7 @@ delete(Name) -> when Name :: name(). join(Name, Pid) when is_pid(Pid) -> - ensure_started(), + _ = ensure_started(), case ets:member(pg2_table, {group, Name}) of false -> {error, {no_such_group, Name}}; @@ -88,7 +88,7 @@ join(Name, Pid) when is_pid(Pid) -> when Name :: name(). leave(Name, Pid) when is_pid(Pid) -> - ensure_started(), + _ = ensure_started(), case ets:member(pg2_table, {group, Name}) of false -> {error, {no_such_group, Name}}; @@ -105,7 +105,7 @@ leave(Name, Pid) when is_pid(Pid) -> when Name :: name(). get_members(Name) -> - ensure_started(), + _ = ensure_started(), case ets:member(pg2_table, {group, Name}) of true -> group_members(Name); @@ -117,7 +117,7 @@ get_members(Name) -> when Name :: name(). get_local_members(Name) -> - ensure_started(), + _ = ensure_started(), case ets:member(pg2_table, {group, Name}) of true -> local_group_members(Name); @@ -128,7 +128,7 @@ get_local_members(Name) -> -spec which_groups() -> [Name :: name()]. which_groups() -> - ensure_started(), + _ = ensure_started(), all_groups(). -spec get_closest_pid(Name) -> pid() | {'error', Reason} when @@ -165,7 +165,7 @@ get_closest_pid(Name) -> init([]) -> Ns = nodes(), - net_kernel:monitor_nodes(true), + ok = net_kernel:monitor_nodes(true), lists:foreach(fun(N) -> {?MODULE, N} ! {new_pg2, node()}, self() ! {nodeup, N} @@ -283,7 +283,7 @@ member_died(Ref) -> join_group(Name, Pid) -> Ref_Pid = {ref, Pid}, - try _ = ets:update_counter(pg2_table, Ref_Pid, {4, +1}) + try _ = ets:update_counter(pg2_table, Ref_Pid, {4, +1}), true catch _:_ -> {RPid, Ref} = do_monitor(Pid), true = ets:insert(pg2_table, {Ref_Pid, RPid, Ref, 1}), diff --git a/lib/kernel/src/rpc.erl b/lib/kernel/src/rpc.erl index 7c965ca384..78fec2aa2b 100644 --- a/lib/kernel/src/rpc.erl +++ b/lib/kernel/src/rpc.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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 @@ -158,20 +158,20 @@ handle_info({Caller, {reply, Reply}}, S) -> {noreply, S} end; handle_info({From, {sbcast, Name, Msg}}, S) -> - case catch Name ! Msg of %% use catch to get the printout - {'EXIT', _} -> - From ! {?NAME, node(), {nonexisting_name, Name}}; - _ -> - From ! {?NAME, node(), node()} - end, + _ = case catch Name ! Msg of %% use catch to get the printout + {'EXIT', _} -> + From ! {?NAME, node(), {nonexisting_name, Name}}; + _ -> + From ! {?NAME, node(), node()} + end, {noreply, S}; handle_info({From, {send, Name, Msg}}, S) -> - case catch Name ! {From, Msg} of %% use catch to get the printout - {'EXIT', _} -> - From ! {?NAME, node(), {nonexisting_name, Name}}; - _ -> - ok %% It's up to Name to respond !!!!! - end, + _ = case catch Name ! {From, Msg} of %% use catch to get the printout + {'EXIT', _} -> + From ! {?NAME, node(), {nonexisting_name, Name}}; + _ -> + ok %% It's up to Name to respond !!!!! + end, {noreply, S}; handle_info({From, {call,Mod,Fun,Args,Gleader}}, S) -> %% Special for hidden C node's, uugh ... @@ -388,13 +388,8 @@ server_call(Node, Name, ReplyWrapper, Msg) {'DOWN', Ref, _, _, _} -> {error, nodedown}; {ReplyWrapper, Node, Reply} -> - erlang:demonitor(Ref), - receive - {'DOWN', Ref, _, _, _} -> - Reply - after 0 -> - Reply - end + erlang:demonitor(Ref, [flush]), + Reply end end. @@ -428,7 +423,7 @@ abcast(Name, Mess) -> abcast([Node|Tail], Name, Mess) -> Dest = {Name,Node}, case catch erlang:send(Dest, Mess, [noconnect]) of - noconnect -> spawn(erlang, send, [Dest,Mess]); + noconnect -> spawn(erlang, send, [Dest,Mess]), ok; _ -> ok end, abcast(Tail, Name, Mess); @@ -501,17 +496,6 @@ start_monitor(Node, Name) -> {Node,erlang:monitor(process, {Name, Node})} end. -%% Cancels a monitor started with Ref=erlang:monitor(_, _), -%% i.e return value {Node, Ref} from start_monitor/2 above. -unmonitor(Ref) when is_reference(Ref) -> - erlang:demonitor(Ref), - receive - {'DOWN', Ref, _, _, _} -> - true - after 0 -> - true - end. - %% Call apply(M,F,A) on all nodes in parallel -spec multicall(Module, Function, Args) -> {ResL, BadNodes} when @@ -635,10 +619,10 @@ rec_nodes(Name, [{N,R} | Tail], Badnodes, Replies) -> rec_nodes(Name, Tail, [N|Badnodes], Replies); {?NAME, N, {nonexisting_name, _}} -> %% used by sbcast() - unmonitor(R), + erlang:demonitor(R, [flush]), rec_nodes(Name, Tail, [N|Badnodes], Replies); {Name, N, Reply} -> %% Name is bound !!! - unmonitor(R), + erlang:demonitor(R, [flush]), rec_nodes(Name, Tail, Badnodes, [Reply|Replies]) end. diff --git a/lib/kernel/src/seq_trace.erl b/lib/kernel/src/seq_trace.erl index a90b7b07c8..38a61f4644 100644 --- a/lib/kernel/src/seq_trace.erl +++ b/lib/kernel/src/seq_trace.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. 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 @@ -125,7 +125,7 @@ get_system_tracer() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% set_token2([{Type,Val}|T]) -> - erlang:seq_trace(Type, Val), + _ = erlang:seq_trace(Type, Val), set_token2(T); set_token2([]) -> ok. diff --git a/lib/kernel/src/standard_error.erl b/lib/kernel/src/standard_error.erl index e41dcd01fc..10cf77e0d4 100644 --- a/lib/kernel/src/standard_error.erl +++ b/lib/kernel/src/standard_error.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% Copyright Ericsson AB 2009-2013. 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 @@ -69,7 +69,7 @@ run(P) -> server_loop(Port) -> receive {io_request,From,ReplyAs,Request} when is_pid(From) -> - do_io_request(Request, From, ReplyAs, Port), + _ = do_io_request(Request, From, ReplyAs, Port), server_loop(Port); {'EXIT',Port,badsig} -> % Ignore badsig errors server_loop(Port); @@ -175,7 +175,7 @@ io_reply(From, ReplyAs, Reply) -> %% put_chars put_chars(Chars, Port) when is_binary(Chars) -> - put_port(Chars, Port), + _ = put_port(Chars, Port), {ok,ok}; put_chars(Chars, Port) -> case catch list_to_binary(Chars) of diff --git a/lib/kernel/src/user.erl b/lib/kernel/src/user.erl index c897d46bc2..40376ef752 100644 --- a/lib/kernel/src/user.erl +++ b/lib/kernel/src/user.erl @@ -103,11 +103,11 @@ catch_loop(Port, Shell, Q) -> {unknown_exit,{Shell,Reason},_} -> % shell has exited case Reason of normal -> - put_chars("*** ", Port, []); + put_port(<<"*** ">>, Port); _ -> - put_chars("*** ERROR: ", Port, []) + put_port(<<"*** ERROR: ">>, Port) end, - put_chars("Shell process terminated! ***\n", Port, []), + put_port(<<"Shell process terminated! ***\n">>, Port), catch_loop(Port, start_new_shell()); {unknown_exit,_,Q1} -> catch_loop(Port, Shell, Q1); @@ -181,7 +181,7 @@ get_fd_geometry(Port) -> do_io_request(Req, From, ReplyAs, Port, Q0) -> case io_request(Req, Port, Q0) of {_Status,Reply,Q1} -> - io_reply(From, ReplyAs, Reply), + _ = io_reply(From, ReplyAs, Reply), Q1; {exit,What} -> ok = send_port(Port, close), diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl index bb654495d3..6544426a54 100644 --- a/lib/kernel/src/user_drv.erl +++ b/lib/kernel/src/user_drv.erl @@ -488,21 +488,19 @@ set_unicode_state(Iport, Bool) -> %% io_request(Request, InPort, OutPort) %% io_requests(Requests, InPort, OutPort) - -io_request({put_chars, unicode,Cs}, _Iport, Oport) -> - Oport ! {self(),{command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]}}; -io_request({move_rel,N}, _Iport, Oport) -> - Oport ! {self(),{command,[?OP_MOVE|put_int16(N, [])]}}; -io_request({insert_chars,unicode,Cs}, _Iport, Oport) -> - Oport ! {self(),{command,[?OP_INSC|unicode:characters_to_binary(Cs,utf8)]}}; -io_request({delete_chars,N}, _Iport, Oport) -> - Oport ! {self(),{command,[?OP_DELC|put_int16(N, [])]}}; -io_request(beep, _Iport, Oport) -> - Oport ! {self(),{command,[?OP_BEEP]}}; -io_request({requests,Rs}, Iport, Oport) -> - io_requests(Rs, Iport, Oport); -io_request(_R, _Iport, _Oport) -> - ok. +%% Note: InPort is unused. + +io_request(Request, Iport, Oport) -> + try io_command(Request) of + Command -> + Oport ! {self(),Command}, + ok + catch + {requests,Rs} -> + io_requests(Rs, Iport, Oport); + _ -> + ok + end. io_requests([R|Rs], Iport, Oport) -> io_request(R, Iport, Oport), @@ -513,6 +511,19 @@ io_requests([], _Iport, _Oport) -> put_int16(N, Tail) -> [(N bsr 8)band 255,N band 255|Tail]. +io_command({put_chars, unicode,Cs}) -> + {command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]}; +io_command({move_rel,N}) -> + {command,[?OP_MOVE|put_int16(N, [])]}; +io_command({insert_chars,unicode,Cs}) -> + {command,[?OP_INSC|unicode:characters_to_binary(Cs,utf8)]}; +io_command({delete_chars,N}) -> + {command,[?OP_DELC|put_int16(N, [])]}; +io_command(beep) -> + {command,[?OP_BEEP]}; +io_command(Else) -> + throw(Else). + %% gr_new() %% gr_get_num(Group, Index) %% gr_get_info(Group, Pid) diff --git a/lib/kernel/src/wrap_log_reader.erl b/lib/kernel/src/wrap_log_reader.erl index 689269fc28..7e1f4aa07f 100644 --- a/lib/kernel/src/wrap_log_reader.erl +++ b/lib/kernel/src/wrap_log_reader.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2012. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. 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 @@ -149,7 +149,7 @@ open_int(File, FileNo, FirstFileNo) -> {ok, Head} -> case disk_log_1:is_head(Head) of no -> - file:close(Fd), + _ = file:close(Fd), {error, {not_a_log_file, FName}}; _ -> % yes or yes_not_closed case last_mod_time(FName) of @@ -161,12 +161,12 @@ open_int(File, FileNo, FirstFileNo) -> first_no = FirstFileNo}, {ok, WR}; {error, E} -> - file:close(Fd), + _ = file:close(Fd), {error, {file_error, FName, E}} end end; _Other -> - file:close(Fd), + _ = file:close(Fd), {error, {not_a_log_file, FName}} end; _Other -> @@ -280,7 +280,7 @@ read_next_file(WR, N, NewFileNo, Bad) -> true -> case open_int(File, NewFileNo, FirstFileNo) of {ok, NWR} -> - close(WR), %% Now we can safely close the old file. + _ = close(WR), %% Now we can safely close the old file. chunk(NWR, N, Bad); Error -> Error diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index c604e7073f..e4c8f0ffaf 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -91,6 +91,8 @@ -export([standard_io/1,mini_server/1]). +-export([old_io_protocol/1]). + %% Debug exports -export([create_file_slow/2, create_file/2, create_bin/2]). -export([verify_file/2, verify_bin/3]). @@ -114,7 +116,7 @@ all() -> delayed_write, read_ahead, segment_read, segment_write, ipread, pid2name, interleaved_read_write, otp_5814, otp_10852, large_file, large_write, read_line_1, read_line_2, read_line_3, - read_line_4, standard_io]. + read_line_4, standard_io, old_io_protocol]. groups() -> [{dirs, [], [make_del_dir, cur_dir_0, cur_dir_1, @@ -310,6 +312,31 @@ standard_io(Config) when is_list(Config) -> Pid ! die, receive after 1000 -> ok end. +old_io_protocol(suite) -> + []; +old_io_protocol(doc) -> + ["Test that the old file IO protocol =< R16B still works"]; +old_io_protocol(Config) when is_list(Config) -> + Dog = test_server:timetrap(test_server:seconds(5)), + RootDir = ?config(priv_dir,Config), + Name = filename:join(RootDir, + atom_to_list(?MODULE) + ++"old_io_protocol.fil"), + MyData = "0123456789abcdefghijklmnopqrstuvxyz", + ok = ?FILE_MODULE:write_file(Name, MyData), + {ok, Fd} = ?FILE_MODULE:open(Name, write), + Fd ! {file_request,self(),Fd,truncate}, + receive + {file_reply,Fd,ok} -> ok + end, + ok = ?FILE_MODULE:close(Fd), + {ok, <<>>} = ?FILE_MODULE:read_file(Name), + test_server:timetrap_cancel(Dog), + [] = flush(), + ok. + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% read_write_file(suite) -> []; @@ -2624,6 +2651,8 @@ symlinks(Config) when is_list(Config) -> ?line #file_info{links=1, type=symlink} = Info2, ?line {ok, Name} = ?FILE_MODULE:read_link(Alias), {ok, Name} = ?FILE_MODULE:read_link_all(Alias), + %% If all is good, delete dir again (avoid hanging dir on windows) + rm_rf(?FILE_MODULE,NewDir), ok end, @@ -4277,3 +4306,18 @@ disc_free(Path) -> memsize() -> {Tot,_Used,_} = memsup:get_memory_data(), Tot. + +%%%----------------------------------------------------------------- +%%% Utilities +rm_rf(Mod,Dir) -> + case Mod:read_link_info(Dir) of + {ok, #file_info{type = directory}} -> + {ok, Content} = Mod:list_dir_all(Dir), + [ rm_rf(Mod,filename:join(Dir,C)) || C <- Content ], + Mod:del_dir(Dir), + ok; + {ok, #file_info{}} -> + Mod:delete(Dir); + _ -> + ok + end. diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl index a6728564e4..9354af2e41 100644 --- a/lib/kernel/test/file_name_SUITE.erl +++ b/lib/kernel/test/file_name_SUITE.erl @@ -1,5 +1,4 @@ -module(file_name_SUITE). -%% -*- coding: utf-8 -*- %% %% %CopyrightBegin% %% @@ -197,7 +196,10 @@ normal(Config) when is_list(Config) -> put(file_module,prim_file), ok = check_normal(prim_file), put(file_module,file), - ok = check_normal(file) + ok = check_normal(file), + %% If all is good, delete dir again (avoid hanging dir on windows) + rm_rf(file,"normal_dir"), + ok after file:set_cwd(Dir) end. @@ -219,7 +221,10 @@ icky(Config) when is_list(Config) -> put(file_module,prim_file), ok = check_icky(prim_file), put(file_module,file), - ok = check_icky(file) + ok = check_icky(file), + %% If all is good, delete dir again (avoid hanging dir on windows) + rm_rf(file,"icky_dir"), + ok after file:set_cwd(Dir) end @@ -243,7 +248,11 @@ very_icky(Config) when is_list(Config) -> {skipped,"VM needs to be started in Unicode filename mode"}; ok -> put(file_module,file), - ok = check_very_icky(file) + ok = check_very_icky(file), + %% If all is good, delete dir again + %% (avoid hanging dir on windows) + rm_rf(file,"very_icky_dir"), + ok end after file:set_cwd(Dir) diff --git a/lib/kernel/test/gen_sctp_SUITE.erl b/lib/kernel/test/gen_sctp_SUITE.erl index 2a886b2efc..c5d8becfd3 100644 --- a/lib/kernel/test/gen_sctp_SUITE.erl +++ b/lib/kernel/test/gen_sctp_SUITE.erl @@ -1399,8 +1399,7 @@ s_req(S, Req) -> {'DOWN',Mref,_,_,Error} -> exit(Error); {S,Mref,Reply} -> - erlang:demonitor(Mref), - receive {'DOWN',Mref,_,_,_} -> ok after 0 -> ok end, + erlang:demonitor(Mref, [flush]), Reply end. diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index 6b672004ec..2d5827282f 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -602,7 +602,7 @@ iter_max_socks(Config) when is_list(Config) -> %% Run on a different node in order to limit the effect if this test fails. Dir = filename:dirname(code:which(?MODULE)), {ok,Node} = test_server:start_node(test_iter_max_socks,slave, - [{args,"-pa " ++ Dir}]), + [{args,"+Q 2048 -pa " ++ Dir}]), L = rpc:call(Node,?MODULE,do_iter_max_socks,[N, initalize]), test_server:stop_node(Node), diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index cd768813cf..4cc6018614 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -1,8 +1,7 @@ -%% -*- coding: utf-8 -*- %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2012. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. 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/kernel/test/global_SUITE_data/global_trace.erl b/lib/kernel/test/global_SUITE_data/global_trace.erl index 4f253baac4..7da4980263 100644 --- a/lib/kernel/test/global_SUITE_data/global_trace.erl +++ b/lib/kernel/test/global_SUITE_data/global_trace.erl @@ -122,12 +122,12 @@ state(Else) -> %%% {ops,Ops}] %%% NewKnown = Known ++ AddedNodes %%% AddedNodes = NewNodes -- Known -%%% NewNodes �r h�r den man f�rhandlat med plus de noder den k�nner till. +%%% NewNodes är här den man förhandlat med plus de noder den känner till. %%% {added, AddedNodes}, Extra = [{ops,Ops}] %%% NewKnown = Known ++ AddedNodes -%%% Den (passiva) noden f�r Nodes som �r NewNodes -%%% hos den f�rhandlande. Sedan: AddedNodes = (Nodes -- Known) -- [node()]. -%%% Det �r som hos f�rhandlaren. +%%% Den (passiva) noden får Nodes som är NewNodes +%%% hos den förhandlande. Sedan: AddedNodes = (Nodes -- Known) -- [node()]. +%%% Det är som hos förhandlaren. %%% {nodes_changed, {New,Old}} %%% Every now and then the list [node() | nodes()] is checked for updates. %%% New are the nodes that global does not know of (yet). diff --git a/lib/kernel/test/inet_sockopt_SUITE.erl b/lib/kernel/test/inet_sockopt_SUITE.erl index 75496ce745..185751fead 100644 --- a/lib/kernel/test/inet_sockopt_SUITE.erl +++ b/lib/kernel/test/inet_sockopt_SUITE.erl @@ -772,8 +772,10 @@ all_listen_options() -> {mode,list,binary,true,true}, {deliver,term,port,true,true}, {exit_on_close, true, false, true, true}, - %{high_watermark,4096,8192,true,true}, - %{low_watermark,2048,4096,true,true}, + {high_watermark,4096,8192,true,true}, + {low_watermark,2048,4096,true,true}, + {high_msgq_watermark,4096,8192,true,true}, + {low_msgq_watermark,2048,4096,true,true}, {send_timeout,infinity,1000,true,true}, {send_timeout_close,false,true,true,true}, {delay_send,false,true,true,true}, @@ -797,6 +799,8 @@ all_connect_options() -> {exit_on_close, true, false, true, true}, {high_watermark,4096,8192,false,true}, {low_watermark,2048,4096,false,true}, + {high_msgq_watermark,4096,8192,true,true}, + {low_msgq_watermark,2048,4096,true,true}, {send_timeout,infinity,1000,true,true}, {send_timeout_close,false,true,true,true}, {delay_send,false,true,true,true}, diff --git a/lib/kernel/test/interactive_shell_SUITE.erl b/lib/kernel/test/interactive_shell_SUITE.erl index dac021c6c6..d7d9434b1f 100644 --- a/lib/kernel/test/interactive_shell_SUITE.erl +++ b/lib/kernel/test/interactive_shell_SUITE.erl @@ -211,7 +211,7 @@ job_control_remote(Config) when is_list(Config) -> {sleep,timeout(short)}, {putline,""}, {getline," -->"}, - {putline,"r "++MyNode}, + {putline,"r '"++MyNode++"'"}, {putline,"c"}, {putline_raw,""}, {getline,"Eshell"}, @@ -265,7 +265,7 @@ job_control_remote_noshell(Config) when is_list(Config) -> {sleep,timeout(short)}, {putline,""}, {getline," -->"}, - {putline,"r "++NSNodeStr}, + {putline,"r '"++NSNodeStr++"'"}, {putline,"c"}, {putline_raw,""}, {getline,"Eshell"}, @@ -721,4 +721,4 @@ get_default_shell() -> end. atom2list(A) -> - lists:flatten(io_lib:format("~w", [A])). + lists:flatten(io_lib:format("~s", [A])). diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl index 382fd6f6a9..9b474c4cdf 100644 --- a/lib/kernel/test/os_SUITE.erl +++ b/lib/kernel/test/os_SUITE.erl @@ -18,20 +18,20 @@ %% -module(os_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, +-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). --export([space_in_cwd/1, quoting/1, space_in_name/1, bad_command/1, - find_executable/1, unix_comment_in_command/1, evil/1]). +-export([space_in_cwd/1, quoting/1, cmd_unicode/1, space_in_name/1, bad_command/1, + find_executable/1, unix_comment_in_command/1, deep_list_command/1, evil/1]). -include_lib("test_server/include/test_server.hrl"). suite() -> [{ct_hooks,[ts_install_cth]}]. -all() -> - [space_in_cwd, quoting, space_in_name, bad_command, - find_executable, unix_comment_in_command, evil]. +all() -> + [space_in_cwd, quoting, cmd_unicode, space_in_name, bad_command, + find_executable, unix_comment_in_command, deep_list_command, evil]. -groups() -> +groups() -> []. init_per_suite(Config) -> @@ -94,6 +94,21 @@ quoting(Config) when is_list(Config) -> ?line [] = receive_all(), ok. + +cmd_unicode(doc) -> "Test that unicode arguments work."; +cmd_unicode(suite) -> []; +cmd_unicode(Config) when is_list(Config) -> + ?line DataDir = ?config(data_dir, Config), + ?line Echo = filename:join(DataDir, "my_echo"), + + ?line comp("one", os:cmd(Echo ++ " one")), + ?line comp("one::two", os:cmd(Echo ++ " one two")), + ?line comp("åäö::ϼΩ", os:cmd(Echo ++ " åäö " ++ [1020, 937])), + ?t:sleep(5), + ?line [] = receive_all(), + ok. + + space_in_name(doc) -> "Test that program with a space in its name can be executed."; space_in_name(suite) -> []; @@ -117,9 +132,9 @@ space_in_name(Config) when is_list(Config) -> ?line ok = file:change_mode(Echo, 8#777), % Make it executable on Unix. %% Run the echo program. - %% Quoting on windows depends on if the full path of the executable + %% Quoting on windows depends on if the full path of the executable %% contains special characters. Paths when running common_tests always - %% include @, why Windows would always fail if we do not double the + %% include @, why Windows would always fail if we do not double the %% quotes (this is the behaviour of cmd.exe, not Erlang's idea). Quote = case os:type() of {win32,_} -> @@ -135,7 +150,7 @@ space_in_name(Config) when is_list(Config) -> ?t:sleep(5), ?line [] = receive_all(), ok. - + bad_command(doc) -> "Check that a bad command doesn't crasch the server or the emulator (it used to)."; bad_command(suite) -> []; @@ -153,17 +168,17 @@ find_executable(suite) -> []; find_executable(doc) -> []; find_executable(Config) when is_list(Config) -> case os:type() of - {win32, _} -> + {win32, _} -> ?line DataDir = filename:join(?config(data_dir, Config), "win32"), ?line ok = file:set_cwd(filename:join([DataDir, "current"])), ?line Bin = filename:join(DataDir, "bin"), ?line Abin = filename:join(DataDir, "abin"), ?line UsrBin = filename:join([DataDir, "usr", "bin"]), ?line {ok, Current} = file:get_cwd(), - + ?line Path = lists:concat([Bin, ";", Abin, ";", UsrBin]), ?line io:format("Path = ~s", [Path]), - + %% Search for programs in Bin (second element in PATH). ?line find_exe(Abin, "my_ar", ".exe", Path), ?line find_exe(Abin, "my_ascii", ".com", Path), @@ -175,18 +190,18 @@ find_executable(Config) when is_list(Config) -> ?line find_exe(Abin, "my_ar.EXE", "", Path), ?line find_exe(Abin, "my_ascii.COM", "", Path), ?line find_exe(Abin, "MY_ADB.BAT", "", Path), - + %% Search for programs in Abin (second element in PATH). ?line find_exe(Abin, "my_ar", ".exe", Path), ?line find_exe(Abin, "my_ascii", ".com", Path), ?line find_exe(Abin, "my_adb", ".bat", Path), - + %% Search for programs in the current working directory. ?line find_exe(Current, "my_program", ".exe", Path), ?line find_exe(Current, "my_command", ".com", Path), ?line find_exe(Current, "my_batch", ".bat", Path), ok; - {unix, _} -> + {unix, _} -> DataDir = ?config(data_dir, Config), %% Smoke test. @@ -237,6 +252,21 @@ unix_comment_in_command(Config) when is_list(Config) -> ?line test_server:timetrap_cancel(Dog), ok. +deep_list_command(doc) -> + "Check that a deep list in command works equally on unix and on windows."; +deep_list_command(suite) -> []; +deep_list_command(Config) when is_list(Config) -> + %% As a 'io_lib' module description says: "There is no guarantee that the + %% character lists returned from some of the functions are flat, they can + %% be deep lists." + %% That's why os:cmd/1 can have arguments that are deep lists. + %% It is not a problem for unix, but for windows it is (in R15B02 for ex.). + Echo = os:cmd([$e, $c, "ho"]), + true = erlang:is_list(Echo), + %% FYI: [$e, $c, "ho"] =:= io_lib:format("ec~s", ["ho"]) + ok. + + -define(EVIL_PROCS, 100). -define(EVIL_LOOPS, 100). -define(PORT_CREATOR, os_cmd_port_creator). @@ -286,8 +316,8 @@ comp(Expected, Got) -> Expected -> ok; Other -> - ok = io:format("Expected: ~s\n", [Expected]), - ok = io:format("Got: ~s\n", [Other]), + ok = io:format("Expected: ~ts\n", [Expected]), + ok = io:format("Got: ~ts\n", [Other]), test_server:fail() end. @@ -303,4 +333,3 @@ receive_all() -> X -> [X|receive_all()] after 0 -> [] end. - diff --git a/lib/kernel/test/os_SUITE_data/my_echo.c b/lib/kernel/test/os_SUITE_data/my_echo.c index 2127511dd1..712c828bb5 100644 --- a/lib/kernel/test/os_SUITE_data/my_echo.c +++ b/lib/kernel/test/os_SUITE_data/my_echo.c @@ -1,3 +1,30 @@ +#ifdef __WIN32__ +#include <windows.h> + +int wmain(int argc, wchar_t **argv) +{ + char* sep = ""; + int len; + + /* + * Echo all arguments separated with '::', so that we can check that + * quotes are interpreted correctly. + */ + + while (argc-- > 1) { + char *utf8; + len = WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, NULL, 0, NULL, NULL); + utf8 = malloc(len*sizeof(char)); + WideCharToMultiByte(CP_UTF8, 0, argv++[1], -1, utf8, len, NULL, NULL); + printf("%s%s", sep, utf8); + free(utf8); + sep = "::"; + } + putchar('\n'); + return 0; +} +#else + #include <stdio.h> int @@ -17,3 +44,4 @@ main(int argc, char** argv) putchar('\n'); return 0; } +#endif diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index ac75037536..199e597e78 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -2039,6 +2039,8 @@ symlinks(Config, Handle, Suffix) -> ?PRIM_FILE_call(read_link, Handle, [Alias]), {ok, Name} = ?PRIM_FILE_call(read_link_all, Handle, [Alias]), + %% If all is good, delete dir again (avoid hanging dir on windows) + rm_rf(?PRIM_FILE,NewDir), ok end, @@ -2245,3 +2247,18 @@ zip_data([], Bs) -> Bs; zip_data(As, []) -> As. + +%%%----------------------------------------------------------------- +%%% Utilities +rm_rf(Mod,Dir) -> + case Mod:read_link_info(Dir) of + {ok, #file_info{type = directory}} -> + {ok, Content} = Mod:list_dir_all(Dir), + [ rm_rf(Mod,filename:join(Dir,C)) || C <- Content ], + Mod:del_dir(Dir), + ok; + {ok, #file_info{}} -> + Mod:delete(Dir); + _ -> + ok + end. diff --git a/lib/kernel/test/ram_file_SUITE.erl b/lib/kernel/test/ram_file_SUITE.erl index 5c4437d4d3..615251a257 100644 --- a/lib/kernel/test/ram_file_SUITE.erl +++ b/lib/kernel/test/ram_file_SUITE.erl @@ -1,8 +1,7 @@ -%% -*- coding: utf-8 -*- %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2012. All Rights Reserved. +%% Copyright Ericsson AB 2001-2013. 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 |