summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-12-21 18:21:17 +0200
committerunknown <heikki@hundin.mysql.fi>2004-12-21 18:21:17 +0200
commitb0d26c26424e7761b5805d41c0dee54c11194a32 (patch)
treeef363a8ff7684a196f4dd28d604ef5427e97a282 /innobase
parent9cee9f6969e45051ac26e62b1a520ff642c6b22e (diff)
downloadmariadb-git-b0d26c26424e7761b5805d41c0dee54c11194a32.tar.gz
os0file.c:
Fix InnoDB bug: on HP-UX, with a 32-bit binary, InnoDB was only able to read or write <= 2 GB files; the reason was that InnoDB treated the return value of lseek() as a 32-bit integer; lseek was used on HP-UX-11 as a replacement for pread() and pwrite() because HAVE_BROKEN_PREAD was defined on that platform innobase/os/os0file.c: Fix InnoDB bug: on HP-UX, with a 32-bit binary, InnoDB was only able to read or write <= 2 GB files; the reason was that InnoDB treated the return value of lseek() as a 32-bit integer; lseek was used on HP-UX-11 as a replacement for pread() and pwrite() because HAVE_BROKEN_PREAD was defined on that platform
Diffstat (limited to 'innobase')
-rw-r--r--innobase/os/os0file.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 6ed3720cc84..bab043fc746 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -6,6 +6,8 @@ The interface to the operating system file i/o primitives
Created 10/21/1995 Heikki Tuuri
*******************************************************/
+#define HAVE_BROKEN_PREAD
+
#include "os0file.h"
#include "os0sync.h"
#include "os0thread.h"
@@ -14,8 +16,6 @@ Created 10/21/1995 Heikki Tuuri
#include "fil0fil.h"
#include "buf0buf.h"
-#undef HAVE_FDATASYNC
-
#ifdef POSIX_ASYNC_IO
/* We assume in this case that the OS has standard Posix aio (at least SunOS
2.6, HP-UX 11i and AIX 4.3 have) */
@@ -1195,6 +1195,7 @@ os_file_pread(
return(n_bytes);
#else
{
+ off_t ret_offset;
ssize_t ret;
ulint i;
@@ -1203,12 +1204,12 @@ os_file_pread(
os_mutex_enter(os_file_seek_mutexes[i]);
- ret = lseek(file, offs, 0);
+ ret_offset = lseek(file, offs, SEEK_SET);
- if (ret < 0) {
+ if (ret_offset < 0) {
os_mutex_exit(os_file_seek_mutexes[i]);
- return(ret);
+ return(-1);
}
ret = read(file, buf, (ssize_t)n);
@@ -1281,6 +1282,7 @@ os_file_pwrite(
return(ret);
#else
{
+ off_t ret_offset;
ulint i;
/* Protect the seek / write operation with a mutex */
@@ -1288,12 +1290,12 @@ os_file_pwrite(
os_mutex_enter(os_file_seek_mutexes[i]);
- ret = lseek(file, offs, 0);
+ ret_offset = lseek(file, offs, SEEK_SET);
- if (ret < 0) {
+ if (ret_offset < 0) {
os_mutex_exit(os_file_seek_mutexes[i]);
- return(ret);
+ return(-1);
}
ret = write(file, buf, (ssize_t)n);