0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-16 08:58:20 +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
// 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... args>
auto
syscall(function&& f,
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)...)
};
@ -664,15 +664,15 @@ syscall(function&& f,
// 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));
//
template<int ERROR_CODE = -1,
template<long ERROR_CODE = -1,
class function,
class... args>
auto
uninterruptible_syscall(function&& f,
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)...);
}