Merge pull request #103 from docker/osutils
Use a better package name for utility functions
This commit is contained in:
commit
4de168877b
5 changed files with 12 additions and 10 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
"syscall"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/containerd/util"
|
||||
"github.com/docker/containerd/osutils"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func main() {
|
|||
signals := make(chan os.Signal, 2048)
|
||||
signal.Notify(signals)
|
||||
// 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")
|
||||
}
|
||||
// open the exit pipe
|
||||
|
@ -82,7 +82,7 @@ func main() {
|
|||
logrus.WithField("signal", s).Debug("shim: received signal")
|
||||
switch s {
|
||||
case syscall.SIGCHLD:
|
||||
exits, err := util.Reap()
|
||||
exits, err := osutils.Reap()
|
||||
if err != nil {
|
||||
logrus.WithField("error", err).Error("shim: reaping child processes")
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"github.com/docker/containerd"
|
||||
"github.com/docker/containerd/api/grpc/server"
|
||||
"github.com/docker/containerd/api/grpc/types"
|
||||
"github.com/docker/containerd/osutils"
|
||||
"github.com/docker/containerd/supervisor"
|
||||
"github.com/docker/containerd/util"
|
||||
"github.com/rcrowley/go-metrics"
|
||||
)
|
||||
|
||||
|
@ -141,7 +141,7 @@ func processMetrics() {
|
|||
// update number of goroutines
|
||||
g.Update(int64(runtime.NumGoroutine()))
|
||||
// collect the number of open fds
|
||||
fds, err := util.GetOpenFds(os.Getpid())
|
||||
fds, err := osutils.GetOpenFds(os.Getpid())
|
||||
if err != nil {
|
||||
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() {
|
||||
s := make(chan os.Signal, 2048)
|
||||
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")
|
||||
}
|
||||
for range s {
|
||||
if _, err := util.Reap(); err != nil {
|
||||
if _, err := osutils.Reap(); err != nil {
|
||||
logrus.WithField("error", err).Error("containerd: reap child processes")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// +build !windows,!darwin
|
||||
|
||||
package util
|
||||
package osutils
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
|
@ -1,7 +1,7 @@
|
|||
// +build linux
|
||||
|
||||
// http://man7.org/linux/man-pages/man2/prctl.2.html
|
||||
package util
|
||||
package osutils
|
||||
|
||||
import (
|
||||
"syscall"
|
|
@ -1,4 +1,6 @@
|
|||
package util
|
||||
// +build !windows
|
||||
|
||||
package osutils
|
||||
|
||||
import (
|
||||
"syscall"
|
Loading…
Reference in a new issue