aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/configure.in12
-rw-r--r--erts/doc/src/erl.xml47
-rw-r--r--erts/doc/src/erlang.xml8
-rw-r--r--erts/doc/src/erts_alloc.xml21
-rw-r--r--erts/doc/src/notes.xml2
-rw-r--r--erts/emulator/beam/bif.c4
-rw-r--r--erts/emulator/beam/big.c9
-rw-r--r--erts/emulator/beam/big.h4
-rw-r--r--erts/emulator/beam/erl_alloc.c6
-rw-r--r--erts/emulator/beam/erl_db_util.c4
-rw-r--r--erts/emulator/beam/erl_gc.c2
-rw-r--r--erts/emulator/beam/erl_init.c30
-rw-r--r--erts/emulator/beam/erl_port_task.c5
-rw-r--r--erts/emulator/beam/erl_process.c443
-rw-r--r--erts/emulator/beam/erl_process.h105
-rw-r--r--erts/emulator/beam/erl_term.h3
-rw-r--r--erts/emulator/beam/erl_vm.h3
-rwxr-xr-xerts/emulator/beam/global.h14
-rw-r--r--erts/emulator/beam/utils.c21
-rw-r--r--erts/emulator/drivers/common/inet_drv.c23
-rw-r--r--erts/emulator/test/match_spec_SUITE.erl9
-rw-r--r--erts/etc/common/erlexec.c1
-rw-r--r--erts/etc/unix/cerl.src7
-rw-r--r--erts/test/z_SUITE.erl4
-rw-r--r--lib/common_test/doc/src/run_test_chapter.xml2
-rw-r--r--lib/compiler/src/beam_except.erl10
-rw-r--r--lib/compiler/test/beam_except_SUITE.erl10
-rw-r--r--lib/crypto/doc/src/crypto.xml24
-rw-r--r--lib/crypto/src/Makefile7
-rw-r--r--lib/crypto/src/crypto.app.src14
-rw-r--r--lib/crypto/src/crypto_app.erl39
-rw-r--r--lib/crypto/src/crypto_server.erl68
-rw-r--r--lib/crypto/src/crypto_sup.erl39
-rw-r--r--lib/debugger/priv/erlang_bug.pngbin2632 -> 4723 bytes
-rwxr-xr-xlib/diameter/bin/diameterc4
-rw-r--r--lib/diameter/doc/src/diameter_make.xml18
-rw-r--r--lib/diameter/doc/src/diameter_sctp.xml36
-rw-r--r--lib/diameter/doc/src/seealso.ent3
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl10
-rw-r--r--lib/diameter/src/base/diameter_service.erl5
-rw-r--r--lib/diameter/src/base/diameter_stats.erl5
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl14
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl21
-rw-r--r--lib/diameter/src/compiler/diameter_dict_util.erl37
-rw-r--r--lib/diameter/src/compiler/diameter_make.erl14
-rw-r--r--lib/diameter/src/diameter.appup.src83
-rw-r--r--lib/diameter/src/transport/diameter_sctp.erl27
-rw-r--r--lib/diameter/test/diameter_compiler_SUITE.erl9
-rw-r--r--lib/diameter/vsn.mk4
-rw-r--r--lib/erl_interface/src/connect/ei_connect.c1
-rw-r--r--lib/inets/doc/src/notes.xml18
-rw-r--r--lib/kernel/test/sendfile_SUITE.erl20
-rw-r--r--lib/observer/priv/erlang_observer.pngbin2679 -> 3698 bytes
-rw-r--r--lib/odbc/doc/src/notes.xml18
-rw-r--r--lib/odbc/vsn.mk2
-rw-r--r--lib/runtime_tools/c_src/Makefile.in30
-rw-r--r--lib/runtime_tools/c_src/dyntrace.c3
-rw-r--r--lib/runtime_tools/doc/src/dbg.xml4
-rw-r--r--lib/runtime_tools/src/dbg.erl4
-rw-r--r--lib/ssh/doc/src/ssh.xml2
-rw-r--r--lib/ssl/doc/src/notes.xml36
-rw-r--r--lib/ssl/doc/src/ssl.xml4
-rw-r--r--lib/ssl/src/ssl.erl8
-rw-r--r--lib/ssl/src/ssl_handshake.erl44
-rw-r--r--lib/ssl/src/ssl_internal.hrl5
-rw-r--r--lib/ssl/src/tls_handshake.erl26
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl82
-rw-r--r--lib/ssl/test/ssl_test_lib.erl20
-rw-r--r--lib/ssl/test/ssl_to_openssl_SUITE.erl10
-rw-r--r--lib/syntax_tools/doc/src/notes.xml32
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl6
-rw-r--r--lib/syntax_tools/vsn.mk2
-rw-r--r--lib/tools/emacs/erlang-skels.el24
-rw-r--r--lib/tools/emacs/erlang.el12
-rw-r--r--lib/tools/emacs/test.erl.indented5
-rw-r--r--lib/tools/emacs/test.erl.orig5
-rw-r--r--lib/wx/api_gen/gen_util.erl10
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl14
-rw-r--r--lib/wx/api_gen/wxapi.conf4
-rw-r--r--lib/wx/c_src/Makefile.in7
-rw-r--r--lib/wx/c_src/gen/wxe_events.cpp10
-rw-r--r--lib/wx/c_src/gen/wxe_funcs.cpp13
-rw-r--r--lib/wx/c_src/wxe_callback_impl.cpp (renamed from lib/wx/c_src/wxePrintout.cpp)71
-rw-r--r--lib/wx/c_src/wxe_callback_impl.h75
-rw-r--r--lib/wx/c_src/wxe_driver.c4
-rw-r--r--lib/wx/c_src/wxe_driver.h3
-rw-r--r--lib/wx/c_src/wxe_events.h14
-rw-r--r--lib/wx/c_src/wxe_gl.cpp17
-rw-r--r--lib/wx/c_src/wxe_gl.h25
-rw-r--r--lib/wx/c_src/wxe_helpers.cpp95
-rw-r--r--lib/wx/c_src/wxe_helpers.h122
-rw-r--r--lib/wx/c_src/wxe_impl.cpp461
-rw-r--r--lib/wx/c_src/wxe_impl.h218
-rw-r--r--lib/wx/c_src/wxe_main.cpp163
-rw-r--r--lib/wx/c_src/wxe_memory.h61
-rw-r--r--lib/wx/doc/src/notes.xml16
-rw-r--r--lib/wx/include/wx.hrl10
-rw-r--r--lib/wx/priv/erlang-logo128.pngbin0 -> 6268 bytes
-rw-r--r--lib/wx/priv/erlang-logo32.pngbin1608 -> 1291 bytes
-rw-r--r--lib/wx/priv/erlang-logo64.pngbin4149 -> 2647 bytes
-rw-r--r--lib/wx/src/gen/wxInitDialogEvent.erl64
-rw-r--r--lib/wx/test/wx_basic_SUITE.erl16
-rw-r--r--lib/wx/test/wx_event_SUITE.erl40
-rw-r--r--lib/wx/vsn.mk2
-rw-r--r--lib/xmerl/doc/src/notes.xml29
-rw-r--r--system/doc/design_principles/spec_proc.xml2
-rw-r--r--system/doc/getting_started/seq_prog.xml4
107 files changed, 2083 insertions, 1200 deletions
diff --git a/erts/configure.in b/erts/configure.in
index c992fb5bd9..c42a6c79d0 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -3827,10 +3827,16 @@ if test "$enable_dtrace_test" = "yes" ; then
if ! dtrace -h $DTRACE_CPP -Iemulator/beam -o ./foo-dtrace.h -s emulator/beam/erlang_dtrace.d; then
AC_MSG_ERROR([Could not precompile erlang_dtrace.d: dtrace -h failed])
fi
- rm -f foo-dtrace.h
+
+ $RM -f dtest.{o,c}
+ cat > dtest.c <<_DTEST
+ #include "foo-dtrace.h"
+ int main(void) { ERLANG_DIST_PORT_BUSY_ENABLED(); return 0; }
+_DTEST
+ $CC $CFLAGS -c -o dtest.o dtest.c
$RM -f $DTRACE_2STEP_TEST
- if dtrace -G $DTRACE_CPP $DTRACE_BITS_FLAG -Iemulator/beam -o $DTRACE_2STEP_TEST -s emulator/beam/erlang_dtrace.d 2> /dev/null && \
+ if dtrace -G $DTRACE_CPP $DTRACE_BITS_FLAG -Iemulator/beam -o $DTRACE_2STEP_TEST -s emulator/beam/erlang_dtrace.d dtest.o && \
test -f $DTRACE_2STEP_TEST ; then
rm $DTRACE_2STEP_TEST
DTRACE_ENABLED_2STEP=yes
@@ -3838,6 +3844,8 @@ if test "$enable_dtrace_test" = "yes" ; then
else
AC_MSG_NOTICE([dtrace precompilation for 1-stage DTrace successful])
fi
+ $RM -f dtest.{o,c} foo-dtrace.h
+
DTRACE_ENABLED=yes
case $OPSYS in
linux)
diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml
index bf0d132955..e737727941 100644
--- a/erts/doc/src/erl.xml
+++ b/erts/doc/src/erl.xml
@@ -941,6 +941,10 @@
when schedulers frequently run out of work. When disabled,
the frequency with which schedulers run out of work will
not be taken into account by the load balancing logic.
+ <br/>&nbsp;&nbsp;<c>+scl false</c> is similar to
+ <seealso marker="#+sub">+sub true</seealso> with the difference
+ that <c>+sub true</c> also will balance scheduler utilization
+ between schedulers.
</p>
</item>
<tag><marker id="+sct"><c>+sct CpuTopology</c></marker></tag>
@@ -1087,6 +1091,29 @@
documentation of the <seealso marker="#+sbt">+sbt</seealso> flag.
</p>
</item>
+ <tag><marker id="+sub"><c>+sub true|false</c></marker></tag>
+ <item>
+ <p>Enable or disable
+ <seealso marker="erts:erlang#statistics_scheduler_wall_time">scheduler
+ utilization</seealso> balancing of load. By default scheduler
+ utilization balancing is disabled and instead scheduler
+ compaction of load is enabled which will strive for a load
+ distribution which causes as many scheduler threads as possible
+ to be fully loaded (i.e., not run out of work). When scheduler
+ utilization balancing is enabled the system will instead try to
+ balance scheduler utilization between schedulers. That is,
+ strive for equal scheduler utilization on all schedulers.
+ <br/>&nbsp;&nbsp;&nbsp;<c>+sub true</c> is only supported on
+ systems where the runtime system detects and use a monotonically
+ increasing high resolution clock. On other systems, the runtime
+ system will fail to start.
+ <br/>&nbsp;&nbsp;&nbsp;<c>+sub true</c> implies
+ <seealso marker="#+scl">+scl false</seealso>. The difference
+ between <c>+sub true</c> and <c>+scl false</c> is that
+ <c>+scl false</c> will not try to balance the scheduler
+ utilization.
+ </p>
+ </item>
<tag><marker id="+swct"><c>+sws very_eager|eager|medium|lazy|very_lazy</c></marker></tag>
<item>
<p>
@@ -1126,18 +1153,18 @@
<tag><marker id="+spp"><c>+spp Bool</c></marker></tag>
<item>
<p>Set default scheduler hint for port parallelism. If set to
- <c>true</c>, the VM will schedule port tasks when it by this can
- improve the parallelism in the system. If set to <c>false</c>,
- the VM will try to perform port tasks immediately and by this
- improve latency at the expense of parallelism. If this
- flag has not been passed, the default scheduler hint for port
- parallelism is currently <c>false</c>. The default used can be
- inspected in runtime by calling
- <seealso marker="erlang#system_info_port_parallelism">erlang:system_info(port_parallelism)</seealso>.
+ <c>true</c>, the VM will schedule port tasks when doing so will
+ improve parallelism in the system. If set to <c>false</c>, the VM
+ will try to perform port tasks immediately, improving latency at the
+ expense of parallelism. If this flag has not been passed, the
+ default scheduler hint for port parallelism is currently
+ <c>false</c>. The default used can be inspected in runtime by
+ calling <seealso
+ marker="erlang#system_info_port_parallelism">erlang:system_info(port_parallelism)</seealso>.
The default can be overriden on port creation by passing the
<seealso marker="erlang#open_port_parallelism">parallelism</seealso>
- option to
- <seealso marker="erlang#open_port/2">open_port/2</seealso></p>.
+ option to <seealso
+ marker="erlang#open_port/2">open_port/2</seealso></p>.
</item>
<tag><marker id="sched_thread_stack_size"><c><![CDATA[+sss size]]></c></marker></tag>
<item>
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 124302a2cb..ea753cfaaf 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -3011,11 +3011,11 @@ os_prompt% </pre>
<tag><marker id="open_port_parallelism"><c>{parallelism, Boolean}</c></marker></tag>
<item>
<p>Set scheduler hint for port parallelism. If set to <c>true</c>,
- the VM will schedule port tasks when it by this can improve the
+ the VM will schedule port tasks when doing so will improve
parallelism in the system. If set to <c>false</c>, the VM will
- try to perform port tasks immediately and by this improving the
- latency at the expense of parallelism. The default can be set on
- system startup by passing the
+ try to perform port tasks immediately, improving latency at the
+ expense of parallelism. The default can be set on system startup
+ by passing the
<seealso marker="erl#+spp">+spp</seealso> command line argument
to <seealso marker="erl">erl(1)</seealso>.
</p>
diff --git a/erts/doc/src/erts_alloc.xml b/erts/doc/src/erts_alloc.xml
index fffa9f594c..c9eca39a99 100644
--- a/erts/doc/src/erts_alloc.xml
+++ b/erts/doc/src/erts_alloc.xml
@@ -395,16 +395,17 @@
<c><![CDATA[<utilization>]]></c> is an integer in the range
<c>[0, 100]</c> representing utilization in percent. When a
utilization value larger than zero is used, allocator instances
- are allowed to abandon multiblock carriers. Currently the default
- is zero. If <c>de</c> (default enabled) is passed instead of a
- <c><![CDATA[<utilization>]]></c>, a recomended non zero utilization
- value will be used. The actual value chosen depend on allocator
- type and may be changed between ERTS versions. Carriers will be
- abandoned when memory utilization in the allocator instance falls
- below the utilization value used. Once a carrier has been abandoned,
- no new allocations will be made in it. When an allocator instance
- gets an increased multiblock carrier need, it will first try to
- fetch an abandoned carrier from an allocator instances of the same
+ are allowed to abandon multiblock carriers. If <c>de</c> (default
+ enabled) is passed instead of a <c><![CDATA[<utilization>]]></c>,
+ a recomended non zero utilization value will be used. The actual
+ value chosen depend on allocator type and may be changed between
+ ERTS versions. Currently the default equals <c>de</c>, but this
+ may be changed in the future. Carriers will be abandoned when
+ memory utilization in the allocator instance falls below the
+ utilization value used. Once a carrier has been abandoned, no new
+ allocations will be made in it. When an allocator instance gets an
+ increased multiblock carrier need, it will first try to fetch an
+ abandoned carrier from an allocator instances of the same
allocator type. If no abandoned carrier could be fetched, it will
create a new empty carrier. When an abandoned carrier has been
fetched it will function as an ordinary carrier. This feature has
diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml
index 8c008c493e..b4ebef72f4 100644
--- a/erts/doc/src/notes.xml
+++ b/erts/doc/src/notes.xml
@@ -257,7 +257,7 @@
processes before the BIF returns, or fail with an
exception due to the port not being open. </p><p> The
synchronous port BIFs are: </p> <list> <item><seealso
- marker="erlang#port_close/1/"><c>port_close/1</c></seealso></item>
+ marker="erlang#port_close/1"><c>port_close/1</c></seealso></item>
<item><seealso
marker="erlang#port_command/2"><c>port_command/2</c></seealso></item>
<item><seealso
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 96666d98ed..61c1abedb5 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -4488,7 +4488,7 @@ BIF_RETTYPE system_flag_2(BIF_ALIST_2)
BIF_P->group_leader,
"A call to erlang:system_flag(cpu_topology, _) was made.\n"
"The cpu_topology argument is deprecated and scheduled\n"
- "for removal in erts-5.10/OTP-R16. For more information\n"
+ "for removal in Erlang/OTP 18. For more information\n"
"see the erlang:system_flag/2 documentation.\n");
BIF_TRAP1(set_cpu_topology_trap, BIF_P, BIF_ARG_2);
} else if (ERTS_IS_ATOM_STR("scheduler_bind_type", BIF_ARG_1)) {
@@ -4496,7 +4496,7 @@ BIF_RETTYPE system_flag_2(BIF_ALIST_2)
BIF_P->group_leader,
"A call to erlang:system_flag(scheduler_bind_type, _) was\n"
"made. The scheduler_bind_type argument is deprecated and\n"
- "scheduled for removal in erts-5.10/OTP-R16. For more\n"
+ "scheduled for removal in Erlang/OTP 18. For more\n"
"information see the erlang:system_flag/2 documentation.\n");
return erts_bind_schedulers(BIF_P, BIF_ARG_2);
}
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index 2b27b111d8..41a041eba6 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. 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
@@ -1603,9 +1603,11 @@ big_to_double(Wterm x, double* resp)
/*
* Logic has been copied from erl_bif_guard.c and slightly
* modified to use a static instead of dynamic heap
+ *
+ * HALFWORD: Return relative term with 'heap' as base.
*/
Eterm
-double_to_big(double x, Eterm *heap)
+double_to_big(double x, Eterm *heap, Uint hsz)
{
int is_negative;
int ds;
@@ -1633,9 +1635,10 @@ double_to_big(double x, Eterm *heap)
sz = BIG_NEED_SIZE(ds); /* number of words including arity */
hp = heap;
- res = make_big(hp);
+ res = make_big_rel(hp, heap);
xp = (ErtsDigit*) (hp + 1);
+ ASSERT(ds < hsz);
for (i = ds - 1; i >= 0; i--) {
ErtsDigit d;
diff --git a/erts/emulator/beam/big.h b/erts/emulator/beam/big.h
index 1a7b14170f..d80111822e 100644
--- a/erts/emulator/beam/big.h
+++ b/erts/emulator/beam/big.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. 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
@@ -141,7 +141,7 @@ Eterm big_lshift(Eterm, Sint, Eterm*);
int big_comp (Wterm, Wterm);
int big_ucomp (Eterm, Eterm);
int big_to_double(Wterm x, double* resp);
-Eterm double_to_big(double, Eterm*);
+Eterm double_to_big(double, Eterm*, Uint hsz);
Eterm small_to_big(Sint, Eterm*);
Eterm uint_to_big(Uint, Eterm*);
Eterm uword_to_big(UWord, Eterm*);
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c
index b5ba9bb94a..8094c6ee2e 100644
--- a/erts/emulator/beam/erl_alloc.c
+++ b/erts/emulator/beam/erl_alloc.c
@@ -75,9 +75,9 @@
#define ERTS_ALC_DEFAULT_ENABLED_ACUL_EHEAP_ALLOC 45
#define ERTS_ALC_DEFAULT_ENABLED_ACUL_LL_ALLOC 85
-#define ERTS_ALC_DEFAULT_ACUL 0
-#define ERTS_ALC_DEFAULT_ACUL_EHEAP_ALLOC 0
-#define ERTS_ALC_DEFAULT_ACUL_LL_ALLOC 0
+#define ERTS_ALC_DEFAULT_ACUL ERTS_ALC_DEFAULT_ENABLED_ACUL
+#define ERTS_ALC_DEFAULT_ACUL_EHEAP_ALLOC ERTS_ALC_DEFAULT_ENABLED_ACUL_EHEAP_ALLOC
+#define ERTS_ALC_DEFAULT_ACUL_LL_ALLOC ERTS_ALC_DEFAULT_ENABLED_ACUL_LL_ALLOC
#ifndef ERTS_SMP
# undef ERTS_ALC_DEFAULT_ACUL
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index ef3749a2c4..a358ecf326 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1998-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1998-2014. 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
@@ -1838,7 +1838,7 @@ restart:
ep = termp;
break;
case matchArrayBind: /* When the array size is unknown. */
- ASSERT(termp);
+ ASSERT(termp || arity==0);
n = *pc++;
variables[n].term = dpm_array_to_list(psp, termp, arity);
break;
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 8ff6f9a3b9..ab8448e8a1 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -1157,7 +1157,7 @@ do_minor(Process *p, Uint new_sz, Eterm* objv, int nobj)
old_htop = sweep_one_area(OLD_HTOP(p), old_htop, heap, heap_size);
}
OLD_HTOP(p) = old_htop;
- HIGH_WATER(p) = (HEAP_START(p) != HIGH_WATER(p)) ? n_heap : n_htop;
+ HIGH_WATER(p) = n_htop;
if (MSO(p).first) {
sweep_off_heap(p, 0);
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index 1af80dd04b..19088fd913 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -537,6 +537,12 @@ void erts_usage(void)
erts_fprintf(stderr, " see the erl(1) documentation for more info.\n");
erts_fprintf(stderr, "-sct cput set cpu topology,\n");
erts_fprintf(stderr, " see the erl(1) documentation for more info.\n");
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT
+ erts_fprintf(stderr, "-sub bool enable/disable scheduler utilization balancing,\n");
+#else
+ erts_fprintf(stderr, "-sub false disable scheduler utilization balancing,\n");
+#endif
+ erts_fprintf(stderr, " see the erl(1) documentation for more info.\n");
erts_fprintf(stderr, "-sws val set scheduler wakeup strategy, valid values are:\n");
erts_fprintf(stderr, " default|legacy.\n");
erts_fprintf(stderr, "-swct val set scheduler wake cleanup threshold, valid values are:\n");
@@ -1433,8 +1439,10 @@ erl_start(int argc, char **argv)
}
else if (has_prefix("cl", sub_param)) {
arg = get_arg(sub_param+2, argv[i+1], &i);
- if (sys_strcmp("true", arg) == 0)
+ if (sys_strcmp("true", arg) == 0) {
erts_sched_compact_load = 1;
+ erts_sched_balance_util = 0;
+ }
else if (sys_strcmp("false", arg) == 0)
erts_sched_compact_load = 0;
else {
@@ -1512,6 +1520,26 @@ erl_start(int argc, char **argv)
erts_usage();
}
}
+ else if (has_prefix("ub", sub_param)) {
+ arg = get_arg(sub_param+2, argv[i+1], &i);
+ if (sys_strcmp("true", arg) == 0) {
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT
+ erts_sched_balance_util = 1;
+#else
+ erts_fprintf(stderr,
+ "scheduler utilization balancing not "
+ "supported on this system\n");
+ erts_usage();
+#endif
+ }
+ else if (sys_strcmp("false", arg) == 0)
+ erts_sched_balance_util = 0;
+ else {
+ erts_fprintf(stderr, "bad scheduler utilization balancing "
+ " value '%s'\n", arg);
+ erts_usage();
+ }
+ }
else if (has_prefix("wct", sub_param)) {
arg = get_arg(sub_param+3, argv[i+1], &i);
if (erts_sched_set_wake_cleanup_threshold(arg) != 0) {
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 547a42beb2..d4108067d0 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -877,6 +877,11 @@ enqueue_port(ErtsRunQueue *runq, Port *pp)
ASSERT(runq->ports.start && runq->ports.end);
erts_smp_inc_runq_len(runq, &runq->ports.info, ERTS_PORT_PRIO_LEVEL);
+
+#ifdef ERTS_SMP
+ if (runq->halt_in_progress)
+ erts_non_empty_runq(runq);
+#endif
}
static ERTS_INLINE Port *
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 9983a26688..74cd84a998 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -144,6 +144,7 @@ extern BeamInstr beam_exit[];
extern BeamInstr beam_continue_exit[];
int erts_sched_compact_load;
+int erts_sched_balance_util = 0;
Uint erts_no_schedulers;
#define ERTS_THR_PRGR_LATER_CLEANUP_OP_THRESHOLD_VERY_LAZY (4*1024*1024)
@@ -608,6 +609,7 @@ erts_late_init_process(void)
static void
init_sched_wall_time(ErtsSchedWallTime *swtp)
{
+ swtp->need = erts_sched_balance_util;
swtp->enabled = 0;
swtp->start = 0;
swtp->working.total = 0;
@@ -630,27 +632,253 @@ sched_wall_time_ts(void)
#endif
}
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+
+#ifdef ARCH_64
+
+static ERTS_INLINE Uint64
+aschedtime_read(ErtsAtomicSchedTime *var)
+{
+ return (Uint64) erts_atomic_read_nob((erts_atomic_t *) var);
+}
+
+static ERTS_INLINE void
+aschedtime_set(ErtsAtomicSchedTime *var, Uint64 val)
+{
+ erts_atomic_set_nob((erts_atomic_t *) var, (erts_aint_t) val);
+}
+
+static ERTS_INLINE void
+aschedtime_init(ErtsAtomicSchedTime *var)
+{
+ erts_atomic_init_nob((erts_atomic_t *) var, (erts_aint_t) 0);
+}
+
+#elif defined(ARCH_32)
+
+static ERTS_INLINE Uint64
+aschedtime_read(ErtsAtomicSchedTime *var)
+{
+ erts_dw_aint_t dw;
+ erts_dw_atomic_read_nob((erts_dw_atomic_t *) var, &dw);
+#ifdef ETHR_SU_DW_NAINT_T__
+ return (Uint64) dw.dw_sint;
+#else
+ {
+ Uint64 res;
+ res = (Uint64) ((Uint32) dw.sint[ERTS_DW_AINT_HIGH_WORD]);
+ res <<= 32;
+ res |= (Uint64) ((Uint32) dw.sint[ERTS_DW_AINT_LOW_WORD]);
+ return res;
+ }
+#endif
+}
+
+static ERTS_INLINE void
+aschedtime_set(ErtsAtomicSchedTime *var, Uint64 val)
+{
+ erts_dw_aint_t dw;
+#ifdef ETHR_SU_DW_NAINT_T__
+ dw.dw_sint = (ETHR_SU_DW_NAINT_T__) val;
+#else
+ dw.sint[ERTS_DW_AINT_LOW_WORD] = (erts_aint_t) (val & 0xffffffff);
+ dw.sint[ERTS_DW_AINT_HIGH_WORD] = (erts_aint_t) ((val >> 32) & 0xffffffff);
+#endif
+ erts_dw_atomic_set_nob((erts_dw_atomic_t *) var, &dw);
+}
+
+static ERTS_INLINE void
+aschedtime_init(ErtsAtomicSchedTime *var)
+{
+ erts_dw_aint_t dw;
+ dw.sint[ERTS_DW_AINT_LOW_WORD] = (erts_aint_t) 0;
+ dw.sint[ERTS_DW_AINT_HIGH_WORD] = (erts_aint_t) 0;
+ erts_dw_atomic_init_nob((erts_dw_atomic_t *) var, &dw);
+}
+
+#else
+# error :-/
+#endif
+
+#define ERTS_GET_AVG_MAX_UNLOCKED_TRY 50
+#define ERTS_SCHED_AVG_UTIL_WRITE_MARKER (~((Uint64) 0))
+
+/* Intervals in nanoseconds */
+#define ERTS_SCHED_UTIL_SHORT_INTERVAL ((Uint64) 1*1000*1000*1000)
+#define ERTS_SCHED_UTIL_LONG_INTERVAL ((Uint64) 10*1000*1000*1000)
+
+
+#define ERTS_SCHED_UTIL_IGNORE_IMBALANCE_DIFF 5000 /* ppm */
+
+static ERTS_INLINE Uint64
+calc_sched_worktime(int is_working, Uint64 now, Uint64 last,
+ Uint64 interval, Uint64 old_worktime)
+{
+ Uint64 worktime;
+ Uint64 new;
+
+ if (now <= last)
+ return old_worktime;
+
+ new = now - last;
+
+ if (new >= interval)
+ return is_working ? interval : (Uint64) 0;
+
+
+ /*
+ * Division by 1000 in order to avoid
+ * overflow. If changed update assertions
+ * in init_runq_sched_util().
+ */
+ worktime = old_worktime;
+ worktime *= (interval - new)/1000;
+ worktime /= (interval/1000);
+ if (is_working)
+ worktime += new;
+
+ ASSERT(0 <= worktime && worktime <= interval);
+
+ return worktime;
+}
+
+static ERTS_INLINE void
+update_avg_sched_util(ErtsSchedulerData *esdp, Uint64 now, int is_working)
+{
+ ErtsRunQueue *rq;
+ int worked;
+ Uint64 swt, lwt, last;
+
+ rq = esdp->run_queue;
+ last = aschedtime_read(&rq->sched_util.last);
+
+ if (now <= last) {
+ ASSERT(last == ERTS_SCHED_AVG_UTIL_WRITE_MARKER);
+ return;
+ }
+
+ ASSERT(now >= last);
+
+ worked = rq->sched_util.is_working;
+
+ swt = calc_sched_worktime(worked, now, last, ERTS_SCHED_UTIL_SHORT_INTERVAL,
+ rq->sched_util.worktime.short_interval);
+ lwt = calc_sched_worktime(worked, now, last, ERTS_SCHED_UTIL_LONG_INTERVAL,
+ rq->sched_util.worktime.long_interval);
+
+ aschedtime_set(&rq->sched_util.last, ERTS_SCHED_AVG_UTIL_WRITE_MARKER);
+ ERTS_THR_WRITE_MEMORY_BARRIER;
+ rq->sched_util.is_working = is_working;
+ rq->sched_util.worktime.short_interval = swt;
+ rq->sched_util.worktime.long_interval = lwt;
+ ERTS_THR_WRITE_MEMORY_BARRIER;
+ aschedtime_set(&rq->sched_util.last, now);
+}
+
+int
+erts_get_sched_util(ErtsRunQueue *rq, int initially_locked, int short_interval)
+{
+ /* Average scheduler utilization in ppm */
+ int util, is_working, try = 0, locked = initially_locked;
+ Uint64 worktime, old_worktime, now, last, interval, *old_worktimep;
+
+ if (short_interval) {
+ old_worktimep = &rq->sched_util.worktime.short_interval;
+ interval = ERTS_SCHED_UTIL_SHORT_INTERVAL;
+ }
+ else {
+ old_worktimep = &rq->sched_util.worktime.long_interval;
+ interval = ERTS_SCHED_UTIL_LONG_INTERVAL;
+ }
+
+ while (1) {
+ Uint64 chk_last;
+ last = aschedtime_read(&rq->sched_util.last);
+ ERTS_THR_READ_MEMORY_BARRIER;
+ is_working = rq->sched_util.is_working;
+ old_worktime = *old_worktimep;
+ ERTS_THR_READ_MEMORY_BARRIER;
+ chk_last = aschedtime_read(&rq->sched_util.last);
+ if (chk_last == last)
+ break;
+ if (!locked) {
+ if (++try >= ERTS_GET_AVG_MAX_UNLOCKED_TRY) {
+ /* Writer will eventually block on runq-lock */
+ erts_smp_runq_lock(rq);
+ locked = 1;
+ }
+ }
+ }
+
+ if (!initially_locked && locked)
+ erts_smp_runq_unlock(rq);
+
+ now = sched_wall_time_ts();
+ worktime = calc_sched_worktime(is_working, now, last, interval, old_worktime);
+
+ util = (int) ((worktime * 1000000)/interval);
+
+ ASSERT(0 <= util && util <= 1000000);
+
+ return util;
+}
+
+static void
+init_runq_sched_util(ErtsRunQueueSchedUtil *rqsu, int enabled)
+{
+ aschedtime_init(&rqsu->last);
+ if (!enabled)
+ aschedtime_set(&rqsu->last, ERTS_SCHED_AVG_UTIL_WRITE_MARKER);
+ rqsu->is_working = 0;
+ rqsu->worktime.short_interval = (Uint64) 0;
+ rqsu->worktime.long_interval = (Uint64) 0;
+
+#ifdef DEBUG
+ {
+ Uint64 intrvl;
+ /*
+ * If one of these asserts fail we may have
+ * overflow in calc_sched_worktime(). Which
+ * have to be fixed either by shrinking
+ * interval size, or fix calculation of
+ * worktime in calc_sched_worktime().
+ */
+ intrvl = ERTS_SCHED_UTIL_SHORT_INTERVAL;
+ ASSERT(intrvl*(intrvl/1000) > intrvl);
+ intrvl = ERTS_SCHED_UTIL_LONG_INTERVAL;
+ ASSERT(intrvl*(intrvl/1000) > intrvl);
+ }
+#endif
+}
+
+#endif /* ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT */
+
static ERTS_INLINE void
sched_wall_time_change(ErtsSchedulerData *esdp, int working)
{
- if (esdp->sched_wall_time.enabled) {
+ if (esdp->sched_wall_time.need) {
Uint64 ts = sched_wall_time_ts();
- if (working) {
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ update_avg_sched_util(esdp, ts, working);
+#endif
+ if (esdp->sched_wall_time.enabled) {
+ if (working) {
#ifdef DEBUG
- ASSERT(!esdp->sched_wall_time.working.currently);
- esdp->sched_wall_time.working.currently = 1;
+ ASSERT(!esdp->sched_wall_time.working.currently);
+ esdp->sched_wall_time.working.currently = 1;
#endif
- ts -= esdp->sched_wall_time.start;
- esdp->sched_wall_time.working.start = ts;
- }
- else {
+ ts -= esdp->sched_wall_time.start;
+ esdp->sched_wall_time.working.start = ts;
+ }
+ else {
#ifdef DEBUG
- ASSERT(esdp->sched_wall_time.working.currently);
- esdp->sched_wall_time.working.currently = 0;
+ ASSERT(esdp->sched_wall_time.working.currently);
+ esdp->sched_wall_time.working.currently = 0;
#endif
- ts -= esdp->sched_wall_time.start;
- ts -= esdp->sched_wall_time.working.start;
- esdp->sched_wall_time.working.total += ts;
+ ts -= esdp->sched_wall_time.start;
+ ts -= esdp->sched_wall_time.working.start;
+ esdp->sched_wall_time.working.total += ts;
+ }
}
}
}
@@ -705,10 +933,13 @@ reply_sched_wall_time(void *vswtrp)
ASSERT(esdp);
if (swtrp->set) {
- if (!swtrp->enable && esdp->sched_wall_time.enabled)
+ if (!swtrp->enable && esdp->sched_wall_time.enabled) {
+ esdp->sched_wall_time.need = erts_sched_balance_util;
esdp->sched_wall_time.enabled = 0;
+ }
else if (swtrp->enable && !esdp->sched_wall_time.enabled) {
Uint64 ts = sched_wall_time_ts();
+ esdp->sched_wall_time.need = 1;
esdp->sched_wall_time.enabled = 1;
esdp->sched_wall_time.start = ts;
esdp->sched_wall_time.working.total = 0;
@@ -2084,9 +2315,8 @@ ongoing_multi_scheduling_block(void)
}
static ERTS_INLINE void
-empty_runq(ErtsRunQueue *rq)
+empty_runq_aux(ErtsRunQueue *rq, Uint32 old_flags)
{
- Uint32 old_flags = ERTS_RUNQ_FLGS_UNSET(rq, ERTS_RUNQ_FLG_NONEMPTY|ERTS_RUNQ_FLG_PROTECTED);
if (old_flags & ERTS_RUNQ_FLG_NONEMPTY) {
#ifdef DEBUG
erts_aint32_t empty = erts_smp_atomic32_read_nob(&no_empty_run_queues);
@@ -2107,6 +2337,23 @@ empty_runq(ErtsRunQueue *rq)
}
static ERTS_INLINE void
+empty_runq(ErtsRunQueue *rq)
+{
+ Uint32 old_flags = ERTS_RUNQ_FLGS_UNSET(rq, ERTS_RUNQ_FLG_NONEMPTY|ERTS_RUNQ_FLG_PROTECTED);
+ empty_runq_aux(rq, old_flags);
+}
+
+static ERTS_INLINE Uint32
+empty_protected_runq(ErtsRunQueue *rq)
+{
+ Uint32 old_flags = ERTS_RUNQ_FLGS_BSET(rq,
+ ERTS_RUNQ_FLG_NONEMPTY|ERTS_RUNQ_FLG_PROTECTED,
+ ERTS_RUNQ_FLG_PROTECTED);
+ empty_runq_aux(rq, old_flags);
+ return old_flags;
+}
+
+static ERTS_INLINE void
non_empty_runq(ErtsRunQueue *rq)
{
Uint32 old_flags = ERTS_RUNQ_FLGS_SET(rq, ERTS_RUNQ_FLG_NONEMPTY);
@@ -2130,6 +2377,18 @@ non_empty_runq(ErtsRunQueue *rq)
}
}
+void
+erts_empty_runq(ErtsRunQueue *rq)
+{
+ empty_runq(rq);
+}
+
+void
+erts_non_empty_runq(ErtsRunQueue *rq)
+{
+ non_empty_runq(rq);
+}
+
static erts_aint32_t
sched_prep_spin_wait(ErtsSchedulerSleepInfo *ssi)
{
@@ -2632,7 +2891,7 @@ ssi_flags_set_wake(ErtsSchedulerSleepInfo *ssi)
}
static void
-wake_scheduler(ErtsRunQueue *rq, int incq)
+wake_scheduler(ErtsRunQueue *rq)
{
ErtsSchedulerSleepInfo *ssi;
erts_aint32_t flgs;
@@ -2651,9 +2910,6 @@ wake_scheduler(ErtsRunQueue *rq, int incq)
flgs = ssi_flags_set_wake(ssi);
erts_sched_finish_poke(ssi, flgs);
-
- if (incq && (flgs & ERTS_SSI_FLG_WAITING))
- non_empty_runq(rq);
}
#define ERTS_NO_USED_RUNQS_SHIFT 16
@@ -2744,7 +3000,7 @@ chk_wake_sched(ErtsRunQueue *crq, int ix, int activate)
if (try_inc_no_active_runqs(ix+1))
(void) ERTS_RUNQ_FLGS_UNSET(wrq, ERTS_RUNQ_FLG_INACTIVE);
}
- wake_scheduler(wrq, 0);
+ wake_scheduler(wrq);
return 1;
}
return 0;
@@ -2792,7 +3048,7 @@ smp_notify_inc_runq(ErtsRunQueue *runq)
{
#ifdef ERTS_SMP
if (runq)
- wake_scheduler(runq, 1);
+ wake_scheduler(runq);
#endif
}
@@ -2810,7 +3066,7 @@ erts_sched_notify_check_cpu_bind(void)
for (ix = 0; ix < erts_no_run_queues; ix++) {
ErtsRunQueue *rq = ERTS_RUNQ_IX(ix);
(void) ERTS_RUNQ_FLGS_SET(rq, ERTS_RUNQ_FLG_CHK_CPU_BIND);
- wake_scheduler(rq, 0);
+ wake_scheduler(rq);
}
#else
erts_sched_check_cpu_bind(erts_get_scheduler_data());
@@ -2938,6 +3194,11 @@ check_immigration_need(ErtsRunQueue *c_rq, ErtsMigrationPath *mp, int prio)
if (!f_rq)
return NULL;
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ if (mp->sched_util)
+ return NULL;
+#endif
+
f_rq_flags = ERTS_RUNQ_FLGS_GET(f_rq);
if (f_rq_flags & ERTS_RUNQ_FLG_PROTECTED)
return NULL;
@@ -3077,7 +3338,7 @@ suspend_run_queue(ErtsRunQueue *rq)
ERTS_SSI_FLG_SUSPENDED);
(void) ERTS_RUNQ_FLGS_SET(rq, ERTS_RUNQ_FLG_SUSPENDED);
- wake_scheduler(rq, 0);
+ wake_scheduler(rq);
}
static void scheduler_ix_resume_wake(Uint ix);
@@ -3169,6 +3430,9 @@ evacuate_run_queue(ErtsRunQueue *rq,
to_rq->misc.start = start;
to_rq->misc.end = end;
+
+ non_empty_runq(to_rq);
+
erts_smp_runq_unlock(to_rq);
smp_notify_inc_runq(to_rq);
erts_smp_runq_lock(to_rq);
@@ -3381,7 +3645,7 @@ try_steal_task(ErtsRunQueue *rq)
Uint32 flags;
/* Protect jobs we steal from getting stolen from us... */
- flags = ERTS_RUNQ_FLGS_SET(rq, ERTS_RUNQ_FLG_PROTECTED);
+ flags = empty_protected_runq(rq);
if (flags & ERTS_RUNQ_FLG_SUSPENDED)
return 0; /* go suspend instead... */
@@ -3460,6 +3724,9 @@ typedef struct {
int full_reds_history_change;
int oowc;
int max_len;
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ int sched_util;
+#endif
} ErtsRunQueueBalance;
static ErtsRunQueueBalance *run_queue_info;
@@ -3623,6 +3890,9 @@ check_balance(ErtsRunQueue *c_rq)
Sint64 scheds_reds, full_scheds_reds;
int forced, active, current_active, oowc, half_full_scheds, full_scheds,
mmax_len, blnc_no_rqs, qix, pix, freds_hist_ix;
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ int sched_util_balancing;
+#endif
if (erts_smp_atomic32_xchg_nob(&balance_info.checking_balance, 1)) {
c_rq->check_balance_reds = INT_MAX;
@@ -3678,6 +3948,10 @@ check_balance(ErtsRunQueue *c_rq)
return;
}
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ sched_util_balancing = 0;
+#endif
+
freds_hist_ix = balance_info.full_reds_history_index;
balance_info.full_reds_history_index++;
if (balance_info.full_reds_history_index >= ERTS_FULL_REDS_HISTORY_SIZE)
@@ -3708,7 +3982,12 @@ check_balance(ErtsRunQueue *c_rq)
run_queue_info[qix].oowc = rq->out_of_work_count;
run_queue_info[qix].max_len = rq->max_len;
rq->check_balance_reds = INT_MAX;
-
+
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ if (erts_sched_balance_util)
+ run_queue_info[qix].sched_util = erts_get_sched_util(rq, 1, 0);
+#endif
+
erts_smp_runq_unlock(rq);
}
@@ -3778,8 +4057,38 @@ check_balance(ErtsRunQueue *c_rq)
mmax_len = run_queue_info[qix].max_len;
}
- if (!erts_sched_compact_load)
+ if (!erts_sched_compact_load) {
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ if (erts_sched_balance_util && full_scheds < blnc_no_rqs) {
+ int avg_util = 0;
+
+ for (qix = 0; qix < blnc_no_rqs; qix++)
+ avg_util += run_queue_info[qix].sched_util;
+
+ avg_util /= blnc_no_rqs; /* in ppm */
+
+ sched_util_balancing = 1;
+ /*
+ * In order to avoid renaming a large amount of fields
+ * we write utilization values instead of lenght values
+ * in the 'max_len' and 'migration_limit' fields...
+ */
+ for (qix = 0; qix < blnc_no_rqs; qix++) {
+ run_queue_info[qix].flags = 0; /* Reset for later use... */
+ for (pix = 0; pix < ERTS_NO_PRIO_LEVELS; pix++) {
+ run_queue_info[qix].prio[pix].emigrate_to = -1;
+ run_queue_info[qix].prio[pix].immigrate_from = -1;
+ run_queue_info[qix].prio[pix].avail = 100;
+ run_queue_info[qix].prio[pix].max_len = run_queue_info[qix].sched_util;
+ run_queue_info[qix].prio[pix].migration_limit = avg_util;
+ }
+ }
+ active = blnc_no_rqs;
+ goto setup_migration_paths;
+ }
+#endif
goto all_active;
+ }
if (!forced && half_full_scheds != blnc_no_rqs) {
int min = 1;
@@ -3896,15 +4205,30 @@ check_balance(ErtsRunQueue *c_rq)
}
}
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ setup_migration_paths:
+#endif
+
/* Setup migration paths for all priorities */
for (pix = 0; pix < ERTS_NO_PRIO_LEVELS; pix++) {
int low = 0, high = 0;
for (qix = 0; qix < blnc_no_rqs; qix++) {
int len_diff = run_queue_info[qix].prio[pix].max_len;
len_diff -= run_queue_info[qix].prio[pix].migration_limit;
+
#ifdef DBG_PRINT
if (pix == 2) erts_fprintf(stderr, "%d ", len_diff);
#endif
+
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ if (sched_util_balancing
+ && -ERTS_SCHED_UTIL_IGNORE_IMBALANCE_DIFF <= len_diff
+ && len_diff <= ERTS_SCHED_UTIL_IGNORE_IMBALANCE_DIFF) {
+ /* ignore minor imbalance */
+ len_diff = 0;
+ }
+#endif
+
run_queue_compare[qix].qix = qix;
run_queue_compare[qix].len = len_diff;
if (len_diff != 0) {
@@ -4031,6 +4355,9 @@ erts_fprintf(stderr, "--------------------------------\n");
Uint32 flags = run_queue_info[qix].flags;
ErtsMigrationPath *mp = &new_mpaths->mpath[qix];
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ mp->sched_util = sched_util_balancing;
+#endif
mp->flags = flags;
mp->misc_evac_runq = NULL;
@@ -4628,6 +4955,11 @@ erts_init_scheduling(int no_schedulers, int no_schedulers_online)
set_wakeup_other_data();
#endif
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ if (erts_sched_balance_util)
+ erts_sched_compact_load = 0;
+#endif
+
ASSERT(no_schedulers_online <= no_schedulers);
ASSERT(no_schedulers_online >= 1);
ASSERT(no_schedulers >= 1);
@@ -4696,6 +5028,11 @@ erts_init_scheduling(int no_schedulers, int no_schedulers_online)
rq->ports.info.reds = 0;
rq->ports.start = NULL;
rq->ports.end = NULL;
+
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ init_runq_sched_util(&rq->sched_util, erts_sched_balance_util);
+#endif
+
}
#ifdef ERTS_SMP
@@ -4794,6 +5131,7 @@ erts_init_scheduling(int no_schedulers, int no_schedulers_online)
esdp->reductions = 0;
init_sched_wall_time(&esdp->sched_wall_time);
+
erts_port_task_handle_init(&esdp->nosuspend_port_task_handle);
}
@@ -5761,7 +6099,7 @@ erts_set_schedulers_online(Process *p,
for (ix = no; ix < online; ix++) {
ErtsRunQueue *rq = ERTS_RUNQ_IX(ix);
- wake_scheduler(rq, 0);
+ wake_scheduler(rq);
}
}
}
@@ -5860,7 +6198,7 @@ erts_block_multi_scheduling(Process *p, ErtsProcLocks plocks, int on, int all)
for (ix = 1; ix < online; ix++) {
ErtsRunQueue *rq = ERTS_RUNQ_IX(ix);
- wake_scheduler(rq, 0);
+ wake_scheduler(rq);
}
if (erts_smp_atomic32_read_nob(&schdlr_sspnd.active)
@@ -7265,19 +7603,13 @@ Process *schedule(Process *p, int calls)
#ifdef ERTS_SMP
ErtsMigrationPaths *mps;
ErtsMigrationPath *mp;
-
-#ifdef ERTS_SMP
- {
- ErtsProcList *pnd_xtrs = rq->procs.pending_exiters;
- if (erts_proclist_fetch(&pnd_xtrs, NULL)) {
- rq->procs.pending_exiters = NULL;
- erts_smp_runq_unlock(rq);
- handle_pending_exiters(pnd_xtrs);
- erts_smp_runq_lock(rq);
- }
-
+ ErtsProcList *pnd_xtrs = rq->procs.pending_exiters;
+ if (erts_proclist_fetch(&pnd_xtrs, NULL)) {
+ rq->procs.pending_exiters = NULL;
+ erts_smp_runq_unlock(rq);
+ handle_pending_exiters(pnd_xtrs);
+ erts_smp_runq_lock(rq);
}
-#endif
if (rq->check_balance_reds <= 0)
check_balance(rq);
@@ -7294,7 +7626,7 @@ Process *schedule(Process *p, int calls)
continue_check_activities_to_run:
flags = ERTS_RUNQ_FLGS_GET_NOB(rq);
continue_check_activities_to_run_known_flags:
-
+ ASSERT(flags & ERTS_RUNQ_FLG_NONEMPTY);
if (flags & (ERTS_RUNQ_FLG_CHK_CPU_BIND|ERTS_RUNQ_FLG_SUSPENDED)) {
@@ -7346,20 +7678,16 @@ Process *schedule(Process *p, int calls)
rq->wakeup_other = 0;
rq->wakeup_other_reds = 0;
- empty_runq(rq);
-
flags = ERTS_RUNQ_FLGS_GET_NOB(rq);
- if (flags & ERTS_RUNQ_FLG_SUSPENDED) {
- non_empty_runq(rq);
+ if (flags & ERTS_RUNQ_FLG_SUSPENDED)
goto continue_check_activities_to_run_known_flags;
- }
- else if (!(flags & ERTS_RUNQ_FLG_INACTIVE)) {
- if (try_steal_task(rq)) {
- non_empty_runq(rq);
+ if (flags & ERTS_RUNQ_FLG_INACTIVE)
+ empty_runq(rq);
+ else {
+ if (try_steal_task(rq))
goto continue_check_activities_to_run;
- }
- (void) ERTS_RUNQ_FLGS_UNSET(rq, ERTS_RUNQ_FLG_PROTECTED);
+ empty_runq(rq);
/*
* Check for ERTS_RUNQ_FLG_SUSPENDED has to be done
@@ -7368,10 +7696,10 @@ Process *schedule(Process *p, int calls)
flags = ERTS_RUNQ_FLGS_GET_NOB(rq);
if (flags & ERTS_RUNQ_FLG_SUSPENDED) {
non_empty_runq(rq);
+ flags |= ERTS_RUNQ_FLG_NONEMPTY;
goto continue_check_activities_to_run_known_flags;
}
}
-
#endif
scheduler_wait(&fcalls, esdp, rq);
@@ -8486,6 +8814,10 @@ erts_schedule_misc_op(void (*func)(void *), void *arg)
rq->misc.start = molp;
rq->misc.end = molp;
+#ifdef ERTS_SMP
+ non_empty_runq(rq);
+#endif
+
erts_smp_runq_unlock(rq);
smp_notify_inc_runq(rq);
@@ -9371,8 +9703,11 @@ save_pending_exiter(Process *p)
erts_proclist_store_last(&rq->procs.pending_exiters, plp);
+ non_empty_runq(rq);
+
erts_smp_runq_unlock(rq);
- wake_scheduler(rq, 1);
+
+ wake_scheduler(rq);
}
#endif
diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h
index e35d1c785c..24832d59b5 100644
--- a/erts/emulator/beam/erl_process.h
+++ b/erts/emulator/beam/erl_process.h
@@ -70,6 +70,9 @@ typedef struct process Process;
struct ErtsNodesMonitor_;
+#define ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT 0
+#define ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT 0
+
#define ERTS_MAX_NO_OF_SCHEDULERS 1024
#define ERTS_DEFAULT_MAX_PROCESSES (1 << 18)
@@ -98,6 +101,7 @@ struct saved_calls {
extern Export exp_send, exp_receive, exp_timeout;
extern int erts_sched_compact_load;
+extern int erts_sched_balance_util;
extern Uint erts_no_schedulers;
extern Uint erts_no_run_queues;
extern int erts_sched_thread_suggested_stack_size;
@@ -198,6 +202,10 @@ extern int erts_sched_thread_suggested_stack_size;
#define ERTS_RUNQ_FLGS_SET(RQ, FLGS) \
((Uint32) erts_smp_atomic32_read_bor_relb(&(RQ)->flags, \
(erts_aint32_t) (FLGS)))
+#define ERTS_RUNQ_FLGS_BSET(RQ, MSK, FLGS) \
+ ((Uint32) erts_smp_atomic32_read_bset_relb(&(RQ)->flags, \
+ (erts_aint32_t) (MSK), \
+ (erts_aint32_t) (FLGS)))
#define ERTS_RUNQ_FLGS_UNSET(RQ, FLGS) \
((Uint32) erts_smp_atomic32_read_band_relb(&(RQ)->flags, \
(erts_aint32_t) ~(FLGS)))
@@ -316,9 +324,40 @@ typedef struct {
int reds;
} ErtsRunQueueInfo;
+
+#ifdef HAVE_GETHRTIME
+# undef ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT
+# define ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT 1
+#endif
+
#ifdef ERTS_SMP
+#undef ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+#define ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT_OPT
+
+#ifdef ARCH_64
+typedef erts_atomic_t ErtsAtomicSchedTime;
+#elif defined(ARCH_32)
+typedef erts_dw_atomic_t ErtsAtomicSchedTime;
+#else
+# error :-/
+#endif
+
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+typedef struct {
+ ErtsAtomicSchedTime last;
+ struct {
+ Uint64 short_interval;
+ Uint64 long_interval;
+ } worktime;
+ int is_working;
+} ErtsRunQueueSchedUtil;
+#endif
+
typedef struct {
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ int sched_util;
+#endif
Uint32 flags;
ErtsRunQueue *misc_evac_runq;
struct {
@@ -385,6 +424,9 @@ struct ErtsRunQueue_ {
Port *start;
Port *end;
} ports;
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ ErtsRunQueueSchedUtil sched_util;
+#endif
};
#ifdef ERTS_SMP
@@ -414,6 +456,7 @@ do { \
} while (0)
typedef struct {
+ int need; /* "+sbu true" or scheduler_wall_time enabled */
int enabled;
Uint64 start;
struct {
@@ -499,7 +542,6 @@ struct ErtsSchedulerData_ {
Eterm tmp_heap[TMP_HEAP_SIZE];
int num_tmp_heap_used;
Eterm beam_emu_tmp_heap[BEAM_EMU_TMP_HEAP_SIZE];
- Eterm cmp_tmp_heap[CMP_TMP_HEAP_SIZE];
Eterm erl_arith_tmp_heap[ERL_ARITH_TMP_HEAP_SIZE];
#endif
ErtsSchedulerSleepInfo *ssi;
@@ -542,6 +584,12 @@ int erts_smp_lc_runq_is_locked(ErtsRunQueue *);
#ifdef ERTS_INCLUDE_SCHEDULER_INTERNALS
+#ifdef ERTS_SMP
+void erts_empty_runq(ErtsRunQueue *rq);
+void erts_non_empty_runq(ErtsRunQueue *rq);
+#endif
+
+
/*
* Run queue locked during modifications. We use atomic ops since
* other threads peek at values without run queue lock.
@@ -574,6 +622,10 @@ erts_smp_inc_runq_len(ErtsRunQueue *rq, ErtsRunQueueInfo *rqi, int prio)
erts_smp_atomic32_set_relb(&rqi->len, len);
+#ifdef ERTS_SMP
+ if (rq->len == 0)
+ erts_non_empty_runq(rq);
+#endif
rq->len++;
if (rq->max_len < rq->len)
rq->max_len = len;
@@ -1686,6 +1738,13 @@ erts_proc_set_error_handler(Process *p, ErtsProcLocks plocks, Eterm handler)
extern erts_atomic_t erts_migration_paths;
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+int erts_get_sched_util(ErtsRunQueue *rq,
+ int initially_locked,
+ int short_interval);
+#endif
+
+
ERTS_GLB_INLINE ErtsMigrationPaths *erts_get_migration_paths_managed(void);
ERTS_GLB_INLINE ErtsMigrationPaths *erts_get_migration_paths(void);
ERTS_GLB_INLINE ErtsRunQueue *erts_check_emigration_need(ErtsRunQueue *c_rq,
@@ -1737,22 +1796,36 @@ erts_check_emigration_need(ErtsRunQueue *c_rq, int prio)
return mp->prio[prio].runq;
}
-
- if (prio == ERTS_PORT_PRIO_LEVEL)
- len = RUNQ_READ_LEN(&c_rq->ports.info.len);
+#if ERTS_HAVE_SCHED_UTIL_BALANCING_SUPPORT
+ if (mp->sched_util) {
+ ErtsRunQueue *rq = mp->prio[prio].runq;
+ /* No migration if other is non-empty */
+ if (!(ERTS_RUNQ_FLGS_GET(rq) & ERTS_RUNQ_FLG_NONEMPTY)
+ && erts_get_sched_util(rq, 0, 1) < mp->prio[prio].limit.other
+ && erts_get_sched_util(c_rq, 0, 1) > mp->prio[prio].limit.this) {
+ return rq;
+ }
+ }
else
- len = RUNQ_READ_LEN(&c_rq->procs.prio_info[prio].len);
-
- if (len > mp->prio[prio].limit.this) {
- ErtsRunQueue *n_rq = mp->prio[prio].runq;
- if (n_rq) {
- if (prio == ERTS_PORT_PRIO_LEVEL)
- len = RUNQ_READ_LEN(&n_rq->ports.info.len);
- else
- len = RUNQ_READ_LEN(&n_rq->procs.prio_info[prio].len);
-
- if (len < mp->prio[prio].limit.other)
- return n_rq;
+#endif
+ {
+
+ if (prio == ERTS_PORT_PRIO_LEVEL)
+ len = RUNQ_READ_LEN(&c_rq->ports.info.len);
+ else
+ len = RUNQ_READ_LEN(&c_rq->procs.prio_info[prio].len);
+
+ if (len > mp->prio[prio].limit.this) {
+ ErtsRunQueue *n_rq = mp->prio[prio].runq;
+ if (n_rq) {
+ if (prio == ERTS_PORT_PRIO_LEVEL)
+ len = RUNQ_READ_LEN(&n_rq->ports.info.len);
+ else
+ len = RUNQ_READ_LEN(&n_rq->procs.prio_info[prio].len);
+
+ if (len < mp->prio[prio].limit.other)
+ return n_rq;
+ }
}
}
}
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index 953edf79ea..50d3e63c58 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2000-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2000-2014. 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
@@ -1126,6 +1126,7 @@ extern unsigned tag_val_def(Wterm);
#define make_tuple_rel make_boxed_rel
#define make_external_rel make_boxed_rel
#define make_internal_ref_rel make_boxed_rel
+#define make_big_rel make_boxed_rel
#define binary_val_rel(RTERM, BASE) binary_val(rterm2wterm(RTERM, BASE))
#define list_val_rel(RTERM, BASE) list_val(rterm2wterm(RTERM, BASE))
diff --git a/erts/emulator/beam/erl_vm.h b/erts/emulator/beam/erl_vm.h
index 337422eead..b7de8208ad 100644
--- a/erts/emulator/beam/erl_vm.h
+++ b/erts/emulator/beam/erl_vm.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -46,7 +46,6 @@
heap data on the C stack or if we use the buffers in the scheduler data. */
#define TMP_HEAP_SIZE 128 /* Number of Eterm in the schedulers
small heap for transient heap data */
-#define CMP_TMP_HEAP_SIZE 32 /* cmp wants its own tmp-heap... */
#define ERL_ARITH_TMP_HEAP_SIZE 4 /* as does erl_arith... */
#define BEAM_EMU_TMP_HEAP_SIZE 2 /* and beam_emu... */
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index c183c519ff..83a8911a36 100755
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -371,9 +371,9 @@ extern int stackdump_on_exit;
*/
typedef struct {
- UWord* start;
- UWord* sp;
- UWord* end;
+ Eterm* start;
+ Eterm* sp;
+ Eterm* end;
ErtsAlcType_t alloc_type;
}ErtsEStack;
@@ -384,7 +384,7 @@ void erl_grow_estack(ErtsEStack*, Eterm* def_stack);
#define ESTK_DEF_STACK(s) ESTK_CONCAT(s,_default_estack)
#define DECLARE_ESTACK(s) \
- UWord ESTK_DEF_STACK(s)[DEF_ESTACK_SIZE]; \
+ Eterm ESTK_DEF_STACK(s)[DEF_ESTACK_SIZE]; \
ErtsEStack s = { \
ESTK_DEF_STACK(s), /* start */ \
ESTK_DEF_STACK(s), /* sp */ \
@@ -418,8 +418,8 @@ do {\
if (s.start == ESTK_DEF_STACK(s)) {\
UWord _wsz = ESTACK_COUNT(s);\
(dst)->start = erts_alloc(s.alloc_type,\
- DEF_ESTACK_SIZE * sizeof(UWord));\
- memcpy((dst)->start, s.start,_wsz*sizeof(UWord));\
+ DEF_ESTACK_SIZE * sizeof(Eterm));\
+ memcpy((dst)->start, s.start,_wsz*sizeof(Eterm));\
(dst)->sp = (dst)->start + _wsz;\
(dst)->end = (dst)->start + DEF_ESTACK_SIZE;\
(dst)->alloc_type = s.alloc_type;\
@@ -495,7 +495,7 @@ typedef struct {
#define DEF_WSTACK_SIZE (16)
-void erl_grow_wstack(ErtsWStack*, Eterm* def_stack);
+void erl_grow_wstack(ErtsWStack*, UWord* def_stack);
#define WSTK_CONCAT(a,b) a##b
#define WSTK_DEF_STACK(s) WSTK_CONCAT(s,_default_wstack)
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 7f8bdcb2ca..e0776cf67d 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -2688,11 +2688,6 @@ tailrecur_ne:
{
FloatDef f1, f2;
Eterm big;
-#if HEAP_ON_C_STACK
- Eterm big_buf[CMP_TMP_HEAP_SIZE]; /* If HEAP_ON_C_STACK */
-#else
- Eterm *big_buf = erts_get_scheduler_data()->cmp_tmp_heap;
-#endif
#if HALFWORD_HEAP
Wterm aw = is_immed(a) ? a : rterm2wterm(a,a_base);
Wterm bw = is_immed(b) ? b : rterm2wterm(b,b_base);
@@ -2703,6 +2698,8 @@ tailrecur_ne:
#define MAX_LOSSLESS_FLOAT ((double)((1LL << 53) - 2))
#define MIN_LOSSLESS_FLOAT ((double)(((1LL << 53) - 2)*-1))
#define BIG_ARITY_FLOAT_MAX (1024 / D_EXP) /* arity of max float as a bignum */
+ Eterm big_buf[BIG_NEED_SIZE(BIG_ARITY_FLOAT_MAX)];
+
b_tag = tag_val_def(bw);
switch(_NUMBER_CODE(a_tag, b_tag)) {
@@ -2718,8 +2715,9 @@ tailrecur_ne:
/* Float is within the no loss limit */
f1.fd = signed_val(aw);
j = float_comp(f1.fd, f2.fd);
+ }
#if ERTS_SIZEOF_ETERM == 8
- } else if (f2.fd > (double) (MAX_SMALL + 1)) {
+ else if (f2.fd > (double) (MAX_SMALL + 1)) {
/* Float is a positive bignum, i.e. bigger */
j = -1;
} else if (f2.fd < (double) (MIN_SMALL - 1)) {
@@ -2730,7 +2728,7 @@ tailrecur_ne:
j = signed_val(aw) - (Sint) f2.fd;
}
#else
- } else {
+ else {
/* If float is positive it is bigger than small */
j = (f2.fd > 0.0) ? -1 : 1;
}
@@ -2764,8 +2762,8 @@ tailrecur_ne:
j = float_comp(f1.fd, f2.fd);
}
} else {
- big = double_to_big(f2.fd, big_buf);
- j = big_comp(aw, big);
+ big = double_to_big(f2.fd, big_buf, sizeof(big_buf)/sizeof(Eterm));
+ j = big_comp(aw, rterm2wterm(big,big_buf));
}
if (_NUMBER_CODE(a_tag, b_tag) == FLOAT_BIG) {
j = -j;
@@ -2777,8 +2775,9 @@ tailrecur_ne:
/* Float is within the no loss limit */
f2.fd = signed_val(bw);
j = float_comp(f1.fd, f2.fd);
+ }
#if ERTS_SIZEOF_ETERM == 8
- } else if (f1.fd > (double) (MAX_SMALL + 1)) {
+ else if (f1.fd > (double) (MAX_SMALL + 1)) {
/* Float is a positive bignum, i.e. bigger */
j = 1;
} else if (f1.fd < (double) (MIN_SMALL - 1)) {
@@ -2789,7 +2788,7 @@ tailrecur_ne:
j = (Sint) f1.fd - signed_val(bw);
}
#else
- } else {
+ else {
/* If float is positive it is bigger than small */
j = (f1.fd > 0.0) ? 1 : -1;
}
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 80937dfcc8..4a861b121c 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -854,9 +854,10 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n)
#define INET_IFNAMSIZ 16
/* INET Ignore states */
-#define INET_IGNORE_NONE 0
-#define INET_IGNORE_READ 1
-#define INET_IGNORE_WRITE 1 << 1
+#define INET_IGNORE_NONE 0
+#define INET_IGNORE_READ (1 << 0)
+#define INET_IGNORE_WRITE (1 << 1)
+#define INET_IGNORE_PASSIVE (1 << 2)
/* Max length of Erlang Term Buffer (for outputting structured terms): */
#ifdef HAVE_SCTP
@@ -8307,11 +8308,19 @@ static ErlDrvSSizeT inet_ctl(inet_descriptor* desc, int cmd, char* buf,
if (*buf == 1 && !desc->is_ignored) {
sock_select(desc, (FD_READ|FD_WRITE|FD_CLOSE|ERL_DRV_USE_NO_CALLBACK), 0);
- desc->is_ignored = INET_IGNORE_READ;
+ if (desc->active)
+ desc->is_ignored = INET_IGNORE_READ;
+ else
+ desc->is_ignored = INET_IGNORE_PASSIVE;
} else if (*buf == 0 && desc->is_ignored) {
- int flags = (FD_READ|FD_CLOSE|((desc->is_ignored & INET_IGNORE_WRITE)?FD_WRITE:0));
+ int flags = FD_CLOSE;
+ if (desc->is_ignored & INET_IGNORE_READ)
+ flags |= FD_READ;
+ if (desc->is_ignored & INET_IGNORE_WRITE)
+ flags |= FD_WRITE;
desc->is_ignored = INET_IGNORE_NONE;
- sock_select(desc, flags, 1);
+ if (flags != FD_CLOSE)
+ sock_select(desc, flags, 1);
} else
return ctl_error(EINVAL, rbuf, rsize);
@@ -8988,6 +8997,8 @@ static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd,
driver_set_timer(desc->inet.port, timeout);
if (!INETP(desc)->is_ignored)
sock_select(INETP(desc),(FD_READ|FD_CLOSE),1);
+ else
+ INETP(desc)->is_ignored |= INET_IGNORE_READ;
}
}
return ctl_reply(INET_REP_OK, tbuf, 2, rbuf, rsize);
diff --git a/erts/emulator/test/match_spec_SUITE.erl b/erts/emulator/test/match_spec_SUITE.erl
index bcc46d78ba..330bef7104 100644
--- a/erts/emulator/test/match_spec_SUITE.erl
+++ b/erts/emulator/test/match_spec_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2014. 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
@@ -25,6 +25,7 @@
trace_control_word/1, silent/1, silent_no_ms/1, silent_test/1,
ms_trace2/1, ms_trace3/1, boxed_and_small/1,
destructive_in_test_bif/1, guard_exceptions/1,
+ empty_list/1,
unary_plus/1, unary_minus/1, moving_labels/1]).
-export([fpe/1]).
-export([otp_9422/1]).
@@ -60,6 +61,7 @@ all() ->
guard_exceptions, unary_plus, unary_minus, fpe,
moving_labels,
faulty_seq_trace,
+ empty_list,
otp_9422];
true -> [not_run]
end.
@@ -897,6 +899,11 @@ fpe(Config) when is_list(Config) ->
_ -> ok
end.
+empty_list(Config) when is_list(Config) ->
+ Val=[{'$1',[], [{message,'$1'},{message,{caller}},{return_trace}]}],
+ %% Did crash debug VM in faulty assert:
+ erlang:match_spec_test([],Val,trace).
+
moving_labels(Config) when is_list(Config) ->
%% Force an andalso/orelse construction to be moved by placing it
%% in a tuple followed by a constant term. Labels should still
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index c30203c632..78a50744ef 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -135,6 +135,7 @@ static char *pluss_val_switches[] = {
"ws",
"ss",
"pp",
+ "ub",
NULL
};
/* +h arguments with values */
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index be8343e87e..78fefbea55 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -86,6 +86,7 @@ run_valgrind=no
# Default rootdir
ROOTDIR=%SRC_ROOTDIR%
BINDIR="$ROOTDIR/bin/`$ROOTDIR/erts/autoconf/config.guess`"
+TARGET=%TARGET%
#BINDIR="$ROOTDIR/bin/%TARGET%"
PROGNAME=$ROOTDIR/bin/cerl
EMU=beam
@@ -248,6 +249,12 @@ while [ $# -gt 0 ]; do
done
+if [ ! -f $BINDIR/erlexec -a -f $ROOTDIR/bin/$TARGET/erlexec ]; then
+ # We are in a strange target (I'm looking at you openbsd) where
+ # TARGET != config.guess
+ BINDIR=$ROOTDIR/bin/$TARGET
+fi
+
PATH=$BINDIR:$ROOTDIR/bin:$PATH
EXEC=$BINDIR/erlexec
diff --git a/erts/test/z_SUITE.erl b/erts/test/z_SUITE.erl
index da72b18f05..056561d3db 100644
--- a/erts/test/z_SUITE.erl
+++ b/erts/test/z_SUITE.erl
@@ -116,7 +116,7 @@ find_cerl(false) ->
end;
find_cerl(DBTop) ->
case catch filelib:wildcard(filename:join([DBTop,
- "otp_src_R*",
+ "otp_src_*",
"bin",
"cerl"])) of
[Cerl | _ ] ->
@@ -242,7 +242,7 @@ dump_core(#core_search_conf{ cerl = Cerl }, Core) ->
_ ->
os:cmd(Cerl ++ " -dump " ++ Core)
end,
- ct:log("~s~n~n~s",[Core,Dump]).
+ ct:log("~ts~n~n~ts",[Core,Dump]).
format_core(Conf, {ignore, Core}) ->
diff --git a/lib/common_test/doc/src/run_test_chapter.xml b/lib/common_test/doc/src/run_test_chapter.xml
index 44fe73d24f..a4a77ee400 100644
--- a/lib/common_test/doc/src/run_test_chapter.xml
+++ b/lib/common_test/doc/src/run_test_chapter.xml
@@ -215,7 +215,7 @@
<pre>-exit_status ignore_config</pre>
<p>For more information about the <c>ct_run</c> program, see the
- <seealso marker="ct_run#top">Reference Manual</seealso> and the
+ <seealso marker="ct_run">Reference Manual</seealso> and the
<seealso marker="install_chapter#general">Installation</seealso> chapter.
</p>
</section>
diff --git a/lib/compiler/src/beam_except.erl b/lib/compiler/src/beam_except.erl
index e5ec1bd904..d261809765 100644
--- a/lib/compiler/src/beam_except.erl
+++ b/lib/compiler/src/beam_except.erl
@@ -131,9 +131,13 @@ translate_exception(_, _, _, _) -> no.
fix_block(Is, 0) ->
reverse(Is);
-fix_block(Is0, Words) ->
- [{set,[],[],{alloc,Live,{F1,F2,Needed,F3}}}|Is] = reverse(Is0),
- [{set,[],[],{alloc,Live,{F1,F2,Needed-Words,F3}}}|Is].
+fix_block(Is, Words) ->
+ fix_block_1(reverse(Is), Words).
+
+fix_block_1([{set,[],[],{alloc,Live,{F1,F2,Needed,F3}}}|Is], Words) ->
+ [{set,[],[],{alloc,Live,{F1,F2,Needed-Words,F3}}}|Is];
+fix_block_1([I|Is], Words) ->
+ [I|fix_block_1(Is, Words)].
dig_out_block_fc([{set,[],[],{alloc,Live,_}}|Bl]) ->
case dig_out_fc(Bl, Live-1, nil) of
diff --git a/lib/compiler/test/beam_except_SUITE.erl b/lib/compiler/test/beam_except_SUITE.erl
index bf67eedd5f..d088863c5c 100644
--- a/lib/compiler/test/beam_except_SUITE.erl
+++ b/lib/compiler/test/beam_except_SUITE.erl
@@ -57,6 +57,11 @@ coverage(_) ->
{'EXIT',{undef,[{erlang,error,[a,b,c],_}|_]}} =
(catch erlang:error(a, b, c)),
+
+ {'EXIT',{badarith,[{?MODULE,bar,1,[File,{line,9}]}|_]}} =
+ (catch bar(x)),
+ {'EXIT',{{case_clause,{1}},[{?MODULE,bar,1,[File,{line,9}]}|_]}} =
+ (catch bar(0)),
ok.
-file("fake.erl", 1).
@@ -65,3 +70,8 @@ fc(a) -> %Line 2
fc(L) when length(L) > 2 -> %Line 4
%% Not the same as a "real" function_clause error.
error(function_clause, [L]). %Line 6
+%% Would crash the compiler.
+bar(X) -> %Line 8
+ case {X+1} of %Line 9
+ 1 -> ok %Line 10
+ end. %Line 11
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index aa60bba96a..40f829e704 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -452,17 +452,17 @@
</func>
<func>
- <name>private_decrypt(Type, ChipherText, PrivateKey, Padding) -> PlainText</name>
- <fsummary>Decrypts ChipherText using the private Key.</fsummary>
+ <name>private_decrypt(Type, CipherText, PrivateKey, Padding) -> PlainText</name>
+ <fsummary>Decrypts CipherText using the private Key.</fsummary>
<type>
<v>Type = rsa</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
<v>PrivateKey = rsa_private()</v>
<v>Padding = rsa_pkcs1_padding | rsa_pkcs1_oaep_padding | rsa_no_padding</v>
<v>PlainText = binary()</v>
</type>
<desc>
- <p>Decrypts the <c>ChipherText</c>, encrypted with
+ <p>Decrypts the <c>CipherText</c>, encrypted with
<seealso marker="#public_encrypt-4">public_encrypt/4</seealso> (or equivalent function)
using the <c>PrivateKey</c>, and returns the
plaintext (message digest). This is a low level signature verification operation
@@ -473,7 +473,7 @@
</func>
<func>
- <name>private_encrypt(Type, PlainText, PrivateKey, Padding) -> ChipherText</name>
+ <name>private_encrypt(Type, PlainText, PrivateKey, Padding) -> CipherText</name>
<fsummary>Encrypts PlainText using the private Key.</fsummary>
<type>
<v>Type = rsa</v>
@@ -484,7 +484,7 @@
used, where N is public modulus of the RSA key.</d>
<v>PrivateKey = rsa_private()</v>
<v>Padding = rsa_pkcs1_padding | rsa_no_padding</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
</type>
<desc>
<p>Encrypts the <c>PlainText</c> using the <c>PrivateKey</c>
@@ -496,17 +496,17 @@
</desc>
</func>
<func>
- <name>public_decrypt(Type, ChipherText, PublicKey, Padding) -> PlainText</name>
- <fsummary>Decrypts ChipherText using the public Key.</fsummary>
+ <name>public_decrypt(Type, CipherText, PublicKey, Padding) -> PlainText</name>
+ <fsummary>Decrypts CipherText using the public Key.</fsummary>
<type>
<v>Type = rsa</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
<v>PublicKey = rsa_public() </v>
<v>Padding = rsa_pkcs1_padding | rsa_no_padding</v>
<v>PlainText = binary()</v>
</type>
<desc>
- <p>Decrypts the <c>ChipherText</c>, encrypted with
+ <p>Decrypts the <c>CipherText</c>, encrypted with
<seealso marker="#private_encrypt-4">private_encrypt/4</seealso>(or equivalent function)
using the <c>PrivateKey</c>, and returns the
plaintext (message digest). This is a low level signature verification operation
@@ -517,7 +517,7 @@
</func>
<func>
- <name>public_encrypt(Type, PlainText, PublicKey, Padding) -> ChipherText</name>
+ <name>public_encrypt(Type, PlainText, PublicKey, Padding) -> CipherText</name>
<fsummary>Encrypts PlainText using the public Key.</fsummary>
<type>
<v>Type = rsa</v>
@@ -528,7 +528,7 @@
used, where N is public modulus of the RSA key.</d>
<v>PublicKey = rsa_public()</v>
<v>Padding = rsa_pkcs1_padding | rsa_pkcs1_oaep_padding | rsa_no_padding</v>
- <v>ChipherText = binary()</v>
+ <v>CipherText = binary()</v>
</type>
<desc>
<p>Encrypts the <c>PlainText</c> (message digest) using the <c>PublicKey</c>
diff --git a/lib/crypto/src/Makefile b/lib/crypto/src/Makefile
index eabfd676c5..c185c159e5 100644
--- a/lib/crypto/src/Makefile
+++ b/lib/crypto/src/Makefile
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1999-2013. All Rights Reserved.
+# Copyright Ericsson AB 1999-2014. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -35,11 +35,8 @@ RELSYSDIR = $(RELEASE_PATH)/lib/crypto-$(VSN)
# ----------------------------------------------------
MODULES= \
- crypto_app \
crypto \
- crypto_ec_curves \
- crypto_server \
- crypto_sup
+ crypto_ec_curves
HRL_FILES=
diff --git a/lib/crypto/src/crypto.app.src b/lib/crypto/src/crypto.app.src
index 161ea7c9fe..d3084ff336 100644
--- a/lib/crypto/src/crypto.app.src
+++ b/lib/crypto/src/crypto.app.src
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2014. 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,16 +17,12 @@
%% %CopyrightEnd%
%%
{application, crypto,
- [{description, "CRYPTO version 2"},
+ [{description, "CRYPTO"},
{vsn, "%VSN%"},
{modules, [crypto,
- crypto_ec_curves,
- crypto_app,
- crypto_sup,
- crypto_server]},
- {registered, [crypto_sup, crypto_server]},
+ crypto_ec_curves]},
+ {registered, []},
{applications, [kernel, stdlib]},
- {env, []},
- {mod, {crypto_app, []}}]}.
+ {env, []}]}.
diff --git a/lib/crypto/src/crypto_app.erl b/lib/crypto/src/crypto_app.erl
deleted file mode 100644
index f1ea1406e4..0000000000
--- a/lib/crypto/src/crypto_app.erl
+++ /dev/null
@@ -1,39 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%% Purpose : Application master for CRYPTO.
-
--module(crypto_app).
-
--behaviour(application).
-
--export([start/2, stop/1]).
-
-%% start/2(Type, StartArgs) -> {ok, Pid} | {ok, Pid, State} |
-%% {error, Reason}
-%%
-start(_Type, _StartArgs) ->
- crypto_sup:start_link().
-
-%% stop(State) -> void()
-%%
-stop(_State) ->
- ok.
-
-
diff --git a/lib/crypto/src/crypto_server.erl b/lib/crypto/src/crypto_server.erl
deleted file mode 100644
index 89650a9f06..0000000000
--- a/lib/crypto/src/crypto_server.erl
+++ /dev/null
@@ -1,68 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%% Purpose: Provide cryptographic algorithms.
-
--module(crypto_server).
-
--behaviour(gen_server).
-
--export([start_link/0]).
-
-%% Internal exports, call-back functions.
--export([init/1,handle_call/3,handle_cast/2,handle_info/2,code_change/3,
- terminate/2]).
-
-
-%%% --------------------------------------------------------
-%%% Interface Functions.
-%%% --------------------------------------------------------
-
-start_link() ->
- gen_server:start_link({local, crypto_server}, crypto_server, [], []).
-
-init([]) ->
- {ok,[]}.
-
-
-
-%%% --------------------------------------------------------
-%%% The call-back functions.
-%%% --------------------------------------------------------
-
-handle_call(_, _, State) ->
- {noreply, State}.
-
-handle_cast(_, State) ->
- {noreply, State}.
-
-handle_info(_, State) ->
- {noreply, State}.
-
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-terminate(_Reason, _State) ->
- [].
-
-
-
-
-
-
diff --git a/lib/crypto/src/crypto_sup.erl b/lib/crypto/src/crypto_sup.erl
deleted file mode 100644
index 8ef58777ab..0000000000
--- a/lib/crypto/src/crypto_sup.erl
+++ /dev/null
@@ -1,39 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%% Purpose: Main supervisor in CRYPTO application.
-
--module(crypto_sup).
-
--behaviour(supervisor).
-
--export([start_link/0, init/1]).
-
-start_link() ->
- supervisor:start_link({local, crypto_sup}, crypto_sup, []).
-
-
-%% init([])
-%% Returns: {ok, {SupFlags, [ChildSpec]}}
-%%
-init([]) ->
- Child = {crypto_server, {crypto_server, start_link, []},
- permanent, 2000, worker, [crypto_server]},
- {ok, {{one_for_all, 10, 3600}, [Child]}}.
-
diff --git a/lib/debugger/priv/erlang_bug.png b/lib/debugger/priv/erlang_bug.png
index 87c8279654..200f531484 100644
--- a/lib/debugger/priv/erlang_bug.png
+++ b/lib/debugger/priv/erlang_bug.png
Binary files differ
diff --git a/lib/diameter/bin/diameterc b/lib/diameter/bin/diameterc
index d31f341c36..2c9a8f555c 100755
--- a/lib/diameter/bin/diameterc
+++ b/lib/diameter/bin/diameterc
@@ -4,7 +4,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -74,7 +74,7 @@ compile(#argv{file = File, options = Opts, output = Out}) ->
ok ->
0;
{error, Reason} ->
- error_msg(Reason, []),
+ error_msg(diameter_make:format_error(Reason), []),
1
catch
error: Reason ->
diff --git a/lib/diameter/doc/src/diameter_make.xml b/lib/diameter/doc/src/diameter_make.xml
index e1673378df..13ec5bbfc1 100644
--- a/lib/diameter/doc/src/diameter_make.xml
+++ b/lib/diameter/doc/src/diameter_make.xml
@@ -16,7 +16,7 @@
<header>
<copyright>
<year>2012</year>
-<year>2013</year>
+<year>2014</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -175,6 +175,10 @@ Note that a dictionary's <c>&dict_name;</c>, together with the
The <c>&dict_name;</c> of a literal input dictionary defaults to
<c>dictionary</c>.</p>
+<p>
+A returned error reason can be converted into a readable string using
+&format_error;.</p>
+
</desc>
</func>
@@ -206,6 +210,18 @@ The return value is also a parsed dictionary.</p>
</desc>
</func>
+<!-- ===================================================================== -->
+
+<func>
+<name>format_error(Reason) -> string()</name>
+<fsummary>Turn an error reason into a readable string.</fsummary>
+<desc>
+
+<p>
+Turn an error reason returned by &codec; into a readable string.</p>
+</desc>
+</func>
+
</funcs>
<!-- ===================================================================== -->
diff --git a/lib/diameter/doc/src/diameter_sctp.xml b/lib/diameter/doc/src/diameter_sctp.xml
index fb7075f2cd..6302cb1435 100644
--- a/lib/diameter/doc/src/diameter_sctp.xml
+++ b/lib/diameter/doc/src/diameter_sctp.xml
@@ -15,7 +15,8 @@
<erlref>
<header>
<copyright>
-<year>2011</year><year>2013</year>
+<year>2011</year>
+<year>2014</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -113,7 +114,7 @@ and port respectively.</p>
<p>
Multiple <c>ip</c> options can be specified for a multihomed peer.
If none are specified then the values of <c>Host-IP-Address</c>
-in the <c>#diameter_service{}</c> record are used.
+in the <c>diameter_service</c> record are used.
(In particular, one of these must be specified.)
Option <c>port</c> defaults to 3868 for a listening transport and 0 for a
connecting transport.</p>
@@ -131,25 +132,18 @@ the buffer size.</p>
</warning>
<p>
-diameter_sctp uses the <c>transport_data</c> field of
-the <c>#diameter_packet{}</c> record to communicate the stream on which an
-inbound message has been received, or on which an outbound message
-should be sent: the value will be of the form <c>{stream, Id}</c>
-on an inbound message passed to a &app_handle_request; or
-&app_handle_answer; callback.
-For an outbound message, either <c>undefined</c> (explicitly or
-by receiving the outbound message as a <c>binary()</c>) or a tuple
-should be set in the return value of &app_handle_request;
-(typically by retaining the value passed into this function)
-or &app_prepare_request;.
-The value <c>undefined</c> uses a "next outbound stream" id and
-increments this modulo the total number outbound streams.
-That is, successive values of <c>undefined</c> cycle through all
-outbound streams.</p>
-
-<!-- TODO: Some way of getting at the number of available outbound -->
-<!-- streams. -->
-
+The <c>transport_data</c> field of record <c>diameter_packet</c>
+is used to communicate the stream on which an inbound message
+has been received, or on which an outbound message should be sent.
+The value will be of the form <c>{stream, Id}</c> for an inbound
+message passed to a &app_handle_request; or &app_handle_answer;
+callback.
+For an outbound message, <c>{outstream, Id}</c> in the return value of
+&app_handle_request; or &app_prepare_retransmit; sets the outbound
+stream, the stream id being interpreted modulo the number of outbound
+streams.
+Any other value, or not setting a value, causes successive such sends
+to cycle though all outbound streams.</p>
</desc>
</func>
diff --git a/lib/diameter/doc/src/seealso.ent b/lib/diameter/doc/src/seealso.ent
index 7bf7460351..44541afb9b 100644
--- a/lib/diameter/doc/src/seealso.ent
+++ b/lib/diameter/doc/src/seealso.ent
@@ -4,7 +4,7 @@
%CopyrightBegin%
-Copyright Ericsson AB 2012-2013. All Rights Reserved.
+Copyright Ericsson AB 2012-2014. 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
@@ -117,6 +117,7 @@ significant.
<!ENTITY make_codec '<seealso marker="diameter_make#codec-2">diameter_make:codec/2</seealso>'>
<!ENTITY make_format '<seealso marker="diameter_make#format-1">diameter_make:format/1</seealso>'>
<!ENTITY make_flatten '<seealso marker="diameter_make#flatten-1">diameter_make:flatten/1</seealso>'>
+<!ENTITY make_format_error '<seealso marker="diameter_make#format_error-1">diameter_make:format_error/1</seealso>'>
<!-- diameter_transport -->
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index 282276827f..f76bd96c3c 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -189,11 +189,7 @@ i({Ack, WPid, {M, Ref} = T, Opts, {Mask, Nodes, Dict0, Svc}}) ->
putr(?RESTRICT_KEY, Nodes),
Tmo = proplists:get_value(capx_timeout, Opts, ?EVENT_TIMEOUT),
- ?IS_TIMEOUT(Tmo) orelse ?ERROR({invalid, {capx_timeout, Tmo}}),
OnLengthErr = proplists:get_value(length_errors, Opts, exit),
- lists:member(OnLengthErr, [exit, handle, discard])
- orelse ?ERROR({invalid, {length_errors, OnLengthErr}}),
- %% Error checking is for configuration added in old code.
{TPid, Addrs} = start_transport(T, Rest, Svc),
@@ -782,10 +778,6 @@ set([_|_] = Ans, FailedAvp) ->
result_code(#diameter_header{is_error = true}, _) ->
{3008, []}; %% DIAMETER_INVALID_HDR_BITS
-result_code(_, [Bs|_])
- when is_bitstring(Bs) -> %% from old code
- {3009, []}; %% DIAMETER_INVALID_HDR_BITS
-
result_code(#diameter_header{version = ?DIAMETER_VERSION}, Es) ->
rc(Es);
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index 70e66537ed..1274e0fc48 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -701,8 +701,7 @@ notify(Share, SvcName, T) ->
Nodes = remotes(Share),
[] /= Nodes andalso diameter_peer:notify(Nodes, SvcName, T).
%% Test for the empty list for upgrade reasons: there's no
-%% diameter_peer:notify/3 in old code so no call means no load order
-%% requirement.
+%% diameter_peer:notify/3 in old code.
remotes(false) ->
[];
diff --git a/lib/diameter/src/base/diameter_stats.erl b/lib/diameter/src/base/diameter_stats.erl
index b68d4af11f..8353613d32 100644
--- a/lib/diameter/src/base/diameter_stats.erl
+++ b/lib/diameter/src/base/diameter_stats.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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,9 +245,6 @@ handle_call({read, Refs, Del}, _From, State) ->
handle_call({read, Refs}, _, State) ->
{reply, read_refs(Refs), State};
-handle_call({flush, Refs}, _From, State) -> %% from old code
- {reply, to_refdict(read(Refs, true)), State};
-
handle_call(Req, From, State) ->
?UNEXPECTED([Req, From]),
{reply, nok, State}.
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 8b6f026b34..7fbb306b02 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2013. All Rights Reserved.
+%% Copyright Ericsson AB 2013-2014. 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
@@ -90,9 +90,6 @@ make_recvdata([SvcName, PeerT, Apps, Mask | _]) ->
peerT = PeerT,
apps = Apps,
sequence = Mask}.
-%% Take a list so that the caller (diameter_service) can be upgraded
-%% first if new members are added. Note that receive_message/4 might
-%% still get an old term from any watchdog started in old code.
%% ---------------------------------------------------------------------------
%% peer_up/1
@@ -305,15 +302,6 @@ errors(_, #diameter_packet{header = #diameter_header{version = V},
when V /= ?DIAMETER_VERSION ->
Pkt#diameter_packet{errors = [5011 | Es]};
-%% DIAMETER_INVALID_AVP_BITS 3009
-%% A request was received that included an AVP whose flag bits are
-%% set to an unrecognized value, or that is inconsistent with the
-%% AVP's definition.
-
-errors(_, #diameter_packet{errors = [Bs | Es]} = Pkt)
- when is_bitstring(Bs) -> %% from old code
- Pkt#diameter_packet{errors = [3009 | Es]};
-
%% DIAMETER_COMMAND_UNSUPPORTED 3001
%% The Request contained a Command-Code that the receiver did not
%% recognize or support. This MUST be used when a Diameter node
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index 9a1c8b6585..53e659e3f6 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -157,8 +157,7 @@ wait(Ref, Pid) ->
config(Opts) ->
Config = proplists:get_value(watchdog_config, Opts, []),
- is_list(Config) orelse config_error({watchdog_config, Config}),
- lists:foldl(fun config/2, #config{}, Config). %% ^ added in old code
+ lists:foldl(fun config/2, #config{}, Config).
config({suspect, N}, Rec)
when ?IS_NATURAL(N) ->
@@ -166,10 +165,7 @@ config({suspect, N}, Rec)
config({okay, N}, Rec)
when ?IS_NATURAL(N) ->
- Rec#config{okay = N};
-
-config(T, _) -> %% added in old code
- config_error(T).
+ Rec#config{okay = N}.
%% start/5
@@ -252,17 +248,6 @@ handle_info(T, #watchdog{} = State) ->
?LOG(stop, T),
event(T, State, State#watchdog{status = down}),
{stop, {shutdown, T}, State}
- end;
-
-handle_info(T, State) -> %% started in old code
- handle_info(T, upgrade(State)).
-
-upgrade(State) ->
- case erlang:append_element(State, #config{}) of
- #watchdog{status = okay, config = #config{suspect = OS}} = S ->
- S#watchdog{num_dwa = OS};
- #watchdog{} = S ->
- S
end.
close({'DOWN', _, process, TPid, {shutdown, Reason}},
diff --git a/lib/diameter/src/compiler/diameter_dict_util.erl b/lib/diameter/src/compiler/diameter_dict_util.erl
index 3941f30e03..136bba16cb 100644
--- a/lib/diameter/src/compiler/diameter_dict_util.erl
+++ b/lib/diameter/src/compiler/diameter_dict_util.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -155,6 +155,8 @@ fmt(grouped_avp_has_wrong_type) ->
"Grouped AVP ~s at line ~p defined with type ~s at line ~p";
fmt(grouped_avp_not_defined) ->
"Grouped AVP ~s on line ~p not defined in @avp_types";
+fmt(grouped_avp_not_grouped) ->
+ "Grouped AVP ~s on line ~p not defined in @grouped";
fmt(grouped_vendor_id_without_flag) ->
"Grouped AVP ~s at line ~p has vendor id "
"but definition at line ~p does not specify V flag";
@@ -401,9 +403,9 @@ read(File) ->
{ok, iolist_to_binary([File])}.
make_dict(Parse, Opts) ->
- make_orddict(pass4(pass3(pass2(pass1(reset(make_dict(Parse),
- Opts))),
- Opts))).
+ Dict = pass3(pass2(pass1(reset(make_dict(Parse), Opts))), Opts),
+ ok = examine(Dict),
+ make_orddict(Dict).
%% make_orddict/1
@@ -1168,7 +1170,7 @@ import_avps(Dict, Opts) ->
Import = inherit(Dict, Opts),
report(imported, Import),
- %% pass4/1 tests that all referenced AVP's are either defined
+ %% examine/1 tests that all referenced AVP's are either defined
%% or imported.
dict:store(import_avps,
@@ -1276,21 +1278,21 @@ dict(Mod) ->
end.
%% ===========================================================================
-%% pass4/1
+%% examine/1
%%
%% Sanity checks.
-pass4(Dict) ->
- dict:fold(fun(K, V, _) -> p4(K, V, Dict) end, ok, Dict),
- Dict.
+examine(Dict) ->
+ dict:fold(fun(K, V, _) -> x(K, V, Dict) end, ok, Dict),
+ ok.
%% Ensure enum AVP's have type Enumerated.
-p4({enum, Name}, [Line | _], Dict)
+x({enum, Name}, [Line | _], Dict)
when is_list(Name) ->
true = is_enumerated_avp(Name, Dict, Line);
%% Ensure all referenced AVP's are either defined locally or imported.
-p4({K, {Name, AvpName}}, [Line | _], Dict)
+x({K, {Name, AvpName}}, [Line | _], Dict)
when (K == grouped orelse K == messages),
is_list(Name),
is_list(AvpName),
@@ -1298,13 +1300,22 @@ p4({K, {Name, AvpName}}, [Line | _], Dict)
true = avp_is_defined(AvpName, Dict, Line);
%% Ditto.
-p4({K, AvpName}, [Line | _], Dict)
+x({K, AvpName}, [Line | _], Dict)
when K == avp_vendor_id;
K == custom_types;
K == codecs ->
true = avp_is_defined(AvpName, Dict, Line);
-p4(_, _, _) ->
+%% Ensure that all local AVP's of type Grouped are also present in @grouped.
+x({avp_types, Name}, [Line | Toks], Dict)
+ when 0 < Line, is_list(Name) ->
+ [{number, _, _Code}, {word, _, Type}, {word, _, _Flags}] = Toks,
+ "Grouped" == Type
+ andalso error == dict:find({grouped, Name}, Dict)
+ andalso ?RETURN(grouped_avp_not_grouped, [Name, Line]),
+ ok;
+
+x(_, _, _) ->
ok.
%% has_enumerated_type/3
diff --git a/lib/diameter/src/compiler/diameter_make.erl b/lib/diameter/src/compiler/diameter_make.erl
index 2f314b7e57..adc7808e49 100644
--- a/lib/diameter/src/compiler/diameter_make.erl
+++ b/lib/diameter/src/compiler/diameter_make.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -33,7 +33,8 @@
-export([codec/2,
codec/1,
format/1,
- flatten/1]).
+ flatten/1,
+ format_error/1]).
-export_type([opt/0]).
@@ -81,8 +82,8 @@ codec(File, Opts) ->
case parse(Dict, Opts) of
{ok, ParseD} ->
make(Path, default(Opts), ParseD);
- {error = E, Reason} ->
- {E, diameter_dict_util:format_error(Reason)}
+ {error, _} = E ->
+ E
end.
codec(File) ->
@@ -115,6 +116,11 @@ flatten([?VERSION = V | Dict]) ->
[grouped, import_groups],
[enum, import_enums]])].
+%% format_error/1
+
+format_error(T) ->
+ diameter_dict_util:format_error(T).
+
%% ===========================================================================
%% flatten/2
diff --git a/lib/diameter/src/diameter.appup.src b/lib/diameter/src/diameter.appup.src
index c7ae8a2828..0d421c229e 100644
--- a/lib/diameter/src/diameter.appup.src
+++ b/lib/diameter/src/diameter.appup.src
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -20,62 +20,37 @@
{"%VSN%",
[
- {"0.9", [{restart_application, diameter}]}, %% R14B03
- {"0.10", [{restart_application, diameter}]}, %% R14B04
- {"1.0", [{restart_application, diameter}]}, %% R15B
- {"1.1", [{restart_application, diameter}]}, %% R15B01
- {"1.2", [{restart_application, diameter}]}, %% R15B02
- {"1.2.1", [{restart_application, diameter}]},
- {"1.3", [{restart_application, diameter}]}, %% R15B03
- {"1.3.1", [{restart_application, diameter}]},
- {"1.4", [{restart_application, diameter}]}, %% R16A
- {"1.4.1", [{restart_application, diameter}]}, %% R16B
+ {"0.9", [{restart_application, diameter}]}, %% R14B03
+ {"0.10", [{restart_application, diameter}]}, %% R14B04
+ {"1.0", [{restart_application, diameter}]}, %% R15B
+ {"1.1", [{restart_application, diameter}]}, %% R15B01
+ {"1.2", [{restart_application, diameter}]}, %% R15B02
+ {"1.2.1", [{restart_application, diameter}]},
+ {"1.3", [{restart_application, diameter}]}, %% R15B03
+ {"1.3.1", [{restart_application, diameter}]},
+ {"1.4", [{restart_application, diameter}]}, %% R16A
+ {"1.4.1", [{restart_application, diameter}]}, %% R16B
{"1.4.1.1", [{restart_application, diameter}]},
- {"1.4.2", [{load_module, diameter_codec}, %% R16B01
- {load_module, diameter_types},
- {load_module, diameter_config},
- {load_module, diameter_capx},
- {load_module, diameter_service},
- {load_module, diameter_peer_fsm},
- {load_module, diameter_watchdog},
- {load_module, diameter}]},
- {"1.4.3", [{load_module, diameter_capx}, %% R16B02
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter_codec},
- {load_module, diameter_types},
- {load_module, diameter_config},
- {load_module, diameter}]},
- {"1.4.4", [{load_module, diameter_capx},
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter_config},
- {load_module, diameter}]}
+ {"1.4.2", [{restart_application, diameter}]}, %% R16B01
+ {"1.4.3", [{restart_application, diameter}]}, %% R16B02
+ {"1.4.4", [{restart_application, diameter}]},
+ {"1.5", [{restart_application, diameter}]} %% R16B03
],
[
- {"0.9", [{restart_application, diameter}]},
- {"0.10", [{restart_application, diameter}]},
- {"1.0", [{restart_application, diameter}]},
- {"1.1", [{restart_application, diameter}]},
- {"1.2", [{restart_application, diameter}]},
- {"1.2.1", [{restart_application, diameter}]},
- {"1.3", [{restart_application, diameter}]},
- {"1.3.1", [{restart_application, diameter}]},
- {"1.4", [{restart_application, diameter}]},
- {"1.4.1", [{restart_application, diameter}]},
+ {"0.9", [{restart_application, diameter}]},
+ {"0.10", [{restart_application, diameter}]},
+ {"1.0", [{restart_application, diameter}]},
+ {"1.1", [{restart_application, diameter}]},
+ {"1.2", [{restart_application, diameter}]},
+ {"1.2.1", [{restart_application, diameter}]},
+ {"1.3", [{restart_application, diameter}]},
+ {"1.3.1", [{restart_application, diameter}]},
+ {"1.4", [{restart_application, diameter}]},
+ {"1.4.1", [{restart_application, diameter}]},
{"1.4.1.1", [{restart_application, diameter}]},
- {"1.4.2", [{restart_application, diameter}]},
- {"1.4.3", [{load_module, diameter_types},
- {load_module, diameter_config},
- {load_module, diameter_codec},
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter_capx},
- {load_module, diameter}]},
- {"1.4.4", [{load_module, diameter_capx},
- {load_module, diameter_config},
- {load_module, diameter_service},
- {load_module, diameter_watchdog},
- {load_module, diameter}]}
+ {"1.4.2", [{restart_application, diameter}]},
+ {"1.4.3", [{restart_application, diameter}]},
+ {"1.4.4", [{restart_application, diameter}]},
+ {"1.5", [{restart_application, diameter}]}
]
}.
diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl
index 49a530b4eb..f5275e66b5 100644
--- a/lib/diameter/src/transport/diameter_sctp.erl
+++ b/lib/diameter/src/transport/diameter_sctp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -70,14 +70,14 @@
-type connect_option() :: {raddr, inet:ip_address()}
| {rport, inet:port_number()}
- | gen_sctp:open_option().
+ | term(). %% gen_sctp:open_option().
-type match() :: inet:ip_address()
| string()
| [match()].
-type listen_option() :: {accept, match()}
- | gen_sctp:open_option().
+ | term(). %% gen_sctp:open_option().
-type uint() :: non_neg_integer().
@@ -338,9 +338,6 @@ handle_call({{accept, Ref}, Pid}, _, #listener{ref = Ref,
{TPid, NewS} = accept(Ref, Pid, S),
{reply, {ok, TPid}, NewS#listener{count = N+1}};
-handle_call(T, From, {listener,_,_,_,_,_,_} = S) -> % started in old code
- handle_call(T, From, upgrade(S));
-
handle_call(_, _, State) ->
{reply, nok, State}.
@@ -359,10 +356,7 @@ handle_info(T, #transport{} = S) ->
{noreply, #transport{} = t(T,S)};
handle_info(T, #listener{} = S) ->
- {noreply, #listener{} = l(T,S)};
-
-handle_info(T, {listener,_,_,_,_,_,_} = S) -> % started in old code
- handle_info(T, upgrade(S)).
+ {noreply, #listener{} = l(T,S)}.
%% ---------------------------------------------------------------------------
%% # code_change/3
@@ -396,9 +390,6 @@ terminate(_, #listener{socket = Sock}) ->
%% ---------------------------------------------------------------------------
-upgrade(S) ->
- #listener{} = erlang:append_element(S, ?DEFAULT_ACCEPT).
-
putr(Key, Val) ->
put({?MODULE, Key}, Val).
@@ -502,8 +493,6 @@ transition({peeloff, Sock, {sctp, LSock, _RA, _RP, _Data} = Msg, Matches},
= S) ->
ok = accept_peer(Sock, Matches),
transition(Msg, S#transport{socket = Sock});
-transition({peeloff = T, _Sock, _Msg} = T, #transport{} = S) ->% from old code
- transition(erlang:append_element(T, ?DEFAULT_ACCEPT), S);
%% Incoming message.
transition({sctp, _Sock, _RA, _RP, Data}, #transport{socket = Sock} = S) ->
@@ -605,11 +594,13 @@ accept(_, Pid, #listener{ref = Ref, pending = {N,Q}} = S) ->
%% send/2
%% Outbound Diameter message on a specified stream ...
-send(#diameter_packet{bin = Bin, transport_data = {stream, SId}}, S) ->
- send(SId, Bin, S),
+send(#diameter_packet{bin = Bin, transport_data = {outstream, SId}},
+ #transport{streams = {_, OS}}
+ = S) ->
+ send(SId rem OS, Bin, S),
S;
-%% ... or not: rotate through all steams.
+%% ... or not: rotate through all streams.
send(Bin, #transport{streams = {_, OS},
os = N}
= S)
diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl
index ed369e8af3..df4dde6240 100644
--- a/lib/diameter/test/diameter_compiler_SUITE.erl
+++ b/lib/diameter/test/diameter_compiler_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. 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
@@ -138,6 +138,9 @@
{grouped_avp_not_defined,
"Failed-AVP *.*",
""},
+ {grouped_avp_not_grouped,
+ "Failed-AVP ::=.*\n.*}",
+ ""},
{grouped_vendor_id_without_flag,
"(Failed-AVP .*)>",
"\\1 668>"},
@@ -397,8 +400,8 @@ replace({E, Mods}, Bin) ->
case {E, parse(B, [{include, here()}]), Mods} of
{ok, {ok, Dict}, _} ->
Dict;
- {_, {error, S}, _} ->
- S
+ {_, {error, {E,_} = T}, _} when E /= ok ->
+ diameter_make:format_error(T)
end.
re({RE, Repl}, Bin) ->
diff --git a/lib/diameter/vsn.mk b/lib/diameter/vsn.mk
index 9fda067f2b..54019fa46c 100644
--- a/lib/diameter/vsn.mk
+++ b/lib/diameter/vsn.mk
@@ -2,7 +2,7 @@
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2010-2013. All Rights Reserved.
+# Copyright Ericsson AB 2010-2014. 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
@@ -18,5 +18,5 @@
# %CopyrightEnd%
APPLICATION = diameter
-DIAMETER_VSN = 1.5
+DIAMETER_VSN = 1.6
APP_VSN = $(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN)
diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c
index 8f1f231b82..c9aa28812c 100644
--- a/lib/erl_interface/src/connect/ei_connect.c
+++ b/lib/erl_interface/src/connect/ei_connect.c
@@ -1161,6 +1161,7 @@ static unsigned int gen_challenge(void)
struct utsname name;
} s;
+ memset(&s, 0, sizeof(s));
gettimeofday(&s.tv, 0);
uname(&s.name);
s.cpu = clock();
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index a6f2933f6a..f77214c589 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -32,7 +32,23 @@
<file>notes.xml</file>
</header>
- <section><title>Inets 5.9.7</title>
+ <section><title>Inets 5.9.8</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Mend max_clients check that was broken and avoid too
+ extensive logging that could cause memory problems.</p>
+ <p>
+ Own Id: OTP-11557 Aux Id: seq12478 </p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Inets 5.9.7</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
diff --git a/lib/kernel/test/sendfile_SUITE.erl b/lib/kernel/test/sendfile_SUITE.erl
index 4cf4c6489d..24884bada5 100644
--- a/lib/kernel/test/sendfile_SUITE.erl
+++ b/lib/kernel/test/sendfile_SUITE.erl
@@ -33,6 +33,7 @@ all() ->
,t_sendfile_offset
,t_sendfile_sendafter
,t_sendfile_recvafter
+ ,t_sendfile_recvafter_remoteclose
,t_sendfile_sendduring
,t_sendfile_recvduring
,t_sendfile_closeduring
@@ -228,6 +229,25 @@ t_sendfile_recvafter(Config) ->
ok = sendfile_send(Send).
+%% This tests specifically for a bug fixed in 17.0
+t_sendfile_recvafter_remoteclose(Config) ->
+ Filename = proplists:get_value(small_file, Config),
+
+ Send = fun(Sock, SFServer) ->
+ {Size, _Data} = sendfile_file_info(Filename),
+ {ok, Size} = file:sendfile(Filename, Sock),
+
+ %% Make sure the remote end has been closed
+ SFServer ! stop,
+ timer:sleep(100),
+
+ %% In the bug this returned {error,ebadf}
+ {error,closed} = gen_tcp:recv(Sock, 1),
+ -1
+ end,
+
+ ok = sendfile_send({127,0,0,1},Send,0).
+
t_sendfile_sendduring(Config) ->
Filename = proplists:get_value(big_file, Config),
diff --git a/lib/observer/priv/erlang_observer.png b/lib/observer/priv/erlang_observer.png
index 01723d210b..cf900a29e6 100644
--- a/lib/observer/priv/erlang_observer.png
+++ b/lib/observer/priv/erlang_observer.png
Binary files differ
diff --git a/lib/odbc/doc/src/notes.xml b/lib/odbc/doc/src/notes.xml
index 2551637001..b254ca3bc9 100644
--- a/lib/odbc/doc/src/notes.xml
+++ b/lib/odbc/doc/src/notes.xml
@@ -31,7 +31,23 @@
<p>This document describes the changes made to the odbc application.
</p>
- <section><title>ODBC 2.10.18</title>
+ <section><title>ODBC 2.10.19</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Updated configure test for header files sql.h and
+ sqlext.h to function correctly on windows.</p>
+ <p>
+ Own Id: OTP-11574</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>ODBC 2.10.18</title>
<section><title>Improvements and New Features</title>
<list>
diff --git a/lib/odbc/vsn.mk b/lib/odbc/vsn.mk
index 6ac83a7718..d9e2ab26a9 100644
--- a/lib/odbc/vsn.mk
+++ b/lib/odbc/vsn.mk
@@ -1 +1 @@
-ODBC_VSN = 2.10.18
+ODBC_VSN = 2.10.19
diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in
index d315a90e18..2bcb93b4dd 100644
--- a/lib/runtime_tools/c_src/Makefile.in
+++ b/lib/runtime_tools/c_src/Makefile.in
@@ -21,11 +21,6 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk
# ----------------------------------------------------
-# Items from top-level configure
-# ----------------------------------------------------
-DTRACE_ENABLED=@DTRACE_ENABLED@
-DTRACE_ENABLED_2STEP=@DTRACE_ENABLED_2STEP@
-# ----------------------------------------------------
# Application version
# ----------------------------------------------------
include ../vsn.mk
@@ -108,28 +103,7 @@ _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR))
debug opt valgrind: $(SOLIBS) $(OBJDIR) $(LIBDIR) $(NIF_LIB)
-ifdef DTRACE_ENABLED
-DTRACE_USER_HEADER=$(OBJDIR)/dtrace_user.h
-$(OBJDIR)/dtrace_user.h: ./dtrace_user.d
- $(dtrace_verbose)dtrace -h -C $(INCLUDES) \
- -s ./dtrace_user.d \
- -o ./dtrace_user.tmp
- $(V_at)sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@
- $(V_at)rm ./dtrace_user.tmp
-else
-DTRACE_USER_HEADER=
-endif
-
-DTRACE_OBJS =
-ifdef DTRACE_ENABLED_2STEP
-DTRACE_OBJS += $(OBJDIR)/dtrace_user.o
-$(OBJDIR)/dtrace_user.o: $(before_DTrace_OBJS) $(OBJDIR)/dtrace_user.h
- $(dtrace_verbose)dtrace -G -C \
- -s ./dtrace_user.d \
- -o $@ $(before_DTrace_OBJS)
-endif
-
-DYNTRACE_OBJS = $(before_DTrace_OBJS) $(DTRACE_OBJS)
+DYNTRACE_OBJS = $(before_DTrace_OBJS)
$(OBJDIR):
-@mkdir -p $(OBJDIR)
@@ -137,7 +111,7 @@ $(OBJDIR):
$(LIBDIR):
-@mkdir -p $(LIBDIR)
-$(OBJDIR)/dyntrace$(TYPEMARKER).o: dyntrace.c $(DTRACE_USER_HEADER)
+$(OBJDIR)/dyntrace$(TYPEMARKER).o: dyntrace.c
$(V_at)$(INSTALL_DIR) $(OBJDIR)
$(V_CC) -c -o $@ $(ALL_CFLAGS) $<
diff --git a/lib/runtime_tools/c_src/dyntrace.c b/lib/runtime_tools/c_src/dyntrace.c
index eef03afd1c..18f91cd7e7 100644
--- a/lib/runtime_tools/c_src/dyntrace.c
+++ b/lib/runtime_tools/c_src/dyntrace.c
@@ -30,9 +30,6 @@
#if defined(USE_DYNAMIC_TRACE) && (defined(USE_DTRACE) || defined(USE_SYSTEMTAP))
#define HAVE_USE_DTRACE 1
#endif
-#ifdef HAVE_USE_DTRACE
-#include "dtrace_user.h"
-#endif
void dtrace_nifenv_str(ErlNifEnv *env, char *process_buf);
void get_string_maybe(ErlNifEnv *env, const ERL_NIF_TERM term, char **ptr, char *buf, int bufsiz);
diff --git a/lib/runtime_tools/doc/src/dbg.xml b/lib/runtime_tools/doc/src/dbg.xml
index bf1a7621fd..d31ccd834d 100644
--- a/lib/runtime_tools/doc/src/dbg.xml
+++ b/lib/runtime_tools/doc/src/dbg.xml
@@ -1024,7 +1024,7 @@ hello</pre>
</desc>
</func>
<func>
- <name>stop() -> stopped</name>
+ <name>stop() -> ok</name>
<fsummary>Stop the <c>dbg</c>server and the tracing of all processes.</fsummary>
<desc>
<p>Stops the <c>dbg</c> server and clears all trace flags for
@@ -1035,7 +1035,7 @@ hello</pre>
</desc>
</func>
<func>
- <name>stop_clear() -> stopped</name>
+ <name>stop_clear() -> ok</name>
<fsummary>Stop the <c>dbg</c>server and the tracing of all processes, and clears trace patterns.</fsummary>
<desc>
<p>Same as stop/0, but also clears all trace patterns on local
diff --git a/lib/runtime_tools/src/dbg.erl b/lib/runtime_tools/src/dbg.erl
index f0086e8cc7..186563ab74 100644
--- a/lib/runtime_tools/src/dbg.erl
+++ b/lib/runtime_tools/src/dbg.erl
@@ -1786,12 +1786,12 @@ h(get_tracer) ->
" - Returns the process or port to which all trace messages are sent."]);
h(stop) ->
help_display(
- ["stop() -> stopped",
+ ["stop() -> ok",
" - Stops the dbg server and the tracing of all processes.",
" Does not clear any trace patterns."]);
h(stop_clear) ->
help_display(
- ["stop_clear() -> stopped",
+ ["stop_clear() -> ok",
" - Stops the dbg server and the tracing of all processes,",
" and clears all trace patterns."]).
diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml
index 89d8be850e..5d5f2e5b91 100644
--- a/lib/ssh/doc/src/ssh.xml
+++ b/lib/ssh/doc/src/ssh.xml
@@ -38,7 +38,7 @@
<item>Supported SSH version is 2.0 </item>
<item>Supported MAC algorithms: hmac-sha1</item>
<item>Supported encryption algorithms: aes128-cb and 3des-cbc</item>
- <item>Supports unicode filenames if the emulator and the underlaying OS supports it. See the DESCRIPTION section in <seealso marker="file">file</seealso> for information about this subject</item>
+ <item>Supports unicode filenames if the emulator and the underlaying OS supports it. See the DESCRIPTION section in <seealso marker="kernel:file">file</seealso> for information about this subject</item>
<item>Supports unicode in shell and cli</item>
</list>
diff --git a/lib/ssl/doc/src/notes.xml b/lib/ssl/doc/src/notes.xml
index fb32ccec7b..0b28b1ebd4 100644
--- a/lib/ssl/doc/src/notes.xml
+++ b/lib/ssl/doc/src/notes.xml
@@ -25,7 +25,41 @@
<file>notes.xml</file>
</header>
<p>This document describes the changes made to the SSL application.</p>
- <section><title>SSL 5.3.2</title>
+ <section><title>SSL 5.3.3</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Add missing validation of the server_name_indication
+ option and test for its explicit use. It was not possible
+ to set or disable the default server_name_indication as
+ the validation of the option was missing.</p>
+ <p>
+ Own Id: OTP-11567</p>
+ </item>
+ <item>
+ <p>
+ Elliptic curve selection in server mode now properly
+ selects a curve suggested by the client, if possible, and
+ the fallback alternative is changed to a more widely
+ supported curve.</p>
+ <p>
+ Own Id: OTP-11575</p>
+ </item>
+ <item>
+ <p>
+ Bug in the TLS hello extension handling caused the server
+ to behave as it did not understand secure renegotiation.</p>
+ <p>
+ Own Id: OTP-11595</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>SSL 5.3.2</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml
index 80ef419fb7..910dca3889 100644
--- a/lib/ssl/doc/src/ssl.xml
+++ b/lib/ssl/doc/src/ssl.xml
@@ -460,6 +460,10 @@ fun(srp, Username :: string(), UserState :: term()) ->
</item>
<tag>{log_alert, boolean()}</tag>
<item>If false, error reports will not be displayed.</item>
+ <tag>{honor_cipher_order, boolean()}</tag>
+ <item>If true, use the server's preference for cipher selection. If false
+ (the default), use the client's preference.
+ </item>
</taglist>
</section>
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl
index a7fd9f5f81..4646468cb6 100644
--- a/lib/ssl/src/ssl.erl
+++ b/lib/ssl/src/ssl.erl
@@ -640,7 +640,8 @@ handle_options(Opts0, _Role) ->
make_next_protocol_selector(
handle_option(client_preferred_next_protocols, Opts, undefined)),
log_alert = handle_option(log_alert, Opts, true),
- server_name_indication = handle_option(server_name_indication, Opts, undefined)
+ server_name_indication = handle_option(server_name_indication, Opts, undefined),
+ honor_cipher_order = handle_option(honor_cipher_order, Opts, false)
},
CbInfo = proplists:get_value(cb_info, Opts, {gen_tcp, tcp, tcp_closed, tcp_error}),
@@ -652,7 +653,8 @@ handle_options(Opts0, _Role) ->
reuse_session, reuse_sessions, ssl_imp,
cb_info, renegotiate_at, secure_renegotiate, hibernate_after,
erl_dist, next_protocols_advertised,
- client_preferred_next_protocols, log_alert, server_name_indication],
+ client_preferred_next_protocols, log_alert,
+ server_name_indication, honor_cipher_order],
SockOpts = lists:foldl(fun(Key, PropList) ->
proplists:delete(Key, PropList)
@@ -840,6 +842,8 @@ validate_option(server_name_indication, disable) ->
disable;
validate_option(server_name_indication, undefined) ->
undefined;
+validate_option(honor_cipher_order, Value) when is_boolean(Value) ->
+ Value;
validate_option(Opt, Value) ->
throw({error, {options, {Opt, Value}}}).
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl
index f5c0034f1b..487dfc01d9 100644
--- a/lib/ssl/src/ssl_handshake.erl
+++ b/lib/ssl/src/ssl_handshake.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2013-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2013-2014. 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
@@ -56,7 +56,7 @@
%% Extensions handling
-export([client_hello_extensions/6,
- handle_client_hello_extensions/8, %% Returns server hello extensions
+ handle_client_hello_extensions/9, %% Returns server hello extensions
handle_server_hello_extensions/9, select_curve/2
]).
@@ -1029,14 +1029,15 @@ cipher_suites(Suites, true) ->
select_session(SuggestedSessionId, CipherSuites, Compressions, Port, #session{ecc = ECCCurve} =
Session, Version,
- #ssl_options{ciphers = UserSuites} = SslOpts, Cache, CacheCb, Cert) ->
+ #ssl_options{ciphers = UserSuites, honor_cipher_order = HCO} = SslOpts,
+ Cache, CacheCb, Cert) ->
{SessionId, Resumed} = ssl_session:server_id(Port, SuggestedSessionId,
SslOpts, Cert,
Cache, CacheCb),
case Resumed of
undefined ->
Suites = available_suites(Cert, UserSuites, Version, ECCCurve),
- CipherSuite = select_cipher_suite(CipherSuites, Suites),
+ CipherSuite = select_cipher_suite(CipherSuites, Suites, HCO),
Compression = select_compression(Compressions),
{new, Session#session{session_id = SessionId,
cipher_suite = CipherSuite,
@@ -1088,17 +1089,19 @@ certificate_authorities_from_db(CertDbHandle, CertDbRef) ->
%%-------------Extension handling --------------------------------
-handle_client_hello_extensions(RecordCB, Random,
- #hello_extensions{renegotiation_info = Info,
- srp = SRP,
- ec_point_formats = ECCFormat,
- next_protocol_negotiation = NextProtocolNegotiation}, Version,
- #ssl_options{secure_renegotiate = SecureRenegotation} = Opts,
- #session{cipher_suite = CipherSuite, compression_method = Compression} = Session0,
- ConnectionStates0, Renegotiation) ->
+handle_client_hello_extensions(RecordCB, Random, ClientCipherSuites,
+ #hello_extensions{renegotiation_info = Info,
+ srp = SRP,
+ ec_point_formats = ECCFormat,
+ next_protocol_negotiation = NextProtocolNegotiation}, Version,
+ #ssl_options{secure_renegotiate = SecureRenegotation} = Opts,
+ #session{cipher_suite = NegotiatedCipherSuite,
+ compression_method = Compression} = Session0,
+ ConnectionStates0, Renegotiation) ->
Session = handle_srp_extension(SRP, Session0),
ConnectionStates = handle_renegotiation_extension(server, RecordCB, Version, Info,
- Random, CipherSuite, Compression,
+ Random, NegotiatedCipherSuite,
+ ClientCipherSuites, Compression,
ConnectionStates0, Renegotiation, SecureRenegotation),
ProtocolsToAdvertise = handle_next_protocol_extension(NextProtocolNegotiation, Renegotiation, Opts),
@@ -1117,7 +1120,8 @@ handle_server_hello_extensions(RecordCB, Random, CipherSuite, Compression,
#ssl_options{secure_renegotiate = SecureRenegotation,
next_protocol_selector = NextProtoSelector},
ConnectionStates0, Renegotiation) ->
- ConnectionStates = handle_renegotiation_extension(client, RecordCB, Version, Info, Random, CipherSuite,
+ ConnectionStates = handle_renegotiation_extension(client, RecordCB, Version, Info, Random,
+ CipherSuite, undefined,
Compression, ConnectionStates0,
Renegotiation, SecureRenegotation),
case handle_next_protocol(NextProtocolNegotiation, NextProtoSelector, Renegotiation) of
@@ -1415,15 +1419,16 @@ calc_master_secret({3,0}, _PrfAlgo, PremasterSecret, ClientRandom, ServerRandom)
calc_master_secret({3,_}, PrfAlgo, PremasterSecret, ClientRandom, ServerRandom) ->
tls_v1:master_secret(PrfAlgo, PremasterSecret, ClientRandom, ServerRandom).
-handle_renegotiation_extension(Role, RecordCB, Version, Info, Random, CipherSuite, Compression,
+handle_renegotiation_extension(Role, RecordCB, Version, Info, Random, NegotiatedCipherSuite,
+ ClientCipherSuites, Compression,
ConnectionStates0, Renegotiation, SecureRenegotation) ->
case handle_renegotiation_info(RecordCB, Role, Info, ConnectionStates0,
Renegotiation, SecureRenegotation,
- [CipherSuite]) of
+ ClientCipherSuites) of
{ok, ConnectionStates} ->
hello_pending_connection_states(RecordCB, Role,
Version,
- CipherSuite,
+ NegotiatedCipherSuite,
Random,
Compression,
ConnectionStates);
@@ -1792,6 +1797,11 @@ handle_srp_extension(#srp{username = Username}, Session) ->
%%-------------Misc --------------------------------
+select_cipher_suite(CipherSuites, Suites, false) ->
+ select_cipher_suite(CipherSuites, Suites);
+select_cipher_suite(CipherSuites, Suites, true) ->
+ select_cipher_suite(Suites, CipherSuites).
+
select_cipher_suite([], _) ->
no_suite;
select_cipher_suite([Suite | ClientSuites], SupportedSuites) ->
diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl
index 0186f9fca2..5a823ec8a4 100644
--- a/lib/ssl/src/ssl_internal.hrl
+++ b/lib/ssl/src/ssl_internal.hrl
@@ -114,7 +114,10 @@
next_protocols_advertised = undefined, %% [binary()],
next_protocol_selector = undefined, %% fun([binary()]) -> binary())
log_alert :: boolean(),
- server_name_indication = undefined
+ server_name_indication = undefined,
+ %% Should the server prefer its own cipher order over the one provided by
+ %% the client?
+ honor_cipher_order = false
}).
-record(config, {ssl, %% SSL parameters
diff --git a/lib/ssl/src/tls_handshake.erl b/lib/ssl/src/tls_handshake.erl
index 003614b448..01abefca46 100644
--- a/lib/ssl/src/tls_handshake.erl
+++ b/lib/ssl/src/tls_handshake.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2014. 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
@@ -52,9 +52,9 @@ client_hello(Host, Port, ConnectionStates,
Pending = ssl_record:pending_connection_state(ConnectionStates, read),
SecParams = Pending#connection_state.security_parameters,
CipherSuites = ssl_handshake:available_suites(UserSuites, Version),
-
- Extensions = ssl_handshake:client_hello_extensions(Host, Version, CipherSuites,
- SslOpts, ConnectionStates, Renegotiation),
+ Extensions = ssl_handshake:client_hello_extensions(Host, Version,
+ CipherSuites,
+ SslOpts, ConnectionStates, Renegotiation),
Id = ssl_session:client_id({Host, Port, SslOpts}, Cache, CacheCb, OwnCert),
@@ -87,8 +87,8 @@ hello(#server_hello{server_version = Version, random = Random,
ConnectionStates0, Renegotiation) ->
case tls_record:is_acceptable_version(Version, SupportedVersions) of
true ->
- handle_hello_extensions(Version, SessionId, Random, CipherSuite,
- Compression, HelloExt, SslOpt, ConnectionStates0, Renegotiation);
+ handle_server_hello_extensions(Version, SessionId, Random, CipherSuite,
+ Compression, HelloExt, SslOpt, ConnectionStates0, Renegotiation);
false ->
?ALERT_REC(?FATAL, ?PROTOCOL_VERSION)
end;
@@ -113,9 +113,9 @@ hello(#client_hello{client_version = ClientVersion,
no_suite ->
?ALERT_REC(?FATAL, ?INSUFFICIENT_SECURITY);
_ ->
- handle_hello_extensions(Version, Type, Random, HelloExt,
- SslOpts, Session1, ConnectionStates0,
- Renegotiation)
+ handle_client_hello_extensions(Version, Type, Random, CipherSuites, HelloExt,
+ SslOpts, Session1, ConnectionStates0,
+ Renegotiation)
end;
false ->
?ALERT_REC(?FATAL, ?PROTOCOL_VERSION)
@@ -217,8 +217,10 @@ enc_handshake(HandshakeMsg, Version) ->
ssl_handshake:encode_handshake(HandshakeMsg, Version).
-handle_hello_extensions(Version, Type, Random, HelloExt, SslOpts, Session0, ConnectionStates0, Renegotiation) ->
- try ssl_handshake:handle_client_hello_extensions(tls_record, Random, HelloExt, Version, SslOpts,
+handle_client_hello_extensions(Version, Type, Random, CipherSuites,
+ HelloExt, SslOpts, Session0, ConnectionStates0, Renegotiation) ->
+ try ssl_handshake:handle_client_hello_extensions(tls_record, Random, CipherSuites,
+ HelloExt, Version, SslOpts,
Session0, ConnectionStates0, Renegotiation) of
{Session, ConnectionStates, ServerHelloExt} ->
{Version, {Type, Session}, ConnectionStates, ServerHelloExt}
@@ -227,7 +229,7 @@ handle_hello_extensions(Version, Type, Random, HelloExt, SslOpts, Session0, Conn
end.
-handle_hello_extensions(Version, SessionId, Random, CipherSuite,
+handle_server_hello_extensions(Version, SessionId, Random, CipherSuite,
Compression, HelloExt, SslOpt, ConnectionStates0, Renegotiation) ->
case ssl_handshake:handle_server_hello_extensions(tls_record, Random, CipherSuite,
Compression, HelloExt, Version,
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index bc7e68a86c..ddc511c652 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -110,7 +110,10 @@ options_tests() ->
empty_protocol_versions,
ipv6,
reuseaddr,
- tcp_reuseaddr].
+ tcp_reuseaddr,
+ honor_server_cipher_order,
+ honor_client_cipher_order
+].
api_tests() ->
[connection_info,
@@ -144,6 +147,7 @@ session_tests() ->
renegotiate_tests() ->
[client_renegotiate,
server_renegotiate,
+ client_secure_renegotiate,
client_renegotiate_reused_session,
server_renegotiate_reused_session,
client_no_wrap_sequence_number,
@@ -1979,6 +1983,37 @@ client_renegotiate(Config) when is_list(Config) ->
ssl_test_lib:close(Client).
%%--------------------------------------------------------------------
+client_secure_renegotiate() ->
+ [{doc,"Test ssl:renegotiate/1 on client."}].
+client_secure_renegotiate(Config) when is_list(Config) ->
+ ServerOpts = ?config(server_opts, Config),
+ ClientOpts = ?config(client_opts, Config),
+
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+
+ Data = "From erlang to erlang",
+
+ Server =
+ ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {?MODULE, erlang_ssl_receive, [Data]}},
+ {options, [{secure_renegotiate, true} | ServerOpts]}]),
+ Port = ssl_test_lib:inet_port(Server),
+
+ Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {mfa, {?MODULE,
+ renegotiate, [Data]}},
+ {options, [{reuse_sessions, false},
+ {secure_renegotiate, true}| ClientOpts]}]),
+
+ ssl_test_lib:check_result(Client, ok, Server, ok),
+ ssl_test_lib:close(Server),
+ ssl_test_lib:close(Client).
+
+
+%%--------------------------------------------------------------------
server_renegotiate() ->
[{doc,"Test ssl:renegotiate/1 on server."}].
server_renegotiate(Config) when is_list(Config) ->
@@ -2411,6 +2446,51 @@ tcp_reuseaddr(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
+honor_server_cipher_order() ->
+ [{doc,"Test API honor server cipher order."}].
+honor_server_cipher_order(Config) when is_list(Config) ->
+ ClientCiphers = [{rsa, aes_128_cbc, sha}, {rsa, aes_256_cbc, sha}],
+ ServerCiphers = [{rsa, aes_256_cbc, sha}, {rsa, aes_128_cbc, sha}],
+honor_cipher_order(Config, true, ServerCiphers, ClientCiphers, {rsa, aes_256_cbc, sha}).
+
+honor_client_cipher_order() ->
+ [{doc,"Test API honor server cipher order."}].
+honor_client_cipher_order(Config) when is_list(Config) ->
+ ClientCiphers = [{rsa, aes_128_cbc, sha}, {rsa, aes_256_cbc, sha}],
+ ServerCiphers = [{rsa, aes_256_cbc, sha}, {rsa, aes_128_cbc, sha}],
+honor_cipher_order(Config, false, ServerCiphers, ClientCiphers, {rsa, aes_128_cbc, sha}).
+
+honor_cipher_order(Config, Honor, ServerCiphers, ClientCiphers, Expected) ->
+ ClientOpts = ?config(client_opts, Config),
+ ServerOpts = ?config(server_opts, Config),
+
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+
+ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {?MODULE, connection_info_result, []}},
+ {options, [{ciphers, ServerCiphers}, {honor_cipher_order, Honor}
+ | ServerOpts]}]),
+ Port = ssl_test_lib:inet_port(Server),
+ Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {mfa, {?MODULE, connection_info_result, []}},
+ {options, [{ciphers, ClientCiphers}, {honor_cipher_order, Honor}
+ | ClientOpts]}]),
+
+ Version =
+ tls_record:protocol_version(tls_record:highest_protocol_version([])),
+
+ ServerMsg = ClientMsg = {ok, {Version, Expected}},
+
+ ssl_test_lib:check_result(Server, ServerMsg, Client, ClientMsg),
+
+ ssl_test_lib:close(Server),
+ ssl_test_lib:close(Client).
+
+%%--------------------------------------------------------------------
+
hibernate() ->
[{doc,"Check that an SSL connection that is started with option "
"{hibernate_after, 1000} indeed hibernates after 1000ms of "
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl
index 74fadc0cc7..7ed9adfcd9 100644
--- a/lib/ssl/test/ssl_test_lib.erl
+++ b/lib/ssl/test/ssl_test_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -146,7 +146,7 @@ remove_close_msg(ReconnectTimes) ->
end.
start_client(Args) ->
- Result = spawn_link(?MODULE, run_client, [lists:delete(return_socket, Args)]),
+ Result = spawn_link(?MODULE, run_client_init, [lists:delete(return_socket, Args)]),
receive
{ connected, Socket } ->
case lists:member(return_socket, Args) of
@@ -155,6 +155,10 @@ start_client(Args) ->
end
end.
+run_client_init(Opts) ->
+ put(retries, 0),
+ run_client(Opts).
+
run_client(Opts) ->
Node = proplists:get_value(node, Opts),
Host = proplists:get_value(host, Opts),
@@ -189,9 +193,19 @@ run_client(Opts) ->
{gen_tcp, closed} ->
ok
end;
+ {error, econnrefused = Reason} ->
+ case get(retries) of
+ N when N < 5 ->
+ put(retries, N+1),
+ ct:sleep(?SLEEP),
+ run_client(Opts);
+ _ ->
+ ct:log("Client faild several times: connection failed: ~p ~n", [Reason]),
+ Pid ! {self(), {error, Reason}}
+ end;
{error, Reason} ->
ct:log("Client: connection failed: ~p ~n", [Reason]),
- Pid ! {self(), {error, Reason}}
+ Pid ! {self(), {error, Reason}}
end.
close(Pid) ->
diff --git a/lib/ssl/test/ssl_to_openssl_SUITE.erl b/lib/ssl/test/ssl_to_openssl_SUITE.erl
index 4682a109af..68784a175e 100644
--- a/lib/ssl/test/ssl_to_openssl_SUITE.erl
+++ b/lib/ssl/test/ssl_to_openssl_SUITE.erl
@@ -912,8 +912,16 @@ ssl2_erlang_server_openssl_client(Config) when is_list(Config) ->
{'EXIT', OpenSslPort, _} = Exit ->
ct:log("Received: ~p ~n", [Exit]),
ok
-
end,
+ receive
+ {'EXIT', _, _} = UnkownExit ->
+ Msg = lists:flatten(io_lib:format("Received: ~p ~n", [UnkownExit])),
+ ct:log(Msg),
+ ct:comment(Msg),
+ ok
+ after 0 ->
+ ok
+ end,
ssl_test_lib:check_result(Server, {error, {tls_alert, "protocol version"}}),
process_flag(trap_exit, false).
diff --git a/lib/syntax_tools/doc/src/notes.xml b/lib/syntax_tools/doc/src/notes.xml
index 4b3d578c78..a9d3f68d1d 100644
--- a/lib/syntax_tools/doc/src/notes.xml
+++ b/lib/syntax_tools/doc/src/notes.xml
@@ -31,6 +31,38 @@
<p>This document describes the changes made to the Syntax_Tools
application.</p>
+<section><title>Syntax_Tools 1.6.13</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ In syntax_tools-1.6.12 (OTP R16B03) a bug was introduced
+ which broke reverting of local implicit funs. Implicit
+ funs were mistakenly thought to be using abstract terms
+ for their name and arity. This has now been corrected.
+ (Thanks to Anthony Ramine)</p>
+ <p>
+ Own Id: OTP-11576</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p> The default encoding of Erlang files has been changed
+ from ISO-8859-1 to UTF-8. </p> <p> The encoding of XML
+ files has also been changed to UTF-8. </p>
+ <p>
+ Own Id: OTP-10907</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Syntax_Tools 1.6.12</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index 82be9aa489..4f7f9e83ac 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -512,7 +512,7 @@
%% @see macro/2
%% @see match_expr/2
%% @see module_qualifier/2
-%% @see named_fun_expr/1
+%% @see named_fun_expr/2
%% @see nil/0
%% @see operator/1
%% @see parentheses/1
@@ -5699,7 +5699,7 @@ named_fun_expr_name(Node) ->
%% =====================================================================
%% @doc Returns the list of clause subtrees of a `named_fun_expr' node.
%%
-%% @see named_fun_expr/1
+%% @see named_fun_expr/2
-spec named_fun_expr_clauses(syntaxTree()) -> [syntaxTree()].
@@ -5722,7 +5722,7 @@ named_fun_expr_clauses(Node) ->
%% syntax tree `C' of type `clause' such that
%% `clause_patterns(C)' is a nonempty list.
%%
-%% @see named_fun_expr/1
+%% @see named_fun_expr/2
%% @see named_fun_expr_clauses/1
%% @see clause/3
%% @see clause_patterns/1
diff --git a/lib/syntax_tools/vsn.mk b/lib/syntax_tools/vsn.mk
index 6cafc4dd55..26153a55f1 100644
--- a/lib/syntax_tools/vsn.mk
+++ b/lib/syntax_tools/vsn.mk
@@ -1 +1 @@
-SYNTAX_TOOLS_VSN = 1.6.12
+SYNTAX_TOOLS_VSN = 1.6.13
diff --git a/lib/tools/emacs/erlang-skels.el b/lib/tools/emacs/erlang-skels.el
index 527e812444..7379215d68 100644
--- a/lib/tools/emacs/erlang-skels.el
+++ b/lib/tools/emacs/erlang-skels.el
@@ -109,32 +109,32 @@ include separators of the form %%--...")
;; Expression templates:
(defvar erlang-skel-case
'((erlang-skel-skip-blank) o >
- "case " p " of" n> p "_ ->" n> p "ok" n> "end" p)
+ "case " p " of" n> p "_ ->" n> p "ok" n "end" > p)
"*The skeleton of a `case' expression.
Please see the function `tempo-define-template'.")
(defvar erlang-skel-if
'((erlang-skel-skip-blank) o >
- "if" n> p " ->" n> p "ok" n> "end" p)
+ "if" n> p " ->" n> p "ok" n "end" > p)
"The skeleton of an `if' expression.
Please see the function `tempo-define-template'.")
(defvar erlang-skel-receive
'((erlang-skel-skip-blank) o >
- "receive" n> p "_ ->" n> p "ok" n> "end" p)
+ "receive" n> p "_ ->" n> p "ok" n "end" > p)
"*The skeleton of a `receive' expression.
Please see the function `tempo-define-template'.")
(defvar erlang-skel-receive-after
'((erlang-skel-skip-blank) o >
- "receive" n> p "_ ->" n> p "ok" n> "after " p "T ->" n>
- p "ok" n> "end" p)
+ "receive" n> p "_ ->" n> p "ok" n "after " > p "T ->" n>
+ p "ok" n "end" > p)
"*The skeleton of a `receive' expression with an `after' clause.
Please see the function `tempo-define-template'.")
(defvar erlang-skel-receive-loop
'(& o "loop(" p ") ->" n> "receive" n> p "_ ->" n>
- "loop(" p ")" n> "end.")
+ "loop(" p ")" n "end." >)
"*The skeleton of a simple `receive' loop.
Please see the function `tempo-define-template'.")
@@ -256,8 +256,8 @@ Please see the function `tempo-define-template'.")
"loop(From) ->" n>
"receive" n>
p "_ ->" n>
- "loop(From)" n>
- "end." n
+ "loop(From)" n
+ "end." > n
)
"*Template of a small server.
Please see the function `tempo-define-template'.")
@@ -291,8 +291,8 @@ Please see the function `tempo-define-template'.")
"{ok, Pid} ->" n>
"{ok, Pid};" n>
"Error ->" n>
- "Error" n>
- "end." n
+ "Error" n
+ "end." > n
n
(erlang-skel-separator-start 2)
"%% @private" n
@@ -421,8 +421,8 @@ Please see the function `tempo-define-template'.")
"{ok, Pid} ->" n>
"{ok, Pid, #state{}};" n>
"Error ->" n>
- "Error" n>
- "end." n
+ "Error" n
+ "end." > n
n
(erlang-skel-separator-start 2)
"%% @private" n
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index fd90e3a870..3a868f1300 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -73,6 +73,8 @@
;; M-x set-variable RET debug-on-error RET t RET
;;; Code:
+(eval-when-compile (require 'cl))
+
;; Variables:
(defconst erlang-version "2.7"
@@ -3043,7 +3045,7 @@ This assumes that the preceding expression is either simple
\(i.e. an atom) or parenthesized."
(save-excursion
(or arg (setq arg 1))
- (forward-sexp (- arg))
+ (ignore-errors (forward-sexp (- arg)))
(let ((col (current-column)))
(skip-chars-backward " \t")
;; Special hack to handle: (note line break)
@@ -3650,6 +3652,10 @@ Normally used in conjunction with `erlang-beginning-of-clause', e.g.:
(setq cont nil))
((looking-at "\\s *\\($\\|%\\)")
(forward-line 1))
+ ((looking-at "\\s *<<[^>]*?>>")
+ (when (zerop res)
+ (setq res (+ 1 res)))
+ (goto-char (match-end 0)))
((looking-at "\\s *,")
(setq res (+ 1 res))
(goto-char (match-end 0)))
@@ -3931,7 +3937,7 @@ non-whitespace characters following the point on the current line."
(self-insert-command arg)
;; Was this the second char in bit-syntax open (`<<')?
- (unless (< (point) 2)
+ (unless (<= (point) 2)
(save-excursion
(backward-char 2)
(when (and (eq (char-after (point)) ?<)
@@ -3952,7 +3958,7 @@ non-whitespace characters following the point on the current line."
(defun erlang-after-bitsyntax-close ()
"Return t if point is immediately after a bit-syntax close parenthesis (`>>')."
- (and (>= (point) 2)
+ (and (>= (point) 3)
(save-excursion
(backward-char 2)
(and (eq (char-after (point)) ?>)
diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented
index 0de626125c..0dc1b47f0d 100644
--- a/lib/tools/emacs/test.erl.indented
+++ b/lib/tools/emacs/test.erl.indented
@@ -744,3 +744,8 @@ commas_first() ->
] }
]
}.
+
+
+%% this used to result in a scan-sexp error
+[{
+ }].
diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig
index 57263d573b..c7d2dc4ce5 100644
--- a/lib/tools/emacs/test.erl.orig
+++ b/lib/tools/emacs/test.erl.orig
@@ -744,3 +744,8 @@ commas_first() ->
] }
]
}.
+
+
+%% this used to result in a scan-sexp error
+[{
+}].
diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl
index 2ba1c6e16f..9b08815bf7 100644
--- a/lib/wx/api_gen/gen_util.erl
+++ b/lib/wx/api_gen/gen_util.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -222,11 +222,12 @@ halt(Reason) ->
erl_copyright() ->
StartYear = start_year(get(current_class)),
+ {CurrentYear,_,_} = erlang:date(),
w("%%~n",[]),
w("%% %CopyrightBegin%~n",[]),
w("%%~n",[]),
- w("%% Copyright Ericsson AB ~p-2013. All Rights Reserved.~n",
- [StartYear]),
+ w("%% Copyright Ericsson AB ~p-~p. All Rights Reserved.~n",
+ [StartYear, CurrentYear]),
w("%%~n",[]),
w("%% The contents of this file are subject to the Erlang Public License,~n",[]),
w("%% Version 1.1, (the \"License\"); you may not use this file except in~n",[]),
@@ -242,10 +243,11 @@ erl_copyright() ->
w("%% %CopyrightEnd%~n",[]).
c_copyright() ->
+ {CurrentYear,_,_} = erlang:date(),
w("/*~n",[]),
w(" * %CopyrightBegin%~n",[]),
w(" *~n",[]),
- w(" * Copyright Ericsson AB 2008-2013. All Rights Reserved.~n",[]),
+ w(" * Copyright Ericsson AB 2008-~p. All Rights Reserved.~n",[CurrentYear]),
w(" *~n",[]),
w(" * The contents of this file are subject to the Erlang Public License,~n",[]),
w(" * Version 1.1, (the \"License\"); you may not use this file except in~n",[]),
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl
index 6eed0668f6..5ac57e4929 100644
--- a/lib/wx/api_gen/wx_gen_cpp.erl
+++ b/lib/wx/api_gen/wx_gen_cpp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -190,10 +190,14 @@ gen_funcs(Defs) ->
%% w(" case WXE_REMOVE_PORT:~n", []),
%% w(" { destroyMemEnv(Ecmd.port); } break;~n", []),
w(" case DESTROY_OBJECT: {~n"),
- w(" wxObject *This = (wxObject *) getPtr(bp,memenv); "),
- w(" if(This) {"),
- w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n"),
- w(" delete This; }~n } break;~n"),
+ w(" wxObject *This = (wxObject *) getPtr(bp,memenv);~n"),
+ w(" if(This) {~n"),
+ w(" if(recurse_level > 1) {~n"),
+ w(" delayed_delete->Append(Ecmd.Save());~n"),
+ w(" } else {~n"),
+ w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n"),
+ w(" delete This; }~n"),
+ w(" } } break;~n"),
w(" case WXE_REGISTER_OBJECT: {~n"
" registerPid(bp, Ecmd.caller, memenv);~n"
" rt.addAtom(\"ok\");~n"
diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf
index ff680d0655..73c5af43d8 100644
--- a/lib/wx/api_gen/wxapi.conf
+++ b/lib/wx/api_gen/wxapi.conf
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -1883,3 +1883,5 @@
[{event,[wxEVT_TASKBAR_MOVE,wxEVT_TASKBAR_LEFT_DOWN,wxEVT_TASKBAR_LEFT_UP,
wxEVT_TASKBAR_RIGHT_DOWN,wxEVT_TASKBAR_RIGHT_UP,
wxEVT_TASKBAR_LEFT_DCLICK,wxEVT_TASKBAR_RIGHT_DCLICK]}],[]}.
+
+{class, wxInitDialogEvent, wxEvent, [{event,[wxEVT_INIT_DIALOG]}], []}.
diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in
index 5507a74c14..93a191378f 100644
--- a/lib/wx/c_src/Makefile.in
+++ b/lib/wx/c_src/Makefile.in
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2008-2012. All Rights Reserved.
+# Copyright Ericsson AB 2008-2014. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -34,8 +34,9 @@ SO_EXT = @SO_EXT@
OBJC_CC=@OBJC_CC@
OBJC_CFLAGS=@OBJC_CFLAGS@
-GENERAL = wxe_driver wxe_ps_init wxe_impl wxePrintout wxe_return wxe_gl
-GENERAL_H = wxe_driver.h wxe_impl.h wxe_return.h
+GENERAL = wxe_driver wxe_ps_init wxe_main wxe_impl wxe_helpers wxe_callback_impl wxe_return wxe_gl
+GENERAL_H = wxe_callback_impl.h wxe_driver.h wxe_events.h wxe_gl.h \
+ wxe_helpers.h wxe_impl.h wxe_memory.h wxe_return.h
GENERATED_F = wxe_funcs wxe_events wxe_init
GENERATED_H = gen/wxe_macros.h
diff --git a/lib/wx/c_src/gen/wxe_events.cpp b/lib/wx/c_src/gen/wxe_events.cpp
index fb3a065448..a1b4d090b3 100644
--- a/lib/wx/c_src/gen/wxe_events.cpp
+++ b/lib/wx/c_src/gen/wxe_events.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -297,6 +297,7 @@ void initEventTable()
{wxEVT_TASKBAR_RIGHT_UP, 227, "taskbar_right_up"},
{wxEVT_TASKBAR_LEFT_DCLICK, 227, "taskbar_left_dclick"},
{wxEVT_TASKBAR_RIGHT_DCLICK, 227, "taskbar_right_dclick"},
+ {wxEVT_INIT_DIALOG, 228, "init_dialog"},
{-1, 0, }
};
for(int i=0; event_types[i].ev_type != -1; i++) {
@@ -814,6 +815,13 @@ case 227: {// wxTaskBarIconEvent
rt.addTupleCount(2);
break;
}
+case 228: {// wxInitDialogEvent
+ evClass = (char*)"wxInitDialogEvent";
+ rt.addAtom((char*)"wxInitDialog");
+ rt.addAtom(Etype->eName);
+ rt.addTupleCount(2);
+ break;
+}
}
rt.addTupleCount(5);
diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp
index 329af36f4d..82dd414911 100644
--- a/lib/wx/c_src/gen/wxe_funcs.cpp
+++ b/lib/wx/c_src/gen/wxe_funcs.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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,9 +45,14 @@ void WxeApp::wxe_dispatch(wxeCommand& Ecmd)
switch (Ecmd.op)
{
case DESTROY_OBJECT: {
- wxObject *This = (wxObject *) getPtr(bp,memenv); if(This) { ((WxeApp *) wxTheApp)->clearPtr((void *) This);
- delete This; }
- } break;
+ wxObject *This = (wxObject *) getPtr(bp,memenv);
+ if(This) {
+ if(recurse_level > 1) {
+ delayed_delete->Append(Ecmd.Save());
+ } else {
+ ((WxeApp *) wxTheApp)->clearPtr((void *) This);
+ delete This; }
+ } } break;
case WXE_REGISTER_OBJECT: {
registerPid(bp, Ecmd.caller, memenv);
rt.addAtom("ok");
diff --git a/lib/wx/c_src/wxePrintout.cpp b/lib/wx/c_src/wxe_callback_impl.cpp
index fc8782ba95..8ba2557d82 100644
--- a/lib/wx/c_src/wxePrintout.cpp
+++ b/lib/wx/c_src/wxe_callback_impl.cpp
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -20,9 +20,49 @@
#include <wx/wx.h>
#include "wxe_impl.h"
#include "wxe_return.h"
+#include "wxe_events.h"
+#include "wxe_gl.h"
#include "gen/wxe_macros.h"
#include "gen/wxe_derived_dest.h"
+
+/* ****************************************************************************
+ * CallbackData *
+ * ****************************************************************************/
+
+wxeCallbackData::wxeCallbackData(ErlDrvTermData caller, int req, char *req_type,
+ int funcb, int skip_ev, wxeErlTerm * userData,
+ wxeEvtListener *handler_cb)
+ : wxObject()
+{
+ listener = caller;
+ obj = req;
+ fun_id = funcb;
+ strcpy(class_name, req_type);
+ skip = skip_ev;
+ user_data = userData;
+ handler = handler_cb;
+}
+
+wxeCallbackData::~wxeCallbackData() {
+ // fprintf(stderr, "CBD Deleteing %p %s\r\n", this, class_name); fflush(stderr);
+ if(user_data) {
+ delete user_data;
+ }
+ ptrMap::iterator it;
+ it = ((WxeApp *)wxTheApp)->ptr2ref.find(handler);
+ if(it != ((WxeApp *)wxTheApp)->ptr2ref.end()) {
+ wxeRefData *refd = it->second;
+ wxeReturn rt = wxeReturn(WXE_DRV_PORT, refd->memenv->owner, false);
+ rt.addAtom("wx_delete_cb");
+ rt.addInt(fun_id);
+ rt.addRef(refd->ref, "wxeEvtListener");
+ rt.addRef(obj, class_name);
+ rt.addTupleCount(4);
+ rt.send();
+ }
+}
+
/* *****************************************************************/
/* Special Class impls */
@@ -228,6 +268,35 @@ EwxListCtrl::~EwxListCtrl() {
clear_cb(port, onGetItemColumnImage);
((WxeApp *)wxTheApp)->clearPtr(this);
}
+
+/* ****************************************************************************
+ * wxListCtrlCompare wrapper
+ * ****************************************************************************/
+
+int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr)
+{
+ callbackInfo * cb = (callbackInfo *)callbackInfoPtr;
+ wxeMemEnv * memenv = ((WxeApp *) wxTheApp)->getMemEnv(cb->port);
+ wxeReturn rt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
+ rt.addInt(cb->callbackID);
+ rt.addInt(item1);
+ rt.addInt(item2);
+ rt.endList(2);
+ rt.addAtom("_wx_invoke_cb_");
+ rt.addTupleCount(3);
+ rt.send();
+ handle_event_callback(WXE_DRV_PORT_HANDLE, memenv->owner);
+
+ if(((WxeApp *) wxTheApp)->cb_buff) {
+ int res = * (int*) ((WxeApp *) wxTheApp)->cb_buff;
+ driver_free(((WxeApp *) wxTheApp)->cb_buff);
+ ((WxeApp *) wxTheApp)->cb_buff = NULL;
+ return res;
+ }
+ return 0;
+}
+
+
// tools
void clear_cb(ErlDrvTermData port, int callback)
diff --git a/lib/wx/c_src/wxe_callback_impl.h b/lib/wx/c_src/wxe_callback_impl.h
new file mode 100644
index 0000000000..c7243e23a4
--- /dev/null
+++ b/lib/wx/c_src/wxe_callback_impl.h
@@ -0,0 +1,75 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#ifndef _WXE_CALLBACK_IMPL_H
+#define _WXE_CALLBACK_IMPL_H
+
+void pre_callback();
+void handle_event_callback(ErlDrvPort port, ErlDrvTermData process);
+
+class wxEPrintout : public wxPrintout
+{
+ public:
+ wxEPrintout(wxString Title, int onPrintP, int onPrepareP,
+ int onBeginP, int onEndP,
+ int onBeginD, int onEndD,
+ int hasP, int getPageI, ErlDrvTermData Port) :
+ wxPrintout(Title),
+ onPrintPage(onPrintP), onPreparePrinting(onPrepareP),
+ onBeginPrinting(onBeginP), onEndPrinting(onEndP),
+ onBeginDocument(onBeginD), onEndDocument(onEndD), hasPage(hasP), getPageInfo(getPageI),
+ port(Port)
+ { } ;
+
+ ~wxEPrintout();
+
+ bool OnBeginDocument(int startPage, int endPage);
+ void OnEndDocument();
+ void OnBeginPrinting();
+ void OnEndPrinting();
+
+ void OnPreparePrinting();
+
+ bool HasPage(int page);
+ bool OnPrintPage(int page);
+ void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
+
+ int onPrintPage;
+ int onPreparePrinting;
+ int onBeginPrinting;
+ int onEndPrinting;
+ int onBeginDocument;
+ int onEndDocument;
+ int hasPage;
+ int getPageInfo;
+
+ ErlDrvTermData port;
+};
+
+void clear_cb(ErlDrvTermData port, int callback);
+
+// Implementation of wxListCtrlCompare
+struct callbackInfo {
+ ErlDrvTermData port;
+ int callbackID;
+};
+
+int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr);
+
+#endif
diff --git a/lib/wx/c_src/wxe_driver.c b/lib/wx/c_src/wxe_driver.c
index 4d3aa577bf..ea52737fa2 100644
--- a/lib/wx/c_src/wxe_driver.c
+++ b/lib/wx/c_src/wxe_driver.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -195,7 +195,7 @@ void wxe_process_died(ErlDrvData handle, ErlDrvMonitor *monitor)
{
/* Callback is active for the dead process */
wxe_data *sd = ((wxe_data *)handle);
- push_command(WXE_CB_RETURN,NULL,0,sd);
+ push_command(WXE_CB_DIED,NULL,0,sd);
/* ErlDrvTermData pid; */
/* pid = driver_get_monitored_process(sd->port_handle, monitor); */
diff --git a/lib/wx/c_src/wxe_driver.h b/lib/wx/c_src/wxe_driver.h
index 0f0143bd4c..e35bbe2118 100644
--- a/lib/wx/c_src/wxe_driver.h
+++ b/lib/wx/c_src/wxe_driver.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -89,6 +89,7 @@ extern char * erl_wx_privdir;
#define WXE_BIN_INCR 11
#define WXE_BIN_DECR 12
#define WXE_INIT_OPENGL 13
+#define WXE_CB_DIED 14
#define OPENGL_START 5000
diff --git a/lib/wx/c_src/wxe_events.h b/lib/wx/c_src/wxe_events.h
index 718e0ad120..22a737d854 100644
--- a/lib/wx/c_src/wxe_events.h
+++ b/lib/wx/c_src/wxe_events.h
@@ -1,20 +1,20 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2014. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
- * %CopyrightEnd%
+ *
+ * %CopyrightEnd%
*/
#ifndef __WXE_EVENT_H__
@@ -22,6 +22,8 @@
#include "wxe_driver.h"
+bool sendevent(wxEvent * event, ErlDrvTermData port);
+
class wxeEtype
{
public:
diff --git a/lib/wx/c_src/wxe_gl.cpp b/lib/wx/c_src/wxe_gl.cpp
index 34904397d3..a9feb23831 100644
--- a/lib/wx/c_src/wxe_gl.cpp
+++ b/lib/wx/c_src/wxe_gl.cpp
@@ -1,20 +1,20 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2014. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
- * %CopyrightEnd%
+ *
+ * %CopyrightEnd%
*/
#include <stdio.h>
@@ -26,8 +26,9 @@
#endif
#include "wxe_impl.h"
#include "wxe_return.h"
+#include "wxe_gl.h"
-/* ****************************************************************************
+/* ****************************************************************************
* Opengl context management *
* ****************************************************************************/
@@ -138,7 +139,7 @@ void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
else {
ErlDrvTermData rt[] = // Error msg
{ERL_DRV_ATOM, driver_mk_atom((char *) "_egl_error_"),
- ERL_DRV_INT, op,
+ ERL_DRV_INT, (ErlDrvTermData) op,
ERL_DRV_ATOM, driver_mk_atom((char *) "no_gl_context"),
ERL_DRV_TUPLE,3};
erl_drv_send_term(WXE_DRV_PORT,caller,rt,8);
diff --git a/lib/wx/c_src/wxe_gl.h b/lib/wx/c_src/wxe_gl.h
index 1b556ff4ec..dc117bf610 100644
--- a/lib/wx/c_src/wxe_gl.h
+++ b/lib/wx/c_src/wxe_gl.h
@@ -1,22 +1,35 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2010. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2014. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
- * %CopyrightEnd%
+ *
+ * %CopyrightEnd%
*/
+#ifndef _WXE_GL_H
+#define _WXE_GL_H
+
#include "egl_impl.h"
+#include "wxe_return.h"
+void activateGL(ErlDrvTermData caller);
+void setActiveGL(ErlDrvTermData caller, wxGLCanvas *canvas);
+void deleteActiveGL(wxGLCanvas *canvas);
void wxe_initOpenGL(wxeReturn, char*);
+void gl_dispatch(int op, char *bp, ErlDrvTermData caller, WXEBinRef *bins[]);
+
+WX_DECLARE_HASH_MAP(ErlDrvTermData, wxGLCanvas*, wxIntegerHash, wxIntegerEqual, wxeGLC);
+extern wxeGLC glc;
+
+#endif
diff --git a/lib/wx/c_src/wxe_helpers.cpp b/lib/wx/c_src/wxe_helpers.cpp
new file mode 100644
index 0000000000..15d75080d9
--- /dev/null
+++ b/lib/wx/c_src/wxe_helpers.cpp
@@ -0,0 +1,95 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#include <wx/wx.h>
+#include "wxe_impl.h"
+
+/* ****************************************************************************
+ * Erlang Commands
+ * ****************************************************************************/
+
+wxeCommand::wxeCommand(int fc,char * cbuf,int buflen, wxe_data *sd)
+ : wxObject()
+{
+ WXEBinRef *temp, *start, *prev;
+ int n = 0;
+ ref_count = 1;
+ caller = driver_caller(sd->port_handle);
+ port = sd->port;
+ op = fc;
+ len = buflen;
+ bin[0] = NULL;
+ bin[1] = NULL;
+ bin[2] = NULL;
+
+ if(cbuf) {
+ buffer = (char *) driver_alloc(len);
+ memcpy((void *) buffer, (void *) cbuf, len);;
+
+ temp = sd->bin;
+
+ prev = NULL;
+ start = temp;
+
+ while(temp) {
+ if(caller == temp->from) {
+ bin[n++] = temp;
+ if(prev) {
+ prev->next = temp->next;
+ } else {
+ start = temp->next;
+ }
+ temp = temp->next;
+ } else {
+ prev = temp;
+ temp = temp->next;
+ }
+ }
+ sd->bin = start;
+ } else { // No-op only PING currently
+ buffer = NULL;
+ }
+}
+
+wxeCommand::~wxeCommand() {
+ int n = 0;
+ if(buffer) {
+ while(bin[n]) {
+ if(bin[n]->bin)
+ driver_free_binary(bin[n]->bin);
+ driver_free(bin[n++]);
+ }
+ driver_free(buffer);
+ }
+}
+
+/* ****************************************************************************
+ * TreeItemData
+ * ****************************************************************************/
+
+wxETreeItemData::wxETreeItemData(int sz, char * data) {
+ size = sz;
+ bin = (char *) driver_alloc(sz);
+ memcpy(bin, data, sz);
+}
+
+wxETreeItemData::~wxETreeItemData()
+{
+ driver_free(bin);
+}
diff --git a/lib/wx/c_src/wxe_helpers.h b/lib/wx/c_src/wxe_helpers.h
new file mode 100644
index 0000000000..659bc666c6
--- /dev/null
+++ b/lib/wx/c_src/wxe_helpers.h
@@ -0,0 +1,122 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#ifndef _WXE_HELPER_H
+#define _WXE_HELPER_H
+
+DECLARE_EVENT_TYPE(wxeEVT_META_COMMAND, -1)
+
+class wxeMetaCommand : public wxEvent
+{
+ public:
+ wxeMetaCommand(wxe_data *sd, int EvId)
+ : wxEvent(EvId, wxeEVT_META_COMMAND)
+ { caller = driver_caller(sd->port_handle); port = sd->port; pdl = sd->pdl; } ;
+ wxeMetaCommand(const wxeMetaCommand& event)
+ : wxEvent(event)
+ { caller = event.caller; port = event.port; pdl = event.pdl; };
+ virtual ~wxeMetaCommand() {};
+ virtual wxEvent *Clone() const { return new wxeMetaCommand(*this); }
+
+ ErlDrvTermData caller;
+ ErlDrvTermData port;
+ ErlDrvPDL pdl;
+};
+
+class wxeCommand : public wxObject
+{
+ public:
+ wxeCommand(int fc,char * cbuf,int buflen, wxe_data *);
+ virtual ~wxeCommand(); // Use Delete()
+
+ wxeCommand * Save() {ref_count++; return this; };
+ void Delete() {if(--ref_count < 1) delete this;};
+
+ ErlDrvTermData caller;
+ ErlDrvTermData port;
+ WXEBinRef * bin[3];
+ char * buffer;
+ int len;
+ int op;
+ int ref_count;
+};
+
+class intListElement {
+ public:
+ intListElement(int Element) {car = Element; cdr = NULL;};
+ intListElement(int Element, intListElement *list)
+ {car = Element; cdr = list;};
+ int car;
+ intListElement *cdr;
+};
+
+class intList {
+ public:
+ intList() {list = NULL;};
+ ~intList() {
+ intListElement *head = list;
+ while(head) {
+ intListElement *tail=head->cdr;
+ delete head;
+ head = tail;
+ } };
+ bool IsEmpty() {return list == NULL;};
+ void Append(int Element) { list = new intListElement(Element, list); };
+ int Pop() {
+ intListElement *temp = list;
+ int res = list->car;
+ list = temp->cdr;
+ delete temp;
+ return res;
+ }
+ intListElement *list;
+};
+
+class wxe_badarg
+{
+ public:
+ wxe_badarg(int Ref) : ref(Ref) { } ;
+ int ref;
+};
+
+class wxeErlTerm : public wxClientData
+{
+ public:
+ wxeErlTerm(WXEBinRef * data)
+ {
+ size = data->size;
+ bin = (char *) driver_alloc(size);
+ memcpy(bin, data->base, size);
+ } ;
+ ~wxeErlTerm() { driver_free(bin); };
+ char * bin;
+ int size;
+};
+
+class wxETreeItemData : public wxTreeItemData
+{
+ public:
+ wxETreeItemData(int sz, char * data);
+ ~wxETreeItemData();
+
+ int size;
+ char * bin;
+};
+
+#endif
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index cc9bcc9957..5964ccfd00 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -23,10 +23,6 @@
#include <wx/wx.h>
-#if defined(_WIN32)
-#include <wx/msw/private.h> // for wxSetInstance
-#endif
-
// Avoid including these in dcbuffer below
#include "wx/dcmemory.h"
#include "wx/dcclient.h"
@@ -34,12 +30,12 @@
// Ok ugly but needed for wxBufferedDC crash workaround
#define private public
#include <wx/dcbuffer.h>
-
#undef private
#include "wxe_impl.h"
#include "wxe_events.h"
#include "wxe_return.h"
+#include "wxe_gl.h"
IMPLEMENT_APP_NO_MAIN(WxeApp)
@@ -47,120 +43,21 @@ DECLARE_APP(WxeApp)
DEFINE_EVENT_TYPE(wxeEVT_META_COMMAND)
-#define WXE_NOT_INITIATED 0
-#define WXE_INITIATED 1
-#define WXE_EXITED 2
-#define WXE_ERROR -1
-
#define WXE_NORMAL 0
#define WXE_CALLBACK 1
#define WXE_STORED 2
-ErlDrvTid wxe_thread;
-
-ErlDrvMutex *wxe_status_m;
-ErlDrvCond *wxe_status_c;
-
-ErlDrvMutex * wxe_batch_locker_m;
-ErlDrvCond * wxe_batch_locker_c;
-
-static int wxe_status = WXE_NOT_INITIATED;
+// Globals initiated in wxe_init.cpp
+extern ErlDrvMutex *wxe_status_m;
+extern ErlDrvCond *wxe_status_c;
+extern ErlDrvMutex * wxe_batch_locker_m;
+extern ErlDrvCond * wxe_batch_locker_c;
+extern ErlDrvTermData init_caller;
+extern int wxe_status;
wxList * wxe_batch = NULL;
wxList * wxe_batch_cb_saved = NULL;
-
-ErlDrvTermData wxe_batch_caller = 0;
-ErlDrvTermData init_caller = 0;
-
-// extern opengl
-void gl_dispatch(int op, char *bp, ErlDrvTermData caller, WXEBinRef *bins[]);
-
-
-// Until fixed in emulator
-#ifndef _WIN32
-extern "C" {
-extern void erts_thread_disable_fpe(void);
-}
-#endif
-
-#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
-#define __DARWIN__ 1
-#endif
-
-#ifdef __DARWIN__
-extern "C" {
- int erl_drv_stolen_main_thread_join(ErlDrvTid tid, void **respp);
- int erl_drv_steal_main_thread(char *name,
- ErlDrvTid *dtid,
- void* (*func)(void*),
- void* arg,
- ErlDrvThreadOpts *opts);
-}
-#endif
-
-void *wxe_main_loop(void * );
-
-/* ************************************************************
- * START AND STOP of driver thread
- * ************************************************************/
-
-int load_native_gui()
-{
- return 1;
-}
-
-int start_native_gui(wxe_data *sd)
-{
- int res;
- wxe_status_m = erl_drv_mutex_create((char *) "wxe_status_m");
- wxe_status_c = erl_drv_cond_create((char *)"wxe_status_c");
-
- wxe_batch_locker_m = erl_drv_mutex_create((char *)"wxe_batch_locker_m");
- wxe_batch_locker_c = erl_drv_cond_create((char *)"wxe_batch_locker_c");
- init_caller = driver_connected(sd->port_handle);
-
-#ifdef __DARWIN__
- res = erl_drv_steal_main_thread((char *)"wxwidgets",
- &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
-#else
- res = erl_drv_thread_create((char *)"wxwidgets",
- &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
-#endif
- if(res == 0) {
- erl_drv_mutex_lock(wxe_status_m);
- for(;wxe_status == WXE_NOT_INITIATED;) {
- erl_drv_cond_wait(wxe_status_c, wxe_status_m);
- }
- erl_drv_mutex_unlock(wxe_status_m);
- return wxe_status;
- } else {
- wxString msg;
- msg.Printf(wxT("Erlang failed to create wxe-thread %d\r\n"), res);
- send_msg("error", &msg);
- return -1;
- }
-}
-
-void stop_native_gui(wxe_data *sd)
-{
- if(wxe_status == WXE_INITIATED) {
- meta_command(WXE_SHUTDOWN, sd);
- }
-#ifdef __DARWIN__
- erl_drv_stolen_main_thread_join(wxe_thread, NULL);
-#else
- erl_drv_thread_join(wxe_thread, NULL);
-#endif
- erl_drv_mutex_destroy(wxe_status_m);
- erl_drv_cond_destroy(wxe_status_c);
- erl_drv_mutex_destroy(wxe_batch_locker_m);
- erl_drv_cond_destroy(wxe_batch_locker_c);
-}
-
-void unload_native_gui()
-{
-
-}
+int wxe_batch_caller = 0; // inside batch if larger than 0
/* ************************************************************
* Commands from erlang
@@ -169,7 +66,8 @@ void unload_native_gui()
void push_command(int op,char * buf,int len, wxe_data *sd)
{
- // fprintf(stderr, "Op %d %d\r\n", op, (int) driver_caller(sd->port_handle)),fflush(stderr);
+ /* fprintf(stderr, "Op %d %d [%ld] %d\r\n", op, (int) driver_caller(sd->port_handle),
+ wxe_batch->size(), wxe_batch_caller),fflush(stderr); */
wxeCommand *Cmd = new wxeCommand(op, buf, len, sd);
erl_drv_mutex_lock(wxe_batch_locker_m);
wxe_batch->Append(Cmd);
@@ -206,60 +104,19 @@ void meta_command(int what, wxe_data *sd) {
}
}
-/* ************************************************************
- * wxWidgets Thread
- * ************************************************************/
-
-void *wxe_main_loop(void *vpdl)
-{
- int result;
- int argc = 1;
- char * temp = (char *) "Erlang";
- char * argv[] = {temp,NULL};
- ErlDrvPDL pdl = (ErlDrvPDL) vpdl;
-
- driver_pdl_inc_refc(pdl);
-
- // Disable floating point execption if they are on.
- // This should be done in emulator but it's not in yet.
-#ifndef _WIN32
- erts_thread_disable_fpe();
-#else
- // Setup that wxWidgets should look for cursors and icons in
- // this dll and not in werl.exe (which is the default)
- HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver"));
- wxSetInstance((HINSTANCE) WXEHandle);
-#endif
-
- wxe_ps_init();
- result = wxEntry(argc, argv);
- // fprintf(stderr, "WXWidgets quits main loop %d \r\n", result);
- if(result >= 0 && wxe_status == WXE_INITIATED) {
- /* We are done try to make a clean exit */
- wxe_status = WXE_EXITED;
- driver_pdl_dec_refc(pdl);
-#ifndef __DARWIN__
- erl_drv_thread_exit(NULL);
-#endif
- return NULL;
- } else {
- erl_drv_mutex_lock(wxe_status_m);
- wxe_status = WXE_ERROR;
- erl_drv_cond_signal(wxe_status_c);
- erl_drv_mutex_unlock(wxe_status_m);
- driver_pdl_dec_refc(pdl);
- return NULL;
- }
-}
-
-void WxeApp::dummy_close(wxEvent& Ev) {
- // fprintf(stderr, "Dummy Close invoked\r\n");
- // wxMac really wants a top level window which command-q quits if there are no
- // windows open, and this will kill the erlang, override default handling
+void send_msg(const char * type, wxString * msg) {
+ wxeReturn rt = wxeReturn(WXE_DRV_PORT, init_caller);
+ rt.addAtom((char *) "wxe_driver");
+ rt.addAtom((char *) type);
+ rt.add(msg);
+ rt.addTupleCount(3);
+ rt.send();
}
+/* ************************************************************
+ * Init WxeApp the application emulator
+ * ************************************************************/
-// Init wx-widgets thread
bool WxeApp::OnInit()
{
@@ -267,6 +124,9 @@ bool WxeApp::OnInit()
wxe_batch = new wxList;
wxe_batch_cb_saved = new wxList;
cb_buff = NULL;
+ recurse_level = 0;
+ delayed_cleanup = new wxList;
+ delayed_delete = new wxList;
wxe_ps_init2();
// wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); // Hmm printpreview doesn't work in 2.9 with this
@@ -304,13 +164,16 @@ void WxeApp::shutdown(wxeMetaCommand& Ecmd) {
ExitMainLoop();
}
-void send_msg(const char * type, wxString * msg) {
- wxeReturn rt = wxeReturn(WXE_DRV_PORT, init_caller);
- rt.addAtom((char *) "wxe_driver");
- rt.addAtom((char *) type);
- rt.add(msg);
- rt.addTupleCount(3);
- rt.send();
+void WxeApp::dummy_close(wxEvent& Ev) {
+ // fprintf(stderr, "Dummy Close invoked\r\n");
+ // wxMac really wants a top level window which command-q quits if there are no
+ // windows open, and this will kill the erlang, override default handling
+}
+
+// Called by wx thread
+void WxeApp::idle(wxIdleEvent& event) {
+ event.Skip(true);
+ dispatch_cmds();
}
/* ************************************************************
@@ -327,29 +190,51 @@ void handle_event_callback(ErlDrvPort port, ErlDrvTermData process)
{
WxeApp * app = (WxeApp *) wxTheApp;
ErlDrvMonitor monitor;
- driver_monitor_process(port, process, &monitor);
- // Should we be able to handle commands when recursing? probably
- erl_drv_mutex_lock(wxe_batch_locker_m);
- //fprintf(stderr, "\r\nCB EV Start %lu \r\n", process);fflush(stderr);
- app->dispatch_cb(wxe_batch, wxe_batch_cb_saved, process);
- //fprintf(stderr, "CB EV done %lu \r\n", process);fflush(stderr);
- wxe_batch_caller = 0;
- erl_drv_mutex_unlock(wxe_batch_locker_m);
- driver_demonitor_process(port, &monitor);
-}
-
-// Called by wx thread
-void WxeApp::idle(wxIdleEvent& event) {
- event.Skip(true);
- dispatch_cmds();
+ // Is thread safe if pdl have been incremented
+ if(driver_monitor_process(port, process, &monitor) == 0) {
+ // Should we be able to handle commands when recursing? probably
+ erl_drv_mutex_lock(wxe_batch_locker_m);
+ //fprintf(stderr, "\r\nCB EV Start %lu \r\n", process);fflush(stderr);
+ app->recurse_level++;
+ app->dispatch_cb(wxe_batch, wxe_batch_cb_saved, process);
+ app->recurse_level--;
+ //fprintf(stderr, "CB EV done %lu \r\n", process);fflush(stderr);
+ wxe_batch_caller = 0;
+ erl_drv_mutex_unlock(wxe_batch_locker_m);
+ driver_demonitor_process(port, &monitor);
+ }
}
-void WxeApp::dispatch_cmds() {
+void WxeApp::dispatch_cmds()
+{
erl_drv_mutex_lock(wxe_batch_locker_m);
+ recurse_level++;
int level = dispatch(wxe_batch_cb_saved, 0, WXE_STORED);
dispatch(wxe_batch, level, WXE_NORMAL);
+ recurse_level--;
wxe_batch_caller = 0;
erl_drv_mutex_unlock(wxe_batch_locker_m);
+ // Cleanup old memenv's and deleted objects
+ if(recurse_level == 0) {
+ if(delayed_delete->size() > 0)
+ for( wxList::compatibility_iterator node = delayed_delete->GetFirst();
+ node;
+ node = delayed_delete->GetFirst()) {
+ wxeCommand *event = (wxeCommand *)node->GetData();
+ delayed_delete->Erase(node);
+ wxe_dispatch(*event);
+ event->Delete();
+ }
+ if(delayed_cleanup->size() > 0)
+ for( wxList::compatibility_iterator node = delayed_cleanup->GetFirst();
+ node;
+ node = delayed_cleanup->GetFirst()) {
+ wxeMetaCommand *event = (wxeMetaCommand *)node->GetData();
+ delayed_cleanup->Erase(node);
+ destroyMemEnv(*event);
+ delete event;
+ }
+ }
}
// Should have erl_drv_mutex_lock(wxe_batch_locker_m);
@@ -401,7 +286,7 @@ int WxeApp::dispatch(wxList * batch, int blevel, int list_type)
erl_drv_mutex_lock(wxe_batch_locker_m);
break;
}
- delete event;
+ event->Delete();
}
} else {
if((list_type == WXE_STORED) || (blevel <= 0 && list_type == WXE_NORMAL)) {
@@ -433,6 +318,7 @@ void WxeApp::dispatch_cb(wxList * batch, wxList * temp, ErlDrvTermData process)
// fprintf(stderr, " Ev %d %lu\r\n", event->op, event->caller);
if(event->caller == process || // Callbacks from CB process only
event->op == WXE_CB_START || // Event callback start change process
+ event->op == WXE_CB_DIED || // Event callback process died
// Allow connect_cb during CB i.e. msg from wxe_server.
(memenv && event->caller == memenv->owner))
{
@@ -445,7 +331,8 @@ void WxeApp::dispatch_cb(wxList * batch, wxList * temp, ErlDrvTermData process)
if(event->len > 0) {
cb_buff = (char *) driver_alloc(event->len);
memcpy(cb_buff, event->buffer, event->len);
- }
+ } // continue
+ case WXE_CB_DIED:
callback_returned = 1;
return;
case WXE_CB_START:
@@ -480,7 +367,7 @@ void WxeApp::dispatch_cb(wxList * batch, wxList * temp, ErlDrvTermData process)
return;
break;
}
- delete event;
+ event->Delete();
} else {
// fprintf(stderr, " save %d \r\n", event->op);
temp->Append(event);
@@ -517,7 +404,8 @@ void WxeApp::newMemEnv(wxeMetaCommand& Ecmd) {
erl_drv_send_term(WXE_DRV_PORT,Ecmd.caller,rt,2);
}
-void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
+void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd)
+{
// Clear incoming cmd queue first
// dispatch_cmds();
wxWindow *parent = NULL;
@@ -536,26 +424,33 @@ void WxeApp::destroyMemEnv(wxeMetaCommand& Ecmd) {
ptrMap::iterator it = ptr2ref.find(ptr);
if(it != ptr2ref.end()) {
wxeRefData *refd = it->second;
- if(refd->alloc_in_erl) {
- if(refd->type == 2) {
- wxDialog *win = (wxDialog *) ptr;
- if(win->IsModal()) {
- win->EndModal(-1);
- }
- parent = win->GetParent();
- if(parent) {
- ptrMap::iterator parentRef = ptr2ref.find(parent);
- if(parentRef == ptr2ref.end()) {
- // The parent is already dead delete the parent ref
- win->SetParent(NULL);
- }
+ if(refd->alloc_in_erl && refd->type == 2) {
+ wxDialog *win = (wxDialog *) ptr;
+ if(win->IsModal()) {
+ win->EndModal(-1);
+ }
+ parent = win->GetParent();
+ if(parent) {
+ ptrMap::iterator parentRef = ptr2ref.find(parent);
+ if(parentRef == ptr2ref.end()) {
+ // The parent is already dead delete the parent ref
+ win->SetParent(NULL);
}
+ }
+ if(recurse_level > 0) {
+ // Delay delete until we are out of dispatch*
+ delayed_cleanup->Append(Ecmd.Clone());
+ } else {
delete win;
}
}
}
}
}
+
+ if(recurse_level > 0)
+ return;
+
// First pass, delete all top parents/windows of all linked objects
// fprintf(stderr, "close port %x\r\n", Ecmd.port);fflush(stderr);
@@ -780,161 +675,3 @@ void WxeApp::registerPid(char * bp, ErlDrvTermData pid, wxeMemEnv * memenv) {
};
throw wxe_badarg(index);
}
-
-
-/* ************************************************************
- * Misc utility classes
- * ************************************************************/
-
-/* ****************************************************************************
- * Memory handling
- * ****************************************************************************/
-
-wxeMemEnv::wxeMemEnv() {
- ref2ptr = (void **) driver_alloc(128*sizeof(void *));
- ref2ptr[0] = NULL;
- next = 1;
- max = 128;
-}
-
-wxeMemEnv::~wxeMemEnv() {
- driver_free(ref2ptr);
-}
-
-/* ****************************************************************************
- * Erlang Commands (don't need to be derived of wxEvent anymore should
- * be re-written to own class struct)
- * ****************************************************************************/
-
-wxeCommand::wxeCommand(int fc,char * cbuf,int buflen, wxe_data *sd)
- : wxObject()
-{
- WXEBinRef *temp, *start, *prev;
- int n = 0;
- caller = driver_caller(sd->port_handle);
- port = sd->port;
- op = fc;
- len = buflen;
- bin[0] = NULL;
- bin[1] = NULL;
- bin[2] = NULL;
-
- if(cbuf) {
- buffer = (char *) driver_alloc(len);
- memcpy((void *) buffer, (void *) cbuf, len);;
-
- temp = sd->bin;
-
- prev = NULL;
- start = temp;
-
- while(temp) {
- if(caller == temp->from) {
- bin[n++] = temp;
- if(prev) {
- prev->next = temp->next;
- } else {
- start = temp->next;
- }
- temp = temp->next;
- } else {
- prev = temp;
- temp = temp->next;
- }
- }
- sd->bin = start;
- } else { // No-op only PING currently
- buffer = NULL;
- }
-}
-
-wxeCommand::~wxeCommand() {
- int n = 0;
- if(buffer) {
- while(bin[n]) {
- if(bin[n]->bin)
- driver_free_binary(bin[n]->bin);
- driver_free(bin[n++]);
- }
- driver_free(buffer);
- }
-}
-
-/* ****************************************************************************
- * TreeItemData
- * ****************************************************************************/
-
-wxETreeItemData::wxETreeItemData(int sz, char * data) {
- size = sz;
- bin = (char *) driver_alloc(sz);
- memcpy(bin, data, sz);
-}
-
-wxETreeItemData::~wxETreeItemData()
-{
- driver_free(bin);
-}
-
-/* ****************************************************************************
- * CallbackData *
- * ****************************************************************************/
-
-wxeCallbackData::wxeCallbackData(ErlDrvTermData caller, int req, char *req_type,
- int funcb, int skip_ev, wxeErlTerm * userData,
- wxeEvtListener *handler_cb)
- : wxObject()
-{
- listener = caller;
- obj = req;
- fun_id = funcb;
- strcpy(class_name, req_type);
- skip = skip_ev;
- user_data = userData;
- handler = handler_cb;
-}
-
-wxeCallbackData::~wxeCallbackData() {
- // fprintf(stderr, "CBD Deleteing %p %s\r\n", this, class_name); fflush(stderr);
- if(user_data) {
- delete user_data;
- }
- ptrMap::iterator it;
- it = ((WxeApp *)wxTheApp)->ptr2ref.find(handler);
- if(it != ((WxeApp *)wxTheApp)->ptr2ref.end()) {
- wxeRefData *refd = it->second;
- wxeReturn rt = wxeReturn(WXE_DRV_PORT, refd->memenv->owner, false);
- rt.addAtom("wx_delete_cb");
- rt.addInt(fun_id);
- rt.addRef(refd->ref, "wxeEvtListener");
- rt.addRef(obj, class_name);
- rt.addTupleCount(4);
- rt.send();
- }
-}
-
-/* ****************************************************************************
- * wxListCtrlCompare wrapper
- * ****************************************************************************/
-
-int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr)
-{
- callbackInfo * cb = (callbackInfo *)callbackInfoPtr;
- wxeMemEnv * memenv = ((WxeApp *) wxTheApp)->getMemEnv(cb->port);
- wxeReturn rt = wxeReturn(WXE_DRV_PORT, memenv->owner, false);
- rt.addInt(cb->callbackID);
- rt.addInt(item1);
- rt.addInt(item2);
- rt.endList(2);
- rt.addAtom("_wx_invoke_cb_");
- rt.addTupleCount(3);
- rt.send();
- handle_event_callback(WXE_DRV_PORT_HANDLE, memenv->owner);
-
- if(((WxeApp *) wxTheApp)->cb_buff) {
- int res = * (int*) ((WxeApp *) wxTheApp)->cb_buff;
- driver_free(((WxeApp *) wxTheApp)->cb_buff);
- ((WxeApp *) wxTheApp)->cb_buff = NULL;
- return res;
- }
- return 0;
-}
diff --git a/lib/wx/c_src/wxe_impl.h b/lib/wx/c_src/wxe_impl.h
index a3c57e2598..bb54961edd 100644
--- a/lib/wx/c_src/wxe_impl.h
+++ b/lib/wx/c_src/wxe_impl.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2013. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2014. 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
@@ -14,12 +14,17 @@
* the License for the specific language governing rights and limitations
* under the License.
*
- * %CopyrightEnd%
+ * %CopyrightEnd%
*/
#ifndef _WXE_IMPL_H
#define _WXE_IMPL_H
+#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
+#define __DARWIN__ 1
+#endif
+
+
#include <wx/glcanvas.h>
#include <wx/treectrl.h>
#include <wx/print.h>
@@ -27,119 +32,16 @@ extern "C" {
#include "wxe_driver.h"
}
-DECLARE_EVENT_TYPE(wxeEVT_META_COMMAND, -1)
-
-class wxeMetaCommand : public wxEvent
-{
- public:
- wxeMetaCommand(wxe_data *sd, int EvId)
- : wxEvent(EvId, wxeEVT_META_COMMAND)
- { caller = driver_caller(sd->port_handle); port = sd->port; pdl = sd->pdl; } ;
- wxeMetaCommand(const wxeMetaCommand& event)
- : wxEvent(event)
- { caller = event.caller; port = event.port; pdl = event.pdl; };
- virtual ~wxeMetaCommand() {};
- virtual wxEvent *Clone() const { return new wxeMetaCommand(*this); }
-
- ErlDrvTermData caller;
- ErlDrvTermData port;
- ErlDrvPDL pdl;
-};
-
-class wxeCommand : public wxObject
-{
- public:
- wxeCommand(int fc,char * cbuf,int buflen, wxe_data *);
- virtual ~wxeCommand();
-
- ErlDrvTermData caller;
- ErlDrvTermData port;
- WXEBinRef * bin[3];
- char * buffer;
- int len;
- int op;
-};
-
-#define WXE_EVENT_PTR 0
-#define WXE_OBJECT_PTR 1
-
-class intListElement {
-public:
- intListElement(int Element) {car = Element; cdr = NULL;};
- intListElement(int Element, intListElement *list)
- {car = Element; cdr = list;};
- int car;
- intListElement *cdr;
-};
-
-class intList {
-public:
- intList() {list = NULL;};
- bool IsEmpty() {return list == NULL;};
- void Append(int Element) { list = new intListElement(Element, list); };
- int Pop() {
- intListElement *temp = list;
- int res = list->car;
- list = temp->cdr;
- delete temp;
- return res;
- }
- intListElement *list;
-};
-
-class wxe_badarg
-{
-public:
- wxe_badarg(int Ref) : ref(Ref) { } ;
- int ref;
-};
-
-class wxeErlTerm : public wxClientData
-{
- public:
- wxeErlTerm(WXEBinRef * data)
- {
- size = data->size;
- bin = (char *) driver_alloc(size);
- memcpy(bin, data->base, size);
- } ;
- ~wxeErlTerm() { driver_free(bin); };
- char * bin;
- int size;
-};
-
-class wxeMemEnv
-{
-public:
- wxeMemEnv();
- int next;
- int max;
- void ** ref2ptr;
- intList free;
- ~wxeMemEnv();
- ErlDrvTermData owner;
-};
-
-class wxeRefData {
- public:
- wxeRefData(unsigned int dref, int ttype, int is_new, wxeMemEnv *menv) :
- ref(dref), type(ttype), alloc_in_erl(is_new), memenv(menv), pid(-1) { } ;
- int ref;
- int type;
- // 0 = wxWindow subclasses, 1 = wxObject subclasses
- // 2 = wxDialog subclasses, 3 = allocated wxObjects but not returned from new
- // > 3 classes which lack virtual destr, or are supposed to be allocated on
- // the stack
- bool alloc_in_erl;
- wxeMemEnv *memenv;
- ErlDrvTermData pid;
-};
-
-WX_DECLARE_HASH_MAP(ErlDrvTermData, wxGLCanvas*, wxIntegerHash, wxIntegerEqual, wxeGLC);
-WX_DECLARE_HASH_MAP(ErlDrvTermData, wxeMemEnv*, wxIntegerHash, wxIntegerEqual, wxeMemMap);
+#include "wxe_helpers.h"
+#include "wxe_callback_impl.h"
+#include "wxe_memory.h"
+#define WXE_NOT_INITIATED 0
+#define WXE_INITIATED 1
+#define WXE_EXITED 2
+#define WXE_ERROR -1
-WX_DECLARE_VOIDPTR_HASH_MAP(wxeRefData *, ptrMap);
+void send_msg(const char *, wxString *); // For debugging and error msgs
class WxeApp : public wxApp
{
@@ -158,101 +60,31 @@ public:
void dummy_close(wxEvent& Ev);
bool sendevent(wxEvent *event);
- // MemEnv handling
+ // MemEnv handling
void newMemEnv(wxeMetaCommand& event);
void destroyMemEnv(wxeMetaCommand& event);
wxeMemEnv * getMemEnv(ErlDrvTermData port);
-
+
int newPtr(void * ptr, int type, wxeMemEnv *memenv);
int getRef(void * ptr, wxeMemEnv *memenv);
- void * getPtr(char * bp, wxeMemEnv *memenv);
+ void * getPtr(char * bp, wxeMemEnv *memenv);
void clearPtr(void *ptr);
void registerPid(char *ptr, ErlDrvTermData pid, wxeMemEnv *memenv);
- void init_nonconsts(wxeMemEnv *memenv, ErlDrvTermData caller);
-
+ void init_nonconsts(wxeMemEnv *memenv, ErlDrvTermData caller);
+
// Code found in gen/wxe_derived_dest.h
void delete_object(void *ptr, wxeRefData *refd);
-
+
wxeMemMap refmap;
ptrMap ptr2ref;
wxeMemEnv * global_me;
-
+
+ int recurse_level;
+ wxList * delayed_cleanup;
+ wxList * delayed_delete;
// Temp container for callbacks
char *cb_buff;
int cb_len;
};
-class wxETreeItemData : public wxTreeItemData
-{
- public:
- wxETreeItemData(int sz, char * data);
-
- ~wxETreeItemData();
-
- int size;
- char * bin;
-};
-
-bool sendevent(wxEvent * event, ErlDrvTermData port);
-void pre_callback();
-void handle_event_callback(ErlDrvPort port, ErlDrvTermData process);
-
-void activateGL(ErlDrvTermData caller);
-void setActiveGL(ErlDrvTermData caller, wxGLCanvas *canvas);
-void deleteActiveGL(wxGLCanvas *canvas);
-
-void send_msg(const char *, wxString *); // For debugging and error msgs
-
-extern wxeGLC glc;
-
-class wxEPrintout : public wxPrintout
-{
- public:
- wxEPrintout(wxString Title, int onPrintP, int onPrepareP,
- int onBeginP, int onEndP,
- int onBeginD, int onEndD,
- int hasP, int getPageI, ErlDrvTermData Port) :
- wxPrintout(Title),
- onPrintPage(onPrintP), onPreparePrinting(onPrepareP),
- onBeginPrinting(onBeginP), onEndPrinting(onEndP),
- onBeginDocument(onBeginD), onEndDocument(onEndD), hasPage(hasP), getPageInfo(getPageI),
- port(Port)
- { } ;
-
- ~wxEPrintout();
-
- bool OnBeginDocument(int startPage, int endPage);
- void OnEndDocument();
- void OnBeginPrinting();
- void OnEndPrinting();
-
- void OnPreparePrinting();
-
- bool HasPage(int page);
- bool OnPrintPage(int page);
- void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
-
- int onPrintPage;
- int onPreparePrinting;
- int onBeginPrinting;
- int onEndPrinting;
- int onBeginDocument;
- int onEndDocument;
- int hasPage;
- int getPageInfo;
-
- ErlDrvTermData port;
-};
-
-void clear_cb(ErlDrvTermData port, int callback);
-
-
-// Implementation of wxListCtrlCompare
-struct callbackInfo {
- ErlDrvTermData port;
- int callbackID;
-};
-
-int wxCALLBACK wxEListCtrlCompare(long item1, long item2, long callbackInfoPtr);
-
#endif //_WXE_IMPL_H
diff --git a/lib/wx/c_src/wxe_main.cpp b/lib/wx/c_src/wxe_main.cpp
new file mode 100644
index 0000000000..2bec2422c9
--- /dev/null
+++ b/lib/wx/c_src/wxe_main.cpp
@@ -0,0 +1,163 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#if defined(_WIN32)
+#include <wx/msw/private.h> // for wxSetInstance
+#endif
+
+#include "wxe_impl.h"
+
+// Until fixed in emulator
+#ifndef _WIN32
+extern "C" {
+ extern void erts_thread_disable_fpe(void);
+}
+#endif
+
+ErlDrvTid wxe_thread;
+
+ErlDrvMutex *wxe_status_m;
+ErlDrvCond *wxe_status_c;
+
+int wxe_status = WXE_NOT_INITIATED;
+
+ErlDrvMutex * wxe_batch_locker_m;
+ErlDrvCond * wxe_batch_locker_c;
+ErlDrvTermData init_caller = 0;
+
+#ifdef __DARWIN__
+extern "C" {
+ int erl_drv_stolen_main_thread_join(ErlDrvTid tid, void **respp);
+ int erl_drv_steal_main_thread(char *name,
+ ErlDrvTid *dtid,
+ void* (*func)(void*),
+ void* arg,
+ ErlDrvThreadOpts *opts);
+}
+#endif
+
+void *wxe_main_loop(void * );
+
+/* ************************************************************
+ * START AND STOP of driver thread
+ * ************************************************************/
+
+int load_native_gui()
+{
+ return 1;
+}
+
+int start_native_gui(wxe_data *sd)
+{
+ int res;
+ wxe_status_m = erl_drv_mutex_create((char *) "wxe_status_m");
+ wxe_status_c = erl_drv_cond_create((char *)"wxe_status_c");
+
+ wxe_batch_locker_m = erl_drv_mutex_create((char *)"wxe_batch_locker_m");
+ wxe_batch_locker_c = erl_drv_cond_create((char *)"wxe_batch_locker_c");
+ init_caller = driver_connected(sd->port_handle);
+
+#ifdef __DARWIN__
+ res = erl_drv_steal_main_thread((char *)"wxwidgets",
+ &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
+#else
+ res = erl_drv_thread_create((char *)"wxwidgets",
+ &wxe_thread,wxe_main_loop,(void *) sd->pdl,NULL);
+#endif
+ if(res == 0) {
+ erl_drv_mutex_lock(wxe_status_m);
+ for(;wxe_status == WXE_NOT_INITIATED;) {
+ erl_drv_cond_wait(wxe_status_c, wxe_status_m);
+ }
+ erl_drv_mutex_unlock(wxe_status_m);
+ return wxe_status;
+ } else {
+ wxString msg;
+ msg.Printf(wxT("Erlang failed to create wxe-thread %d\r\n"), res);
+ send_msg("error", &msg);
+ return -1;
+ }
+}
+
+void stop_native_gui(wxe_data *sd)
+{
+ if(wxe_status == WXE_INITIATED) {
+ meta_command(WXE_SHUTDOWN, sd);
+ }
+#ifdef __DARWIN__
+ erl_drv_stolen_main_thread_join(wxe_thread, NULL);
+#else
+ erl_drv_thread_join(wxe_thread, NULL);
+#endif
+ erl_drv_mutex_destroy(wxe_status_m);
+ erl_drv_cond_destroy(wxe_status_c);
+ erl_drv_mutex_destroy(wxe_batch_locker_m);
+ erl_drv_cond_destroy(wxe_batch_locker_c);
+}
+
+void unload_native_gui()
+{
+
+}
+
+/* ************************************************************
+ * wxWidgets Thread
+ * ************************************************************/
+
+void *wxe_main_loop(void *vpdl)
+{
+ int result;
+ int argc = 1;
+ char * temp = (char *) "Erlang";
+ char * argv[] = {temp,NULL};
+ ErlDrvPDL pdl = (ErlDrvPDL) vpdl;
+
+ driver_pdl_inc_refc(pdl);
+
+ // Disable floating point execption if they are on.
+ // This should be done in emulator but it's not in yet.
+#ifndef _WIN32
+ erts_thread_disable_fpe();
+#else
+ // Setup that wxWidgets should look for cursors and icons in
+ // this dll and not in werl.exe (which is the default)
+ HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver"));
+ wxSetInstance((HINSTANCE) WXEHandle);
+#endif
+
+ wxe_ps_init();
+ result = wxEntry(argc, argv);
+ // fprintf(stderr, "WXWidgets quits main loop %d \r\n", result);
+ if(result >= 0 && wxe_status == WXE_INITIATED) {
+ /* We are done try to make a clean exit */
+ wxe_status = WXE_EXITED;
+ driver_pdl_dec_refc(pdl);
+#ifndef __DARWIN__
+ erl_drv_thread_exit(NULL);
+#endif
+ return NULL;
+ } else {
+ erl_drv_mutex_lock(wxe_status_m);
+ wxe_status = WXE_ERROR;
+ erl_drv_cond_signal(wxe_status_c);
+ erl_drv_mutex_unlock(wxe_status_m);
+ driver_pdl_dec_refc(pdl);
+ return NULL;
+ }
+}
diff --git a/lib/wx/c_src/wxe_memory.h b/lib/wx/c_src/wxe_memory.h
new file mode 100644
index 0000000000..ec22183bfa
--- /dev/null
+++ b/lib/wx/c_src/wxe_memory.h
@@ -0,0 +1,61 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 2014. All Rights Reserved.
+ *
+ * The contents of this file are subject to the Erlang Public License,
+ * Version 1.1, (the "License"); you may not use this file except in
+ * compliance with the License. You should have received a copy of the
+ * Erlang Public License along with this software. If not, it can be
+ * retrieved online at http://www.erlang.org/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * %CopyrightEnd%
+ */
+
+#ifndef _WXE_MEMORY_H
+#define _WXE_MEMORY_H
+
+class wxeMemEnv
+{
+public:
+ wxeMemEnv()
+ {
+ ref2ptr = (void **) driver_alloc(128*sizeof(void *));
+ ref2ptr[0] = NULL;
+ next = 1;
+ max = 128;
+ };
+ ~wxeMemEnv()
+ { driver_free(ref2ptr); };
+ int next;
+ int max;
+ void ** ref2ptr;
+ intList free;
+ ErlDrvTermData owner;
+};
+
+class wxeRefData {
+ public:
+ wxeRefData(unsigned int dref, int ttype, int is_new, wxeMemEnv *menv) :
+ ref(dref), type(ttype), alloc_in_erl(is_new), memenv(menv), pid(-1) { } ;
+ int ref;
+ int type;
+ // 0 = wxWindow subclasses, 1 = wxObject subclasses
+ // 2 = wxDialog subclasses, 3 = allocated wxObjects but not returned from new
+ // > 3 classes which lack virtual destr, or are supposed to be allocated on
+ // the stack
+ bool alloc_in_erl;
+ wxeMemEnv *memenv;
+ ErlDrvTermData pid;
+};
+
+WX_DECLARE_HASH_MAP(ErlDrvTermData, wxeMemEnv*, wxIntegerHash, wxIntegerEqual, wxeMemMap);
+
+WX_DECLARE_VOIDPTR_HASH_MAP(wxeRefData *, ptrMap);
+
+#endif
diff --git a/lib/wx/doc/src/notes.xml b/lib/wx/doc/src/notes.xml
index c330353dd4..6e653cf828 100644
--- a/lib/wx/doc/src/notes.xml
+++ b/lib/wx/doc/src/notes.xml
@@ -31,6 +31,22 @@
<p>This document describes the changes made to the wxErlang
application.</p>
+<section><title>Wx 1.1.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fixed a problem which caused the debugger to crash when
+ closing a window. Fixed static linking on mac.</p>
+ <p>
+ Own Id: OTP-11444</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Wx 1.1.1</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/wx/include/wx.hrl b/lib/wx/include/wx.hrl
index aa1c81ac0f..2dc1791cce 100644
--- a/lib/wx/include/wx.hrl
+++ b/lib/wx/include/wx.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -273,6 +273,10 @@
-type wxAuiManagerEventType() :: aui_pane_button | aui_pane_close | aui_pane_maximize | aui_pane_restore | aui_render | aui_find_manager.
-type wxAuiManager() :: #wxAuiManager{}. %% Callback event: {@link wxAuiManagerEvent}
+-record(wxInitDialog, {type :: wxInitDialogEventType()}). %% Callback event: {@link wxInitDialogEvent}
+-type wxInitDialogEventType() :: init_dialog.
+-type wxInitDialog() :: #wxInitDialog{}. %% Callback event: {@link wxInitDialogEvent}
+
-record(wxCommand,{type :: wxCommandEventType(), %% Callback event: {@link wxCommandEvent}
cmdString :: unicode:chardata(),
commandInt :: integer(),
@@ -312,8 +316,8 @@
-type wxTreeEventType() :: command_tree_begin_drag | command_tree_begin_rdrag | command_tree_begin_label_edit | command_tree_end_label_edit | command_tree_delete_item | command_tree_get_info | command_tree_set_info | command_tree_item_expanded | command_tree_item_expanding | command_tree_item_collapsed | command_tree_item_collapsing | command_tree_sel_changed | command_tree_sel_changing | command_tree_key_down | command_tree_item_activated | command_tree_item_right_click | command_tree_item_middle_click | command_tree_end_drag | command_tree_state_image_click | command_tree_item_gettooltip | command_tree_item_menu.
-type wxTree() :: #wxTree{}. %% Callback event: {@link wxTreeEvent}
--type event() :: wxAuiManager() | wxAuiNotebook() | wxCalendar() | wxChildFocus() | wxClipboardText() | wxClose() | wxColourPicker() | wxCommand() | wxContextMenu() | wxDate() | wxDisplayChanged() | wxErase() | wxFileDirPicker() | wxFocus() | wxFontPicker() | wxGrid() | wxHelp() | wxHtmlLink() | wxIconize() | wxIdle() | wxJoystick() | wxKey() | wxList() | wxMaximize() | wxMenu() | wxMouse() | wxMouseCaptureChanged() | wxMove() | wxNavigationKey() | wxNotebook() | wxPaint() | wxPaletteChanged() | wxQueryNewPalette() | wxSash() | wxScroll() | wxScrollWin() | wxSetCursor() | wxShow() | wxSize() | wxSpin() | wxSplitter() | wxStyledText() | wxSysColourChanged() | wxTaskBarIcon() | wxTree() | wxUpdateUI() | wxWindowCreate() | wxWindowDestroy().
--type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxClipboardTextEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType().
+-type event() :: wxAuiManager() | wxAuiNotebook() | wxCalendar() | wxChildFocus() | wxClipboardText() | wxClose() | wxColourPicker() | wxCommand() | wxContextMenu() | wxDate() | wxDisplayChanged() | wxErase() | wxFileDirPicker() | wxFocus() | wxFontPicker() | wxGrid() | wxHelp() | wxHtmlLink() | wxIconize() | wxIdle() | wxInitDialog() | wxJoystick() | wxKey() | wxList() | wxMaximize() | wxMenu() | wxMouse() | wxMouseCaptureChanged() | wxMove() | wxNavigationKey() | wxNotebook() | wxPaint() | wxPaletteChanged() | wxQueryNewPalette() | wxSash() | wxScroll() | wxScrollWin() | wxSetCursor() | wxShow() | wxSize() | wxSpin() | wxSplitter() | wxStyledText() | wxSysColourChanged() | wxTaskBarIcon() | wxTree() | wxUpdateUI() | wxWindowCreate() | wxWindowDestroy().
+-type wxEventType() :: wxAuiManagerEventType() | wxAuiNotebookEventType() | wxCalendarEventType() | wxChildFocusEventType() | wxClipboardTextEventType() | wxCloseEventType() | wxColourPickerEventType() | wxCommandEventType() | wxContextMenuEventType() | wxDateEventType() | wxDisplayChangedEventType() | wxEraseEventType() | wxFileDirPickerEventType() | wxFocusEventType() | wxFontPickerEventType() | wxGridEventType() | wxHelpEventType() | wxHtmlLinkEventType() | wxIconizeEventType() | wxIdleEventType() | wxInitDialogEventType() | wxJoystickEventType() | wxKeyEventType() | wxListEventType() | wxMaximizeEventType() | wxMenuEventType() | wxMouseCaptureChangedEventType() | wxMouseEventType() | wxMoveEventType() | wxNavigationKeyEventType() | wxNotebookEventType() | wxPaintEventType() | wxPaletteChangedEventType() | wxQueryNewPaletteEventType() | wxSashEventType() | wxScrollEventType() | wxScrollWinEventType() | wxSetCursorEventType() | wxShowEventType() | wxSizeEventType() | wxSpinEventType() | wxSplitterEventType() | wxStyledTextEventType() | wxSysColourChangedEventType() | wxTaskBarIconEventType() | wxTreeEventType() | wxUpdateUIEventType() | wxWindowCreateEventType() | wxWindowDestroyEventType().
%% Hardcoded Records
-record(wxMouseState, {x :: integer(), y :: integer(),
diff --git a/lib/wx/priv/erlang-logo128.png b/lib/wx/priv/erlang-logo128.png
new file mode 100644
index 0000000000..33d1475cea
--- /dev/null
+++ b/lib/wx/priv/erlang-logo128.png
Binary files differ
diff --git a/lib/wx/priv/erlang-logo32.png b/lib/wx/priv/erlang-logo32.png
index a4afed8140..efddf5c5f9 100644
--- a/lib/wx/priv/erlang-logo32.png
+++ b/lib/wx/priv/erlang-logo32.png
Binary files differ
diff --git a/lib/wx/priv/erlang-logo64.png b/lib/wx/priv/erlang-logo64.png
index 91dfbbab53..b7d2128cdb 100644
--- a/lib/wx/priv/erlang-logo64.png
+++ b/lib/wx/priv/erlang-logo64.png
Binary files differ
diff --git a/lib/wx/src/gen/wxInitDialogEvent.erl b/lib/wx/src/gen/wxInitDialogEvent.erl
new file mode 100644
index 0000000000..c8fe6042ac
--- /dev/null
+++ b/lib/wx/src/gen/wxInitDialogEvent.erl
@@ -0,0 +1,64 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%% This file is generated DO NOT EDIT
+
+%% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxinitdialogevent.html">wxInitDialogEvent</a>.
+%% <dl><dt>Use {@link wxEvtHandler:connect/3.} with EventType:</dt>
+%% <dd><em>init_dialog</em></dd></dl>
+%% See also the message variant {@link wxEvtHandler:wxInitDialog(). #wxInitDialog{}} event record type.
+%%
+%% <p>This class is derived (and can use functions) from:
+%% <br />{@link wxEvent}
+%% </p>
+%% @type wxInitDialogEvent(). An object reference, The representation is internal
+%% and can be changed without notice. It can't be used for comparsion
+%% stored on disc or distributed for use on other nodes.
+
+-module(wxInitDialogEvent).
+-include("wxe.hrl").
+-export([]).
+
+%% inherited exports
+-export([getId/1,getSkipped/1,getTimestamp/1,isCommandEvent/1,parent_class/1,
+ resumePropagation/2,shouldPropagate/1,skip/1,skip/2,stopPropagation/1]).
+
+-export_type([wxInitDialogEvent/0]).
+%% @hidden
+parent_class(wxEvent) -> true;
+parent_class(_Class) -> erlang:error({badtype, ?MODULE}).
+
+-type wxInitDialogEvent() :: wx:wx_object().
+ %% From wxEvent
+%% @hidden
+stopPropagation(This) -> wxEvent:stopPropagation(This).
+%% @hidden
+skip(This, Options) -> wxEvent:skip(This, Options).
+%% @hidden
+skip(This) -> wxEvent:skip(This).
+%% @hidden
+shouldPropagate(This) -> wxEvent:shouldPropagate(This).
+%% @hidden
+resumePropagation(This,PropagationLevel) -> wxEvent:resumePropagation(This,PropagationLevel).
+%% @hidden
+isCommandEvent(This) -> wxEvent:isCommandEvent(This).
+%% @hidden
+getTimestamp(This) -> wxEvent:getTimestamp(This).
+%% @hidden
+getSkipped(This) -> wxEvent:getSkipped(This).
+%% @hidden
+getId(This) -> wxEvent:getId(This).
diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl
index 9174b80d52..79dbea0575 100644
--- a/lib/wx/test/wx_basic_SUITE.erl
+++ b/lib/wx/test/wx_basic_SUITE.erl
@@ -241,21 +241,6 @@ wx_misc(Config) ->
%% wx:shutdown() %% How do you test this?
- case os:type() of
- {win32, _} -> %% These hangs when running automatic tests
- skip; %% through ssh on windows. Works otherwise
- _ ->
- wx_misc:shell([{command,"echo TESTING close the popup shell"}])
- end,
-
- case wx_test_lib:user_available(Config) of
- true ->
- wx_misc:shell();
- false ->
- %% Don't want to spawn a shell if no user
- skip %% is available
- end,
-
?m(false, wx_misc:isBusy()),
?m(ok, wx_misc:beginBusyCursor([])),
?m(true, wx_misc:isBusy()),
@@ -356,6 +341,7 @@ wx_object(Config) ->
%% Which it did in my buggy handling of the sync_callback
wxWindow:refresh(Frame),
?m([{sync_event, #wx{event=#wxPaint{}}, _}], flush()),
+ timer:sleep(500),
?m([{cast, slept}], flush()),
Monitor = erlang:monitor(process, FramePid),
diff --git a/lib/wx/test/wx_event_SUITE.erl b/lib/wx/test/wx_event_SUITE.erl
index bbb5294d08..b9c2fafe0e 100644
--- a/lib/wx/test/wx_event_SUITE.erl
+++ b/lib/wx/test/wx_event_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2014. 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
@@ -48,7 +48,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[connect, disconnect, connect_msg_20, connect_cb_20,
mouse_on_grid, spin_event, connect_in_callback, recursive,
- char_events, callback_clean
+ dialog, char_events, callback_clean
].
groups() ->
@@ -402,6 +402,42 @@ recursive(Config) ->
wx_test_lib:wx_destroy(Frame, Config).
+dialog(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
+dialog(Config) ->
+ Wx = wx:new(),
+ Frame = wxFrame:new(Wx, ?wxID_ANY, "Testing"),
+ wxFrame:show(Frame),
+ Env = wx:get_env(),
+ Tester = self(),
+ PD = wxProgressDialog:new("Dialog","Testing",
+ [%%{parent, Frame},
+ {maximum,101},
+ {style, ?wxPD_SMOOTH bor ?wxPD_AUTO_HIDE}]),
+ Forward = fun(#wx{event=#wxInitDialog{}}, Ev) ->
+ ?mt(wxInitDialogEvent, Ev),
+ io:format("Heyhoo~n", []),
+ wxEvent:skip(Ev),
+ Tester ! {progress_dialog,PD}
+ end,
+ wxDialog:connect(PD, init_dialog, [{callback, Forward}]),
+ Recurse = fun(Recurse, N) ->
+ true = wxProgressDialog:update(PD, min(N,100)),
+ timer:sleep(5),
+ Recurse(Recurse,N+1)
+ end,
+ Run = fun() ->
+ wx:set_env(Env),
+ Recurse(Recurse, 0)
+ end,
+ Worker = spawn_link(Run),
+ timer:sleep(500),
+ io:format("Got ~p~n", [wx_test_lib:flush()]),
+ unlink(Worker),
+ wxProgressDialog:destroy(PD),
+ wx_test_lib:wx_destroy(Frame, Config).
+
+
+
char_events(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo);
char_events(Config) ->
Wx = wx:new(),
diff --git a/lib/wx/vsn.mk b/lib/wx/vsn.mk
index 24c62390f4..c018b4fb86 100644
--- a/lib/wx/vsn.mk
+++ b/lib/wx/vsn.mk
@@ -1 +1 @@
-WX_VSN = 1.1.1
+WX_VSN = 1.1.2
diff --git a/lib/xmerl/doc/src/notes.xml b/lib/xmerl/doc/src/notes.xml
index 8f51262c81..b020b9bfa3 100644
--- a/lib/xmerl/doc/src/notes.xml
+++ b/lib/xmerl/doc/src/notes.xml
@@ -31,6 +31,35 @@
<p>This document describes the changes made to the Xmerl application.</p>
+<section><title>Xmerl 1.3.6</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p> Fixed a problem in the SAX parser when the header of
+ the next document was appearing in the buffer when using
+ xmerl_sax_parser:stream/2 function. </p>
+ <p>
+ Own Id: OTP-11551 Aux Id: seq12505 </p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p> The default encoding of Erlang files has been changed
+ from ISO-8859-1 to UTF-8. </p> <p> The encoding of XML
+ files has also been changed to UTF-8. </p>
+ <p>
+ Own Id: OTP-10907</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Xmerl 1.3.5</title>
<section><title>Improvements and New Features</title>
diff --git a/system/doc/design_principles/spec_proc.xml b/system/doc/design_principles/spec_proc.xml
index 96e82c83b3..8de7a5fe03 100644
--- a/system/doc/design_principles/spec_proc.xml
+++ b/system/doc/design_principles/spec_proc.xml
@@ -43,7 +43,7 @@
<p>The module <c>sys</c> contains some functions for simple debugging
of processes implemented using behaviours. We use the
<c>code_lock</c> example from
- the <seealso marker="fsm#ex">gen_event</seealso> chapter to
+ the <seealso marker="fsm#ex">gen_fsm</seealso> chapter to
illustrate this:</p>
<pre>
% <input>erl</input>
diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml
index 567d032bb5..3830a34e5a 100644
--- a/system/doc/getting_started/seq_prog.xml
+++ b/system/doc/getting_started/seq_prog.xml
@@ -408,7 +408,7 @@ list_length([First | Rest]) ->
or "structs" in other languages and we use lists when we want to
represent things which have varying sizes, (i.e. where we would
use linked lists in other languages).</p>
- <p>Erlang does not have a string date type, instead strings can be
+ <p>Erlang does not have a string data type, instead strings can be
represented by lists of ASCII characters. So the list
<c>[97,98,99]</c> is equivalent to "abc". The Erlang shell is
"clever" and guesses the what sort of list we mean and outputs it
@@ -1031,7 +1031,7 @@ month_length(Year, Month) ->
<title>Built In Functions (BIFs)</title>
<p>Built in functions BIFs are functions which for some reason is
built in to the Erlang virtual machine. BIFs often implement
- functionality that is impossible to implement in Erlang or is to
+ functionality that is impossible to implement in Erlang or is too
inefficient to implement in Erlang. Some BIFs can be called
by use of the function name only but they are by default belonging
to the erlang module so for example the call to the BIF <c>trunc</c>