mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 07:07:33 -04:00
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:
+14
-1
@@ -64,6 +64,7 @@ package unix
|
|||||||
#include <linux/vm_sockets.h>
|
#include <linux/vm_sockets.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
#include <linux/taskstats.h>
|
#include <linux/taskstats.h>
|
||||||
|
#include <linux/cgroupstats.h>
|
||||||
#include <linux/genetlink.h>
|
#include <linux/genetlink.h>
|
||||||
|
|
||||||
// On mips64, the glibc stat and kernel stat do not agree
|
// 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
|
type Winsize C.struct_winsize
|
||||||
|
|
||||||
// Taskstats
|
// Taskstats and cgroup stats.
|
||||||
|
|
||||||
type Taskstats C.struct_taskstats
|
type Taskstats C.struct_taskstats
|
||||||
|
|
||||||
@@ -565,6 +566,18 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = C.TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK
|
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
|
// Generic netlink
|
||||||
|
|
||||||
type Genlmsghdr C.struct_genlmsghdr
|
type Genlmsghdr C.struct_genlmsghdr
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ ccflags="$@"
|
|||||||
$2 ~ /^(VM|VMADDR)_/ ||
|
$2 ~ /^(VM|VMADDR)_/ ||
|
||||||
$2 ~ /^IOCTL_VM_SOCKETS_/ ||
|
$2 ~ /^IOCTL_VM_SOCKETS_/ ||
|
||||||
$2 ~ /^(TASKSTATS|TS)_/ ||
|
$2 ~ /^(TASKSTATS|TS)_/ ||
|
||||||
|
$2 ~ /^CGROUPSTATS_/ ||
|
||||||
$2 ~ /^GENL_/ ||
|
$2 ~ /^GENL_/ ||
|
||||||
$2 ~ /^UTIME_/ ||
|
$2 ~ /^UTIME_/ ||
|
||||||
$2 ~ /^XATTR_(CREATE|REPLACE)/ ||
|
$2 ~ /^XATTR_(CREATE|REPLACE)/ ||
|
||||||
|
|||||||
@@ -760,6 +760,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -778,6 +778,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -749,6 +749,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -757,6 +757,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -754,6 +754,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -759,6 +759,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -759,6 +759,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -754,6 +754,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -767,6 +767,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -767,6 +767,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
@@ -784,6 +784,24 @@ const (
|
|||||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CGroupStats struct {
|
||||||
|
Sleeping uint64
|
||||||
|
Running uint64
|
||||||
|
Stopped uint64
|
||||||
|
Uninterruptible uint64
|
||||||
|
Io_wait uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
CGROUPSTATS_CMD_UNSPEC = 0x3
|
||||||
|
CGROUPSTATS_CMD_GET = 0x4
|
||||||
|
CGROUPSTATS_CMD_NEW = 0x5
|
||||||
|
CGROUPSTATS_TYPE_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_TYPE_CGROUP_STATS = 0x1
|
||||||
|
CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0
|
||||||
|
CGROUPSTATS_CMD_ATTR_FD = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
type Genlmsghdr struct {
|
type Genlmsghdr struct {
|
||||||
Cmd uint8
|
Cmd uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
|||||||
Reference in New Issue
Block a user