Commit 7b792405 authored by unknown's avatar unknown

Merge siva.hindu.god:/usr/home/tim/m/bk/b19764/51

into  siva.hindu.god:/usr/home/tim/m/bk/tmp/mrgOct16/51

parents d0172194 b3149432
...@@ -20,7 +20,7 @@ ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_m ...@@ -20,7 +20,7 @@ ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_m
my_clock.c my_compress.c my_conio.c my_copy.c my_crc32.c my_create.c my_delete.c my_clock.c my_compress.c my_conio.c my_copy.c my_crc32.c my_create.c my_delete.c
my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c
my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
my_lib.c my_lock.c my_lockmem.c my_lread.c my_lwrite.c my_malloc.c my_messnc.c my_lib.c my_lock.c my_lockmem.c my_malloc.c my_messnc.c
my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c
my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_wincond.c my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_wincond.c
......
...@@ -43,7 +43,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ ...@@ -43,7 +43,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
tree.c trie.c list.c hash.c array.c string.c typelib.c \ tree.c trie.c list.c hash.c array.c string.c typelib.c \
my_copy.c my_append.c my_lib.c \ my_copy.c my_append.c my_lib.c \
my_delete.c my_rename.c my_redel.c \ my_delete.c my_rename.c my_redel.c \
my_chsize.c my_lread.c my_lwrite.c my_clock.c \ my_chsize.c my_clock.c \
my_quick.c my_lockmem.c my_static.c \ my_quick.c my_lockmem.c my_static.c \
my_sync.c my_getopt.c my_mkdir.c \ my_sync.c my_getopt.c my_mkdir.c \
default_modify.c default.c \ default_modify.c default.c \
......
...@@ -312,7 +312,7 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) ...@@ -312,7 +312,7 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
{ {
char *buf; char *buf;
int fd; int fd;
uint len; uint len, tmp_len;
MY_STAT stat_info; MY_STAT stat_info;
if (!my_stat(filename, &stat_info, MYF(myflags)) || if (!my_stat(filename, &stat_info, MYF(myflags)) ||
...@@ -321,12 +321,11 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) ...@@ -321,12 +321,11 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
return TRUE; return TRUE;
if ((fd=my_open(filename,O_RDONLY,myflags)) < 0) if ((fd=my_open(filename,O_RDONLY,myflags)) < 0)
{ goto error;
my_free(buf,myflags); tmp_len=my_read(fd, buf, len, myflags);
return TRUE;
}
len=read(fd,buf,len);
my_close(fd,myflags); my_close(fd,myflags);
if (tmp_len != len)
goto error;
if (my_parse_charset_xml(buf,len,add_collation)) if (my_parse_charset_xml(buf,len,add_collation))
{ {
...@@ -340,6 +339,10 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) ...@@ -340,6 +339,10 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
my_free(buf, myflags); my_free(buf, myflags);
return FALSE; return FALSE;
error:
my_free(buf, myflags);
return TRUE;
} }
......
rm -f .deps/* raid.o mf_iocache.o libmysys.a rm -f .deps/* raid.o mf_iocache.o libmysys.a
ccc -DDEFAULT_BASEDIR="\"/usr/local/mysql\"" -DDATADIR="\"/usr/local/mysql/var\"" -DHAVE_CONFIG_H -I./../include -I../include -I.. -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c array.c checksum.c default.c errors.c getopt.c getopt1.c getvar.c hash.c list.c mf_brkhant.c mf_cache.c mf_casecnv.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_keycache.c mf_loadpath.c mf_pack.c mf_pack2.c mf_path.c mf_qsort.c mf_qsort2.c mf_radix.c mf_reccache.c mf_same.c mf_sort.c mf_soundex.c mf_stripp.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_alarm.c my_alloc.c my_append.c my_chsize.c my_clock.c my_compress.c my_copy.c my_create.c my_delete.c my_div.c my_error.c my_fopen.c my_fstream.c my_getwd.c my_init.c my_lib.c my_lockmem.c my_lread.c my_lwrite.c my_malloc.c my_messnc.c my_mkdir.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_static.c my_tempnam.c my_thr_init.c my_write.c ptr_cmp.c queues.c safemalloc.c string.c thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c tree.c typelib.c ccc -DDEFAULT_BASEDIR="\"/usr/local/mysql\"" -DDATADIR="\"/usr/local/mysql/var\"" -DHAVE_CONFIG_H -I./../include -I../include -I.. -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c array.c checksum.c default.c errors.c getopt.c getopt1.c getvar.c hash.c list.c mf_brkhant.c mf_cache.c mf_casecnv.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_keycache.c mf_loadpath.c mf_pack.c mf_pack2.c mf_path.c mf_qsort.c mf_qsort2.c mf_radix.c mf_reccache.c mf_same.c mf_sort.c mf_soundex.c mf_stripp.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_alarm.c my_alloc.c my_append.c my_chsize.c my_clock.c my_compress.c my_copy.c my_create.c my_delete.c my_div.c my_error.c my_fopen.c my_fstream.c my_getwd.c my_init.c my_lib.c my_lockmem.c my_malloc.c my_messnc.c my_mkdir.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_static.c my_tempnam.c my_thr_init.c my_write.c ptr_cmp.c queues.c safemalloc.c string.c thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c tree.c typelib.c
make raid.o mf_iocache.o my_lock.o make raid.o mf_iocache.o my_lock.o
ar -cr libmysys.a array.o raid.o mf_iocache.o my_lock.o ar -cr libmysys.a array.o raid.o mf_iocache.o my_lock.o
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
#include "mysys_err.h"
/* Read a chunk of bytes from a file */
uint32 my_lread(int Filedes, byte *Buffer, uint32 Count, myf MyFlags)
/* File descriptor */
/* Buffer must be at least count bytes */
/* Max number of bytes returnd */
/* Flags on what to do on error */
{
uint32 readbytes;
DBUG_ENTER("my_lread");
DBUG_PRINT("my",("Fd: %d Buffer: %ld Count: %ld MyFlags: %d",
Filedes, Buffer, Count, MyFlags));
/* Temp hack to get count to int32 while read wants int */
if ((readbytes = (uint32) read(Filedes, Buffer, (uint) Count)) != Count)
{
my_errno=errno;
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
if (readbytes == MY_FILE_ERROR)
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),errno);
else
if (MyFlags & (MY_NABP | MY_FNABP))
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),errno);
}
if (readbytes == MY_FILE_ERROR || MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN((uint32) -1); /* Return med felkod */
}
if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Ok vid l{sning */
DBUG_RETURN(readbytes);
} /* my_lread */
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
#include "mysys_err.h"
/* Write a chunk of bytes to a file */
uint32 my_lwrite(int Filedes, const byte *Buffer, uint32 Count, myf MyFlags)
{
uint32 writenbytes;
DBUG_ENTER("my_lwrite");
DBUG_PRINT("my",("Fd: %d Buffer: 0x%lx Count: %ld MyFlags: %d",
Filedes, Buffer, Count, MyFlags));
/* Temp hack to get count to int32 while write wants int */
if ((writenbytes = (uint32) write(Filedes, Buffer, (uint) Count)) != Count)
{
my_errno=errno;
if (writenbytes == (uint32) -1 || MyFlags & (MY_NABP | MY_FNABP))
{
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),errno);
}
DBUG_RETURN((uint32) -1); /* Return med felkod */
}
}
if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Ok vid l{sning */
DBUG_RETURN(writenbytes);
} /* my_lwrite */
...@@ -75,8 +75,12 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset, ...@@ -75,8 +75,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", DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes,Count,Filedes,my_errno)); readbytes,Count,Filedes,my_errno));
#ifdef THREAD #ifdef THREAD
if (readbytes == 0 && errno == EINTR) if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
{
DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
(int) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
}
#endif #endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{ {
...@@ -170,8 +174,8 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset, ...@@ -170,8 +174,8 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue; continue;
} }
if ((writenbytes == 0 && my_errno == EINTR) || if ((writenbytes > 0 && (uint) writenbytes != (uint) -1) ||
(writenbytes > 0 && (uint) writenbytes != (uint) -1)) my_errno == EINTR)
continue; /* Retry */ continue; /* Retry */
#endif #endif
if (MyFlags & (MY_NABP | MY_FNABP)) if (MyFlags & (MY_NABP | MY_FNABP))
......
...@@ -26,6 +26,14 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags) ...@@ -26,6 +26,14 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags)
if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count) 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; my_errno=errno;
return readbytes; return readbytes;
} }
...@@ -35,8 +43,24 @@ uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf MyFlags) ...@@ -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) 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; my_errno=errno;
return (uint) -1; return (uint) -1;
} }
......
...@@ -51,9 +51,10 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags) ...@@ -51,9 +51,10 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d", DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes, Count, Filedes, my_errno)); readbytes, Count, Filedes, my_errno));
#ifdef THREAD #ifdef THREAD
if ((int) readbytes <= 0 && errno == EINTR) if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
{ {
DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes)); DBUG_PRINT("debug", ("my_read() was interrupted and returned %d",
(int) readbytes));
continue; /* Interrupted */ continue; /* Interrupted */
} }
#endif #endif
......
...@@ -57,18 +57,24 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags) ...@@ -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)); VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
continue; 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) if (my_errno == EINTR)
continue;
if (!errors++) /* Retry once */
{ {
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 */ errno=EFBIG; /* Assume this is the error */
continue; continue;
} }
} }
else if ((uint) writenbytes != (uint) -1) else
continue; /* Retry */ continue; /* Retry */
#endif #endif
if (MyFlags & (MY_NABP | MY_FNABP)) if (MyFlags & (MY_NABP | MY_FNABP))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment