From a65d6fd83bebb47b8966e2752f80d20de8b6bc09 Mon Sep 17 00:00:00 2001 From: Eric Rafaloff Date: Thu, 26 Mar 2015 23:05:07 -0400 Subject: [PATCH 1/3] Add some basic doc for SysInfo Signed-off-by: Eric Rafaloff --- sysinfo/README.md | 1 + sysinfo/sysinfo.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 sysinfo/README.md diff --git a/sysinfo/README.md b/sysinfo/README.md new file mode 100644 index 0000000..c1530ce --- /dev/null +++ b/sysinfo/README.md @@ -0,0 +1 @@ +SysInfo stores information about which features a kernel supports. diff --git a/sysinfo/sysinfo.go b/sysinfo/sysinfo.go index 506124e..7c769e3 100644 --- a/sysinfo/sysinfo.go +++ b/sysinfo/sysinfo.go @@ -9,6 +9,7 @@ import ( "github.com/docker/libcontainer/cgroups" ) +// SysInfo stores information about which features a kernel supports. type SysInfo struct { MemoryLimit bool SwapLimit bool @@ -16,6 +17,7 @@ type SysInfo struct { AppArmor bool } +// Returns a new SysInfo, using the filesystem to detect which features the kernel supports. func New(quiet bool) *SysInfo { sysInfo := &SysInfo{} 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) { sysInfo.AppArmor = false } else { From 6bd155234fd9ee70f942d75b1f84c2377d27b8e5 Mon Sep 17 00:00:00 2001 From: Eric Rafaloff Date: Thu, 26 Mar 2015 23:22:05 -0400 Subject: [PATCH 2/3] Add missing . in comment Signed-off-by: Eric Rafaloff --- sysinfo/sysinfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysinfo/sysinfo.go b/sysinfo/sysinfo.go index 7c769e3..67dc589 100644 --- a/sysinfo/sysinfo.go +++ b/sysinfo/sysinfo.go @@ -39,7 +39,7 @@ func New(quiet bool) *SysInfo { } } - // Check if AppArmor is supported + // Check if AppArmor is supported. if _, err := os.Stat("/sys/kernel/security/apparmor"); os.IsNotExist(err) { sysInfo.AppArmor = false } else { From c402815bdffcd0a7e10839278653c53e2d120217 Mon Sep 17 00:00:00 2001 From: Eric Rafaloff Date: Fri, 27 Mar 2015 13:55:22 -0400 Subject: [PATCH 3/3] Update inline doc for New Signed-off-by: Eric Rafaloff --- sysinfo/sysinfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysinfo/sysinfo.go b/sysinfo/sysinfo.go index 67dc589..16839bc 100644 --- a/sysinfo/sysinfo.go +++ b/sysinfo/sysinfo.go @@ -17,7 +17,7 @@ type SysInfo struct { AppArmor bool } -// Returns a new SysInfo, using the filesystem to detect which features the kernel supports. +// New returns a new SysInfo, using the filesystem to detect which features the kernel supports. func New(quiet bool) *SysInfo { sysInfo := &SysInfo{} if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil {