File libaio-generic-arch.diff of Package libaio

From 5e96c73d5dfbdea8d0be82b7f3fc8d6735e5dfa7 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 17 Jan 2010 17:07:48 -0500
Subject: [PATCH] add a generic syscall() fallback

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 src/syscall-generic.h |   29 +++++++++++++++++++++++++++++
 src/syscall.h         |    3 ++-
 2 files changed, 31 insertions(+), 1 deletions(-)
 create mode 100644 src/syscall-generic.h

Index: src/syscall-generic.h
===================================================================
--- /dev/null
+++ 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)
Index: src/syscall.h
===================================================================
--- src/syscall.h.orig
+++ src/syscall.h
@@ -35,5 +35,6 @@
 #elif defined(__sh__)
 #include "syscall-sh.h"
 #else
-#error "add syscall-arch.h"
+#warning "using generic syscall method"
+#include "syscall-generic.h"
 #endif