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
6fae0aa9
Commit
6fae0aa9
authored
Dec 20, 2016
by
4ast
Committed by
GitHub
Dec 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #868 from shodoco/pin
add bpf_obj_pin/bpf_obj_get to pin/get bpf objects
parents
ae8ae662
37dcac0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
src/cc/CMakeLists.txt
src/cc/CMakeLists.txt
+1
-1
src/cc/libbpf.c
src/cc/libbpf.c
+19
-0
src/cc/libbpf.h
src/cc/libbpf.h
+3
-0
No files found.
src/cc/CMakeLists.txt
View file @
6fae0aa9
...
...
@@ -67,7 +67,7 @@ target_link_libraries(bcc-static b_frontend clang_frontend bcc-loader-static ${c
install
(
TARGETS bcc-shared LIBRARY COMPONENT libbcc
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
install
(
FILES bpf_common.h bpf_module.h bcc_syms.h bcc_exception.h libbpf.h perf_reader.h BPF.h BPFTable.h COMPONENT libbcc
install
(
FILES bpf_common.h bpf_module.h bcc_syms.h bcc_exception.h libbpf.h perf_reader.h BPF.h BPFTable.h
shared_table.h
COMPONENT libbcc
DESTINATION include/bcc
)
install
(
DIRECTORY compat/linux/ COMPONENT libbcc
DESTINATION include/bcc/compat/linux
...
...
src/cc/libbpf.c
View file @
6fae0aa9
...
...
@@ -631,3 +631,22 @@ int bpf_detach_perf_event(uint32_t ev_type, uint32_t ev_config) {
// callers to detach anything they attach.
return
0
;
}
int
bpf_obj_pin
(
int
fd
,
const
char
*
pathname
)
{
union
bpf_attr
attr
=
{
.
pathname
=
ptr_to_u64
((
void
*
)
pathname
),
.
bpf_fd
=
fd
,
};
return
syscall
(
__NR_bpf
,
BPF_OBJ_PIN
,
&
attr
,
sizeof
(
attr
));
}
int
bpf_obj_get
(
const
char
*
pathname
)
{
union
bpf_attr
attr
=
{
.
pathname
=
ptr_to_u64
((
void
*
)
pathname
),
};
return
syscall
(
__NR_bpf
,
BPF_OBJ_GET
,
&
attr
,
sizeof
(
attr
));
}
src/cc/libbpf.h
View file @
6fae0aa9
...
...
@@ -71,6 +71,9 @@ int bpf_attach_perf_event(int progfd, uint32_t ev_type, uint32_t ev_config,
pid_t
pid
,
int
cpu
,
int
group_fd
);
int
bpf_detach_perf_event
(
uint32_t
ev_type
,
uint32_t
ev_config
);
int
bpf_obj_pin
(
int
fd
,
const
char
*
pathname
);
int
bpf_obj_get
(
const
char
*
pathname
);
#define LOG_BUF_SIZE 65536
// Put non-static/inline functions in their own section with this prefix +
...
...
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