Check if func equals -1 and throw sys::bad_call with error code and error location unless errno(3) equals EAGAIN or EINPROGRESS. In that case set func to 0.
Check if func equals -1 and throw sys::bad_call with error code and error location.
Uncoditionally throw sys::bad_call with error code and error location.
Check if func equals ret and throw sys::bad_call with error code and error location.