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
d4a3baf4
Commit
d4a3baf4
authored
Dec 20, 2016
by
Huapeng Zhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not close extern table when a module destructs
parent
35d6ff8d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
src/cc/bpf_module.cc
src/cc/bpf_module.cc
+3
-2
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+2
-3
src/cc/table_desc.h
src/cc/table_desc.h
+1
-0
No files found.
src/cc/bpf_module.cc
View file @
d4a3baf4
...
...
@@ -118,10 +118,11 @@ BPFModule::~BPFModule() {
ctx_
.
reset
();
if
(
tables_
)
{
for
(
auto
table
:
*
tables_
)
{
if
(
table
.
is_shared
)
if
(
table
.
is_shared
)
{
SharedTables
::
instance
()
->
remove_fd
(
table
.
name
);
else
}
else
if
(
!
table
.
is_extern
)
{
close
(
table
.
fd
);
}
}
}
}
...
...
src/cc/frontends/clang/b_frontend_action.cc
View file @
d4a3baf4
...
...
@@ -631,7 +631,6 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
++
i
;
}
bool
is_extern
=
false
;
bpf_map_type
map_type
=
BPF_MAP_TYPE_UNSPEC
;
if
(
A
->
getName
()
==
"maps/hash"
)
{
map_type
=
BPF_MAP_TYPE_HASH
;
...
...
@@ -666,7 +665,7 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
}
else
if
(
A
->
getName
()
==
"maps/stacktrace"
)
{
map_type
=
BPF_MAP_TYPE_STACK_TRACE
;
}
else
if
(
A
->
getName
()
==
"maps/extern"
)
{
is_extern
=
true
;
table
.
is_extern
=
true
;
table
.
fd
=
SharedTables
::
instance
()
->
lookup_fd
(
table
.
name
);
table
.
type
=
SharedTables
::
instance
()
->
lookup_type
(
table
.
name
);
}
else
if
(
A
->
getName
()
==
"maps/export"
)
{
...
...
@@ -687,7 +686,7 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
return
true
;
}
if
(
!
is_extern
)
{
if
(
!
table
.
is_extern
)
{
if
(
map_type
==
BPF_MAP_TYPE_UNSPEC
)
{
error
(
Decl
->
getLocStart
(),
"unsupported map type: %0"
)
<<
A
->
getName
();
return
false
;
...
...
src/cc/table_desc.h
View file @
d4a3baf4
...
...
@@ -40,6 +40,7 @@ struct TableDesc {
llvm
::
Function
*
key_snprintf
;
llvm
::
Function
*
leaf_snprintf
;
bool
is_shared
;
bool
is_extern
;
};
}
// 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