|
|
|
|
|
by throw7
2232 days ago
|
|
The site pushes really hard that you shouldn't use the low-level system calls in your code and that you should (always?) be using a library (liburing). What exactly is liburing bringing to the table that I shouldn't be using the uring syscalls directly? |
|
https://github.com/torvalds/linux/blob/master/tools/include/...
This system call avoidance dogma exists because libraries generally have more convenient interfaces and are therefore easier to use. They're not strictly necessary though.
It should be noted that using certain system calls may cause problems with the libraries you're using. For example, glibc needs to maintain complete control over the threading model in order to implement thread-local storage. By issuing a clone system call directly, the glibc threading model is broken and even something simple like errno is likely to break.
In my opinion, libraries shouldn't contain thread-local or global variables in the first place. Unfortunately, the C language is old and these problems will never be fixed. It's possible to create better libraries in freestanding C or even freestanding Rust but replacing what already exists is a lifetime of work.
> What exactly is liburing bringing to the table that I shouldn't be using the uring syscalls directly?
It's easier to use compared to the kernel interface. For example, it handles submission queue polling automatically without any extra code.