var Endian … type genMsghdr … type netlinkMessage … func (m netlinkMessage) toRawMsg() (rawmsg syscall.NetlinkMessage) { … } type loadStatsResp … // Return required padding to align 'size' to 'alignment'. func padding(size int, alignment int) int { … } // Get family id for taskstats subsystem. func getFamilyID(conn *Connection) (uint16, error) { … } // Append an attribute to the message. // Adds attribute info (length and type), followed by the data and necessary padding. // Can be called multiple times to add attributes. Only fixed size and string type // attributes are handled. We don't need nested attributes for task stats. func addAttribute(buf *bytes.Buffer, attrType uint16, data interface{ … } // Prepares the message and generic headers and appends attributes as data. func prepareMessage(headerType uint16, cmd uint8, attributes []byte) (msg netlinkMessage) { … } // Prepares message to query family id for task stats. func prepareFamilyMessage() (msg netlinkMessage) { … } // Prepares message to query task stats for a task group. func prepareCmdMessage(id uint16, cfd uintptr) (msg netlinkMessage) { … } // Extracts returned family id from the response. func parseFamilyResp(msg syscall.NetlinkMessage) (uint16, error) { … } // Extract task stats from response returned by kernel. func parseLoadStatsResp(msg syscall.NetlinkMessage) (*loadStatsResp, error) { … } // Verify and return any error reported by kernel. func verifyHeader(msg syscall.NetlinkMessage) error { … } // Get load stats for a task group. // id: family id for taskstats. // cfd: open file to path to the cgroup directory under cpu hierarchy. // conn: open netlink connection used to communicate with kernel. func getLoadStats(id uint16, cfd *os.File, conn *Connection) (info.LoadStats, error) { … }