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
b8af171f
Commit
b8af171f
authored
Mar 28, 2017
by
Mauricio Vasquez B
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cc: add support for prog table
Signed-off-by:
Mauricio Vasquez B
<
mauricio.vasquez@polito.it
>
parent
0f3787f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
src/cc/BPF.cc
src/cc/BPF.cc
+7
-0
src/cc/BPF.h
src/cc/BPF.h
+2
-0
src/cc/BPFTable.h
src/cc/BPFTable.h
+16
-0
No files found.
src/cc/BPF.cc
View file @
b8af171f
...
@@ -482,6 +482,13 @@ std::string BPF::get_kprobe_event(const std::string& kernel_func,
...
@@ -482,6 +482,13 @@ std::string BPF::get_kprobe_event(const std::string& kernel_func,
return
res
;
return
res
;
}
}
BPFProgTable
BPF
::
get_prog_table
(
const
std
::
string
&
name
)
{
TableStorage
::
iterator
it
;
if
(
bpf_module_
->
table_storage
().
Find
(
Path
({
bpf_module_
->
id
(),
name
}),
it
))
return
BPFProgTable
(
it
->
second
);
return
BPFProgTable
({});
}
std
::
string
BPF
::
get_uprobe_event
(
const
std
::
string
&
binary_path
,
std
::
string
BPF
::
get_uprobe_event
(
const
std
::
string
&
binary_path
,
uint64_t
offset
,
bpf_probe_attach_type
type
)
{
uint64_t
offset
,
bpf_probe_attach_type
type
)
{
std
::
string
res
=
attach_type_prefix
(
type
)
+
"_"
;
std
::
string
res
=
attach_type_prefix
(
type
)
+
"_"
;
...
...
src/cc/BPF.h
View file @
b8af171f
...
@@ -106,6 +106,8 @@ public:
...
@@ -106,6 +106,8 @@ public:
return
BPFHashTable
<
KeyType
,
ValueType
>
({});
return
BPFHashTable
<
KeyType
,
ValueType
>
({});
}
}
BPFProgTable
get_prog_table
(
const
std
::
string
&
name
);
BPFStackTable
get_stack_table
(
const
std
::
string
&
name
)
{
BPFStackTable
get_stack_table
(
const
std
::
string
&
name
)
{
TableStorage
::
iterator
it
;
TableStorage
::
iterator
it
;
if
(
bpf_module_
->
table_storage
().
Find
(
Path
({
bpf_module_
->
id
(),
name
}),
it
))
if
(
bpf_module_
->
table_storage
().
Find
(
Path
({
bpf_module_
->
id
(),
name
}),
it
))
...
...
src/cc/BPFTable.h
View file @
b8af171f
...
@@ -202,4 +202,20 @@ class BPFPerfBuffer : protected BPFTableBase<int, int> {
...
@@ -202,4 +202,20 @@ class BPFPerfBuffer : protected BPFTableBase<int, int> {
std
::
unique_ptr
<
epoll_event
[]
>
ep_events_
;
std
::
unique_ptr
<
epoll_event
[]
>
ep_events_
;
};
};
class
BPFProgTable
:
protected
BPFTableBase
<
int
,
int
>
{
public:
BPFProgTable
(
const
TableDesc
&
desc
)
:
BPFTableBase
<
int
,
int
>
(
desc
)
{
if
(
desc
.
type
!=
BPF_MAP_TYPE_PROG_ARRAY
)
throw
std
::
invalid_argument
(
"Table '"
+
desc
.
name
+
"' is not a prog table"
);
}
// updates an element
StatusTuple
update_value
(
const
int
&
index
,
const
int
&
value
)
{
if
(
!
this
->
update
(
const_cast
<
int
*>
(
&
index
),
const_cast
<
int
*>
(
&
value
)))
return
StatusTuple
(
-
1
,
"Error updating value: %s"
,
std
::
strerror
(
errno
));
return
StatusTuple
(
0
);
}
};
}
// namespace ebpf
}
// namespace ebpf
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