Integrate sys.SetSubreaper, sys.GetSubreaper in sys/reaper package

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-05-03 17:21:35 +02:00
parent fffea312aa
commit 1b66fecad3
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 4 additions and 5 deletions

View File

@ -20,7 +20,6 @@ import (
"os" "os"
"os/signal" "os/signal"
"github.com/containerd/containerd/sys"
"github.com/containerd/containerd/sys/reaper" "github.com/containerd/containerd/sys/reaper"
runc "github.com/containerd/go-runc" runc "github.com/containerd/go-runc"
"github.com/containerd/ttrpc" "github.com/containerd/ttrpc"
@ -36,7 +35,7 @@ func setupSignals() (chan os.Signal, error) {
// for waiting on processes // for waiting on processes
runc.Monitor = reaper.Default runc.Monitor = reaper.Default
// 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 := sys.SetSubreaper(1); err != nil { if err := reaper.SetSubreaper(1); err != nil {
return nil, err return nil, err
} }
return signals, nil return signals, nil

View File

@ -17,7 +17,7 @@
package shim package shim
import ( import (
"github.com/containerd/containerd/sys" "github.com/containerd/containerd/sys/reaper"
"github.com/containerd/ttrpc" "github.com/containerd/ttrpc"
) )
@ -26,5 +26,5 @@ func newServer() (*ttrpc.Server, error) {
} }
func subreaper() error { func subreaper() error {
return sys.SetSubreaper(1) return reaper.SetSubreaper(1)
} }

View File

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
*/ */
package sys package reaper
import ( import (
"unsafe" "unsafe"