HARNESS_SRCS:=main.c
# io_queue.c
-MK_CPPFLAGS = -I../src $(CPPFLAGS)
+MK_CPPFLAGS = -I../src -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $(CPPFLAGS)
CFLAGS ?= -Wall -Werror -g -O2
MK_CFLAGS = $(CFLAGS)
#-lpthread -lrt
includedir ?= $(prefix)/include
libdir ?= $(prefix)/lib
-MK_CPPFLAGS = -I. $(CPPFLAGS)
+MK_CPPFLAGS = -I. -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $(CPPFLAGS)
CFLAGS ?= -Wall -g -fomit-frame-pointer -O2
MK_CFLAGS = -fPIC $(CFLAGS)
SO_CFLAGS = -shared $(MK_CFLAGS)
libaio_srcs += aio_pgetevents.c aio_getevents.c
libaio_srcs += io_getevents.c io_submit.c io_cancel.c
libaio_srcs += io_setup.c io_destroy.c io_pgetevents.c
+libaio_srcs += io_pgetevents_time64.c io_getevents_time64.c
# old symbols
libaio_srcs += compat-0_1.c
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
+/*
+ * On 32-bit systems these were using 32-bit struct timespec, keep these
+ * backward compatibility functions that way.
+ */
+#undef _TIME_BITS
+
#include <stdlib.h>
#include <asm/errno.h>
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
+/*
+ * On 32-bit systems these were using 32-bit struct timespec, keep this
+ * backward compatibility function that way.
+ */
+#undef _TIME_BITS
+
#include <libaio.h>
#include <errno.h>
#include <stdlib.h>
--- /dev/null
+/* io_getevents_time64.c
+ libaio Linux async I/O interface
+ Copyright 2002 Red Hat, Inc.
+ Copyright 2024 Guillem Jover <guillem@hadrons.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <libaio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include "syscall.h"
+#include "aio_time.h"
+
+#if __BITS_PER_LONG == 32
+int io_getevents_time64(io_context_t ctx, long min_nr, long nr,
+ struct io_event * events, struct timespec * timeout)
+{
+ struct __kernel_timespec kts;
+
+ if (timeout)
+ aio_get_timespec(&kts, timeout);
+ return aio_getevents(ctx, min_nr, nr, events, timeout ? &kts : NULL);
+}
+#endif
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
+/*
+ * On 32-bit systems these were using 32-bit struct timespec, keep this
+ * backward compatibility function that way.
+ */
+#undef _TIME_BITS
+
#include <libaio.h>
#include <errno.h>
#include <stdlib.h>
--- /dev/null
+/*
+ libaio Linux async I/O interface
+ Copyright 2018 Christoph Hellwig.
+ Copyright 2024 Guillem Jover <guillem@hadrons.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <libaio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include <signal.h>
+#include "aio_time.h"
+
+#if __BITS_PER_LONG == 32
+int io_pgetevents_time64(io_context_t ctx, long min_nr, long nr,
+ struct io_event *events, struct timespec *timeout,
+ sigset_t *sigmask)
+{
+ struct __kernel_timespec kts;
+
+ if (timeout)
+ aio_get_timespec(&kts, timeout);
+ return aio_pgetevents(ctx, min_nr, nr, events, timeout ? &kts : NULL,
+ sigmask);
+}
+#endif
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
+/*
+ * On 32-bit systems these were using 32-bit struct timespec, keep this
+ * backward compatibility function that way.
+ */
+#undef _TIME_BITS
+
#define NO_SYSCALL_ERRNO
#include <sys/types.h>
#include <libaio.h>
extern "C" {
#endif
+#include <linux/types.h>
#include <sys/types.h>
#include <string.h>
#include <signal.h>
IO_CMD_PWRITEV = 8,
} io_iocb_cmd_t;
+#define LIBAIO_STRING(x) #x
+
+#define LIBAIO_REDIRECT(name, proto, alias) name proto __asm__(LIBAIO_ASMNAME(#alias))
+#define LIBAIO_ASMNAME(cname) LIBAIO_ASMNAME_PREFIX(__USER_LABEL_PREFIX__, cname)
+#define LIBAIO_ASMNAME_PREFIX(prefix, cname) LIBAIO_STRING(prefix) cname
+
/* little endian, 32 bits */
#if defined(__i386__) || \
(defined(__x86_64__) && defined(__ILP32__)) || \
extern int io_pgetevents(io_context_t ctx, long min_nr, long nr,
struct io_event *events, struct timespec *timeout,
sigset_t *sigmask);
+#if __BITS_PER_LONG == 32 && defined(_TIME_BITS) && _TIME_BITS == 64
+extern int LIBAIO_REDIRECT(io_getevents, (io_context_t ctx,
+ long min_nr, long nr,
+ struct io_event *events, struct timespec *timeout),
+ io_getevents_time64);
+extern int LIBAIO_REDIRECT(io_pgetevents, (io_context_t ctx,
+ long min_nr, long nr,
+ struct io_event *events, struct timespec *timeout,
+ sigset_t *sigmask),
+ io_pgetevents_time64);
+#endif
static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
global:
io_pgetevents;
} LIBAIO_0.4;
+
+LIBAIO_0.6 {
+ global:
+ io_getevents_time64;
+ io_pgetevents_time64;
+} LIBAIO_0.5;