From ed80ddf66943dc2654a92eb77b57c3d68613e9d6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 23 Nov 2009 15:14:48 +0100 Subject: [PATCH] Add posix_* weak helpers Signed-off-by: Jens Axboe --- Makefile.solaris | 2 +- compiler/compiler.h | 2 ++ helpers.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 helpers.c diff --git a/Makefile.solaris b/Makefile.solaris index 595f8545..b87a92f9 100644 --- a/Makefile.solaris +++ b/Makefile.solaris @@ -4,7 +4,7 @@ PROGS = fio SCRIPTS = fio_generate_plots OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \ eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \ - rbtree.o fifo.o smalloc.o filehash.o lib/strsep.o + rbtree.o fifo.o smalloc.o filehash.o lib/strsep.o helpers.o OBJS += crc/crc7.o OBJS += crc/crc16.o diff --git a/compiler/compiler.h b/compiler/compiler.h index 1a0556bd..0a08bb12 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -15,4 +15,6 @@ #define uninitialized_var(x) x = x +#define __weak __attribute__((weak)) + #endif diff --git a/helpers.c b/helpers.c new file mode 100644 index 00000000..987f5b68 --- /dev/null +++ b/helpers.c @@ -0,0 +1,15 @@ +#include +#include + +#include "compiler/compiler.h" + +int __weak posix_memalign(void **ptr, size_t align, size_t size) +{ + *ptr = memalign(align, size); + return *ptr == NULL; +} + +int __weak posix_fallocate(int fd, off_t offset, off_t len) +{ + return 0; +} -- 2.25.1