The kernel uses (drivers/staging/android/ashmem.h):
#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) #define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
Generated bionic header uses (bionic/libc/kernel/common/linux/ashmem.h):
#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) #define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
But frameworks/native/include/utils/ashmem.h uses:
#define ASHMEM_PIN _IO(__ASHMEMIOC, 7) #define ASHMEM_UNPIN _IO(__ASHMEMIOC, 8)
Due to the above, any userspace call ioctl(fd, ASHMEM_PIN, XXX) is invalid.
Also there is a name mismatch: kernel uses ASHMEM_GET_PIN_STATUS for ioctl and ASHMEM_IS_PINNED / ASHMEM_IS_UNPINNED for the result, but userspace uses ASHMEM_ISPINNED for ioctl and ASHMEM_NOW_PINNED / ASHMEM_NOW_UNPINNED for the result. This is pretty confusing and IMHO should be unified between kernel and userspace headers.
Suggested fix for frameworks/native/include/utils/ashmem.h is attached.
Dmitry