aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/file_io_server.erl
diff options
context:
space:
mode:
authorScott Lystig Fritchie <[email protected]>2011-11-17 00:47:23 -0600
committerPatrik Nyblom <[email protected]>2012-03-22 18:16:13 +0100
commitad6387b0242caa2b3c64d62a133752e10546211b (patch)
tree2125af8da5823487592cfeae6e21d03f8f71551b /lib/kernel/src/file_io_server.erl
parent2f532f889a6bd31f74122bd223277d7c609f7bdc (diff)
downloadotp-ad6387b0242caa2b3c64d62a133752e10546211b.tar.gz
otp-ad6387b0242caa2b3c64d62a133752e10546211b.tar.bz2
otp-ad6387b0242caa2b3c64d62a133752e10546211b.zip
Add DTrace support for OS X, Solaris, and Linux (via SystemTap), 4/4
Add probes to (mostly) the efile_drv.c driver and other file I/O-related source files.
Diffstat (limited to 'lib/kernel/src/file_io_server.erl')
-rw-r--r--lib/kernel/src/file_io_server.erl15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/kernel/src/file_io_server.erl b/lib/kernel/src/file_io_server.erl
index 14da9c1a55..cc0343031b 100644
--- a/lib/kernel/src/file_io_server.erl
+++ b/lib/kernel/src/file_io_server.erl
@@ -21,7 +21,7 @@
%% A simple file server for io to one file instance per server instance.
-export([format_error/1]).
--export([start/3, start_link/3]).
+-export([start/4, start_link/4]).
-export([count_and_find/3]).
@@ -43,18 +43,18 @@ format_error({_Line, Mod, Reason}) ->
format_error(ErrorId) ->
erl_posix_msg:message(ErrorId).
-start(Owner, FileName, ModeList)
+start(Owner, FileName, ModeList, DTraceUtag)
when is_pid(Owner), (is_list(FileName) orelse is_binary(FileName)), is_list(ModeList) ->
- do_start(spawn, Owner, FileName, ModeList).
+ do_start(spawn, Owner, FileName, ModeList, DTraceUtag).
-start_link(Owner, FileName, ModeList)
+start_link(Owner, FileName, ModeList, DTraceUtag)
when is_pid(Owner), (is_list(FileName) orelse is_binary(FileName)), is_list(ModeList) ->
- do_start(spawn_link, Owner, FileName, ModeList).
+ do_start(spawn_link, Owner, FileName, ModeList, DTraceUtag).
%%%-----------------------------------------------------------------
%%% Server starter, dispatcher and helpers
-do_start(Spawn, Owner, FileName, ModeList) ->
+do_start(Spawn, Owner, FileName, ModeList, DTraceUtag) ->
Self = self(),
Ref = make_ref(),
Pid =
@@ -63,11 +63,12 @@ do_start(Spawn, Owner, FileName, ModeList) ->
%% process_flag(trap_exit, true),
case parse_options(ModeList) of
{ReadMode, UnicodeMode, Opts} ->
- case ?PRIM_FILE:open(FileName, Opts) of
+ case ?PRIM_FILE:open(FileName, Opts, DTraceUtag) of
{error, Reason} = Error ->
Self ! {Ref, Error},
exit(Reason);
{ok, Handle} ->
+ put(dtrace_utag, DTraceUtag), % TODO: API?
%% XXX must I handle R6 nodes here?
M = erlang:monitor(process, Owner),
Self ! {Ref, ok},