Skip to content

QRWells/LibUringSharp

Repository files navigation

LibUringSharp

A C# wrapper for the Linux io_uring API like liburing.

Features

  • io_uring probe
  • Basic Operations
  • Select Buffers
  • Async/Await Support
  • Kernel version check

Example

using LibUringSharp;

using var ring = new Ring(4);
using var file = Open("test.txt", OpenOption.Create | OpenOption.Truncate | OpenOption.ReadWrite, new FilePermissions());

var str = "Hello World!";

Submission sub;

// Write to the file
if (ring.TryGetNextSqe(out sub))
{
    var bytes = Encoding.UTF8.GetBytes(str);
    sub.Option |= SubmissionOption.IoLink;
    sub.PrepareWrite(file, bytes, 0);
}

// Read the file
if (ring.TryGetNextSqe(out sub))
{
    var buffer = new byte[str.Length];
    sub.PrepareRead(file, buffer, 0);
}

ring.Submit();

while (ring.TryGetCompletion(out var com))
{
    Console.WriteLine(com.Result); // output: 12
}

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A C# wrapper for the Linux io_uring API.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages