Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
6c99958e
Commit
6c99958e
authored
Feb 06, 2017
by
Derek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch bcc to use single instance per bcc process,
instance dir is bcc_pid, fixed issue #940
parent
6004c32e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
src/cc/libbpf.c
src/cc/libbpf.c
+9
-7
No files found.
src/cc/libbpf.c
View file @
6c99958e
...
...
@@ -373,14 +373,16 @@ void * bpf_attach_kprobe(int progfd, enum bpf_probe_attach_type attach_type, con
close
(
kfd
);
if
(
access
(
"/sys/kernel/debug/tracing/instances"
,
F_OK
)
!=
-
1
)
{
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/%s"
,
new_name
);
if
(
mkdir
(
buf
,
0755
)
==
-
1
)
goto
retry
;
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/%s/events/%ss/%s"
,
new_name
,
event_type
,
new_name
);
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/bcc_%d"
,
getpid
());
if
(
access
(
buf
,
F_OK
)
==
-
1
)
{
if
(
mkdir
(
buf
,
0755
)
==
-
1
)
goto
retry
;
}
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/bcc_%d/events/%ss/%s"
,
getpid
(),
event_type
,
new_name
);
if
(
n
<
sizeof
(
buf
)
&&
bpf_attach_tracing_event
(
progfd
,
buf
,
reader
,
pid
,
cpu
,
group_fd
)
==
0
)
goto
out
;
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/
%s"
,
new_name
);
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/
bcc_%d"
,
getpid
()
);
rmdir
(
buf
);
}
retry:
...
...
@@ -471,7 +473,7 @@ int bpf_detach_kprobe(const char *ev_name)
{
char
buf
[
256
];
int
ret
=
bpf_detach_probe
(
ev_name
,
"kprobe"
);
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/
%s_bcc_%d"
,
ev_name
,
getpid
());
snprintf
(
buf
,
sizeof
(
buf
),
"/sys/kernel/debug/tracing/instances/
bcc_%d"
,
getpid
());
if
(
access
(
buf
,
F_OK
)
!=
-
1
)
{
rmdir
(
buf
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment