aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/linux/bpf.zig
AgeCommit message (Collapse)Author
2025-09-15bpf: use bitCast instead of intCast in ld_imm_implGeorge Huebner
Any 32 bit immediate is allowed in a BPF instruction, including those greater than the largest positive i32 value.
2025-03-24lib/std: PermissionDenied/AccessDenied cleanup and falloutPat Tullmann
This PR consistently maps .ACCES into AccessDenied and .PERM into PermissionDenied. AccessDenied is returned if the file mode bit (user/group/other rwx bits) disallow access (errno was `EACCES`). PermissionDenied is returned if something else denies access (errno was `EPERM`) (immutable bit, SELinux, capabilities, etc). This somewhat subtle distinction is a POSIX thing. Most of the change is updating std.posix Error Sets to contain both errors, and then propagating the pair up through caller Error Sets. Fixes #16782
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-07-09std: fix typos (#20560)Jora Troosh
2024-07-09bpf: sync map/prog/attach type with latest linux kernelTw
Note that the original `cgroup_storage` MapType has been deprecated, so renamed to `cgroup_storage_deprecated`. Signed-off-by: Tw <tw19881113@gmail.com>
2024-04-20Fix usage of `unexpectedErrno`Jared Baur
`unexpectedErrno` comes from `std.posix`, not `std.os`.
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-01-03doc: Fix typos in bpf docsKarl Böhlmark
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-09-15bpf: remove unhelpful "comptime" and fix union orderbfredl
Insn.st() can be used with dynamic size just like Insn.stx(), which is relevant in a code generation context. using ImmOrReg caused an error as its fields were ordered differently than Source.
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13bpf: expose "syscall" program type and F_SLEEPABLE flagbfredl
2023-04-28std: update to use `@memcpy` directlyAndrew Kelley
2022-11-27linux.bpf: expose map_get_next_keybfredl
Returning a bool allows to conveniently use it as the condition of a while loop. Also remove restriction that ST cannot be double-word. While imm is only 32-bit, this value is extended into a 64-bit memory location.
2022-10-16os.linux: some fixes to BPF modulebfredl
- For ALU operations, src should be allowed to be an explicit Reg. - Expose AluOp and JmpOp as public types. This makes code generation using BPF as a backend easier, as AluOp and JmpOp can be used directly as part of an IR
2022-08-19std.os.linux.bpf: fix compile errorAndrew Kelley
2021-09-01std, compiler-rt: remove test names where applicableAndrew Kelley
Tests with no names are executed when using `zig test` regardless of the `--test-filter` used. Non-named tests should be used when simply importing unit tests from another file. This allows `zig test` to find all the appropriate tests, even when using `--test-filter`.
2021-09-01std.os.linux: remove the "bits" namespace altogetherAndrew Kelley
Now there is only 1 architecture-specific file for Linux kernel bits.
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24std: [breaking] move errno to become an nonexhaustive enumAndrew Kelley
The primary purpose of this change is to eliminate one usage of `usingnamespace` in the standard library - specifically the usage for errno values in `std.os.linux`. This is accomplished by truncating the `E` prefix from error values, and making errno a proper enum. A similar strategy can be used to eliminate some other `usingnamespace` sites in the std lib.
2021-06-21std.os.linux.bpf: fix incorrect usage of unexpectedErrnoAndrew Kelley
2021-06-21fix code broken from previous commitJacob G-W
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-22std: fix compile errors caught by stage2 AstGenAndrew Kelley
Follow-up from 507a8096d2f9624bafaf963c3e189a477ef6b7bf
2021-04-22delete packed enums from the languageAndrew Kelley
No need for any such thing. Instead, provide an integer tag type for the enum.
2020-12-31Year++Frank Denis
2020-09-12added helper definitionsMatt Knight
2020-09-08Merge pull request #6267 from mattnite/btfAndrew Kelley
BPF: add BTF
2020-09-07added map create, update, delete, and prog loadMatt Knight
2020-09-07BPF: add some more documentation (#6268)Matthew Knight
* added documentation for ringbuffers, which context type maps to which program type, and added some formatting
2020-09-06added btfMatt Knight
2020-09-06fixed improper builtin importMatt Knight
2020-09-06improved compile error messageMatt Knight
2020-09-06removed redundant pseudo insnMatt Knight
2020-09-06implemented and testing op codes for instructions documented in the ↵Matt Knight
unofficial bpf insn reference
2020-08-22Bpf: move under os/linux instead of bits (#6126)Matthew Knight
* moved bpf syscall, added some bpf instructions and tests * had to move bpf out of bits so that a freestanding target could import it * removed line * fixed imports