0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd::util: Extend return value in syscall() suite.

This commit is contained in:
Jason Volk 2018-01-09 16:24:42 -08:00
parent c03bb7e4f2
commit 78c2af094e

View file

@ -641,15 +641,15 @@ struct values
// Error-checking closure for POSIX system calls. Note the usage is // Error-checking closure for POSIX system calls. Note the usage is
// syscall(read, foo, bar, baz) not a macro like syscall(read(foo, bar, baz)); // syscall(read, foo, bar, baz) not a macro like syscall(read(foo, bar, baz));
// //
template<int ERROR_CODE = -1, template<long ERROR_CODE = -1,
class function, class function,
class... args> class... args>
auto auto
syscall(function&& f, syscall(function&& f,
args&&... a) args&&... a)
-> typename std::enable_if<std::is_same<int, decltype(f(a...))>::value, int>::type -> typename std::enable_if<std::is_convertible<long, decltype(f(a...))>::value, long>::type
{ {
const int ret const auto ret
{ {
f(std::forward<args>(a)...) f(std::forward<args>(a)...)
}; };
@ -664,15 +664,15 @@ syscall(function&& f,
// Error-checking closure for POSIX system calls. Note the usage is // Error-checking closure for POSIX system calls. Note the usage is
// syscall(read, foo, bar, baz) not a macro like syscall(read(foo, bar, baz)); // syscall(read, foo, bar, baz) not a macro like syscall(read(foo, bar, baz));
// //
template<int ERROR_CODE = -1, template<long ERROR_CODE = -1,
class function, class function,
class... args> class... args>
auto auto
uninterruptible_syscall(function&& f, uninterruptible_syscall(function&& f,
args&&... a) args&&... a)
-> typename std::enable_if<std::is_same<int, decltype(f(a...))>::value, int>::type -> typename std::enable_if<std::is_convertible<long, decltype(f(a...))>::value, long>::type
{ {
int ret; do long ret; do
{ {
ret = f(std::forward<args>(a)...); ret = f(std::forward<args>(a)...);
} }