summaryrefslogtreecommitdiffstats
path: root/usr/klibc/pread.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/pread.c')
-rw-r--r--usr/klibc/pread.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/usr/klibc/pread.c b/usr/klibc/pread.c
new file mode 100644
index 0000000..1ac3075
--- /dev/null
+++ b/usr/klibc/pread.c
@@ -0,0 +1,30 @@
+/*
+ * pread.c
+ *
+ * Some architectures need to wrap the system call
+ */
+
+#include <sys/types.h>
+#include <endian.h>
+#include <sys/syscall.h>
+
+#if defined(__hppa__)
+
+#if _BITSIZE == 32
+extern size_t __pread(int, void *, size_t, unsigned int, unsigned int);
+#else
+extern size_t __pread(int, void *, size_t, off_t);
+#endif
+
+size_t pread(int fd, void *buf, size_t count, off_t offset)
+{
+#if _BITSIZE == 32
+ unsigned int hi = offset >> 32;
+ unsigned int lo = (unsigned int) offset;
+ return __pread(fd, buf, count, __LONG_LONG_PAIR(hi, lo));
+#else
+ return __pread(fd, buf, count, offset);
+#endif
+}
+
+#endif