summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen LaHaise <bcrl@kvack.org>2002-09-13 03:30:12 +0000
committerBen LaHaise <bcrl@kvack.org>2002-09-13 03:30:12 +0000
commit34c539fcb98c4397b9f04e93f8a475a9e445cf33 (patch)
tree2bab8bf992110dcb07eab31ac1c5acedcaf1616a
parent8a9aa88e5092b35692773cd50d31b7723667794e (diff)
downloadlibaio-34c539fcb98c4397b9f04e93f8a475a9e445cf33.tar.gz
more libaio cleanups for ia64
-rw-r--r--src/Makefile4
-rw-r--r--src/io_destroy.c26
-rw-r--r--src/io_queue_release.c1
-rw-r--r--src/io_queue_run.c3
-rw-r--r--src/io_queue_wait.c4
-rw-r--r--src/io_setup.c26
-rw-r--r--src/libaio.map2
-rw-r--r--src/raw_syscall.c18
-rw-r--r--src/syscall-ia64.h22
9 files changed, 98 insertions, 8 deletions
diff --git a/src/Makefile b/src/Makefile
index 29b03dd..4a86b4d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -18,6 +18,10 @@ libaio_srcs += io_queue_wait.c io_queue_run.c
# real syscalls
libaio_srcs += io_getevents.c io_submit.c io_cancel.c
+libaio_srcs += io_setup.c io_destroy.c
+
+# internal functions
+libaio_srcs += raw_syscall.c
# old symbols
libaio_srcs += compat-0_1.c
diff --git a/src/io_destroy.c b/src/io_destroy.c
new file mode 100644
index 0000000..99f8bf9
--- /dev/null
+++ b/src/io_destroy.c
@@ -0,0 +1,26 @@
+/* io_destroy
+ libaio Linux async I/O interface
+ Copyright 2002 Red Hat, Inc.
+
+ 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 <errno.h>
+#include <libaio.h>
+#include "syscall.h"
+
+int io_destroy(io_context_t ctx)
+{
+ return syscall1(__NR_io_destroy, ctx);
+}
diff --git a/src/io_queue_release.c b/src/io_queue_release.c
index afa57fe..94bbb86 100644
--- a/src/io_queue_release.c
+++ b/src/io_queue_release.c
@@ -20,7 +20,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#include "vsys_def.h"
int io_queue_release(io_context_t ctx)
{
diff --git a/src/io_queue_run.c b/src/io_queue_run.c
index 255392f..83f8f2a 100644
--- a/src/io_queue_run.c
+++ b/src/io_queue_run.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <stdlib.h>
#include <time.h>
-#include "vsys_def.h"
int io_queue_run(io_context_t ctx)
{
@@ -29,7 +28,7 @@ int io_queue_run(io_context_t ctx)
int ret;
/* FIXME: batch requests? */
- while (1 == (ret = vsys_io_getevents(ctx, 1, &event, &timeout))) {
+ while (1 == (ret = io_getevents(ctx, 0, 1, &event, &timeout))) {
io_callback_t cb = (io_callback_t)event.data;
struct iocb *iocb = (struct iocb *)event.obj;
diff --git a/src/io_queue_wait.c b/src/io_queue_wait.c
index a39bc47..a6e0bec 100644
--- a/src/io_queue_wait.c
+++ b/src/io_queue_wait.c
@@ -21,11 +21,9 @@
#include <libaio.h>
#include <errno.h>
-#include "vsys_def.h"
-
struct timespec;
int io_queue_wait(io_context_t ctx, struct timespec *timeout)
{
- return vsys_io_getevents(ctx, 0, NULL, timeout);
+ return io_getevents(ctx, 0, 0, NULL, timeout);
}
diff --git a/src/io_setup.c b/src/io_setup.c
new file mode 100644
index 0000000..a2d3788
--- /dev/null
+++ b/src/io_setup.c
@@ -0,0 +1,26 @@
+/* io_setup
+ libaio Linux async I/O interface
+ Copyright 2002 Red Hat, Inc.
+
+ 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 <errno.h>
+#include <libaio.h>
+#include "syscall.h"
+
+int io_setup(int maxevents, io_context_t *ctxp)
+{
+ return syscall2(__NR_io_setup, maxevents, ctxp);
+}
diff --git a/src/libaio.map b/src/libaio.map
index 480fbf8..c491c16 100644
--- a/src/libaio.map
+++ b/src/libaio.map
@@ -1,5 +1,7 @@
LIBAIO_0.4 {
global:
+ io_setup;
+ io_destroy;
io_cancel;
io_getevents;
local:
diff --git a/src/raw_syscall.c b/src/raw_syscall.c
new file mode 100644
index 0000000..3c8d7fa
--- /dev/null
+++ b/src/raw_syscall.c
@@ -0,0 +1,18 @@
+#include "syscall.h"
+
+#if defined(__ia64__)
+/* based on code from glibc by Jes Sorensen */
+__asm__(".text\n"
+ ".globl __ia64_aio_raw_syscall\n"
+ "__ia64_aio_raw_syscall:\n"
+ "alloc r2=ar.pfs,1,0,8,0\n"
+ "mov r15=r32\n"
+ "break 0x100000\n"
+ ";;"
+ "br.ret.sptk.few b0\n"
+ ".size __ia64_aio_raw_syscall, . - __ia64_aio_raw_syscall\n"
+ ".endp __ia64_aio_raw_syscall"
+);
+#endif
+
+;
diff --git a/src/syscall-ia64.h b/src/syscall-ia64.h
index a7edd79..a159a9c 100644
--- a/src/syscall-ia64.h
+++ b/src/syscall-ia64.h
@@ -1,10 +1,28 @@
-#define __NR_io_setup 1238
+#define __NR_io_setup 1025 //1238
#define __NR_io_destroy 1239
#define __NR_io_getevents 1240
#define __NR_io_submit 1241
#define __NR_io_cancel 1242
-#define syscall5(nr, a, b, c, d, e) __ia64_raw_syscall(nr, a, b, c, d, e)
+extern long __ia64_aio_raw_syscall(long a, long b, long c, long d, long e, long nr);
+#if 0
+static long __ia64_raw_syscall(nr, a, b, c, d, e)
+{
+ long dummy aa, bb, cc, dd, ee;
+
+ __asm__("break __BREAK_SYSCALL\n"
+ ";;\n"
+ "1:\n"
+ : "out0" (aa),
+ "out1" (bb),
+ "out2" (cc),
+ "out3" (dd),
+ "out4" (ee),
+ "out5" (ff))
+}
+#endif
+
+#define syscall5(nr, a, b, c, d, e) __ia64_aio_raw_syscall(a, b, c, d, e, nr)
#define syscall4(nr, a, b, c, d) syscall5(nr, a, b, c, d, 0)
#define syscall3(nr, a, b, c) syscall4(nr, a, b, c, 0)
#define syscall2(nr, a, b) syscall3(nr, a, b, 0)