Skip to content

Commit eb6ee20

Browse files
tixxdzjrfastab
authored andcommitted
pkg:api: add Cgroup message definition
Add cgroup message definition that will be sent from bpf side. Signed-off-by: Djalal Harouni <[email protected]>
1 parent e733a99 commit eb6ee20

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pkg/api/processapi/processapi.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const (
1212
// cgroup of the task
1313
DOCKER_ID_LENGTH = 128
1414

15+
// Length of the cgroup name as it is returned from BPF side
16+
CGROUP_NAME_LENGTH = 128
17+
18+
// Length of the cgroup path as it is returned from BPF side
19+
CGROUP_PATH_LENGTH = 4096
20+
1521
MSG_SIZEOF_MAXARG = 100
1622
MSG_SIZEOF_EXECVE = 32
1723
MSG_SIZEOF_CWD = 256
@@ -138,3 +144,29 @@ type MsgExitEvent struct {
138144
ProcessKey MsgExecveKey `align:"current"`
139145
Info MsgExitInfo `align:"info"`
140146
}
147+
148+
// MsgCgroupData is complementary cgroup data that is collected from
149+
// BPF side on various cgroup events.
150+
type MsgCgroupData struct {
151+
State int32 // State of cgroup
152+
HierarchyId uint32 // Unique id for the hierarchy
153+
Level uint32 // The depth this cgroup is at
154+
Pad uint32
155+
Name [CGROUP_NAME_LENGTH]byte // Cgroup kernfs_node name
156+
}
157+
158+
// MsgCgroupEvent is the data that is sent from BPF side on cgroup events
159+
// into ring buffer.
160+
type MsgCgroupEvent struct {
161+
Common MsgCommon
162+
Parent MsgExecveKey
163+
CgrpOp uint32 // Current cgroup operation
164+
PID uint32
165+
NSPID uint32
166+
Flags uint32
167+
Ktime uint64
168+
CgrpidTracker uint64 // The tracking cgroup ID
169+
Cgrpid uint64 // Current cgroup ID
170+
CgrpData MsgCgroupData // Complementary cgroup data
171+
Path [CGROUP_PATH_LENGTH]byte // Full path of the cgroup on fs
172+
}

0 commit comments

Comments
 (0)