aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/emulator/beam/beam_emu.c2
-rw-r--r--erts/emulator/beam/dist.c4
-rw-r--r--erts/emulator/beam/erl_message.c6
-rw-r--r--erts/emulator/drivers/common/efile_drv.c18
-rw-r--r--erts/preloaded/ebin/prim_file.beambin38764 -> 38764 bytes
-rw-r--r--lib/dtrace/examples/user-probe.systemtap4
-rw-r--r--lib/kernel/src/file.erl11
-rw-r--r--lib/kernel/src/file_io_server.erl3
8 files changed, 30 insertions, 18 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 763d15e101..8cfcbd0fb8 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -1963,7 +1963,7 @@ void process_main(void)
dtrace_proc_str(c_p, receiver_name);
token2 = SEQ_TRACE_TOKEN(c_p);
- if (token2 != NIL) {
+ if (token2 != NIL && token2 != am_have_dt_utag) {
tok_label = signed_val(SEQ_TRACE_T_LABEL(token2));
tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(token2));
tok_serial = signed_val(SEQ_TRACE_T_SERIAL(token2));
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index a44caa36db..e93176ba4e 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -769,7 +769,7 @@ erts_dsig_send_msg(ErtsDSigData *dsdp, Eterm remote, Eterm message)
erts_snprintf(sender_name, sizeof(sender_name), "%T", sender->id);
erts_snprintf(receiver_name, sizeof(receiver_name), "%T", remote);
msize = size_object(message);
- if (token != NIL) {
+ if (token != NIL && token != am_have_dt_utag) {
tok_label = signed_val(SEQ_TRACE_T_LABEL(token));
tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(token));
tok_serial = signed_val(SEQ_TRACE_T_SERIAL(token));
@@ -823,7 +823,7 @@ erts_dsig_send_reg_msg(ErtsDSigData *dsdp, Eterm remote_name, Eterm message)
erts_snprintf(receiver_name, sizeof(receiver_name),
"{%T,%s}", remote_name, node_name);
msize = size_object(message);
- if (token != NIL) {
+ if (token != NIL && token != am_have_dt_utag) {
tok_label = signed_val(SEQ_TRACE_T_LABEL(token));
tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(token));
tok_serial = signed_val(SEQ_TRACE_T_SERIAL(token));
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 5d4dcaef6d..7de30d25ed 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -384,7 +384,7 @@ erts_queue_dist_message(Process *rcvr,
DTRACE_CHARBUF(receiver_name, DTRACE_TERM_BUF_SIZE);
dtrace_proc_str(rcvr, receiver_name);
- if (token != NIL) {
+ if (token != NIL && token != am_have_dt_utag) {
tok_label = signed_val(SEQ_TRACE_T_LABEL(token));
tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(token));
tok_serial = signed_val(SEQ_TRACE_T_SERIAL(token));
@@ -419,7 +419,7 @@ erts_queue_dist_message(Process *rcvr,
DTRACE_CHARBUF(receiver_name, DTRACE_TERM_BUF_SIZE);
dtrace_proc_str(rcvr, receiver_name);
- if (token != NIL) {
+ if (token != NIL && token != am_have_dt_utag) {
tok_label = signed_val(SEQ_TRACE_T_LABEL(token));
tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(token));
tok_serial = signed_val(SEQ_TRACE_T_SERIAL(token));
@@ -957,7 +957,7 @@ erts_send_message(Process* sender,
BM_SWAP_TIMER(copy,send);
if (DTRACE_ENABLED(message_send)) {
- if (stoken != NIL) {
+ if (stoken != NIL && stoken != am_have_dt_utag) {
tok_label = signed_val(SEQ_TRACE_T_LABEL(stoken));
tok_lastcnt = signed_val(SEQ_TRACE_T_LASTCNT(stoken));
tok_serial = signed_val(SEQ_TRACE_T_SERIAL(stoken));
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 53cdb13db0..b33a8d210b 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -2711,9 +2711,15 @@ file_output(ErlDrvData e, char* buf, ErlDrvSizeT count)
return;
}
#ifdef USE_VM_PROBES
- DTRACE11(efile_drv_entry, dt_priv->thread_num, dt_priv->tag++,
+ if (dt_utag != NULL && dt_utag[0] == '\0') {
+ dt_utag = NULL;
+ }
+
+ DTRACE11(efile_drv_entry, dt_priv->thread_num, dt_priv->tag,
dt_utag, command, name, dt_s2,
dt_i1, dt_i2, dt_i3, dt_i4, desc->port_str);
+ DTRACE6(efile_drv_return, dt_priv->thread_num, dt_priv->tag++,
+ dt_utag, command, 1, 0);
#endif
TRACE_C('R');
driver_output2(desc->port, resbuf, 1, NULL, 0);
@@ -3806,8 +3812,6 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
;
dt_s1 = d->b;
dt_utag = EV_CHAR_P(ev, p, q);
- if (*dt_utag != 0)
- fprintf(stderr,"dt_utag = %s\r\n",dt_utag);
}
#endif
d->c.read_file.binp = NULL;
@@ -4108,8 +4112,12 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->sched_i2 = dt_priv->tag;
d->sched_utag[0] = '\0';
if (dt_utag != NULL) {
- strncpy(d->sched_utag, dt_utag, sizeof(d->sched_utag) - 1);
- d->sched_utag[sizeof(d->sched_utag) - 1] = '\0';
+ if (dt_utag[0] == '\0') {
+ dt_utag = NULL;
+ } else {
+ strncpy(d->sched_utag, dt_utag, sizeof(d->sched_utag) - 1);
+ d->sched_utag[sizeof(d->sched_utag) - 1] = '\0';
+ }
}
DTRACE11(efile_drv_entry, dt_priv->thread_num, dt_priv->tag++,
dt_utag, command, dt_s1, NULL, dt_i1, dt_i2, dt_i3, dt_i4,
diff --git a/erts/preloaded/ebin/prim_file.beam b/erts/preloaded/ebin/prim_file.beam
index 88c07ab4eb..ea6d2cb8c6 100644
--- a/erts/preloaded/ebin/prim_file.beam
+++ b/erts/preloaded/ebin/prim_file.beam
Binary files differ
diff --git a/lib/dtrace/examples/user-probe.systemtap b/lib/dtrace/examples/user-probe.systemtap
index c80bf94697..84a45709e8 100644
--- a/lib/dtrace/examples/user-probe.systemtap
+++ b/lib/dtrace/examples/user-probe.systemtap
@@ -28,12 +28,12 @@
* environment.
*/
-probe process("dtrace.so").mark("user_trace-s1")
+probe process("dyntrace.so").mark("user_trace-s1")
{
printf("%s\n", user_string($arg1));
}
-probe process("dtrace.so").mark("user_trace-i4s4")
+probe process("dyntrace.so").mark("user_trace-i4s4")
{
printf("%s %s %d %d %d %d '%s' '%s' '%s' '%s'\n",
user_string($arg1),
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
index 3a618976f5..b281151778 100644
--- a/lib/kernel/src/file.erl
+++ b/lib/kernel/src/file.erl
@@ -1416,15 +1416,16 @@ mode_list(_) ->
%% Functions for communicating with the file server
call(Command, Args) when is_list(Args) ->
- gen_server:call(?FILE_SERVER, list_to_tuple([Command | Args]), infinity).
+ X = erlang:spread_utag(true),
+ Y = gen_server:call(?FILE_SERVER, list_to_tuple([Command | Args]),
+ infinity),
+ erlang:restore_utag(X),
+ Y.
check_and_call(Command, Args) when is_list(Args) ->
case check_args(Args) of
ok ->
- X = erlang:spread_utag(true),
- Y = call(Command, Args),
- erlang:restore_utag(X),
- Y;
+ call(Command, Args);
Error ->
Error
end.
diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl
index 14da9c1a55..6369a5250c 100644
--- a/lib/kernel/src/file_io_server.erl
+++ b/lib/kernel/src/file_io_server.erl
@@ -57,9 +57,11 @@ start_link(Owner, FileName, ModeList)
do_start(Spawn, Owner, FileName, ModeList) ->
Self = self(),
Ref = make_ref(),
+ Utag = erlang:spread_utag(true),
Pid =
erlang:Spawn(
fun() ->
+ erlang:restore_utag(Utag),
%% process_flag(trap_exit, true),
case parse_options(ModeList) of
{ReadMode, UnicodeMode, Opts} ->
@@ -84,6 +86,7 @@ do_start(Spawn, Owner, FileName, ModeList) ->
exit(Reason1)
end
end),
+ erlang:restore_utag(Utag),
Mref = erlang:monitor(process, Pid),
receive
{Ref, {error, _Reason} = Error} ->