summaryrefslogtreecommitdiff
path: root/include/my_sys.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
commit9809f05199aeb0b67991fac41bd86f38730768dc (patch)
treefa2792ff86d0da014b535d743759810612338042 /include/my_sys.h
parent0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff)
parent5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff)
downloadmariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz
5.5-merge
Diffstat (limited to 'include/my_sys.h')
-rw-r--r--include/my_sys.h57
1 files changed, 31 insertions, 26 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index ecb478818ac..4dfe425dc30 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -29,12 +29,27 @@ typedef struct my_aio_result {
} my_aio_result;
#endif
-#ifndef THREAD
-extern int my_errno; /* Last error in mysys */
+#ifdef HAVE_valgrind
+#define IF_VALGRIND(A,B) A
#else
-#include <my_pthread.h>
+#define IF_VALGRIND(A,B) B
#endif
+#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H)
+# include <valgrind/memcheck.h>
+# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
+# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
+# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+#else /* HAVE_VALGRIND */
+# define MEM_UNDEFINED(a,len) bfill(a, len, 0x8F)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+#endif /* HAVE_VALGRIND */
+
+#include <my_pthread.h>
+
#include <m_ctype.h> /* for CHARSET_INFO */
#include <stdarg.h>
#include <typelib.h>
@@ -98,7 +113,7 @@ extern int my_errno; /* Last error in mysys */
#define ME_HOLDTANG 8 /* Don't delete last keys */
#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */
#define ME_WAITTANG 32 /* Wait for a user action */
-#define ME_NOREFRESH 64 /* Dont refresh screen */
+#define ME_NOREFRESH 64 /* Write the error message to error log */
#define ME_NOINPUT 128 /* Dont use the input libary */
#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
@@ -254,7 +269,7 @@ extern my_bool my_disable_sync;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
/* from default.c */
-extern char *my_defaults_extra_file;
+extern const char *my_defaults_extra_file;
extern const char *my_defaults_group_suffix;
extern const char *my_defaults_file;
@@ -318,7 +333,7 @@ struct st_my_file_info
int oflag; /* open flags, e.g O_APPEND */
#endif
enum file_type type;
-#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
+#if !defined(HAVE_PREAD) && !defined(_WIN32)
mysql_mutex_t mutex;
#endif
};
@@ -338,9 +353,7 @@ typedef struct st_my_tmpdir
DYNAMIC_ARRAY full_list;
char **list;
uint cur, max;
-#ifdef THREAD
mysql_mutex_t mutex;
-#endif
} MY_TMPDIR;
typedef struct st_dynamic_string
@@ -352,7 +365,6 @@ typedef struct st_dynamic_string
struct st_io_cache;
typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
-#ifdef THREAD
typedef struct st_io_cache_share
{
mysql_mutex_t mutex; /* To sync on reads into buffer. */
@@ -372,7 +384,6 @@ typedef struct st_io_cache_share
my_bool alloced;
#endif
} IO_CACHE_SHARE;
-#endif
typedef struct st_io_cache /* Used when cacheing files */
{
@@ -413,7 +424,7 @@ typedef struct st_io_cache /* Used when cacheing files */
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/
uchar **current_pos, **current_end;
-#ifdef THREAD
+
/*
The lock is for append buffer used in SEQ_READ_APPEND cache
need mutex copying from append buffer to read buffer.
@@ -427,7 +438,7 @@ typedef struct st_io_cache /* Used when cacheing files */
READ_CACHE mode is supported.
*/
IO_CACHE_SHARE *share;
-#endif
+
/*
A caller will use my_b_read() macro to read from the cache
if the data is already in cache, it will be simply copied with
@@ -460,7 +471,8 @@ typedef struct st_io_cache /* Used when cacheing files */
IO_CACHE_CALLBACK pre_close;
/*
Counts the number of times, when we were forced to use disk. We use it to
- increase the binlog_cache_disk_use status variable.
+ increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
+ variables.
*/
ulong disk_writes;
void* arg; /* for use by pre/post_read */
@@ -635,10 +647,13 @@ extern const char** get_global_errmsgs();
extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
+extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
extern int my_fclose(FILE *fd,myf MyFlags);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_chmod(const char *name, mode_t mode, myf my_flags);
+extern void thr_set_sync_wait_callback(void (*before_sync)(void),
+ void (*after_sync)(void));
extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
@@ -653,21 +668,12 @@ extern int my_error_register(const char** (*get_errmsgs) (),
extern const char **my_error_unregister(int first, int last);
extern void my_message(uint my_err, const char *str,myf MyFlags);
extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
-extern my_bool my_basic_init(void);
extern my_bool my_init(void);
extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags);
extern int my_copystat(const char *from, const char *to, int MyFlags);
extern char * my_filename(File fd);
-#ifndef THREAD
-extern void dont_break(void);
-extern void allow_break(void);
-#else
-#define dont_break()
-#define allow_break()
-#endif
-
#ifdef EXTRA_DEBUG
void my_print_open_files(void);
#else
@@ -740,12 +746,10 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
pbool clear_cache);
extern void setup_io_cache(IO_CACHE* info);
extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
-#ifdef THREAD
extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
IO_CACHE *write_cache, uint num_threads);
extern void remove_io_thread(IO_CACHE *info);
-#endif
extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
extern int _my_b_get(IO_CACHE *info);
@@ -839,7 +843,8 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
-extern const char *args_separator;
+extern my_bool my_getopt_use_args_separator;
+extern my_bool my_getopt_is_args_separator(const char* arg);
extern int my_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups,