libs/foreignmem: Fix/simplify errno handling for map_resource

Simplify the FreeBSD and Linux logic, left in this state by the previous
change.  No functional change.

Duplicate the FreeBSD logic for NetBSD, to maintain the uniform ABI for
callers that EOPNOTSUPP covers all Xen/Kernel support.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ian Jackson <iwj@xenproject.org>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
This commit is contained in:
Andrew Cooper committed 2021-02-03 19:25:35 +00:00
1 parent 9351e1468d
commit d203dbd69f
3 files changed
+5 -6

No files matched your search

+1 -3
View File
@@ -133,9 +133,7 @@ int osdep_xenforeignmemory_map_resource(xenforeignmemory_handle *fmem,
{
int saved_errno;
if ( errno != ENOSYS )
;
else
if ( errno == ENOSYS )
errno = EOPNOTSUPP;
if ( fres->addr )
+1 -3
View File
@@ -325,9 +325,7 @@ int osdep_xenforeignmemory_map_resource(
{
int saved_errno;
if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP )
;
else
if ( errno == fmem->unimpl_errno )
errno = EOPNOTSUPP;
if ( fres->addr )
+3
View File
@@ -147,6 +147,9 @@ int osdep_xenforeignmemory_map_resource(
rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
if ( rc )
{
if ( errno == ENOSYS )
errno = EOPNOTSUPP;
if ( fres->addr )
{
int saved_errno = errno;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.