mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-11 01:31:37 +00:00
Merge pull request #857 from Begasus/haiku
Fix Haiku references, no <sys/syscall.h> and missing defines for USEMMAP
This commit is contained in:
commit
201d82ae0d
@ -168,7 +168,7 @@ endif
|
||||
ifeq "$(SYS)" "Haiku"
|
||||
SHMAT_OK=0
|
||||
override CFLAGS += -DUSEMMAP=1 -Wno-error=format -fPIC
|
||||
LDFLAGS += -Wno-deprecated-declarations -lgnu
|
||||
LDFLAGS += -Wno-deprecated-declarations -lgnu -lnetwork
|
||||
SPECIAL_PERFORMANCE += -DUSEMMAP=1
|
||||
endif
|
||||
|
||||
|
@ -34,8 +34,10 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#ifndef __HAIKU__
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
#ifndef USEMMAP
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#include <sys/wait.h>
|
||||
@ -76,6 +78,10 @@
|
||||
#define MAP_INITIAL_SIZE MAP_SIZE
|
||||
#endif
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
extern ssize_t _kern_write(int fd, off_t pos, const void *buffer, size_t bufferSize);
|
||||
#endif // HAIKU
|
||||
|
||||
u8 __afl_area_initial[MAP_INITIAL_SIZE];
|
||||
u8 * __afl_area_ptr_dummy = __afl_area_initial;
|
||||
u8 * __afl_area_ptr = __afl_area_initial;
|
||||
@ -1736,7 +1742,11 @@ static int area_is_valid(void *ptr, size_t len) {
|
||||
|
||||
if (unlikely(!ptr || __asan_region_is_poisoned(ptr, len))) { return 0; }
|
||||
|
||||
long r = syscall(SYS_write, __afl_dummy_fd[1], ptr, len);
|
||||
#ifndef __HAIKU__
|
||||
long r = syscall(SYS_write, __afl_dummy_fd[1], ptr, len);
|
||||
#else
|
||||
long r = _kern_write(__afl_dummy_fd[1], -1, ptr, len);
|
||||
#endif // HAIKU
|
||||
|
||||
if (r <= 0 || r > len) return 0;
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/resource.h>
|
||||
@ -53,7 +52,9 @@
|
||||
#include <netinet/ip6.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/shm.h>
|
||||
#ifndef USEMMAP
|
||||
#include <sys/shm.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user