]> xenbits.xensource.com Git - people/dwmw2/xen.git/commit
xenforeignmemory: work around bug in older privcmd
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 24 Aug 2018 12:16:26 +0000 (13:16 +0100)
committerWei Liu <wei.liu2@citrix.com>
Sun, 26 Aug 2018 09:53:15 +0000 (10:53 +0100)
commitb49ef5d39d930bda6a8da1afcee196420f1b7424
tree51de419dcd70986381e3efffcd6ae57ee6478cd2
parent4be26bd61efdb8fbc39ab4528f1f3dea040b605f
xenforeignmemory: work around bug in older privcmd

Versions of linux privcmd prior to commit dc9eab6fd94d ("return -ENOTTY
for unimplemented IOCTLs") will return -EINVAL rather than the conventional
-ENOTTY for unimplemented codes. This breaks the error path in
libxenforeignmemory resource mapping, which only translates ENOTTY into
EOPNOTSUPP to inform callers of the need to use an alternative (legacy)
mechanism.

This patch adds a new 'unimplemented' [1] ioctl code into the local
privcmd header which is then used to probe for the appropriate errno to
translate in the resource mapping error path

[1] this is a code that has, so far, never been used in any version of
    privcmd and will be added to future versions of the header in the
    linux source, to make sure it stays unimplemented.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/include/xen-sys/Linux/privcmd.h
tools/libs/foreignmemory/linux.c
tools/libs/foreignmemory/private.h