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:
parent
c03bb7e4f2
commit
78c2af094e
1 changed files with 6 additions and 6 deletions
|
@ -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)...);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue