rebase to 0.3.110, which adds support for aarch64 and other arches
- 0.3.110 adds support for sparc, aarch64, and generic syscall support for new architectures that libaio hasn't yet been ported to. - Move to /usr/lib64, finally. - Will resolve bz#969680 (libaio fails to build for aarch64) when backported to f19.
This commit is contained in:
parent
a5a02a9b31
commit
59a99b95f4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
libaio-0.3.109.tar.gz
|
||||
/libaio-0.3.110.tar.gz
|
||||
|
||||
@ -1,157 +0,0 @@
|
||||
diff --git a/compat-libaio-0.3.109/src/libaio.h b/compat-libaio-0.3.109/src/libaio.h
|
||||
index 18dbc2a..c03ff9c 100644
|
||||
--- a/compat-libaio-0.3.109/src/libaio.h
|
||||
+++ b/compat-libaio-0.3.109/src/libaio.h
|
||||
@@ -91,6 +91,16 @@ typedef enum io_iocb_cmd {
|
||||
#define PADDED(x, y) unsigned y; x
|
||||
#define PADDEDptr(x, y) unsigned y; x
|
||||
#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+#elif defined(__aarch64__)
|
||||
+# if defined (__AARCH64EB__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+# elif defined(__AARCH64EL__) /* little endian, 64 bits */
|
||||
+#define PADDED(x, y) x, y
|
||||
+#define PADDEDptr(x, y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+# endif
|
||||
#else
|
||||
#error endian?
|
||||
#endif
|
||||
diff --git a/compat-libaio-0.3.109/src/syscall-generic.h b/compat-libaio-0.3.109/src/syscall-generic.h
|
||||
new file mode 100644
|
||||
index 0000000..6a9a41d
|
||||
--- /dev/null
|
||||
+++ b/compat-libaio-0.3.109/src/syscall-generic.h
|
||||
@@ -0,0 +1,29 @@
|
||||
+#include <errno.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/syscall.h>
|
||||
+
|
||||
+#define _body_io_syscall(sname, args...) \
|
||||
+{ \
|
||||
+ int ret = syscall(__NR_##sname, ## args); \
|
||||
+ return ret < 0 ? -errno : ret; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall1(type,fname,sname,type1,arg1) \
|
||||
+type fname(type1 arg1) \
|
||||
+_body_io_syscall(sname, (long)arg1)
|
||||
+
|
||||
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
|
||||
+type fname(type1 arg1,type2 arg2) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2)
|
||||
+
|
||||
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
|
||||
+type fname(type1 arg1,type2 arg2,type3 arg3) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3)
|
||||
+
|
||||
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
|
||||
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4)
|
||||
+
|
||||
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \
|
||||
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5)
|
||||
diff --git a/compat-libaio-0.3.109/src/syscall.h b/compat-libaio-0.3.109/src/syscall.h
|
||||
index 62879a5..d9ee036 100644
|
||||
--- a/compat-libaio-0.3.109/src/syscall.h
|
||||
+++ b/compat-libaio-0.3.109/src/syscall.h
|
||||
@@ -27,5 +27,6 @@
|
||||
#elif defined(__sparc__)
|
||||
#include "syscall-sparc.h"
|
||||
#else
|
||||
-#error "add syscall-arch.h"
|
||||
+#warning "using generic syscall method"
|
||||
+#include "syscall-generic.h"
|
||||
#endif
|
||||
diff --git a/harness/cases/16.t b/harness/cases/16.t
|
||||
index c3157cc..074756d 100644
|
||||
--- a/harness/cases/16.t
|
||||
+++ b/harness/cases/16.t
|
||||
@@ -18,6 +18,8 @@
|
||||
#define SYS_eventfd 318
|
||||
#elif defined(__alpha__)
|
||||
#define SYS_eventfd 478
|
||||
+#elif defined(__aarch64__)
|
||||
+#define SYS_eventfd 1044
|
||||
#else
|
||||
#error define SYS_eventfd for your arch!
|
||||
#endif
|
||||
diff --git a/src/libaio.h b/src/libaio.h
|
||||
index 18dbc2a..15e12a7 100644
|
||||
--- a/src/libaio.h
|
||||
+++ b/src/libaio.h
|
||||
@@ -1,6 +1,6 @@
|
||||
/* /usr/include/libaio.h
|
||||
*
|
||||
- * Copyright 2000,2001,2002 Red Hat, Inc.
|
||||
+ * Copyright 2000,2001,2002,2013 Red Hat, Inc.
|
||||
*
|
||||
* Written by Benjamin LaHaise <bcrl@redhat.com>
|
||||
*
|
||||
@@ -91,6 +91,16 @@ typedef enum io_iocb_cmd {
|
||||
#define PADDED(x, y) unsigned y; x
|
||||
#define PADDEDptr(x, y) unsigned y; x
|
||||
#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+#elif defined(__aarch64__)
|
||||
+# if defined (__AARCH64EB__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+# elif defined(__AARCH64EL__) /* little endian, 64 bits */
|
||||
+#define PADDED(x, y) x, y
|
||||
+#define PADDEDptr(x, y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+# endif
|
||||
#else
|
||||
#error endian?
|
||||
#endif
|
||||
diff --git a/src/syscall-generic.h b/src/syscall-generic.h
|
||||
new file mode 100644
|
||||
index 0000000..6a9a41d
|
||||
--- /dev/null
|
||||
+++ b/src/syscall-generic.h
|
||||
@@ -0,0 +1,29 @@
|
||||
+#include <errno.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/syscall.h>
|
||||
+
|
||||
+#define _body_io_syscall(sname, args...) \
|
||||
+{ \
|
||||
+ int ret = syscall(__NR_##sname, ## args); \
|
||||
+ return ret < 0 ? -errno : ret; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall1(type,fname,sname,type1,arg1) \
|
||||
+type fname(type1 arg1) \
|
||||
+_body_io_syscall(sname, (long)arg1)
|
||||
+
|
||||
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
|
||||
+type fname(type1 arg1,type2 arg2) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2)
|
||||
+
|
||||
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
|
||||
+type fname(type1 arg1,type2 arg2,type3 arg3) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3)
|
||||
+
|
||||
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
|
||||
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4)
|
||||
+
|
||||
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \
|
||||
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
|
||||
+_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5)
|
||||
diff --git a/src/syscall.h b/src/syscall.h
|
||||
index 62879a5..d9ee036 100644
|
||||
--- a/src/syscall.h
|
||||
+++ b/src/syscall.h
|
||||
@@ -27,5 +27,6 @@
|
||||
#elif defined(__sparc__)
|
||||
#include "syscall-sparc.h"
|
||||
#else
|
||||
-#error "add syscall-arch.h"
|
||||
+#warning "using generic syscall method"
|
||||
+#include "syscall-generic.h"
|
||||
#endif
|
||||
20
libaio-install-to-destdir-slash-usr.patch
Normal file
20
libaio-install-to-destdir-slash-usr.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff -up libaio-0.3.110/src/Makefile.orig libaio-0.3.110/src/Makefile
|
||||
--- libaio-0.3.110/src/Makefile.orig 2014-03-05 09:32:55.683632263 -0500
|
||||
+++ libaio-0.3.110/src/Makefile 2014-03-05 09:34:05.836297667 -0500
|
||||
@@ -53,11 +53,11 @@ $(libname): $(libaio_sobjs) libaio.map
|
||||
$(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
|
||||
|
||||
install: $(all_targets)
|
||||
- install -D -m 644 libaio.h $(includedir)/libaio.h
|
||||
- install -D -m 644 libaio.a $(libdir)/libaio.a
|
||||
- install -D -m 755 $(libname) $(libdir)/$(libname)
|
||||
- ln -sf $(libname) $(libdir)/$(soname)
|
||||
- ln -sf $(libname) $(libdir)/libaio.so
|
||||
+ install -D -m 644 libaio.h $(destdir)$(includedir)/libaio.h
|
||||
+ install -D -m 644 libaio.a $(destdir)$(usrlibdir)/libaio.a
|
||||
+ install -D -m 755 $(libname) $(destdir)$(usrlibdir)/$(libname)
|
||||
+ ln -sf $(libname) $(destdir)$(usrlibdir)/$(soname)
|
||||
+ ln -sf $(libname) $(destdir)$(usrlibdir)/libaio.so
|
||||
|
||||
$(libaio_objs): libaio.h
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
diff -up libaio-0.3.107/src/Makefile.orig libaio-0.3.107/src/Makefile
|
||||
--- libaio-0.3.107/src/Makefile.orig 2009-01-20 10:07:31.520105235 -0500
|
||||
+++ libaio-0.3.107/src/Makefile 2009-01-20 10:08:51.199104930 -0500
|
||||
@@ -1,6 +1,7 @@
|
||||
prefix=/usr
|
||||
-includedir=$(prefix)/include
|
||||
-libdir=$(prefix)/lib
|
||||
+includedir=/usr/include
|
||||
+libdir=/usr/lib
|
||||
+usrlibdir=/usr/lib
|
||||
|
||||
ARCH := $(shell uname -m | sed -e s/i.86/i386/)
|
||||
CFLAGS := -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC
|
||||
@@ -51,11 +52,11 @@ $(libname): $(libaio_sobjs) libaio.map
|
||||
$(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
|
||||
|
||||
install: $(all_targets)
|
||||
- install -D -m 644 libaio.h $(includedir)/libaio.h
|
||||
- install -D -m 644 libaio.a $(libdir)/libaio.a
|
||||
- install -D -m 755 $(libname) $(libdir)/$(libname)
|
||||
- ln -sf $(libname) $(libdir)/$(soname)
|
||||
- ln -sf $(libname) $(libdir)/libaio.so
|
||||
+ install -D -m 644 libaio.h $(destdir)$(includedir)/libaio.h
|
||||
+ install -D -m 644 libaio.a $(destdir)$(usrlibdir)/libaio.a
|
||||
+ install -D -m 755 $(libname) $(destdir)$(libdir)/$(libname)
|
||||
+ ln -sf $(libdir)/$(libname) $(destdir)$(libdir)/$(soname)
|
||||
+ ln -sf $(libdir)/$(libname) $(destdir)$(usrlibdir)/libaio.so
|
||||
|
||||
$(libaio_objs): libaio.h
|
||||
|
||||
@ -1,908 +0,0 @@
|
||||
diff -uNr libaio-0.3.109-orig/compat-libaio-0.3.109/src/libaio.h libaio-0.3.109/compat-libaio-0.3.109/src/libaio.h
|
||||
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/libaio.h 2009-10-09 13:17:02.000000000 -0500
|
||||
+++ libaio-0.3.109/compat-libaio-0.3.109/src/libaio.h 2011-04-03 12:52:50.000000000 -0500
|
||||
@@ -83,6 +83,14 @@
|
||||
#define PADDEDptr(x, y) x; unsigned y
|
||||
#define PADDEDul(x, y) unsigned long x; unsigned y
|
||||
# endif
|
||||
+#elif defined(__sparc__) && defined(__arch64__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__sparc__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
#else
|
||||
#error endian?
|
||||
#endif
|
||||
diff -uNr libaio-0.3.109-orig/compat-libaio-0.3.109/src/libaio.h.orig libaio-0.3.109/compat-libaio-0.3.109/src/libaio.h.orig
|
||||
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/libaio.h.orig 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ libaio-0.3.109/compat-libaio-0.3.109/src/libaio.h.orig 2009-10-09 13:17:02.000000000 -0500
|
||||
@@ -0,0 +1,265 @@
|
||||
+/* /usr/include/libaio.h
|
||||
+ *
|
||||
+ * Copyright 2000,2001,2002 Red Hat, Inc.
|
||||
+ *
|
||||
+ * Written by Benjamin LaHaise <bcrl@redhat.com>
|
||||
+ *
|
||||
+ * libaio Linux async I/O interface
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+#ifndef __LIBAIO_H
|
||||
+#define __LIBAIO_H
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+struct timespec;
|
||||
+struct sockaddr;
|
||||
+struct iovec;
|
||||
+
|
||||
+typedef struct io_context *io_context_t;
|
||||
+
|
||||
+typedef enum io_iocb_cmd {
|
||||
+ IO_CMD_PREAD = 0,
|
||||
+ IO_CMD_PWRITE = 1,
|
||||
+
|
||||
+ IO_CMD_FSYNC = 2,
|
||||
+ IO_CMD_FDSYNC = 3,
|
||||
+
|
||||
+ IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */
|
||||
+ IO_CMD_NOOP = 6,
|
||||
+ IO_CMD_PREADV = 7,
|
||||
+ IO_CMD_PWRITEV = 8,
|
||||
+} io_iocb_cmd_t;
|
||||
+
|
||||
+#if defined(__i386__) /* little endian, 32 bits */
|
||||
+#define PADDED(x, y) x; unsigned y
|
||||
+#define PADDEDptr(x, y) x; unsigned y
|
||||
+#define PADDEDul(x, y) unsigned long x; unsigned y
|
||||
+#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__)
|
||||
+#define PADDED(x, y) x, y
|
||||
+#define PADDEDptr(x, y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__powerpc64__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__PPC__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+#elif defined(__s390x__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__s390__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+#elif defined(__arm__)
|
||||
+# if defined (__ARMEB__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+# else /* little endian, 32 bits */
|
||||
+#define PADDED(x, y) x; unsigned y
|
||||
+#define PADDEDptr(x, y) x; unsigned y
|
||||
+#define PADDEDul(x, y) unsigned long x; unsigned y
|
||||
+# endif
|
||||
+#else
|
||||
+#error endian?
|
||||
+#endif
|
||||
+
|
||||
+struct io_iocb_poll {
|
||||
+ PADDED(int events, __pad1);
|
||||
+}; /* result code is the set of result flags or -'ve errno */
|
||||
+
|
||||
+struct io_iocb_sockaddr {
|
||||
+ struct sockaddr *addr;
|
||||
+ int len;
|
||||
+}; /* result code is the length of the sockaddr, or -'ve errno */
|
||||
+
|
||||
+struct io_iocb_common {
|
||||
+ PADDEDptr(void *buf, __pad1);
|
||||
+ PADDEDul(nbytes, __pad2);
|
||||
+ long long offset;
|
||||
+ long long __pad3;
|
||||
+ unsigned flags;
|
||||
+ unsigned resfd;
|
||||
+}; /* result code is the amount read or -'ve errno */
|
||||
+
|
||||
+struct io_iocb_vector {
|
||||
+ const struct iovec *vec;
|
||||
+ int nr;
|
||||
+ long long offset;
|
||||
+}; /* result code is the amount read or -'ve errno */
|
||||
+
|
||||
+struct iocb {
|
||||
+ PADDEDptr(void *data, __pad1); /* Return in the io completion event */
|
||||
+ PADDED(unsigned key, __pad2); /* For use in identifying io requests */
|
||||
+
|
||||
+ short aio_lio_opcode;
|
||||
+ short aio_reqprio;
|
||||
+ int aio_fildes;
|
||||
+
|
||||
+ union {
|
||||
+ struct io_iocb_common c;
|
||||
+ struct io_iocb_vector v;
|
||||
+ struct io_iocb_poll poll;
|
||||
+ struct io_iocb_sockaddr saddr;
|
||||
+ } u;
|
||||
+};
|
||||
+
|
||||
+struct io_event {
|
||||
+ PADDEDptr(void *data, __pad1);
|
||||
+ PADDEDptr(struct iocb *obj, __pad2);
|
||||
+ PADDEDul(res, __pad3);
|
||||
+ PADDEDul(res2, __pad4);
|
||||
+};
|
||||
+
|
||||
+#undef PADDED
|
||||
+#undef PADDEDptr
|
||||
+#undef PADDEDul
|
||||
+
|
||||
+typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2);
|
||||
+
|
||||
+/* library wrappers */
|
||||
+extern int io_queue_init(int maxevents, io_context_t *ctxp);
|
||||
+/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/
|
||||
+extern int io_queue_release(io_context_t ctx);
|
||||
+/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/
|
||||
+extern int io_queue_run(io_context_t ctx);
|
||||
+
|
||||
+/* Actual syscalls */
|
||||
+extern int io_setup(int maxevents, io_context_t *ctxp);
|
||||
+extern int io_destroy(io_context_t ctx);
|
||||
+extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]);
|
||||
+extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt);
|
||||
+extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout);
|
||||
+
|
||||
+
|
||||
+static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
|
||||
+{
|
||||
+ iocb->data = (void *)cb;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PREAD;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = buf;
|
||||
+ iocb->u.c.nbytes = count;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PWRITE;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = buf;
|
||||
+ iocb->u.c.nbytes = count;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PREADV;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = (void *)iov;
|
||||
+ iocb->u.c.nbytes = iovcnt;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PWRITEV;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = (void *)iov;
|
||||
+ iocb->u.c.nbytes = iovcnt;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+/* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3.
|
||||
+ * AFAICT, it was never in mainline, and should not be used. --RR */
|
||||
+static inline void io_prep_poll(struct iocb *iocb, int fd, int events)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_POLL;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.poll.events = events;
|
||||
+}
|
||||
+
|
||||
+static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events)
|
||||
+{
|
||||
+ io_prep_poll(iocb, fd, events);
|
||||
+ io_set_callback(iocb, cb);
|
||||
+ return io_submit(ctx, 1, &iocb);
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_fsync(struct iocb *iocb, int fd)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_FSYNC;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+}
|
||||
+
|
||||
+static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
|
||||
+{
|
||||
+ io_prep_fsync(iocb, fd);
|
||||
+ io_set_callback(iocb, cb);
|
||||
+ return io_submit(ctx, 1, &iocb);
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_fdsync(struct iocb *iocb, int fd)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_FDSYNC;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+}
|
||||
+
|
||||
+static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
|
||||
+{
|
||||
+ io_prep_fdsync(iocb, fd);
|
||||
+ io_set_callback(iocb, cb);
|
||||
+ return io_submit(ctx, 1, &iocb);
|
||||
+}
|
||||
+
|
||||
+static inline void io_set_eventfd(struct iocb *iocb, int eventfd)
|
||||
+{
|
||||
+ iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */;
|
||||
+ iocb->u.c.resfd = eventfd;
|
||||
+}
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif /* __LIBAIO_H */
|
||||
diff -uNr libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall.h libaio-0.3.109/compat-libaio-0.3.109/src/syscall.h
|
||||
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall.h 2009-10-09 13:17:02.000000000 -0500
|
||||
+++ libaio-0.3.109/compat-libaio-0.3.109/src/syscall.h 2011-04-03 12:53:23.000000000 -0500
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "syscall-alpha.h"
|
||||
#elif defined(__arm__)
|
||||
#include "syscall-arm.h"
|
||||
+#elif defined(__sparc__)
|
||||
+#include "syscall-sparc.h"
|
||||
#else
|
||||
#error "add syscall-arch.h"
|
||||
#endif
|
||||
diff -uNr libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall.h.orig libaio-0.3.109/compat-libaio-0.3.109/src/syscall.h.orig
|
||||
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall.h.orig 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ libaio-0.3.109/compat-libaio-0.3.109/src/syscall.h.orig 2009-10-09 13:17:02.000000000 -0500
|
||||
@@ -0,0 +1,29 @@
|
||||
+#include <sys/syscall.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define _SYMSTR(str) #str
|
||||
+#define SYMSTR(str) _SYMSTR(str)
|
||||
+
|
||||
+#define SYMVER(compat_sym, orig_sym, ver_sym) \
|
||||
+ __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
|
||||
+
|
||||
+#define DEFSYMVER(compat_sym, orig_sym, ver_sym) \
|
||||
+ __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym));
|
||||
+
|
||||
+#if defined(__i386__)
|
||||
+#include "syscall-i386.h"
|
||||
+#elif defined(__x86_64__)
|
||||
+#include "syscall-x86_64.h"
|
||||
+#elif defined(__ia64__)
|
||||
+#include "syscall-ia64.h"
|
||||
+#elif defined(__PPC__)
|
||||
+#include "syscall-ppc.h"
|
||||
+#elif defined(__s390__)
|
||||
+#include "syscall-s390.h"
|
||||
+#elif defined(__alpha__)
|
||||
+#include "syscall-alpha.h"
|
||||
+#elif defined(__arm__)
|
||||
+#include "syscall-arm.h"
|
||||
+#else
|
||||
+#error "add syscall-arch.h"
|
||||
+#endif
|
||||
diff -uNr libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall-sparc.h libaio-0.3.109/compat-libaio-0.3.109/src/syscall-sparc.h
|
||||
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall-sparc.h 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ libaio-0.3.109/compat-libaio-0.3.109/src/syscall-sparc.h 2011-04-03 12:51:33.000000000 -0500
|
||||
@@ -0,0 +1,118 @@
|
||||
+#include <errno.h>
|
||||
+
|
||||
+#define __NR_io_setup 268
|
||||
+#define __NR_io_destroy 269
|
||||
+#define __NR_io_submit 270
|
||||
+#define __NR_io_cancel 271
|
||||
+#define __NR_io_getevents 272
|
||||
+
|
||||
+#define io_syscall1(type,fname,sname,type1,arg1) \
|
||||
+type fname(type1 arg1) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res >= 0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
|
||||
+type fname(type1 arg1,type2 arg2) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res >= 0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
|
||||
+type fname(type1 arg1,type2 arg2,type3 arg3) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res>=0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
|
||||
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
+register long __o3 __asm__ ("o3") = (long)(arg4); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res>=0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
|
||||
+ type5,arg5) \
|
||||
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
+register long __o3 __asm__ ("o3") = (long)(arg4); \
|
||||
+register long __o4 __asm__ ("o4") = (long)(arg5); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res>=0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
diff -uNr libaio-0.3.109-orig/src/libaio.h libaio-0.3.109/src/libaio.h
|
||||
--- libaio-0.3.109-orig/src/libaio.h 2009-10-09 13:17:02.000000000 -0500
|
||||
+++ libaio-0.3.109/src/libaio.h 2011-04-03 12:53:38.000000000 -0500
|
||||
@@ -83,6 +83,14 @@
|
||||
#define PADDEDptr(x, y) x; unsigned y
|
||||
#define PADDEDul(x, y) unsigned long x; unsigned y
|
||||
# endif
|
||||
+#elif defined(__sparc__) && defined(__arch64__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__sparc__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
#else
|
||||
#error endian?
|
||||
#endif
|
||||
diff -uNr libaio-0.3.109-orig/src/libaio.h.orig libaio-0.3.109/src/libaio.h.orig
|
||||
--- libaio-0.3.109-orig/src/libaio.h.orig 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ libaio-0.3.109/src/libaio.h.orig 2009-10-09 13:17:02.000000000 -0500
|
||||
@@ -0,0 +1,265 @@
|
||||
+/* /usr/include/libaio.h
|
||||
+ *
|
||||
+ * Copyright 2000,2001,2002 Red Hat, Inc.
|
||||
+ *
|
||||
+ * Written by Benjamin LaHaise <bcrl@redhat.com>
|
||||
+ *
|
||||
+ * libaio Linux async I/O interface
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+#ifndef __LIBAIO_H
|
||||
+#define __LIBAIO_H
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+#include <sys/types.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+struct timespec;
|
||||
+struct sockaddr;
|
||||
+struct iovec;
|
||||
+
|
||||
+typedef struct io_context *io_context_t;
|
||||
+
|
||||
+typedef enum io_iocb_cmd {
|
||||
+ IO_CMD_PREAD = 0,
|
||||
+ IO_CMD_PWRITE = 1,
|
||||
+
|
||||
+ IO_CMD_FSYNC = 2,
|
||||
+ IO_CMD_FDSYNC = 3,
|
||||
+
|
||||
+ IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */
|
||||
+ IO_CMD_NOOP = 6,
|
||||
+ IO_CMD_PREADV = 7,
|
||||
+ IO_CMD_PWRITEV = 8,
|
||||
+} io_iocb_cmd_t;
|
||||
+
|
||||
+#if defined(__i386__) /* little endian, 32 bits */
|
||||
+#define PADDED(x, y) x; unsigned y
|
||||
+#define PADDEDptr(x, y) x; unsigned y
|
||||
+#define PADDEDul(x, y) unsigned long x; unsigned y
|
||||
+#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__)
|
||||
+#define PADDED(x, y) x, y
|
||||
+#define PADDEDptr(x, y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__powerpc64__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__PPC__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+#elif defined(__s390x__) /* big endian, 64 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x,y) x
|
||||
+#define PADDEDul(x, y) unsigned long x
|
||||
+#elif defined(__s390__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+#elif defined(__arm__)
|
||||
+# if defined (__ARMEB__) /* big endian, 32 bits */
|
||||
+#define PADDED(x, y) unsigned y; x
|
||||
+#define PADDEDptr(x, y) unsigned y; x
|
||||
+#define PADDEDul(x, y) unsigned y; unsigned long x
|
||||
+# else /* little endian, 32 bits */
|
||||
+#define PADDED(x, y) x; unsigned y
|
||||
+#define PADDEDptr(x, y) x; unsigned y
|
||||
+#define PADDEDul(x, y) unsigned long x; unsigned y
|
||||
+# endif
|
||||
+#else
|
||||
+#error endian?
|
||||
+#endif
|
||||
+
|
||||
+struct io_iocb_poll {
|
||||
+ PADDED(int events, __pad1);
|
||||
+}; /* result code is the set of result flags or -'ve errno */
|
||||
+
|
||||
+struct io_iocb_sockaddr {
|
||||
+ struct sockaddr *addr;
|
||||
+ int len;
|
||||
+}; /* result code is the length of the sockaddr, or -'ve errno */
|
||||
+
|
||||
+struct io_iocb_common {
|
||||
+ PADDEDptr(void *buf, __pad1);
|
||||
+ PADDEDul(nbytes, __pad2);
|
||||
+ long long offset;
|
||||
+ long long __pad3;
|
||||
+ unsigned flags;
|
||||
+ unsigned resfd;
|
||||
+}; /* result code is the amount read or -'ve errno */
|
||||
+
|
||||
+struct io_iocb_vector {
|
||||
+ const struct iovec *vec;
|
||||
+ int nr;
|
||||
+ long long offset;
|
||||
+}; /* result code is the amount read or -'ve errno */
|
||||
+
|
||||
+struct iocb {
|
||||
+ PADDEDptr(void *data, __pad1); /* Return in the io completion event */
|
||||
+ PADDED(unsigned key, __pad2); /* For use in identifying io requests */
|
||||
+
|
||||
+ short aio_lio_opcode;
|
||||
+ short aio_reqprio;
|
||||
+ int aio_fildes;
|
||||
+
|
||||
+ union {
|
||||
+ struct io_iocb_common c;
|
||||
+ struct io_iocb_vector v;
|
||||
+ struct io_iocb_poll poll;
|
||||
+ struct io_iocb_sockaddr saddr;
|
||||
+ } u;
|
||||
+};
|
||||
+
|
||||
+struct io_event {
|
||||
+ PADDEDptr(void *data, __pad1);
|
||||
+ PADDEDptr(struct iocb *obj, __pad2);
|
||||
+ PADDEDul(res, __pad3);
|
||||
+ PADDEDul(res2, __pad4);
|
||||
+};
|
||||
+
|
||||
+#undef PADDED
|
||||
+#undef PADDEDptr
|
||||
+#undef PADDEDul
|
||||
+
|
||||
+typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2);
|
||||
+
|
||||
+/* library wrappers */
|
||||
+extern int io_queue_init(int maxevents, io_context_t *ctxp);
|
||||
+/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/
|
||||
+extern int io_queue_release(io_context_t ctx);
|
||||
+/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/
|
||||
+extern int io_queue_run(io_context_t ctx);
|
||||
+
|
||||
+/* Actual syscalls */
|
||||
+extern int io_setup(int maxevents, io_context_t *ctxp);
|
||||
+extern int io_destroy(io_context_t ctx);
|
||||
+extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]);
|
||||
+extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt);
|
||||
+extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout);
|
||||
+
|
||||
+
|
||||
+static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
|
||||
+{
|
||||
+ iocb->data = (void *)cb;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PREAD;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = buf;
|
||||
+ iocb->u.c.nbytes = count;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PWRITE;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = buf;
|
||||
+ iocb->u.c.nbytes = count;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PREADV;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = (void *)iov;
|
||||
+ iocb->u.c.nbytes = iovcnt;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_PWRITEV;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.c.buf = (void *)iov;
|
||||
+ iocb->u.c.nbytes = iovcnt;
|
||||
+ iocb->u.c.offset = offset;
|
||||
+}
|
||||
+
|
||||
+/* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3.
|
||||
+ * AFAICT, it was never in mainline, and should not be used. --RR */
|
||||
+static inline void io_prep_poll(struct iocb *iocb, int fd, int events)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_POLL;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+ iocb->u.poll.events = events;
|
||||
+}
|
||||
+
|
||||
+static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events)
|
||||
+{
|
||||
+ io_prep_poll(iocb, fd, events);
|
||||
+ io_set_callback(iocb, cb);
|
||||
+ return io_submit(ctx, 1, &iocb);
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_fsync(struct iocb *iocb, int fd)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_FSYNC;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+}
|
||||
+
|
||||
+static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
|
||||
+{
|
||||
+ io_prep_fsync(iocb, fd);
|
||||
+ io_set_callback(iocb, cb);
|
||||
+ return io_submit(ctx, 1, &iocb);
|
||||
+}
|
||||
+
|
||||
+static inline void io_prep_fdsync(struct iocb *iocb, int fd)
|
||||
+{
|
||||
+ memset(iocb, 0, sizeof(*iocb));
|
||||
+ iocb->aio_fildes = fd;
|
||||
+ iocb->aio_lio_opcode = IO_CMD_FDSYNC;
|
||||
+ iocb->aio_reqprio = 0;
|
||||
+}
|
||||
+
|
||||
+static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
|
||||
+{
|
||||
+ io_prep_fdsync(iocb, fd);
|
||||
+ io_set_callback(iocb, cb);
|
||||
+ return io_submit(ctx, 1, &iocb);
|
||||
+}
|
||||
+
|
||||
+static inline void io_set_eventfd(struct iocb *iocb, int eventfd)
|
||||
+{
|
||||
+ iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */;
|
||||
+ iocb->u.c.resfd = eventfd;
|
||||
+}
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif /* __LIBAIO_H */
|
||||
diff -uNr libaio-0.3.109-orig/src/syscall.h libaio-0.3.109/src/syscall.h
|
||||
--- libaio-0.3.109-orig/src/syscall.h 2009-10-09 13:17:02.000000000 -0500
|
||||
+++ libaio-0.3.109/src/syscall.h 2011-04-03 12:53:53.000000000 -0500
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "syscall-alpha.h"
|
||||
#elif defined(__arm__)
|
||||
#include "syscall-arm.h"
|
||||
+#elif defined(__sparc__)
|
||||
+#include "syscall-sparc.h"
|
||||
#else
|
||||
#error "add syscall-arch.h"
|
||||
#endif
|
||||
diff -uNr libaio-0.3.109-orig/src/syscall.h.orig libaio-0.3.109/src/syscall.h.orig
|
||||
--- libaio-0.3.109-orig/src/syscall.h.orig 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ libaio-0.3.109/src/syscall.h.orig 2009-10-09 13:17:02.000000000 -0500
|
||||
@@ -0,0 +1,29 @@
|
||||
+#include <sys/syscall.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define _SYMSTR(str) #str
|
||||
+#define SYMSTR(str) _SYMSTR(str)
|
||||
+
|
||||
+#define SYMVER(compat_sym, orig_sym, ver_sym) \
|
||||
+ __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
|
||||
+
|
||||
+#define DEFSYMVER(compat_sym, orig_sym, ver_sym) \
|
||||
+ __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym));
|
||||
+
|
||||
+#if defined(__i386__)
|
||||
+#include "syscall-i386.h"
|
||||
+#elif defined(__x86_64__)
|
||||
+#include "syscall-x86_64.h"
|
||||
+#elif defined(__ia64__)
|
||||
+#include "syscall-ia64.h"
|
||||
+#elif defined(__PPC__)
|
||||
+#include "syscall-ppc.h"
|
||||
+#elif defined(__s390__)
|
||||
+#include "syscall-s390.h"
|
||||
+#elif defined(__alpha__)
|
||||
+#include "syscall-alpha.h"
|
||||
+#elif defined(__arm__)
|
||||
+#include "syscall-arm.h"
|
||||
+#else
|
||||
+#error "add syscall-arch.h"
|
||||
+#endif
|
||||
diff -uNr libaio-0.3.109-orig/src/syscall-sparc.h libaio-0.3.109/src/syscall-sparc.h
|
||||
--- libaio-0.3.109-orig/src/syscall-sparc.h 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ libaio-0.3.109/src/syscall-sparc.h 2011-04-03 12:51:33.000000000 -0500
|
||||
@@ -0,0 +1,118 @@
|
||||
+#include <errno.h>
|
||||
+
|
||||
+#define __NR_io_setup 268
|
||||
+#define __NR_io_destroy 269
|
||||
+#define __NR_io_submit 270
|
||||
+#define __NR_io_cancel 271
|
||||
+#define __NR_io_getevents 272
|
||||
+
|
||||
+#define io_syscall1(type,fname,sname,type1,arg1) \
|
||||
+type fname(type1 arg1) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res >= 0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
|
||||
+type fname(type1 arg1,type2 arg2) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res >= 0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
|
||||
+type fname(type1 arg1,type2 arg2,type3 arg3) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res>=0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
|
||||
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
+register long __o3 __asm__ ("o3") = (long)(arg4); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res>=0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
+
|
||||
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
|
||||
+ type5,arg5) \
|
||||
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
|
||||
+{ \
|
||||
+long __res; \
|
||||
+register long __g1 __asm__ ("g1") = __NR_##sname; \
|
||||
+register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
+register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
+register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
+register long __o3 __asm__ ("o3") = (long)(arg4); \
|
||||
+register long __o4 __asm__ ("o4") = (long)(arg5); \
|
||||
+__asm__ __volatile__ ("t 0x10\n\t" \
|
||||
+ "bcc 1f\n\t" \
|
||||
+ "mov %%o0, %0\n\t" \
|
||||
+ "sub %%g0, %%o0, %0\n\t" \
|
||||
+ "1:\n\t" \
|
||||
+ : "=r" (__res), "=&r" (__o0) \
|
||||
+ : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
|
||||
+ : "cc"); \
|
||||
+if (__res < -255 || __res>=0) \
|
||||
+ return (type) __res; \
|
||||
+errno = -__res; \
|
||||
+return -1; \
|
||||
+}
|
||||
30
libaio.spec
30
libaio.spec
@ -1,14 +1,12 @@
|
||||
Name: libaio
|
||||
Version: 0.3.109
|
||||
Release: 9%{?dist}
|
||||
Version: 0.3.110
|
||||
Release: 2%{?dist}
|
||||
Summary: Linux-native asynchronous I/O access library
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
Source: ftp://ftp.kernel.org/pub/linux/libs/aio/%{name}-%{version}.tar.gz
|
||||
Source: https://fedorahosted.org/releases/l/i/libaio/libaio-0.3.110.tar.gz
|
||||
|
||||
Patch1: libaio-install-to-slash.patch
|
||||
Patch2: libaio-sparc.patch
|
||||
Patch3: libaio-aarch64.patch
|
||||
Patch1: libaio-install-to-destdir-slash-usr.patch
|
||||
|
||||
%description
|
||||
The Linux-native asynchronous I/O facility ("async I/O", or "aio") has a
|
||||
@ -31,11 +29,10 @@ This package provides header files to include and libraries to link with
|
||||
for the Linux-native asynchronous I/O facility ("async I/O", or "aio").
|
||||
|
||||
%prep
|
||||
%setup -a 0
|
||||
%patch1 -p1
|
||||
%setup -q -a 0
|
||||
%patch1 -p0 -b .install-to-destdir-slash-usr
|
||||
%patch1 -p1 -b .install-to-destdir-slash-usr
|
||||
mv %{name}-%{version} compat-%{name}-%{version}
|
||||
%patch2 -p1
|
||||
%patch3 -p1 -b .aarch64
|
||||
|
||||
%build
|
||||
# A library with a soname of 1.0.0 was inadvertantly released. This
|
||||
@ -51,7 +48,7 @@ make
|
||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
cd compat-%{name}-%{version}
|
||||
install -D -m 755 src/libaio.so.1.0.0 \
|
||||
$RPM_BUILD_ROOT/%{libdir}/libaio.so.1.0.0
|
||||
$RPM_BUILD_ROOT/%{usrlibdir}/libaio.so.1.0.0
|
||||
cd ..
|
||||
make destdir=$RPM_BUILD_ROOT prefix=/ libdir=%{libdir} usrlibdir=%{usrlibdir} \
|
||||
includedir=%{_includedir} install
|
||||
@ -63,14 +60,19 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';'
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%attr(0755,root,root) %{libdir}/libaio.so.*
|
||||
%attr(0755,root,root) %{usrlibdir}/libaio.so.*
|
||||
%doc COPYING TODO
|
||||
|
||||
%files devel
|
||||
%attr(0644,root,root) %{_includedir}/*
|
||||
%attr(0755,root,root) %{usrlibdir}/libaio.so*
|
||||
%attr(0755,root,root) %{usrlibdir}/libaio.so
|
||||
|
||||
%changelog
|
||||
* Wed Mar 5 2014 Jeff Moyer <jmoyer@redhat.com> - 0.3.110-2
|
||||
- Rebase to 0.3.110 which adds support for aarch64 and other arches (Jeff Moyer)
|
||||
- Move to /usr
|
||||
- Resolves: bz#969680
|
||||
|
||||
* Tue Mar 4 2014 Marcin Juszkiewicz <mjuszkiewicz@redhat.com> - 0.3.109-9
|
||||
- Initial aarch64 compatibility patch.
|
||||
|
||||
@ -253,7 +255,7 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';'
|
||||
- make the post scriptlet not use /bin/sh
|
||||
|
||||
* Sat Apr 12 2002 Benjamin LaHaise <bcrl@redhat.com>
|
||||
- add /lib/libredhat-kernel* to %files.
|
||||
- add /lib/libredhat-kernel* to %%files.
|
||||
|
||||
* Fri Apr 12 2002 Benjamin LaHaise <bcrl@redhat.com>
|
||||
- make the dummy install as /lib/libredhat-kernel.so.1.0.0 so
|
||||
|
||||
Loading…
Reference in New Issue
Block a user