Add some basic doc for SysInfo

Signed-off-by: Eric Rafaloff <erafaloff@gmail.com>
This commit is contained in:
Eric Rafaloff 2015-03-26 23:05:07 -04:00
parent bf8dd1f603
commit a65d6fd83b
2 changed files with 4 additions and 1 deletions

1
sysinfo/README.md Normal file
View file

@ -0,0 +1 @@
SysInfo stores information about which features a kernel supports.

View file

@ -9,6 +9,7 @@ import (
"github.com/docker/libcontainer/cgroups" "github.com/docker/libcontainer/cgroups"
) )
// SysInfo stores information about which features a kernel supports.
type SysInfo struct { type SysInfo struct {
MemoryLimit bool MemoryLimit bool
SwapLimit bool SwapLimit bool
@ -16,6 +17,7 @@ type SysInfo struct {
AppArmor bool AppArmor bool
} }
// Returns a new SysInfo, using the filesystem to detect which features the kernel supports.
func New(quiet bool) *SysInfo { func New(quiet bool) *SysInfo {
sysInfo := &SysInfo{} sysInfo := &SysInfo{}
if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil { if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil {
@ -37,7 +39,7 @@ func New(quiet bool) *SysInfo {
} }
} }
// Check if AppArmor seems to be enabled on this system. // Check if AppArmor is supported
if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) { if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) {
sysInfo.AppArmor = false sysInfo.AppArmor = false
} else { } else {