From 4d27f20db0637f9a30053444212d3deb7fc5b1d0 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 24 Nov 2017 14:45:54 +0100 Subject: [PATCH] libcontainer: drop FreeBSD support runc is not supported on FreeBSD, so remove all FreeBSD specific bits. As suggested by @crosbymichael in #1653 Signed-off-by: Tobias Klauser --- libcontainer/configs/cgroup_unsupported.go | 2 +- libcontainer/configs/device_defaults.go | 2 +- libcontainer/devices/devices_test.go | 2 +- libcontainer/mount/mount_freebsd.go | 41 ---------------------- libcontainer/mount/mount_unsupported.go | 2 +- libcontainer/stats_freebsd.go | 5 --- libcontainer/system/sysconfig.go | 2 +- 7 files changed, 5 insertions(+), 51 deletions(-) delete mode 100644 libcontainer/mount/mount_freebsd.go delete mode 100644 libcontainer/stats_freebsd.go diff --git a/libcontainer/configs/cgroup_unsupported.go b/libcontainer/configs/cgroup_unsupported.go index 95e2830a..101d82a1 100644 --- a/libcontainer/configs/cgroup_unsupported.go +++ b/libcontainer/configs/cgroup_unsupported.go @@ -1,4 +1,4 @@ -// +build !windows,!linux,!freebsd +// +build !windows,!linux package configs diff --git a/libcontainer/configs/device_defaults.go b/libcontainer/configs/device_defaults.go index 4d348d21..e4f423c5 100644 --- a/libcontainer/configs/device_defaults.go +++ b/libcontainer/configs/device_defaults.go @@ -1,4 +1,4 @@ -// +build linux freebsd +// +build linux package configs diff --git a/libcontainer/devices/devices_test.go b/libcontainer/devices/devices_test.go index e804eff0..5d68804b 100644 --- a/libcontainer/devices/devices_test.go +++ b/libcontainer/devices/devices_test.go @@ -1,4 +1,4 @@ -// +build linux freebsd +// +build linux package devices diff --git a/libcontainer/mount/mount_freebsd.go b/libcontainer/mount/mount_freebsd.go deleted file mode 100644 index 4f32edcd..00000000 --- a/libcontainer/mount/mount_freebsd.go +++ /dev/null @@ -1,41 +0,0 @@ -package mount - -/* -#include -#include -#include -*/ -import "C" - -import ( - "fmt" - "reflect" - "unsafe" -) - -// Parse /proc/self/mountinfo because comparing Dev and ino does not work from -// bind mounts. -func parseMountTable() ([]*Info, error) { - var rawEntries *C.struct_statfs - - count := int(C.getmntinfo(&rawEntries, C.MNT_WAIT)) - if count == 0 { - return nil, fmt.Errorf("Failed to call getmntinfo") - } - - var entries []C.struct_statfs - header := (*reflect.SliceHeader)(unsafe.Pointer(&entries)) - header.Cap = count - header.Len = count - header.Data = uintptr(unsafe.Pointer(rawEntries)) - - var out []*Info - for _, entry := range entries { - var mountinfo Info - mountinfo.Mountpoint = C.GoString(&entry.f_mntonname[0]) - mountinfo.Source = C.GoString(&entry.f_mntfromname[0]) - mountinfo.Fstype = C.GoString(&entry.f_fstypename[0]) - out = append(out, &mountinfo) - } - return out, nil -} diff --git a/libcontainer/mount/mount_unsupported.go b/libcontainer/mount/mount_unsupported.go index 8245f01d..6cde1ed7 100644 --- a/libcontainer/mount/mount_unsupported.go +++ b/libcontainer/mount/mount_unsupported.go @@ -1,4 +1,4 @@ -// +build !linux,!freebsd freebsd,!cgo +// +build !linux package mount diff --git a/libcontainer/stats_freebsd.go b/libcontainer/stats_freebsd.go deleted file mode 100644 index f8d1d689..00000000 --- a/libcontainer/stats_freebsd.go +++ /dev/null @@ -1,5 +0,0 @@ -package libcontainer - -type Stats struct { - Interfaces []*NetworkInterface -} diff --git a/libcontainer/system/sysconfig.go b/libcontainer/system/sysconfig.go index b3a07cba..b8434f10 100644 --- a/libcontainer/system/sysconfig.go +++ b/libcontainer/system/sysconfig.go @@ -1,4 +1,4 @@ -// +build cgo,linux cgo,freebsd +// +build cgo,linux package system