# io_uring: simplify tests by checking kernel version · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/87dd8d56690b4e8187d9a2a9fda9c611199f430f)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 87dd8d56690b4e8187d9a2a9fda9c611199f430f

Requested commit: 87dd8d56690b4e8187d9a2a9fda9c611199f430f

Commit: 87dd8d56690b4e8187d9a2a9fda9c611199f430f

Tree: afc3c541cd1c1ff950bb0e893b829e2bfdf6196b

Author: Igor Anić

Committer: Igor Anić

## Message

```
io_uring: simplify tests by checking kernel version

So far we relied on getting EINVAL in CQE for operations that kernel don't
support. The problem with that approach is that there are many other reasons
(like wrong params) to get EINVAL. The other problem is when we have an
operation that existed before and gets new behavior via different attributes,
like accept and accept_direct. Older kernels can fall back to non direct
operation although we set attributes for direct operation. Operation completes
successfully in both cases but with different results.

This commit introduces kernel version check at the start of the test. Making
body of the test free of checking for various kernel version differences.

Feature availability references:
  * https://manpages.debian.org/unstable/liburing-dev/io_uring_enter.2.en.html
  * https://kernel.dk/axboe-kr2022.pdf
  * https://github.com/Jiboo/zig/blob/5acf7969bc759ce51005924109924d9666f74429/lib/std/os/linux.zig#L3727
  * https://github.com/Jiboo/zig/blob/5acf7969bc759ce51005924109924d9666f74429/lib/std/os/linux.zig#L3993

```

## Parents

- [256384a2ec2f67fc1b9380be987c63d5702f180c](https://git.cafe/gitcafe/zig/commit/256384a2ec2f67fc1b9380be987c63d5702f180c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/87dd8d56690b4e8187d9a2a9fda9c611199f430f?format=markdown)
