commit a46ffebb5194b4547ef400008f1ebe00c7fe3730
parent 8b10ef57d22a763cec2c0e7df8c68963622dcdba
Author: Blain Smith <rebelgeek@blainsmith.com>
Date: Tue, 26 Dec 2023 11:09:14 -0500
rt: BPF socket structs & option levels for Linux
I've been working on a BPF module with my own versions of these structs
and definitions, but I figured it was worth issuing a patch to get
them included in the Linux runtime here. I kept the names of the struct
fields as close as possible to the kernel versions.
Signed-off-by: Blain Smith <rebelgeek@blainsmith.com>
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/rt/+linux/socket.ha b/rt/+linux/socket.ha
@@ -86,6 +86,18 @@ export type cmsg = struct {
cmsg_data: [*]u8,
};
+export type sock_filter = struct {
+ __code: u16,
+ __jt: u8,
+ __jf: u8,
+ __k: u32,
+};
+
+export type sock_fprog = struct {
+ __len: u16,
+ __filter: *[*]sock_filter,
+};
+
// domain for socket(2)
// Unspecified
@@ -404,6 +416,9 @@ export def SO_PRIORITY: int = 12;
export def SO_LINGER: int = 13;
export def SO_BSDCOMPAT: int = 14;
export def SO_REUSEPORT: int = 15;
+export def SO_ATTACH_FILTER: int = 26;
+export def SO_DETATCH_FILTER: int = 27;
+export def SO_LOCK_FILTER: int = 44;
// the following differ on ppc
export def SO_PASSCRED: int = 16;