aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-02-26 20:40:51 +0100
committerSverker Eriksson <[email protected]>2018-03-02 19:16:48 +0100
commit7fb3ed7d2731050186eb5224fe8e6050e4909341 (patch)
treead655e7b9c7d5480065d7cd1579307baa08fcac4
parent2709c93ede0be977ac13543d0fabe8ff3c27f4cc (diff)
downloadotp-7fb3ed7d2731050186eb5224fe8e6050e4909341.tar.gz
otp-7fb3ed7d2731050186eb5224fe8e6050e4909341.tar.bz2
otp-7fb3ed7d2731050186eb5224fe8e6050e4909341.zip
erts,kernel: Add dist_util:strict_order_flags/0
to replace DFLAGS_STRICT_ORDER_DELIVERY and remove that compile time dependency.
-rw-r--r--erts/doc/src/alt_dist.xml11
-rw-r--r--erts/doc/src/erl_dist_protocol.xml7
-rw-r--r--erts/emulator/beam/dist.c12
-rw-r--r--erts/emulator/beam/dist.h2
-rw-r--r--erts/preloaded/ebin/erts_internal.beambin14100 -> 14104 bytes
-rw-r--r--erts/preloaded/src/erts_internal.erl3
-rw-r--r--lib/kernel/include/dist.hrl5
-rw-r--r--lib/kernel/src/dist_util.erl9
8 files changed, 27 insertions, 22 deletions
diff --git a/erts/doc/src/alt_dist.xml b/erts/doc/src/alt_dist.xml
index d3731a5391..92d40d8558 100644
--- a/erts/doc/src/alt_dist.xml
+++ b/erts/doc/src/alt_dist.xml
@@ -782,10 +782,9 @@
<taglist>
<tag><c>DFLAG_DIST_HDR_ATOM_CACHE</c></tag>
<item>Do not use atom cache over this connection.</item>
- <tag><c>DFLAGS_STRICT_ORDER_DELIVERY</c></tag>
- <item>Do not use any features that require strict
- order delivery.</item>
</taglist>
+ <p>Use function <c>dist_util:strict_order_flags/0</c> to get all flags
+ for features that require strict order delivery.</p>
<p>
This flag field is optional.
</p>
@@ -819,9 +818,9 @@
<p>
The data delivery order can be relaxed by disabling
features that require strict ordering. This is done by
- passing the <c>?DFLAGS_STRICT_ORDER_DELIVERY</c>
- <seealso marker="erl_dist_protocol#dflags">distribution
- flags</seealso> in the
+ passing the
+ <seealso marker="erl_dist_protocol#dflags">distribution flags</seealso>
+ returned by <c>dist_util:strict_order_flags/0</c> in the
<seealso marker="alt_dist#hs_data_reject_flags"><c>reject_flags</c></seealso>
field of the <seealso marker="#hs_data_record"><c>#hs_data{}</c></seealso>
record used when setting up the connection. When relaxed
diff --git a/erts/doc/src/erl_dist_protocol.xml b/erts/doc/src/erl_dist_protocol.xml
index a78b13aaa4..98a9a76b60 100644
--- a/erts/doc/src/erl_dist_protocol.xml
+++ b/erts/doc/src/erl_dist_protocol.xml
@@ -849,10 +849,9 @@ DiB == gen_digest(ChA, ICA)?
</item>
</taglist>
<p>
- There are also a collection of <c>DFLAG</c>s bitwise or:ed
- together in the <c>DFLAGS_STRICT_ORDER_DELIVERY</c> macro.
- These flags corresponds to features that require strict
- ordering of data over distribution channels.
+ There is also function <c>dist_util:strict_order_flags/0</c>
+ returning all flags (bitwise or:ed together) corresponding to features
+ that require strict ordering of data over distribution channels.
</p>
</section>
</section>
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index 6f122273dc..c08a8ec832 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -644,7 +644,8 @@ trap_function(Eterm func, int arity)
/*
* Sync with dist_util.erl:
*
- * -record(erts_dflags, {default, mandatory, addable, rejectable}).
+ * -record(erts_dflags,
+ * {default, mandatory, addable, rejectable, strict_order}).
*/
static Eterm erts_dflags_record;
@@ -665,13 +666,14 @@ void init_dist(void)
am_dist_ctrl_put_data,
2);
{
- Eterm* hp = erts_alloc(ERTS_ALC_T_LITERAL, (1+5)*sizeof(Eterm));
- erts_dflags_record = TUPLE5(hp, am_erts_dflags,
+ Eterm* hp = erts_alloc(ERTS_ALC_T_LITERAL, (1+6)*sizeof(Eterm));
+ erts_dflags_record = TUPLE6(hp, am_erts_dflags,
make_small(DFLAG_DIST_DEFAULT),
make_small(DFLAG_DIST_MANDATORY),
make_small(DFLAG_DIST_ADDABLE),
- make_small(DFLAG_DIST_REJECTABLE));
- erts_set_literal_tag(&erts_dflags_record, hp, (1+5));
+ make_small(DFLAG_DIST_REJECTABLE),
+ make_small(DFLAG_DIST_STRICT_ORDER));
+ erts_set_literal_tag(&erts_dflags_record, hp, (1+6));
}
}
diff --git a/erts/emulator/beam/dist.h b/erts/emulator/beam/dist.h
index 202457bb3b..e8dcdb669d 100644
--- a/erts/emulator/beam/dist.h
+++ b/erts/emulator/beam/dist.h
@@ -84,6 +84,8 @@
| DFLAG_HIDDEN_ATOM_CACHE \
| DFLAG_ATOM_CACHE)
+/* Flags for all features needing strict order delivery */
+#define DFLAG_DIST_STRICT_ORDER DFLAG_DIST_HDR_ATOM_CACHE
/* All flags that should be enabled when term_to_binary/1 is used. */
#define TERM_TO_BINARY_DFLAGS (DFLAG_EXTENDED_REFERENCES \
diff --git a/erts/preloaded/ebin/erts_internal.beam b/erts/preloaded/ebin/erts_internal.beam
index 7206b0415d..b79f734a6d 100644
--- a/erts/preloaded/ebin/erts_internal.beam
+++ b/erts/preloaded/ebin/erts_internal.beam
Binary files differ
diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl
index 291a8e8fa8..a51c0c4c0e 100644
--- a/erts/preloaded/src/erts_internal.erl
+++ b/erts/preloaded/src/erts_internal.erl
@@ -511,7 +511,8 @@ dist_ctrl_put_data(DHandle, IoList) ->
end.
--spec erts_internal:get_dflags() -> {erts_dflags,integer(),integer(),integer(),integer()}.
+-spec erts_internal:get_dflags() -> {erts_dflags, integer(), integer(),
+ integer(), integer(), integer()}.
get_dflags() ->
erlang:nif_error(undefined).
diff --git a/lib/kernel/include/dist.hrl b/lib/kernel/include/dist.hrl
index 986aca6c26..b7c35712a6 100644
--- a/lib/kernel/include/dist.hrl
+++ b/lib/kernel/include/dist.hrl
@@ -42,10 +42,5 @@
-define(DFLAG_BIG_CREATION, 16#40000).
-define(DFLAG_SEND_SENDER, 16#80000).
-%% DFLAGs that require strict ordering or:ed together...
--define(DFLAGS_STRICT_ORDER_DELIVERY,
- ?DFLAG_DIST_HDR_ATOM_CACHE).
-
-
%% Also update dflag2str() in ../src/dist_util.erl
%% when adding flags...
diff --git a/lib/kernel/src/dist_util.erl b/lib/kernel/src/dist_util.erl
index 5614b80802..3927b64b06 100644
--- a/lib/kernel/src/dist_util.erl
+++ b/lib/kernel/src/dist_util.erl
@@ -27,6 +27,7 @@
%%-compile(export_all).
-export([handshake_we_started/1, handshake_other_started/1,
+ strict_order_flags/0,
start_timer/1, setup_timer/2,
reset_timer/1, cancel_timer/1,
shutdown/3, shutdown/4]).
@@ -135,9 +136,15 @@ publish_flag(_, OtherNode) ->
default, % flags erts prefers
mandatory, % flags erts needs
addable, % flags local dist implementation is allowed to add
- rejectable % flags local dist implementation is allowed to reject
+ rejectable, % flags local dist implementation is allowed to reject
+ strict_order % flags for features needing strict order delivery
}).
+-spec strict_order_flags() -> integer().
+strict_order_flags() ->
+ EDF = erts_internal:get_dflags(),
+ EDF#erts_dflags.strict_order.
+
make_this_flags(RequestType, AddFlags, RejectFlags, OtherNode,
#erts_dflags{}=EDF) ->
case RejectFlags band (bnot EDF#erts_dflags.rejectable) of