diff options
author | David Carlier <devnexen@gmail.com> | 2020-06-14 15:26:43 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2020-06-14 15:32:02 +0000 |
commit | 67d87dd2a9dbc393b56162e77ff3178f4e3f59fa (patch) | |
tree | 24a839cd715e1bc204edeff4ee886f04d7fca267 /src | |
parent | bfe5b88e782ffd3f97c2a25da60b0b36552a6a64 (diff) | |
download | afl++-67d87dd2a9dbc393b56162e77ff3178f4e3f59fa.tar.gz |
Porting to Haiku.
getrusage does not implement resident memory gathering, no shm api neither.
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-analyze.c | 2 | ||||
-rw-r--r-- | src/afl-fuzz-stats.c | 8 | ||||
-rw-r--r-- | src/afl-gcc.c | 2 | ||||
-rw-r--r-- | src/afl-sharedmem.c | 2 | ||||
-rw-r--r-- | src/afl-showmap.c | 2 | ||||
-rw-r--r-- | src/afl-tmin.c | 2 | ||||
-rw-r--r-- | src/third_party/libradamsa/libradamsa.c | 9 |
7 files changed, 22 insertions, 5 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c index f1c141d5..cf5e9b16 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -51,7 +51,9 @@ #include <sys/wait.h> #include <sys/time.h> +#ifndef USEMMAP #include <sys/shm.h> +#endif #include <sys/stat.h> #include <sys/types.h> #include <sys/resource.h> diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c index 5d2e5358..de58f277 100644 --- a/src/afl-fuzz-stats.c +++ b/src/afl-fuzz-stats.c @@ -31,7 +31,9 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability, double eps) { +#ifndef __HAIKU__ struct rusage rus; +#endif unsigned long long int cur_time = get_cur_time(); u8 fn[PATH_MAX]; @@ -65,7 +67,9 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability, } +#ifndef __HAIKU__ if (getrusage(RUSAGE_CHILDREN, &rus)) { rus.ru_maxrss = 0; } +#endif fprintf( f, @@ -119,11 +123,15 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability, afl->last_path_time / 1000, afl->last_crash_time / 1000, afl->last_hang_time / 1000, afl->fsrv.total_execs - afl->last_crash_execs, afl->fsrv.exec_tmout, afl->slowest_exec_ms, +#ifndef __HAIKU__ #ifdef __APPLE__ (unsigned long int)(rus.ru_maxrss >> 20), #else (unsigned long int)(rus.ru_maxrss >> 10), #endif +#else + -1UL, +#endif #ifdef HAVE_AFFINITY afl->cpu_aff, #else diff --git a/src/afl-gcc.c b/src/afl-gcc.c index 7eb01c0c..b8ff7e77 100644 --- a/src/afl-gcc.c +++ b/src/afl-gcc.c @@ -335,7 +335,7 @@ static void edit_params(u32 argc, char **argv) { } -#ifdef USEMMAP +#if defined(USEMMAP) && !defined(__HAIKU__) cc_params[cc_par_cnt++] = "-lrt"; #endif diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c index 63013435..f8bbebc8 100644 --- a/src/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -145,7 +145,7 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size, if (!non_instrumented_mode) setenv(SHM_ENV_VAR, shm->g_shm_file_path, 1); - if (shm->map == -1 || !shm->map) PFATAL("mmap() failed"); + if (shm->map == (void *)-1 || !shm->map) PFATAL("mmap() failed"); #else u8 *shm_str; diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 560c8cf6..70a30ce4 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -56,7 +56,9 @@ #include <sys/wait.h> #include <sys/time.h> +#ifndef USEMMAP #include <sys/shm.h> +#endif #include <sys/stat.h> #include <sys/types.h> #include <sys/resource.h> diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 609f61d1..5a28ba79 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -54,7 +54,9 @@ #include <sys/wait.h> #include <sys/time.h> +#ifndef USEMMAP #include <sys/shm.h> +#endif #include <sys/stat.h> #include <sys/types.h> #include <sys/resource.h> diff --git a/src/third_party/libradamsa/libradamsa.c b/src/third_party/libradamsa/libradamsa.c index 4f5515e5..37c986e9 100644 --- a/src/third_party/libradamsa/libradamsa.c +++ b/src/third_party/libradamsa/libradamsa.c @@ -2413,9 +2413,12 @@ static word prim_sys(word op, word a, word b, word c) { #endif O_DSYNC, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_RSYNC, O_SYNC, O_TRUNC, O_TTY_INIT, O_ACCMODE, - FD_CLOEXEC, F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETOWN, - F_SETOWN, F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_UNLCK, F_WRLCK, CLOCK_MONOTONIC, - CLOCK_PROCESS_CPUTIME_ID, CLOCK_REALTIME, CLOCK_THREAD_CPUTIME_ID + FD_CLOEXEC, F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD, F_GETFL, F_SETFL, + F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_UNLCK, F_WRLCK, CLOCK_MONOTONIC, + CLOCK_PROCESS_CPUTIME_ID, CLOCK_REALTIME, CLOCK_THREAD_CPUTIME_ID, +#if !defined __HAIKU__ + F_GETOWN, F_SETOWN +#endif }; return onum(sysconst[immval(a) % (sizeof sysconst / W)], 0); } case 9: /* return process variables */ |