Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at nocache-cleanup 106 lines 2.1 kB view raw
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ 3#include "bpf_experimental.h" 4#include <bpf/bpf_helpers.h> 5#include "bpf_misc.h" 6#include <stdbool.h> 7 8char _license[] SEC("license") = "GPL"; 9 10typedef __s32 s32; 11typedef s32 i32; 12typedef __u8 u8; 13 14enum Enum { EA1 = 0, EA2 = 11, EA3 = 10 }; 15enum Enumu64 {EB1 = 0llu, EB2 = 12llu }; 16enum Enums64 { EC1 = 0ll, EC2 = 13ll }; 17 18const volatile __s64 var_s64 = -1; 19const volatile __u64 var_u64 = 0; 20const volatile i32 var_s32 = -1; 21const volatile __u32 var_u32 = 0; 22const volatile __s16 var_s16 = -1; 23const volatile __u16 var_u16 = 0; 24const volatile __s8 var_s8 = -1; 25const volatile u8 var_u8 = 0; 26const volatile enum Enum var_ea = EA1; 27const volatile enum Enumu64 var_eb = EB1; 28const volatile enum Enums64 var_ec = EC1; 29const volatile bool var_b = false; 30const volatile i32 arr[32]; 31const volatile enum Enum enum_arr[32]; 32const volatile i32 three_d[47][19][17]; 33const volatile i32 *ptr_arr[32]; 34 35struct Struct { 36 int:16; 37 __u16 filler; 38 struct { 39 const __u16 filler2; 40 }; 41 struct Struct2 { 42 __u16 filler; 43 volatile struct { 44 const int:1; 45 union { 46 const volatile u8 var_u8[3]; 47 const volatile __s16 filler3; 48 const int:1; 49 s32 mat[7][5]; 50 } u; 51 }; 52 } struct2[2][4]; 53}; 54 55const volatile __u32 stru = 0; /* same prefix as below */ 56const volatile struct Struct struct1[3]; 57const volatile struct Struct struct11[11][7]; 58 59struct Struct3 { 60 struct { 61 u8 var_u8_l; 62 }; 63 struct { 64 struct { 65 u8 var_u8_h; 66 }; 67 }; 68}; 69 70typedef struct Struct3 Struct3_t; 71 72union Union { 73 __u16 var_u16; 74 Struct3_t struct3; 75}; 76 77const volatile union Union union1 = {.var_u16 = -1}; 78 79SEC("socket") 80int test_set_globals(void *ctx) 81{ 82 volatile __s8 a; 83 84 a = var_s64; 85 a = var_u64; 86 a = var_s32; 87 a = var_u32; 88 a = var_s16; 89 a = var_u16; 90 a = var_s8; 91 a = var_u8; 92 a = var_ea; 93 a = var_eb; 94 a = var_ec; 95 a = var_b; 96 a = struct1[2].struct2[1][2].u.var_u8[2]; 97 a = union1.var_u16; 98 a = arr[3]; 99 a = arr[EA2]; 100 a = enum_arr[EC2]; 101 a = three_d[31][7][EA2]; 102 a = struct1[2].struct2[1][2].u.mat[5][3]; 103 a = struct11[7][5].struct2[0][1].u.mat[3][0]; 104 105 return a; 106}