Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5acfb160
Commit
5acfb160
authored
Jul 20, 2017
by
Tobias Klauser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Eventfd() from x/sys/unix
Use unix.Eventfd() instead of C.eventfd and also use the correct corresponding unix.EFD_CLOEXEC flag. This allows to get rid of cgo.
parent
4a69005f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
23 deletions
+2
-23
BUILD
pkg/kubelet/eviction/BUILD
+1
-14
threshold_notifier_linux.go
pkg/kubelet/eviction/threshold_notifier_linux.go
+1
-9
No files found.
pkg/kubelet/eviction/BUILD
View file @
5acfb160
...
@@ -4,23 +4,10 @@ licenses(["notice"])
...
@@ -4,23 +4,10 @@ licenses(["notice"])
load(
load(
"@io_bazel_rules_go//go:def.bzl",
"@io_bazel_rules_go//go:def.bzl",
"cgo_genrule",
"go_library",
"go_library",
"go_test",
"go_test",
)
)
cgo_genrule(
name = "cgo_codegen",
srcs = ["threshold_notifier_linux.go"],
clinkopts = [
"-lz",
"-lm",
"-lpthread",
"-ldl",
],
tags = ["automanaged"],
)
go_test(
go_test(
name = "go_default_test",
name = "go_default_test",
srcs = [
srcs = [
...
@@ -53,9 +40,9 @@ go_library(
...
@@ -53,9 +40,9 @@ go_library(
"doc.go",
"doc.go",
"eviction_manager.go",
"eviction_manager.go",
"helpers.go",
"helpers.go",
"threshold_notifier_linux.go",
"types.go",
"types.go",
],
],
library = ":cgo_codegen",
tags = ["automanaged"],
tags = ["automanaged"],
deps = [
deps = [
"//pkg/api:go_default_library",
"//pkg/api:go_default_library",
...
...
pkg/kubelet/eviction/threshold_notifier_linux.go
View file @
5acfb160
// +build cgo
/*
/*
Copyright 2016 The Kubernetes Authors.
Copyright 2016 The Kubernetes Authors.
...
@@ -18,11 +16,6 @@ limitations under the License.
...
@@ -18,11 +16,6 @@ limitations under the License.
package
eviction
package
eviction
/*
#include <sys/eventfd.h>
*/
import
"C"
import
(
import
(
"fmt"
"fmt"
...
@@ -61,11 +54,10 @@ func NewMemCGThresholdNotifier(path, attribute, threshold, description string, h
...
@@ -61,11 +54,10 @@ func NewMemCGThresholdNotifier(path, attribute, threshold, description string, h
unix
.
Close
(
controlfd
)
unix
.
Close
(
controlfd
)
}
}
}()
}()
e
fd
,
err
:=
C
.
eventfd
(
0
,
C
.
EFD_CLOEXEC
)
e
ventfd
,
err
:=
unix
.
Eventfd
(
0
,
unix
.
EFD_CLOEXEC
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
eventfd
:=
int
(
efd
)
if
eventfd
<
0
{
if
eventfd
<
0
{
err
=
fmt
.
Errorf
(
"eventfd call failed"
)
err
=
fmt
.
Errorf
(
"eventfd call failed"
)
return
nil
,
err
return
nil
,
err
...
...
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