unix: add cgroupstats type and constants

The cgroupstats structure is available via Linux's generic netlink
taskstats interface.

For more information, please see:
https://www.kernel.org/doc/Documentation/accounting/cgroupstats.txt.

Fixes golang/go#23388.

Change-Id: I8a05a3875209e99a427d54049eacc98f415e44cf
Reviewed-on: https://go-review.googlesource.com/86975
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Matt Layher
2018-01-09 18:07:26 +00:00
parent d38bf781f1
commit b9cf5f96b6
13 changed files with 213 additions and 1 deletions
+14 -1
View File
@@ -64,6 +64,7 @@ package unix
#include <linux/vm_sockets.h>
#include <linux/random.h>
#include <linux/taskstats.h>
#include <linux/cgroupstats.h>
#include <linux/genetlink.h>
// On mips64, the glibc stat and kernel stat do not agree
@@ -543,7 +544,7 @@ type Termios C.termios_t
type Winsize C.struct_winsize
// Taskstats
// Taskstats and cgroup stats.
type Taskstats C.struct_taskstats
@@ -565,6 +566,18 @@ const (
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = C.TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK
)
type CGroupStats C.struct_cgroupstats
const (
CGROUPSTATS_CMD_UNSPEC = C.__TASKSTATS_CMD_MAX
CGROUPSTATS_CMD_GET = C.CGROUPSTATS_CMD_GET
CGROUPSTATS_CMD_NEW = C.CGROUPSTATS_CMD_NEW
CGROUPSTATS_TYPE_UNSPEC = C.CGROUPSTATS_TYPE_UNSPEC
CGROUPSTATS_TYPE_CGROUP_STATS = C.CGROUPSTATS_TYPE_CGROUP_STATS
CGROUPSTATS_CMD_ATTR_UNSPEC = C.CGROUPSTATS_CMD_ATTR_UNSPEC
CGROUPSTATS_CMD_ATTR_FD = C.CGROUPSTATS_CMD_ATTR_FD
)
// Generic netlink
type Genlmsghdr C.struct_genlmsghdr