Use a better package name for utility functions.
This commit is contained in:
parent
8c38c931b0
commit
f611b37834
5 changed files with 10 additions and 10 deletions
|
@ -8,7 +8,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/containerd/util"
|
"github.com/docker/containerd/osutils"
|
||||||
"github.com/docker/docker/pkg/term"
|
"github.com/docker/docker/pkg/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func main() {
|
||||||
signals := make(chan os.Signal, 2048)
|
signals := make(chan os.Signal, 2048)
|
||||||
signal.Notify(signals)
|
signal.Notify(signals)
|
||||||
// set the shim as the subreaper for all orphaned processes created by the container
|
// set the shim as the subreaper for all orphaned processes created by the container
|
||||||
if err := util.SetSubreaper(1); err != nil {
|
if err := osutils.SetSubreaper(1); err != nil {
|
||||||
logrus.WithField("error", err).Fatal("shim: set as subreaper")
|
logrus.WithField("error", err).Fatal("shim: set as subreaper")
|
||||||
}
|
}
|
||||||
// open the exit pipe
|
// open the exit pipe
|
||||||
|
@ -82,7 +82,7 @@ func main() {
|
||||||
logrus.WithField("signal", s).Debug("shim: received signal")
|
logrus.WithField("signal", s).Debug("shim: received signal")
|
||||||
switch s {
|
switch s {
|
||||||
case syscall.SIGCHLD:
|
case syscall.SIGCHLD:
|
||||||
exits, err := util.Reap()
|
exits, err := osutils.Reap()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithField("error", err).Error("shim: reaping child processes")
|
logrus.WithField("error", err).Error("shim: reaping child processes")
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ import (
|
||||||
"github.com/docker/containerd"
|
"github.com/docker/containerd"
|
||||||
"github.com/docker/containerd/api/grpc/server"
|
"github.com/docker/containerd/api/grpc/server"
|
||||||
"github.com/docker/containerd/api/grpc/types"
|
"github.com/docker/containerd/api/grpc/types"
|
||||||
|
"github.com/docker/containerd/osutils"
|
||||||
"github.com/docker/containerd/supervisor"
|
"github.com/docker/containerd/supervisor"
|
||||||
"github.com/docker/containerd/util"
|
|
||||||
"github.com/rcrowley/go-metrics"
|
"github.com/rcrowley/go-metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ func processMetrics() {
|
||||||
// update number of goroutines
|
// update number of goroutines
|
||||||
g.Update(int64(runtime.NumGoroutine()))
|
g.Update(int64(runtime.NumGoroutine()))
|
||||||
// collect the number of open fds
|
// collect the number of open fds
|
||||||
fds, err := util.GetOpenFds(os.Getpid())
|
fds, err := osutils.GetOpenFds(os.Getpid())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithField("error", err).Error("containerd: get open fd count")
|
logrus.WithField("error", err).Error("containerd: get open fd count")
|
||||||
}
|
}
|
||||||
|
@ -194,11 +194,11 @@ func daemon(address, stateDir string, concurrency int, oom bool) error {
|
||||||
func reapProcesses() {
|
func reapProcesses() {
|
||||||
s := make(chan os.Signal, 2048)
|
s := make(chan os.Signal, 2048)
|
||||||
signal.Notify(s, syscall.SIGCHLD)
|
signal.Notify(s, syscall.SIGCHLD)
|
||||||
if err := util.SetSubreaper(1); err != nil {
|
if err := osutils.SetSubreaper(1); err != nil {
|
||||||
logrus.WithField("error", err).Error("containerd: set subpreaper")
|
logrus.WithField("error", err).Error("containerd: set subpreaper")
|
||||||
}
|
}
|
||||||
for range s {
|
for range s {
|
||||||
if _, err := util.Reap(); err != nil {
|
if _, err := osutils.Reap(); err != nil {
|
||||||
logrus.WithField("error", err).Error("containerd: reap child processes")
|
logrus.WithField("error", err).Error("containerd: reap child processes")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// +build !windows,!darwin
|
// +build !windows,!darwin
|
||||||
|
|
||||||
package util
|
package osutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
|
@ -1,7 +1,7 @@
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
// http://man7.org/linux/man-pages/man2/prctl.2.html
|
// http://man7.org/linux/man-pages/man2/prctl.2.html
|
||||||
package util
|
package osutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
|
@ -1,4 +1,4 @@
|
||||||
package util
|
package osutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
Loading…
Reference in a new issue