summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <tsmith/tim@siva.hindu.god>2006-10-16 19:59:15 -0600
committerunknown <tsmith/tim@siva.hindu.god>2006-10-16 19:59:15 -0600
commitf3258af51379c018850140849f16552d7a66be8b (patch)
tree3e8cd6f7169b69bff3dc768068295592c981a7ee /mysys
parent2f7849dfd5884d2d6f7097f5c0e4431a3b5a3e30 (diff)
parentd7a1f97c15fc5adaaf3116b8fb9ee32783498165 (diff)
downloadmariadb-git-f3258af51379c018850140849f16552d7a66be8b.tar.gz
Merge siva.hindu.god:/usr/home/tim/m/bk/b4053/40
into siva.hindu.god:/usr/home/tim/m/bk/tmp/mrgOct16/40 mysys/my_read.c: Manual merge
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_lread.c2
-rw-r--r--mysys/my_lwrite.c2
-rw-r--r--mysys/my_pread.c12
-rw-r--r--mysys/my_quick.c26
-rw-r--r--mysys/my_read.c9
-rw-r--r--mysys/my_write.c20
6 files changed, 55 insertions, 16 deletions
diff --git a/mysys/my_lread.c b/mysys/my_lread.c
index 601d772b844..a96febe4474 100644
--- a/mysys/my_lread.c
+++ b/mysys/my_lread.c
@@ -30,6 +30,8 @@ uint32 my_lread(int Filedes, byte *Buffer, uint32 Count, myf MyFlags)
DBUG_PRINT("my",("Fd: %d Buffer: %ld Count: %ld MyFlags: %d",
Filedes, Buffer, Count, MyFlags));
+ DBUG_PRINT("error", ("Deprecated my_lread() function should not be used."));
+
/* Temp hack to get count to int32 while read wants int */
if ((readbytes = (uint32) read(Filedes, Buffer, (uint) Count)) != Count)
{
diff --git a/mysys/my_lwrite.c b/mysys/my_lwrite.c
index e1a3decd053..cfdbd5d4576 100644
--- a/mysys/my_lwrite.c
+++ b/mysys/my_lwrite.c
@@ -26,6 +26,8 @@ uint32 my_lwrite(int Filedes, const byte *Buffer, uint32 Count, myf MyFlags)
DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %ld MyFlags: %d",
Filedes, Buffer, Count, MyFlags));
+ DBUG_PRINT("error", ("Deprecated my_lwrite() function should not be used."));
+
/* Temp hack to get count to int32 while write wants int */
if ((writenbytes = (uint32) write(Filedes, Buffer, (uint) Count)) != Count)
{
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index f76233fc4cc..70990ad12a6 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -52,8 +52,12 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes,Count,Filedes,my_errno));
#ifdef THREAD
- if (readbytes == 0 && errno == EINTR)
- continue; /* Interrupted */
+ if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+ {
+ DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
+ (int) readbytes));
+ continue; /* Interrupted */
+ }
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
@@ -124,8 +128,8 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue;
}
- if ((writenbytes == 0 && my_errno == EINTR) ||
- (writenbytes > 0 && (uint) writenbytes != (uint) -1))
+ if ((writenbytes > 0 && (uint) writenbytes != (uint) -1) ||
+ my_errno == EINTR)
continue; /* Retry */
#endif
if (MyFlags & (MY_NABP | MY_FNABP))
diff --git a/mysys/my_quick.c b/mysys/my_quick.c
index 44ed3fc0b2c..ffc8160c371 100644
--- a/mysys/my_quick.c
+++ b/mysys/my_quick.c
@@ -26,6 +26,14 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags)
if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
{
+#ifndef DBUG_OFF
+ if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+ {
+ DBUG_PRINT("error", ("my_quick_read() was interrupted and returned %d"
+ ". This function does not retry the read!",
+ (int) readbytes));
+ }
+#endif
my_errno=errno;
return readbytes;
}
@@ -35,8 +43,24 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags)
uint my_quick_write(File Filedes,const byte *Buffer,uint Count)
{
- if ((uint) write(Filedes,Buffer,Count) != Count)
+#ifndef DBUG_OFF
+ uint writtenbytes;
+#endif
+
+ if ((
+#ifndef DBUG_OFF
+ writtenbytes =
+#endif
+ (uint) write(Filedes,Buffer,Count)) != Count)
{
+#ifndef DBUG_OFF
+ if ((writtenbytes == 0 || (int) writtenbytes == -1) && errno == EINTR)
+ {
+ DBUG_PRINT("error", ("my_quick_write() was interrupted and returned %d"
+ ". This function does not retry the write!",
+ (int) writtenbytes));
+ }
+#endif
my_errno=errno;
return (uint) -1;
}
diff --git a/mysys/my_read.c b/mysys/my_read.c
index bca28694295..ff47a7c67f9 100644
--- a/mysys/my_read.c
+++ b/mysys/my_read.c
@@ -51,10 +51,11 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes, Count, Filedes, my_errno));
#ifdef THREAD
- if ((int) readbytes <= 0 && errno == EINTR)
- {
- DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes));
- continue; /* Interrupted */
+ if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+ {
+ DBUG_PRINT("debug", ("my_read() was interrupted and returned %d",
+ (int) readbytes));
+ continue; /* Interrupted */
}
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 1d1a893090a..de762c16a07 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -57,18 +57,24 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue;
}
- if (!writenbytes)
+
+ if ((writenbytes == 0 || (int) writenbytes == -1))
{
- /* We may come here on an interrupt or if the file quote is exeeded */
if (my_errno == EINTR)
- continue;
- if (!errors++) /* Retry once */
{
- errno=EFBIG; /* Assume this is the error */
- continue;
+ DBUG_PRINT("debug", ("my_write() was interrupted and returned %d",
+ (int) writenbytes));
+ continue; /* Interrupted */
+ }
+
+ if (!writenbytes && !errors++) /* Retry once */
+ {
+ /* We may come here if the file quota is exeeded */
+ errno=EFBIG; /* Assume this is the error */
+ continue;
}
}
- else if ((uint) writenbytes != (uint) -1)
+ else
continue; /* Retry */
#endif
if (MyFlags & (MY_NABP | MY_FNABP))