diff options
author | unknown <monty@mashka.mysql.fi> | 2002-08-08 03:29:36 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-08-08 03:29:36 +0300 |
commit | a6b15fdd7682bffc2e197ac50e21332bb9bcf297 (patch) | |
tree | da5d29e4a08217e2773b16c5aef05ab734c760e4 /mysys | |
parent | 93f5a0616ab15113844fa211a26c44182af8018c (diff) | |
parent | f01f49916b7a0ea6eaf9f0e4e1dfad911584f8a2 (diff) | |
download | mariadb-git-a6b15fdd7682bffc2e197ac50e21332bb9bcf297.tar.gz |
merge
BitKeeper/etc/logging_ok:
auto-union
include/my_sys.h:
Auto merged
innobase/include/dyn0dyn.h:
Auto merged
innobase/include/dyn0dyn.ic:
Auto merged
myisam/mi_check.c:
Auto merged
sql/ha_berkeley.h:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/lex.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/Makefile.am | 5 | ||||
-rw-r--r-- | mysys/mf_iocache.c | 12 | ||||
-rw-r--r-- | mysys/mf_iocache2.c | 14 | ||||
-rw-r--r-- | mysys/my_chsize.c | 8 | ||||
-rw-r--r-- | mysys/my_os2file64.c | 16 | ||||
-rw-r--r-- | mysys/my_os2thread.c | 7 | ||||
-rw-r--r-- | mysys/raid.cc | 17 |
7 files changed, 58 insertions, 21 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 3ca07b7b80b..646bedf9603 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -21,7 +21,10 @@ INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include -I.. -I$(srcdir) pkglib_LIBRARIES = libmysys.a LDADD = libmysys.a ../dbug/libdbug.a \ ../strings/libmystrings.a -noinst_HEADERS = mysys_priv.h my_static.h +noinst_HEADERS = mysys_priv.h my_static.h \ + my_os2cond.c my_os2dirsrch.c my_os2dirsrch.h \ + my_os2dlfcn.c my_os2file64.c my_os2mutex.c \ + my_os2thread.c my_os2tls.c libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ mf_path.c mf_loadpath.c\ my_open.c my_create.c my_dup.c my_seek.c my_read.c \ diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index b6e721cbd57..a4bf09ef7a7 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -123,7 +123,8 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, uint min_cache; my_off_t end_of_file= ~(my_off_t) 0; DBUG_ENTER("init_io_cache"); - DBUG_PRINT("enter",("type: %d pos: %ld",(int) type, (ulong) seek_offset)); + DBUG_PRINT("enter",("cache: %lx type: %d pos: %ld", + (ulong) info, (int) type, (ulong) seek_offset)); info->file= file; info->type=type; @@ -264,8 +265,9 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, pbool clear_cache) { DBUG_ENTER("reinit_io_cache"); - DBUG_PRINT("enter",("type: %d seek_offset: %lu clear_cache: %d", - type, (ulong) seek_offset, (int) clear_cache)); + DBUG_PRINT("enter",("cache: %lx type: %d seek_offset: %lu clear_cache: %d", + (ulong) info, type, (ulong) seek_offset, + (int) clear_cache)); /* One can't do reinit with the following types */ DBUG_ASSERT(type != READ_NET && info->type != READ_NET && @@ -283,11 +285,15 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, { info->read_end=info->write_pos; info->end_of_file=my_b_tell(info); + info->seek_not_done=1; } else if (type == WRITE_CACHE) { if (info->type == READ_CACHE) + { info->write_end=info->write_buffer+info->buffer_length; + info->seek_not_done=1; + } info->end_of_file = ~(my_off_t) 0; } pos=info->request_pos+(seek_offset-info->pos_in_file); diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index b19ca391672..21979b99285 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -212,6 +212,20 @@ uint my_b_gets(IO_CACHE *info, char *to, uint max_length) } +my_off_t my_b_filelength(IO_CACHE *info) +{ + if (info->type == WRITE_CACHE) + { + return my_b_tell(info); + } + else + { + info->seek_not_done=0; + return my_seek(info->file,0L,MY_SEEK_END,MYF(0)); + } +} + + /* Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu" Used for logging in MySQL diff --git a/mysys/my_chsize.c b/mysys/my_chsize.c index 54129f12897..06e8f159f4a 100644 --- a/mysys/my_chsize.c +++ b/mysys/my_chsize.c @@ -25,17 +25,19 @@ my_chsize() fd File descriptor new_length New file size + filler If we don't have truncate, fill up all bytes after + new_length with this character MyFlags Flags DESCRIPTION - my_chsize() truncates file if shorter, else expand with zero. + my_chsize() truncates file if shorter, else fill with the filler character RETURN VALUE 0 Ok 1 Error */ -int my_chsize(File fd, my_off_t newlength, myf MyFlags) +int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) { DBUG_ENTER("my_chsize"); DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength, @@ -81,7 +83,7 @@ int my_chsize(File fd, my_off_t newlength, myf MyFlags) } #endif /* Full file with 0 until it's as big as requested */ - bzero(buff,IO_SIZE); + bfill(buff, IO_SIZE, filler); while (newlength-oldsize > IO_SIZE) { if (my_write(fd,(byte*) buff,IO_SIZE,MYF(MY_NABP))) diff --git a/mysys/my_os2file64.c b/mysys/my_os2file64.c index b7ee40d292e..2f41d344e32 100644 --- a/mysys/my_os2file64.c +++ b/mysys/my_os2file64.c @@ -22,6 +22,7 @@ void _OS2errno( APIRET rc); longlong _lseek64( int fd, longlong offset, int seektype); int _lock64( int fd, int locktype, my_off_t start, my_off_t length, myf MyFlags); +int _sopen64( const char *name, int oflag, int shflag, int mask); // // this class is used to define a global c++ variable, that @@ -191,8 +192,17 @@ inline _SetFileLocksL(HFILE hFile, ULONG timeout, ULONG flags) { - if (_DosSetFileLocksL) - return _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags); + if (_DosSetFileLocksL) { + APIRET rc; + rc = _DosSetFileLocksL( hFile, pflUnlock, pflLock, timeout, flags); + + // on FAT/HPFS/LAN a INVALID_PARAMETER is returned, seems that + // only JFS can handle >2GB ranges. + if (rc != 87) + return rc; + + // got INVALID_PARAMETER, fallback to standard call + } FILELOCK flUnlock = { pflUnlock->lOffset, pflUnlock->lRange }; FILELOCK flLock = { pflLock->lOffset, pflLock->lRange }; @@ -254,7 +264,7 @@ int _lock64( int fd, int locktype, my_off_t start, return(-1); } -int _sopen( const char *name, int oflag, int shflag, int mask) +int sopen( const char *name, int oflag, int shflag, int mask) { int fail_errno; APIRET rc = 0; diff --git a/mysys/my_os2thread.c b/mysys/my_os2thread.c index 017ba7f316b..89a3311c10b 100644 --- a/mysys/my_os2thread.c +++ b/mysys/my_os2thread.c @@ -53,6 +53,7 @@ void win_pthread_init(void) static pthread_handler_decl(pthread_start,param) { + DBUG_ENTER("pthread_start"); pthread_handler func=((struct pthread_map *) param)->func; void *func_param=((struct pthread_map *) param)->param; my_thread_init(); /* Will always succeed in windows */ @@ -60,8 +61,10 @@ static pthread_handler_decl(pthread_start,param) win_pthread_self=((struct pthread_map *) param)->pthreadself; pthread_mutex_unlock(&THR_LOCK_thread); free((char*) param); /* Free param from create */ - pthread_exit((void*) (*func)(func_param)); - return 0; /* Safety */ + //pthread_exit((void*) (*func)(func_param)); + (*func)(func_param); + DBUG_RETURN(0); + //return 0; /* Safety */ } diff --git a/mysys/raid.cc b/mysys/raid.cc index 6196e1f1aa6..d6359dc0f93 100644 --- a/mysys/raid.cc +++ b/mysys/raid.cc @@ -75,7 +75,7 @@ #endif #include "mysys_priv.h" -#include "my_dir.h" +#include <my_dir.h> #include <m_string.h> #include <assert.h> @@ -281,7 +281,7 @@ extern "C" { DBUG_RETURN(my_close(fd, MyFlags)); } - int my_raid_chsize(File fd, my_off_t newlength, myf MyFlags) + int my_raid_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) { DBUG_ENTER("my_raid_chsize"); DBUG_PRINT("enter",("Fd: %d newlength: %u MyFlags: %d", @@ -289,10 +289,10 @@ extern "C" { if (is_raid(fd)) { RaidFd *raid= (*dynamic_element(&RaidFd::_raid_map,fd,RaidFd**)); - DBUG_RETURN(raid->Chsize(fd, newlength, MyFlags)); + DBUG_RETURN(raid->Chsize(fd, newlength, filler, MyFlags)); } else - DBUG_RETURN(my_chsize(fd, newlength, MyFlags)); + DBUG_RETURN(my_chsize(fd, newlength, filler, MyFlags)); } int my_raid_rename(const char *from, const char *to, @@ -738,7 +738,7 @@ Tell(myf MyFlags) } int RaidFd:: -Chsize(File fd, my_off_t newlength, myf MyFlags) +Chsize(File fd, my_off_t newlength, int filler, myf MyFlags) { DBUG_ENTER("RaidFd::Chsize"); DBUG_PRINT("enter",("Fd: %d, newlength: %d, MyFlags: %d", @@ -752,17 +752,16 @@ Chsize(File fd, my_off_t newlength, myf MyFlags) if ( i < _this_block ) newpos = my_chsize(_fd_vector[i], _this_block * _raid_chunksize + (_rounds + 1) * - _raid_chunksize, - MyFlags); + _raid_chunksize, filler, MyFlags); else if ( i == _this_block ) newpos = my_chsize(_fd_vector[i], _this_block * _raid_chunksize + _rounds * _raid_chunksize + (newlength % _raid_chunksize), - MyFlags); + filler, MyFlags); else // this means: i > _this_block newpos = my_chsize(_fd_vector[i], _this_block * _raid_chunksize + _rounds * - _raid_chunksize, MyFlags); + _raid_chunksize, filler, MyFlags); if (newpos) DBUG_RETURN(1); } |