Skip to content

Commit d3618be

Browse files
committed
Moving the rest of runc to x/sys/unix
Signed-off-by: Christy Perez <[email protected]>
1 parent 852f375 commit d3618be

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

checkpoint.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"fmt"
77
"strconv"
88
"strings"
9-
"syscall"
109

1110
"github.com/opencontainers/runc/libcontainer"
1211
"github.com/opencontainers/runtime-spec/specs-go"
1312
"github.com/urfave/cli"
13+
14+
"golang.org/x/sys/unix"
1415
)
1516

1617
var checkpointCommand = cli.Command{
@@ -113,7 +114,7 @@ func setManageCgroupsMode(context *cli.Context, options *libcontainer.CriuOpts)
113114
}
114115

115116
var namespaceMapping = map[specs.LinuxNamespaceType]int{
116-
specs.NetworkNamespace: syscall.CLONE_NEWNET,
117+
specs.NetworkNamespace: unix.CLONE_NEWNET,
117118
}
118119

119120
func setEmptyNsMask(context *cli.Context, options *libcontainer.CriuOpts) error {

delete.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import (
1111

1212
"github.com/opencontainers/runc/libcontainer"
1313
"github.com/urfave/cli"
14+
15+
"golang.org/x/sys/unix"
1416
)
1517

1618
func killContainer(container libcontainer.Container) error {
17-
_ = container.Signal(syscall.SIGKILL, false)
19+
_ = container.Signal(unix.SIGKILL, false)
1820
for i := 0; i < 100; i++ {
1921
time.Sleep(100 * time.Millisecond)
2022
if err := container.Signal(syscall.Signal(0), false); err != nil {

list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"io/ioutil"
88
"os"
99
"path/filepath"
10-
"syscall"
10+
"syscall" // avoid use if possible
1111
"text/tabwriter"
1212
"time"
1313

restore.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ package main
55
import (
66
"fmt"
77
"os"
8-
"syscall"
98

109
"github.com/Sirupsen/logrus"
1110
"github.com/opencontainers/runc/libcontainer"
1211
"github.com/opencontainers/runc/libcontainer/configs"
1312
"github.com/opencontainers/runc/libcontainer/specconv"
1413
"github.com/opencontainers/runtime-spec/specs-go"
1514
"github.com/urfave/cli"
15+
16+
"golang.org/x/sys/unix"
1617
)
1718

1819
var restoreCommand = cli.Command{
@@ -189,7 +190,7 @@ func restoreContainer(context *cli.Context, spec *specs.Spec, config *configs.Co
189190
}
190191
if pidFile := context.String("pid-file"); pidFile != "" {
191192
if err := createPidFile(pidFile, process); err != nil {
192-
_ = process.Signal(syscall.SIGKILL)
193+
_ = process.Signal(unix.SIGKILL)
193194
_, _ = process.Wait()
194195
return -1, err
195196
}

utils_linux.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"os"
1010
"path/filepath"
1111
"strconv"
12-
"syscall"
1312

1413
"github.com/Sirupsen/logrus"
1514
"github.com/coreos/go-systemd/activation"
@@ -20,6 +19,8 @@ import (
2019
"github.com/opencontainers/runc/libcontainer/utils"
2120
"github.com/opencontainers/runtime-spec/specs-go"
2221
"github.com/urfave/cli"
22+
23+
"golang.org/x/sys/unix"
2324
)
2425

2526
var errEmptyID = errors.New("container id cannot be empty")
@@ -308,7 +309,7 @@ func (r *runner) destroy() {
308309
}
309310

310311
func (r *runner) terminate(p *libcontainer.Process) {
311-
_ = p.Signal(syscall.SIGKILL)
312+
_ = p.Signal(unix.SIGKILL)
312313
_, _ = p.Wait()
313314
}
314315

0 commit comments

Comments
 (0)