The following changes since commit a0bafb7d88c33b9046073e0bc4af7d64d0caa30b: Add support for dumping the status on Windows. (2013-04-28 17:34:15 +0200) are available in the git repository at: git://git.kernel.dk/fio.git master Akers, Jason B (1): android: use ashmem Jens Axboe (1): configure: remove argument for --build-32bit-win configure | 4 ++-- os/os-android.h | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 7 deletions(-) --- Diff of recent changes: diff --git a/configure b/configure index 7be8789..5939bed 100755 --- a/configure +++ b/configure @@ -148,7 +148,7 @@ for opt do ;; --extra-cflags=*) CFLAGS="$CFLAGS $optarg" ;; - --build-32bit-win=*) build_32bit_win="$optarg" + --build-32bit-win) build_32bit_win="yes" ;; --enable-gfio) gfio="yes" @@ -167,7 +167,7 @@ if test "$show_help" = "yes" ; then echo "--cpu= Specify target CPU if auto-detect fails" echo "--cc= Specify compiler to use" echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" - echo "--build-32bit-win= Specify yes for a 32-bit build on Windows" + echo "--build-32bit-win Enable 32-bit build on Windows" echo "--enable-gfio Enable building of gtk gfio" exit $exit_val fi diff --git a/os/os-android.h b/os/os-android.h index df22333..954178d 100644 --- a/os/os-android.h +++ b/os/os-android.h @@ -57,27 +57,67 @@ #include <linux/shm.h> #define SHM_HUGETLB 04000 +#include <stdio.h> +#include <linux/ashmem.h> +#include <sys/mman.h> + +#define ASHMEM_DEVICE "/dev/ashmem" + static inline int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) { - return syscall(__NR_shmctl, __shmid, __cmd, __buf); + int ret=0; + if (__cmd == IPC_RMID) + { + int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); + struct ashmem_pin pin = {0 , length}; + ret = ioctl(__shmid, ASHMEM_UNPIN, &pin); + close(__shmid); + } + return ret; } static inline int shmget (key_t __key, size_t __size, int __shmflg) { - return syscall(__NR_shmget, __key, __size, __shmflg); + int fd,ret; + char key[11]; + + fd = open(ASHMEM_DEVICE, O_RDWR); + if (fd < 0) + return fd; + + sprintf(key,"%d",__key); + ret = ioctl(fd, ASHMEM_SET_NAME, key); + if (ret < 0) + goto error; + + ret = ioctl(fd, ASHMEM_SET_SIZE, __size); + if (ret < 0) + goto error; + + return fd; + +error: + close(fd); + return ret; } static inline void *shmat (int __shmid, const void *__shmaddr, int __shmflg) { - return (void *)syscall(__NR_shmat, __shmid, __shmaddr, __shmflg); + size_t *ptr, size = ioctl(__shmid, ASHMEM_GET_SIZE, NULL); + ptr = mmap(NULL, size + sizeof(size_t), PROT_READ | PROT_WRITE, MAP_SHARED, __shmid, 0); + *ptr = size; //save size at beginning of buffer, for use with munmap + return &ptr[1]; } static inline int shmdt (const void *__shmaddr) { - return syscall(__NR_shmctl, __shmaddr); + size_t *ptr, size; + ptr = (size_t *)__shmaddr; + ptr--; + size = *ptr; //find mmap size which we stored at the beginning of the buffer + return munmap((void *)ptr, size + sizeof(size_t)); } - #define SPLICE_DEF_SIZE (64*1024) enum { -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html