On 12/06/2012 01:41 AM, Dmitry Antipov wrote:
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.
Hey Dmitry, I was playing with your current ashmem unit test and needed the following trivial patch to get it all (seemingly) working against Linus' head kernel w/ ubuntu userland.
thanks -john
diff --git a/ashmem.h b/ashmem.h index 519fcfb..5a14837 100644 --- a/ashmem.h +++ b/ashmem.h @@ -39,7 +39,7 @@ #define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) #define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) #define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) -#define ASHMEM_ISPINNED _IOW(__ASHMEMIOC, 9, struct ashmem_pin) +#define ASHMEM_ISPINNED _IO(__ASHMEMIOC, 9) #define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
#endif /* _UTILS_ASHMEM_H */