Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
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
bpftrace
Commits
489c716c
Commit
489c716c
authored
Oct 30, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build after BCC update. Add name arguments to bpf_prog_load and bpf_create_map.
parent
0f0c8317
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
src/attached_probe.cpp
src/attached_probe.cpp
+1
-1
src/map.cpp
src/map.cpp
+5
-2
No files found.
src/attached_probe.cpp
View file @
489c716c
...
@@ -161,7 +161,7 @@ void AttachedProbe::load_prog()
...
@@ -161,7 +161,7 @@ void AttachedProbe::load_prog()
char
*
log_buf
=
nullptr
;
char
*
log_buf
=
nullptr
;
unsigned
log_buf_size
=
0
;
unsigned
log_buf_size
=
0
;
progfd_
=
bpf_prog_load
(
progtype
(
probe_
.
type
),
progfd_
=
bpf_prog_load
(
progtype
(
probe_
.
type
),
probe_
.
name
.
c_str
(),
reinterpret_cast
<
struct
bpf_insn
*>
(
insns
),
prog_len
,
reinterpret_cast
<
struct
bpf_insn
*>
(
insns
),
prog_len
,
license
,
kern_version
,
log_buf
,
log_buf_size
);
license
,
kern_version
,
log_buf
,
log_buf_size
);
...
...
src/map.cpp
View file @
489c716c
...
@@ -29,7 +29,7 @@ Map::Map(const std::string &name, const SizedType &type, const MapKey &key)
...
@@ -29,7 +29,7 @@ Map::Map(const std::string &name, const SizedType &type, const MapKey &key)
int
value_size
=
type
.
size
;
int
value_size
=
type
.
size
;
int
max_entries
=
128
;
int
max_entries
=
128
;
int
flags
=
0
;
int
flags
=
0
;
mapfd_
=
bpf_create_map
(
map_type
,
key_size
,
value_size
,
max_entries
,
flags
);
mapfd_
=
bpf_create_map
(
map_type
,
name
.
c_str
(),
key_size
,
value_size
,
max_entries
,
flags
);
if
(
mapfd_
<
0
)
if
(
mapfd_
<
0
)
{
{
std
::
cerr
<<
"Error creating map: '"
<<
name_
<<
"'"
<<
std
::
endl
;
std
::
cerr
<<
"Error creating map: '"
<<
name_
<<
"'"
<<
std
::
endl
;
...
@@ -40,8 +40,10 @@ Map::Map(enum bpf_map_type map_type)
...
@@ -40,8 +40,10 @@ Map::Map(enum bpf_map_type map_type)
{
{
int
key_size
,
value_size
,
max_entries
,
flags
;
int
key_size
,
value_size
,
max_entries
,
flags
;
std
::
string
name
;
if
(
map_type
==
BPF_MAP_TYPE_STACK_TRACE
)
if
(
map_type
==
BPF_MAP_TYPE_STACK_TRACE
)
{
{
name
=
"stack"
;
key_size
=
4
;
key_size
=
4
;
value_size
=
sizeof
(
uintptr_t
)
*
MAX_STACK_SIZE
;
value_size
=
sizeof
(
uintptr_t
)
*
MAX_STACK_SIZE
;
max_entries
=
128
;
max_entries
=
128
;
...
@@ -50,6 +52,7 @@ Map::Map(enum bpf_map_type map_type)
...
@@ -50,6 +52,7 @@ Map::Map(enum bpf_map_type map_type)
else
if
(
map_type
==
BPF_MAP_TYPE_PERF_EVENT_ARRAY
)
else
if
(
map_type
==
BPF_MAP_TYPE_PERF_EVENT_ARRAY
)
{
{
std
::
vector
<
int
>
cpus
=
ebpf
::
get_online_cpus
();
std
::
vector
<
int
>
cpus
=
ebpf
::
get_online_cpus
();
name
=
"printf"
;
key_size
=
4
;
key_size
=
4
;
value_size
=
4
;
value_size
=
4
;
max_entries
=
cpus
.
size
();
max_entries
=
cpus
.
size
();
...
@@ -59,7 +62,7 @@ Map::Map(enum bpf_map_type map_type)
...
@@ -59,7 +62,7 @@ Map::Map(enum bpf_map_type map_type)
{
{
abort
();
abort
();
}
}
mapfd_
=
bpf_create_map
(
map_type
,
key_size
,
value_size
,
max_entries
,
flags
);
mapfd_
=
bpf_create_map
(
map_type
,
name
.
c_str
(),
key_size
,
value_size
,
max_entries
,
flags
);
if
(
mapfd_
<
0
)
if
(
mapfd_
<
0
)
{
{
std
::
string
name
;
std
::
string
name
;
...
...
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