Blame SOURCES/libaio-sparc.patch

c3928b
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
c3928b
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/libaio.h	2009-10-09 13:17:02.000000000 -0500
c3928b
+++ libaio-0.3.109/compat-libaio-0.3.109/src/libaio.h	2011-04-03 12:52:50.000000000 -0500
c3928b
@@ -83,6 +83,14 @@
c3928b
 #define PADDEDptr(x, y)	x; unsigned y
c3928b
 #define PADDEDul(x, y)	unsigned long x; unsigned y
c3928b
 #  endif
c3928b
+#elif defined(__sparc__) && defined(__arch64__) /* big endian, 64 bits */
c3928b
+#define PADDED(x, y)    unsigned y; x
c3928b
+#define PADDEDptr(x,y)  x
c3928b
+#define PADDEDul(x, y)  unsigned long x
c3928b
+#elif defined(__sparc__)  /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)    unsigned y; x
c3928b
+#define PADDEDptr(x, y) unsigned y; x
c3928b
+#define PADDEDul(x, y)  unsigned y; unsigned long x
c3928b
 #else
c3928b
 #error	endian?
c3928b
 #endif
c3928b
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
c3928b
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/libaio.h.orig	1969-12-31 18:00:00.000000000 -0600
c3928b
+++ libaio-0.3.109/compat-libaio-0.3.109/src/libaio.h.orig	2009-10-09 13:17:02.000000000 -0500
c3928b
@@ -0,0 +1,265 @@
c3928b
+/* /usr/include/libaio.h
c3928b
+ *
c3928b
+ * Copyright 2000,2001,2002 Red Hat, Inc.
c3928b
+ *
c3928b
+ * Written by Benjamin LaHaise <bcrl@redhat.com>
c3928b
+ *
c3928b
+ * libaio Linux async I/O interface
c3928b
+ *
c3928b
+ * This library is free software; you can redistribute it and/or
c3928b
+ * modify it under the terms of the GNU Lesser General Public
c3928b
+ * License as published by the Free Software Foundation; either
c3928b
+ * version 2 of the License, or (at your option) any later version.
c3928b
+ *
c3928b
+ * This library is distributed in the hope that it will be useful,
c3928b
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
c3928b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c3928b
+ * Lesser General Public License for more details.
c3928b
+ *
c3928b
+ * You should have received a copy of the GNU Lesser General Public
c3928b
+ * License along with this library; if not, write to the Free Software
c3928b
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
c3928b
+ */
c3928b
+#ifndef __LIBAIO_H
c3928b
+#define __LIBAIO_H
c3928b
+
c3928b
+#ifdef __cplusplus
c3928b
+extern "C" {
c3928b
+#endif
c3928b
+
c3928b
+#include <sys/types.h>
c3928b
+#include <string.h>
c3928b
+
c3928b
+struct timespec;
c3928b
+struct sockaddr;
c3928b
+struct iovec;
c3928b
+
c3928b
+typedef struct io_context *io_context_t;
c3928b
+
c3928b
+typedef enum io_iocb_cmd {
c3928b
+	IO_CMD_PREAD = 0,
c3928b
+	IO_CMD_PWRITE = 1,
c3928b
+
c3928b
+	IO_CMD_FSYNC = 2,
c3928b
+	IO_CMD_FDSYNC = 3,
c3928b
+
c3928b
+	IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */
c3928b
+	IO_CMD_NOOP = 6,
c3928b
+	IO_CMD_PREADV = 7,
c3928b
+	IO_CMD_PWRITEV = 8,
c3928b
+} io_iocb_cmd_t;
c3928b
+
c3928b
+#if defined(__i386__) /* little endian, 32 bits */
c3928b
+#define PADDED(x, y)	x; unsigned y
c3928b
+#define PADDEDptr(x, y)	x; unsigned y
c3928b
+#define PADDEDul(x, y)	unsigned long x; unsigned y
c3928b
+#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__)
c3928b
+#define PADDED(x, y)	x, y
c3928b
+#define PADDEDptr(x, y)	x
c3928b
+#define PADDEDul(x, y)	unsigned long x
c3928b
+#elif defined(__powerpc64__) /* big endian, 64 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x,y)	x
c3928b
+#define PADDEDul(x, y)	unsigned long x
c3928b
+#elif defined(__PPC__)  /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x, y)	unsigned y; x
c3928b
+#define PADDEDul(x, y)	unsigned y; unsigned long x
c3928b
+#elif defined(__s390x__) /* big endian, 64 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x,y)	x
c3928b
+#define PADDEDul(x, y)	unsigned long x
c3928b
+#elif defined(__s390__) /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x, y) unsigned y; x
c3928b
+#define PADDEDul(x, y)	unsigned y; unsigned long x
c3928b
+#elif defined(__arm__)
c3928b
+#  if defined (__ARMEB__) /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x, y)	unsigned y; x
c3928b
+#define PADDEDul(x, y)	unsigned y; unsigned long x
c3928b
+#  else                   /* little endian, 32 bits */
c3928b
+#define PADDED(x, y)	x; unsigned y
c3928b
+#define PADDEDptr(x, y)	x; unsigned y
c3928b
+#define PADDEDul(x, y)	unsigned long x; unsigned y
c3928b
+#  endif
c3928b
+#else
c3928b
+#error	endian?
c3928b
+#endif
c3928b
+
c3928b
+struct io_iocb_poll {
c3928b
+	PADDED(int events, __pad1);
c3928b
+};	/* result code is the set of result flags or -'ve errno */
c3928b
+
c3928b
+struct io_iocb_sockaddr {
c3928b
+	struct sockaddr *addr;
c3928b
+	int		len;
c3928b
+};	/* result code is the length of the sockaddr, or -'ve errno */
c3928b
+
c3928b
+struct io_iocb_common {
c3928b
+	PADDEDptr(void	*buf, __pad1);
c3928b
+	PADDEDul(nbytes, __pad2);
c3928b
+	long long	offset;
c3928b
+	long long	__pad3;
c3928b
+	unsigned	flags;
c3928b
+	unsigned	resfd;
c3928b
+};	/* result code is the amount read or -'ve errno */
c3928b
+
c3928b
+struct io_iocb_vector {
c3928b
+	const struct iovec	*vec;
c3928b
+	int			nr;
c3928b
+	long long		offset;
c3928b
+};	/* result code is the amount read or -'ve errno */
c3928b
+
c3928b
+struct iocb {
c3928b
+	PADDEDptr(void *data, __pad1);	/* Return in the io completion event */
c3928b
+	PADDED(unsigned key, __pad2);	/* For use in identifying io requests */
c3928b
+
c3928b
+	short		aio_lio_opcode;	
c3928b
+	short		aio_reqprio;
c3928b
+	int		aio_fildes;
c3928b
+
c3928b
+	union {
c3928b
+		struct io_iocb_common		c;
c3928b
+		struct io_iocb_vector		v;
c3928b
+		struct io_iocb_poll		poll;
c3928b
+		struct io_iocb_sockaddr	saddr;
c3928b
+	} u;
c3928b
+};
c3928b
+
c3928b
+struct io_event {
c3928b
+	PADDEDptr(void *data, __pad1);
c3928b
+	PADDEDptr(struct iocb *obj,  __pad2);
c3928b
+	PADDEDul(res,  __pad3);
c3928b
+	PADDEDul(res2, __pad4);
c3928b
+};
c3928b
+
c3928b
+#undef PADDED
c3928b
+#undef PADDEDptr
c3928b
+#undef PADDEDul
c3928b
+
c3928b
+typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2);
c3928b
+
c3928b
+/* library wrappers */
c3928b
+extern int io_queue_init(int maxevents, io_context_t *ctxp);
c3928b
+/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/
c3928b
+extern int io_queue_release(io_context_t ctx);
c3928b
+/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/
c3928b
+extern int io_queue_run(io_context_t ctx);
c3928b
+
c3928b
+/* Actual syscalls */
c3928b
+extern int io_setup(int maxevents, io_context_t *ctxp);
c3928b
+extern int io_destroy(io_context_t ctx);
c3928b
+extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]);
c3928b
+extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt);
c3928b
+extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout);
c3928b
+
c3928b
+
c3928b
+static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
c3928b
+{
c3928b
+	iocb->data = (void *)cb;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PREAD;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = buf;
c3928b
+	iocb->u.c.nbytes = count;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PWRITE;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = buf;
c3928b
+	iocb->u.c.nbytes = count;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PREADV;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = (void *)iov;
c3928b
+	iocb->u.c.nbytes = iovcnt;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PWRITEV;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = (void *)iov;
c3928b
+	iocb->u.c.nbytes = iovcnt;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+/* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3.
c3928b
+ * AFAICT, it was never in mainline, and should not be used. --RR */
c3928b
+static inline void io_prep_poll(struct iocb *iocb, int fd, int events)
c3928b
+{
c3928b
+        memset(iocb, 0, sizeof(*iocb));
c3928b
+        iocb->aio_fildes = fd;
c3928b
+        iocb->aio_lio_opcode = IO_CMD_POLL;
c3928b
+        iocb->aio_reqprio = 0;
c3928b
+        iocb->u.poll.events = events;
c3928b
+}
c3928b
+
c3928b
+static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events)
c3928b
+{
c3928b
+        io_prep_poll(iocb, fd, events);
c3928b
+        io_set_callback(iocb, cb);
c3928b
+        return io_submit(ctx, 1, &iocb;;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_fsync(struct iocb *iocb, int fd)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_FSYNC;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+}
c3928b
+
c3928b
+static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
c3928b
+{
c3928b
+	io_prep_fsync(iocb, fd);
c3928b
+	io_set_callback(iocb, cb);
c3928b
+	return io_submit(ctx, 1, &iocb;;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_fdsync(struct iocb *iocb, int fd)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_FDSYNC;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+}
c3928b
+
c3928b
+static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
c3928b
+{
c3928b
+	io_prep_fdsync(iocb, fd);
c3928b
+	io_set_callback(iocb, cb);
c3928b
+	return io_submit(ctx, 1, &iocb;;
c3928b
+}
c3928b
+
c3928b
+static inline void io_set_eventfd(struct iocb *iocb, int eventfd)
c3928b
+{
c3928b
+	iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */;
c3928b
+	iocb->u.c.resfd = eventfd;
c3928b
+}
c3928b
+
c3928b
+#ifdef __cplusplus
c3928b
+}
c3928b
+#endif
c3928b
+
c3928b
+#endif /* __LIBAIO_H */
c3928b
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
c3928b
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall.h	2009-10-09 13:17:02.000000000 -0500
c3928b
+++ libaio-0.3.109/compat-libaio-0.3.109/src/syscall.h	2011-04-03 12:53:23.000000000 -0500
c3928b
@@ -24,6 +24,8 @@
c3928b
 #include "syscall-alpha.h"
c3928b
 #elif defined(__arm__)
c3928b
 #include "syscall-arm.h"
c3928b
+#elif defined(__sparc__)
c3928b
+#include "syscall-sparc.h"
c3928b
 #else
c3928b
 #error "add syscall-arch.h"
c3928b
 #endif
c3928b
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
c3928b
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall.h.orig	1969-12-31 18:00:00.000000000 -0600
c3928b
+++ libaio-0.3.109/compat-libaio-0.3.109/src/syscall.h.orig	2009-10-09 13:17:02.000000000 -0500
c3928b
@@ -0,0 +1,29 @@
c3928b
+#include <sys/syscall.h>
c3928b
+#include <unistd.h>
c3928b
+
c3928b
+#define _SYMSTR(str)	#str
c3928b
+#define SYMSTR(str)	_SYMSTR(str)
c3928b
+
c3928b
+#define SYMVER(compat_sym, orig_sym, ver_sym)	\
c3928b
+	__asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
c3928b
+
c3928b
+#define DEFSYMVER(compat_sym, orig_sym, ver_sym)	\
c3928b
+	__asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym));
c3928b
+
c3928b
+#if defined(__i386__)
c3928b
+#include "syscall-i386.h"
c3928b
+#elif defined(__x86_64__)
c3928b
+#include "syscall-x86_64.h"
c3928b
+#elif defined(__ia64__)
c3928b
+#include "syscall-ia64.h"
c3928b
+#elif defined(__PPC__)
c3928b
+#include "syscall-ppc.h"
c3928b
+#elif defined(__s390__)
c3928b
+#include "syscall-s390.h"
c3928b
+#elif defined(__alpha__)
c3928b
+#include "syscall-alpha.h"
c3928b
+#elif defined(__arm__)
c3928b
+#include "syscall-arm.h"
c3928b
+#else
c3928b
+#error "add syscall-arch.h"
c3928b
+#endif
c3928b
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
c3928b
--- libaio-0.3.109-orig/compat-libaio-0.3.109/src/syscall-sparc.h	1969-12-31 18:00:00.000000000 -0600
c3928b
+++ libaio-0.3.109/compat-libaio-0.3.109/src/syscall-sparc.h	2011-04-03 12:51:33.000000000 -0500
c3928b
@@ -0,0 +1,118 @@
c3928b
+#include <errno.h>
c3928b
+
c3928b
+#define __NR_io_setup           268
c3928b
+#define __NR_io_destroy         269
c3928b
+#define __NR_io_submit          270
c3928b
+#define __NR_io_cancel          271
c3928b
+#define __NR_io_getevents       272
c3928b
+
c3928b
+#define io_syscall1(type,fname,sname,type1,arg1) \
c3928b
+type fname(type1 arg1) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res >= 0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
c3928b
+type fname(type1 arg1,type2 arg2) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res >= 0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
c3928b
+type fname(type1 arg1,type2 arg2,type3 arg3) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+register long __o2 __asm__ ("o2") = (long)(arg3); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res>=0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
c3928b
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+register long __o2 __asm__ ("o2") = (long)(arg3); \
c3928b
+register long __o3 __asm__ ("o3") = (long)(arg4); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res>=0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
c3928b
+          type5,arg5) \
c3928b
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+register long __o2 __asm__ ("o2") = (long)(arg3); \
c3928b
+register long __o3 __asm__ ("o3") = (long)(arg4); \
c3928b
+register long __o4 __asm__ ("o4") = (long)(arg5); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res>=0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
diff -uNr libaio-0.3.109-orig/src/libaio.h libaio-0.3.109/src/libaio.h
c3928b
--- libaio-0.3.109-orig/src/libaio.h	2009-10-09 13:17:02.000000000 -0500
c3928b
+++ libaio-0.3.109/src/libaio.h	2011-04-03 12:53:38.000000000 -0500
c3928b
@@ -83,6 +83,14 @@
c3928b
 #define PADDEDptr(x, y)	x; unsigned y
c3928b
 #define PADDEDul(x, y)	unsigned long x; unsigned y
c3928b
 #  endif
c3928b
+#elif defined(__sparc__) && defined(__arch64__) /* big endian, 64 bits */
c3928b
+#define PADDED(x, y)    unsigned y; x
c3928b
+#define PADDEDptr(x,y)  x
c3928b
+#define PADDEDul(x, y)  unsigned long x
c3928b
+#elif defined(__sparc__)  /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)    unsigned y; x
c3928b
+#define PADDEDptr(x, y) unsigned y; x
c3928b
+#define PADDEDul(x, y)  unsigned y; unsigned long x
c3928b
 #else
c3928b
 #error	endian?
c3928b
 #endif
c3928b
diff -uNr libaio-0.3.109-orig/src/libaio.h.orig libaio-0.3.109/src/libaio.h.orig
c3928b
--- libaio-0.3.109-orig/src/libaio.h.orig	1969-12-31 18:00:00.000000000 -0600
c3928b
+++ libaio-0.3.109/src/libaio.h.orig	2009-10-09 13:17:02.000000000 -0500
c3928b
@@ -0,0 +1,265 @@
c3928b
+/* /usr/include/libaio.h
c3928b
+ *
c3928b
+ * Copyright 2000,2001,2002 Red Hat, Inc.
c3928b
+ *
c3928b
+ * Written by Benjamin LaHaise <bcrl@redhat.com>
c3928b
+ *
c3928b
+ * libaio Linux async I/O interface
c3928b
+ *
c3928b
+ * This library is free software; you can redistribute it and/or
c3928b
+ * modify it under the terms of the GNU Lesser General Public
c3928b
+ * License as published by the Free Software Foundation; either
c3928b
+ * version 2 of the License, or (at your option) any later version.
c3928b
+ *
c3928b
+ * This library is distributed in the hope that it will be useful,
c3928b
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
c3928b
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c3928b
+ * Lesser General Public License for more details.
c3928b
+ *
c3928b
+ * You should have received a copy of the GNU Lesser General Public
c3928b
+ * License along with this library; if not, write to the Free Software
c3928b
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
c3928b
+ */
c3928b
+#ifndef __LIBAIO_H
c3928b
+#define __LIBAIO_H
c3928b
+
c3928b
+#ifdef __cplusplus
c3928b
+extern "C" {
c3928b
+#endif
c3928b
+
c3928b
+#include <sys/types.h>
c3928b
+#include <string.h>
c3928b
+
c3928b
+struct timespec;
c3928b
+struct sockaddr;
c3928b
+struct iovec;
c3928b
+
c3928b
+typedef struct io_context *io_context_t;
c3928b
+
c3928b
+typedef enum io_iocb_cmd {
c3928b
+	IO_CMD_PREAD = 0,
c3928b
+	IO_CMD_PWRITE = 1,
c3928b
+
c3928b
+	IO_CMD_FSYNC = 2,
c3928b
+	IO_CMD_FDSYNC = 3,
c3928b
+
c3928b
+	IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */
c3928b
+	IO_CMD_NOOP = 6,
c3928b
+	IO_CMD_PREADV = 7,
c3928b
+	IO_CMD_PWRITEV = 8,
c3928b
+} io_iocb_cmd_t;
c3928b
+
c3928b
+#if defined(__i386__) /* little endian, 32 bits */
c3928b
+#define PADDED(x, y)	x; unsigned y
c3928b
+#define PADDEDptr(x, y)	x; unsigned y
c3928b
+#define PADDEDul(x, y)	unsigned long x; unsigned y
c3928b
+#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__)
c3928b
+#define PADDED(x, y)	x, y
c3928b
+#define PADDEDptr(x, y)	x
c3928b
+#define PADDEDul(x, y)	unsigned long x
c3928b
+#elif defined(__powerpc64__) /* big endian, 64 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x,y)	x
c3928b
+#define PADDEDul(x, y)	unsigned long x
c3928b
+#elif defined(__PPC__)  /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x, y)	unsigned y; x
c3928b
+#define PADDEDul(x, y)	unsigned y; unsigned long x
c3928b
+#elif defined(__s390x__) /* big endian, 64 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x,y)	x
c3928b
+#define PADDEDul(x, y)	unsigned long x
c3928b
+#elif defined(__s390__) /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x, y) unsigned y; x
c3928b
+#define PADDEDul(x, y)	unsigned y; unsigned long x
c3928b
+#elif defined(__arm__)
c3928b
+#  if defined (__ARMEB__) /* big endian, 32 bits */
c3928b
+#define PADDED(x, y)	unsigned y; x
c3928b
+#define PADDEDptr(x, y)	unsigned y; x
c3928b
+#define PADDEDul(x, y)	unsigned y; unsigned long x
c3928b
+#  else                   /* little endian, 32 bits */
c3928b
+#define PADDED(x, y)	x; unsigned y
c3928b
+#define PADDEDptr(x, y)	x; unsigned y
c3928b
+#define PADDEDul(x, y)	unsigned long x; unsigned y
c3928b
+#  endif
c3928b
+#else
c3928b
+#error	endian?
c3928b
+#endif
c3928b
+
c3928b
+struct io_iocb_poll {
c3928b
+	PADDED(int events, __pad1);
c3928b
+};	/* result code is the set of result flags or -'ve errno */
c3928b
+
c3928b
+struct io_iocb_sockaddr {
c3928b
+	struct sockaddr *addr;
c3928b
+	int		len;
c3928b
+};	/* result code is the length of the sockaddr, or -'ve errno */
c3928b
+
c3928b
+struct io_iocb_common {
c3928b
+	PADDEDptr(void	*buf, __pad1);
c3928b
+	PADDEDul(nbytes, __pad2);
c3928b
+	long long	offset;
c3928b
+	long long	__pad3;
c3928b
+	unsigned	flags;
c3928b
+	unsigned	resfd;
c3928b
+};	/* result code is the amount read or -'ve errno */
c3928b
+
c3928b
+struct io_iocb_vector {
c3928b
+	const struct iovec	*vec;
c3928b
+	int			nr;
c3928b
+	long long		offset;
c3928b
+};	/* result code is the amount read or -'ve errno */
c3928b
+
c3928b
+struct iocb {
c3928b
+	PADDEDptr(void *data, __pad1);	/* Return in the io completion event */
c3928b
+	PADDED(unsigned key, __pad2);	/* For use in identifying io requests */
c3928b
+
c3928b
+	short		aio_lio_opcode;	
c3928b
+	short		aio_reqprio;
c3928b
+	int		aio_fildes;
c3928b
+
c3928b
+	union {
c3928b
+		struct io_iocb_common		c;
c3928b
+		struct io_iocb_vector		v;
c3928b
+		struct io_iocb_poll		poll;
c3928b
+		struct io_iocb_sockaddr	saddr;
c3928b
+	} u;
c3928b
+};
c3928b
+
c3928b
+struct io_event {
c3928b
+	PADDEDptr(void *data, __pad1);
c3928b
+	PADDEDptr(struct iocb *obj,  __pad2);
c3928b
+	PADDEDul(res,  __pad3);
c3928b
+	PADDEDul(res2, __pad4);
c3928b
+};
c3928b
+
c3928b
+#undef PADDED
c3928b
+#undef PADDEDptr
c3928b
+#undef PADDEDul
c3928b
+
c3928b
+typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2);
c3928b
+
c3928b
+/* library wrappers */
c3928b
+extern int io_queue_init(int maxevents, io_context_t *ctxp);
c3928b
+/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/
c3928b
+extern int io_queue_release(io_context_t ctx);
c3928b
+/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/
c3928b
+extern int io_queue_run(io_context_t ctx);
c3928b
+
c3928b
+/* Actual syscalls */
c3928b
+extern int io_setup(int maxevents, io_context_t *ctxp);
c3928b
+extern int io_destroy(io_context_t ctx);
c3928b
+extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]);
c3928b
+extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt);
c3928b
+extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout);
c3928b
+
c3928b
+
c3928b
+static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
c3928b
+{
c3928b
+	iocb->data = (void *)cb;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PREAD;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = buf;
c3928b
+	iocb->u.c.nbytes = count;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PWRITE;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = buf;
c3928b
+	iocb->u.c.nbytes = count;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PREADV;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = (void *)iov;
c3928b
+	iocb->u.c.nbytes = iovcnt;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_PWRITEV;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+	iocb->u.c.buf = (void *)iov;
c3928b
+	iocb->u.c.nbytes = iovcnt;
c3928b
+	iocb->u.c.offset = offset;
c3928b
+}
c3928b
+
c3928b
+/* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3.
c3928b
+ * AFAICT, it was never in mainline, and should not be used. --RR */
c3928b
+static inline void io_prep_poll(struct iocb *iocb, int fd, int events)
c3928b
+{
c3928b
+        memset(iocb, 0, sizeof(*iocb));
c3928b
+        iocb->aio_fildes = fd;
c3928b
+        iocb->aio_lio_opcode = IO_CMD_POLL;
c3928b
+        iocb->aio_reqprio = 0;
c3928b
+        iocb->u.poll.events = events;
c3928b
+}
c3928b
+
c3928b
+static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events)
c3928b
+{
c3928b
+        io_prep_poll(iocb, fd, events);
c3928b
+        io_set_callback(iocb, cb);
c3928b
+        return io_submit(ctx, 1, &iocb;;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_fsync(struct iocb *iocb, int fd)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_FSYNC;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+}
c3928b
+
c3928b
+static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
c3928b
+{
c3928b
+	io_prep_fsync(iocb, fd);
c3928b
+	io_set_callback(iocb, cb);
c3928b
+	return io_submit(ctx, 1, &iocb;;
c3928b
+}
c3928b
+
c3928b
+static inline void io_prep_fdsync(struct iocb *iocb, int fd)
c3928b
+{
c3928b
+	memset(iocb, 0, sizeof(*iocb));
c3928b
+	iocb->aio_fildes = fd;
c3928b
+	iocb->aio_lio_opcode = IO_CMD_FDSYNC;
c3928b
+	iocb->aio_reqprio = 0;
c3928b
+}
c3928b
+
c3928b
+static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
c3928b
+{
c3928b
+	io_prep_fdsync(iocb, fd);
c3928b
+	io_set_callback(iocb, cb);
c3928b
+	return io_submit(ctx, 1, &iocb;;
c3928b
+}
c3928b
+
c3928b
+static inline void io_set_eventfd(struct iocb *iocb, int eventfd)
c3928b
+{
c3928b
+	iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */;
c3928b
+	iocb->u.c.resfd = eventfd;
c3928b
+}
c3928b
+
c3928b
+#ifdef __cplusplus
c3928b
+}
c3928b
+#endif
c3928b
+
c3928b
+#endif /* __LIBAIO_H */
c3928b
diff -uNr libaio-0.3.109-orig/src/syscall.h libaio-0.3.109/src/syscall.h
c3928b
--- libaio-0.3.109-orig/src/syscall.h	2009-10-09 13:17:02.000000000 -0500
c3928b
+++ libaio-0.3.109/src/syscall.h	2011-04-03 12:53:53.000000000 -0500
c3928b
@@ -24,6 +24,8 @@
c3928b
 #include "syscall-alpha.h"
c3928b
 #elif defined(__arm__)
c3928b
 #include "syscall-arm.h"
c3928b
+#elif defined(__sparc__)
c3928b
+#include "syscall-sparc.h"
c3928b
 #else
c3928b
 #error "add syscall-arch.h"
c3928b
 #endif
c3928b
diff -uNr libaio-0.3.109-orig/src/syscall.h.orig libaio-0.3.109/src/syscall.h.orig
c3928b
--- libaio-0.3.109-orig/src/syscall.h.orig	1969-12-31 18:00:00.000000000 -0600
c3928b
+++ libaio-0.3.109/src/syscall.h.orig	2009-10-09 13:17:02.000000000 -0500
c3928b
@@ -0,0 +1,29 @@
c3928b
+#include <sys/syscall.h>
c3928b
+#include <unistd.h>
c3928b
+
c3928b
+#define _SYMSTR(str)	#str
c3928b
+#define SYMSTR(str)	_SYMSTR(str)
c3928b
+
c3928b
+#define SYMVER(compat_sym, orig_sym, ver_sym)	\
c3928b
+	__asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym));
c3928b
+
c3928b
+#define DEFSYMVER(compat_sym, orig_sym, ver_sym)	\
c3928b
+	__asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym));
c3928b
+
c3928b
+#if defined(__i386__)
c3928b
+#include "syscall-i386.h"
c3928b
+#elif defined(__x86_64__)
c3928b
+#include "syscall-x86_64.h"
c3928b
+#elif defined(__ia64__)
c3928b
+#include "syscall-ia64.h"
c3928b
+#elif defined(__PPC__)
c3928b
+#include "syscall-ppc.h"
c3928b
+#elif defined(__s390__)
c3928b
+#include "syscall-s390.h"
c3928b
+#elif defined(__alpha__)
c3928b
+#include "syscall-alpha.h"
c3928b
+#elif defined(__arm__)
c3928b
+#include "syscall-arm.h"
c3928b
+#else
c3928b
+#error "add syscall-arch.h"
c3928b
+#endif
c3928b
diff -uNr libaio-0.3.109-orig/src/syscall-sparc.h libaio-0.3.109/src/syscall-sparc.h
c3928b
--- libaio-0.3.109-orig/src/syscall-sparc.h	1969-12-31 18:00:00.000000000 -0600
c3928b
+++ libaio-0.3.109/src/syscall-sparc.h	2011-04-03 12:51:33.000000000 -0500
c3928b
@@ -0,0 +1,118 @@
c3928b
+#include <errno.h>
c3928b
+
c3928b
+#define __NR_io_setup           268
c3928b
+#define __NR_io_destroy         269
c3928b
+#define __NR_io_submit          270
c3928b
+#define __NR_io_cancel          271
c3928b
+#define __NR_io_getevents       272
c3928b
+
c3928b
+#define io_syscall1(type,fname,sname,type1,arg1) \
c3928b
+type fname(type1 arg1) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res >= 0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
c3928b
+type fname(type1 arg1,type2 arg2) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res >= 0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
c3928b
+type fname(type1 arg1,type2 arg2,type3 arg3) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+register long __o2 __asm__ ("o2") = (long)(arg3); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res>=0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
c3928b
+type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+register long __o2 __asm__ ("o2") = (long)(arg3); \
c3928b
+register long __o3 __asm__ ("o3") = (long)(arg4); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res>=0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}
c3928b
+
c3928b
+#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
c3928b
+          type5,arg5) \
c3928b
+type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
c3928b
+{ \
c3928b
+long __res; \
c3928b
+register long __g1 __asm__ ("g1") = __NR_##sname; \
c3928b
+register long __o0 __asm__ ("o0") = (long)(arg1); \
c3928b
+register long __o1 __asm__ ("o1") = (long)(arg2); \
c3928b
+register long __o2 __asm__ ("o2") = (long)(arg3); \
c3928b
+register long __o3 __asm__ ("o3") = (long)(arg4); \
c3928b
+register long __o4 __asm__ ("o4") = (long)(arg5); \
c3928b
+__asm__ __volatile__ ("t 0x10\n\t" \
c3928b
+                      "bcc 1f\n\t" \
c3928b
+                      "mov %%o0, %0\n\t" \
c3928b
+                      "sub %%g0, %%o0, %0\n\t" \
c3928b
+                      "1:\n\t" \
c3928b
+                      : "=r" (__res), "=&r" (__o0) \
c3928b
+                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
c3928b
+                      : "cc"); \
c3928b
+if (__res < -255 || __res>=0) \
c3928b
+        return (type) __res; \
c3928b
+errno = -__res; \
c3928b
+return -1; \
c3928b
+}