diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-11-03 16:54:00 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-11-03 16:54:00 -0700 |
commit | cd825a19936d26735db0c1b4b251bd78617d0c2b (patch) | |
tree | 8abf01e56458b77f0e836d8f72481d71cc846b68 /include | |
parent | 368c6c1f30f44d1d028022a06dbcb9754815ee92 (diff) | |
download | mariadb-git-cd825a19936d26735db0c1b4b251bd78617d0c2b.tar.gz |
more work on IO_CACHE
portability fixes for systems with broken syscalls that do not interrupt on
a signal
temporary commit - will not be pushed, need to sync up
include/my_sys.h:
work on READ_APPEND cache
mysys/Makefile.am:
change to test IO_CACHE
mysys/mf_iocache.c:
work on READ_APPEND cache
BitKeeper/etc/ignore:
Added mysys/#mf_iocache.c# mysys/test_io_cache to the ignore list
sql/mysqld.cc:
make shutdown work on broken systems
sql/sql_repl.cc:
make sure slave can be stopped on broken systems in all cases, clean-up
Diffstat (limited to 'include')
-rw-r--r-- | include/my_sys.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index f6d303a6ccb..5174425006d 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -293,6 +293,16 @@ typedef struct st_dynamic_string { struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); +#ifdef THREAD +#define lock_append_buffer(info) \ + pthread_mutex_lock(&(info)->append_buffer_lock) +#define unlock_append_buffer(info) \ + pthread_mutex_unlock(&(info)->append_buffer_lock) +#else +#define lock_append_buffer(info) +#define unlock_append_buffer(info) +#endif + typedef struct st_io_cache /* Used when cacheing files */ { my_off_t pos_in_file,end_of_file; @@ -301,7 +311,7 @@ typedef struct st_io_cache /* Used when cacheing files */ that will use a buffer allocated somewhere else */ - byte *append_buffer, *append_pos, *append_end; + byte *append_buffer, *append_read_pos, *append_write_pos, *append_end; /* for append buffer used in READ_APPEND cache */ #ifdef THREAD pthread_mutex_t append_buffer_lock; @@ -348,10 +358,15 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); _my_b_get(info)) #define my_b_write(info,Buffer,Count) \ + ((info)->type != SEQ_READ_APPEND) ? (\ ((info)->rc_pos + (Count) <= (info)->rc_end ?\ (memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \ ((info)->rc_pos+=(Count)),0) :\ - _my_b_write(info,Buffer,Count)) + _my_b_write(info,Buffer,Count))) : \ + ((info)->append_write_pos + (Count) <= (info)->append_end ?\ + (memcpy((info)->append_write_pos,Buffer,(size_t)Count), \ + ((info)->append_write_pos+=(Count),0)) : \ + _my_b_append(info,Buffer,Count)) /* my_b_write_byte dosn't have any err-check */ #define my_b_write_byte(info,chr) \ @@ -564,6 +579,7 @@ extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_get(IO_CACHE *info); extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); +extern int _my_b_append(IO_CACHE *info,const byte *Buffer,uint Count); extern int my_block_write(IO_CACHE *info, const byte *Buffer, uint Count, my_off_t pos); extern int flush_io_cache(IO_CACHE *info); |