aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-03-26 09:03:51 +0100
committerGitHub <noreply@github.com>2021-03-26 09:03:51 +0100
commit96533f627e9ec5133502312211a7d677e256bfe7 (patch)
tree492858f07d42fdffb4628dd522a2dbe623e5cf1e /include
parent22c696ff1c64025398504e87f3112da82857d901 (diff)
parentc89264205779635ec43f2913a94fa3ae5e6a5186 (diff)
downloadafl++-96533f627e9ec5133502312211a7d677e256bfe7.tar.gz
Merge pull request #845 from joeyjiaojg/dev
Dev
Diffstat (limited to 'include')
-rw-r--r--include/android-ashmem.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/include/android-ashmem.h b/include/android-ashmem.h
index 91699b27..44fe556a 100644
--- a/include/android-ashmem.h
+++ b/include/android-ashmem.h
@@ -2,32 +2,31 @@
#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;
if (__cmd == IPC_RMID) {
- int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL);
+ int length = ioctl(__shmid, ASHMEM_GET_SIZE, NULL);
struct ashmem_pin pin = {0, length};
ret = ioctl(__shmid, ASHMEM_UNPIN, &pin);
close(__shmid);
@@ -78,6 +77,6 @@ void *shmat(int __shmid, const void *__shmaddr, int __shmflg) {
}
- #endif /* !_ANDROID_ASHMEM_H */
-#endif /* !__ANDROID__ */
+ #endif /* !_ANDROID_ASHMEM_H */
+#endif /* !__ANDROID__ */