]> git.ipfire.org Git - thirdparty/systemd.git/commit
macro: add new helper RET_NERRNO()
authorLennart Poettering <lennart@poettering.net>
Sun, 14 Nov 2021 21:31:27 +0000 (22:31 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 16 Nov 2021 07:04:09 +0000 (08:04 +0100)
commitef470ffa234c8c824897488195fb2fc9a4a520e6
tree8228fb8b72994716f8bbf86d8ea543cbd6d0f484
parentcb3763d57ba9a7e89d4accbf0aff074c294d29be
macro: add new helper RET_NERRNO()

This new helper converts libc style syscall return values into
systemd-kernel (actually: kernel style) negative errno values.

It's implemented as macro-like inline function, and propagates return
values >= 0 as themselves and returns -errno for negative error returns.

THis is supposed to be little more than syntactic sugar so that we can
reduce a lot of (short, but still) boilerplate code whever we convert
libc style error handling into our own.

As discussed here:

https://github.com/systemd/systemd/pull/21326#discussion_r748413537
src/basic/errno-util.h