about summary refs log tree commit diff
path: root/include/android-ashmem.h
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-04-20 11:38:09 +0200
committerGitHub <noreply@github.com>2021-04-20 11:38:09 +0200
commit48cef3c74727407f82c44800d382737265fe65b4 (patch)
tree07338ec82703c20cc1f78a235ac3ad16e2465bf1 /include/android-ashmem.h
parentf7179e44f6c46fef318b6413d9c00693c1af4602 (diff)
parent3b5fa3632b0e482b2915709d7fbec827e1d997b9 (diff)
downloadafl++-48cef3c74727407f82c44800d382737265fe65b4.tar.gz
Merge pull request #871 from AFLplusplus/dev
push to stable
Diffstat (limited to 'include/android-ashmem.h')
-rw-r--r--include/android-ashmem.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/include/android-ashmem.h b/include/android-ashmem.h
index 91699b27..1bfd3220 100644
--- a/include/android-ashmem.h
+++ b/include/android-ashmem.h
@@ -2,26 +2,27 @@
   #ifndef _ANDROID_ASHMEM_H
     #define _ANDROID_ASHMEM_H
 
+    #define _GNU_SOURCE
+    #include <sys/syscall.h>
+    #include <unistd.h>
     #include <fcntl.h>
     #include <linux/ashmem.h>
     #include <sys/ioctl.h>
     #include <sys/mman.h>
-
-    #if __ANDROID_API__ >= 26
-      #define shmat bionic_shmat
-      #define shmctl bionic_shmctl
-      #define shmdt bionic_shmdt
-      #define shmget bionic_shmget
-    #endif
     #include <sys/shm.h>
-    #undef shmat
-    #undef shmctl
-    #undef shmdt
-    #undef shmget
     #include <stdio.h>
-
     #define ASHMEM_DEVICE "/dev/ashmem"
 
+int shmdt(const void *address) {
+
+    #if defined(SYS_shmdt)
+  return syscall(SYS_shmdt, address);
+    #else
+  return syscall(SYS_ipc, SHMDT, 0, 0, 0, address, 0);
+    #endif
+
+}
+
 int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf) {
 
   int ret = 0;