diff options
author | monty@hundin.mysql.fi <> | 2002-06-03 12:59:31 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2002-06-03 12:59:31 +0300 |
commit | f0b28da6f91cf87804015b5dde4820be040c2de7 (patch) | |
tree | be04186411dc657ef6bbcbe01267d30f2675c914 /include | |
parent | 3ede8f6289b53345f44aecffd70c7e291f88186b (diff) | |
parent | 544f95c45112993df1d31d3eda859dd5e4efff89 (diff) | |
download | mariadb-git-f0b28da6f91cf87804015b5dde4820be040c2de7.tar.gz |
merge with 4.0
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 8 | ||||
-rw-r--r-- | include/my_alloc.h | 39 | ||||
-rw-r--r-- | include/my_getopt.h | 4 | ||||
-rw-r--r-- | include/my_global.h | 8 | ||||
-rw-r--r-- | include/my_net.h | 42 | ||||
-rw-r--r-- | include/my_pthread.h | 32 | ||||
-rw-r--r-- | include/my_sys.h | 29 | ||||
-rw-r--r-- | include/mysql.h | 18 | ||||
-rw-r--r-- | include/mysql_com.h | 1 | ||||
-rw-r--r-- | include/mysqld_error.h | 2 | ||||
-rw-r--r-- | include/mysys_err.h | 16 | ||||
-rw-r--r-- | include/violite.h | 16 |
12 files changed, 127 insertions, 88 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 8cf9c7c5a78..85cd640a0a3 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -18,8 +18,8 @@ BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \ mysql.h mysql_com.h mysqld_error.h mysql_embed.h \ - my_pthread.h my_no_pthread.h raid.h errmsg.h \ - my_global.h my_net.h \ + my_semaphore.h my_pthread.h my_no_pthread.h raid.h errmsg.h \ + my_global.h my_net.h my_alloc.h\ sslopt-case.h sslopt-longopts.h sslopt-usage.h \ sslopt-vars.h $(BUILT_SOURCES) noinst_HEADERS = config-win.h \ @@ -28,8 +28,8 @@ noinst_HEADERS = config-win.h \ my_dir.h mysys_err.h my_base.h \ my_nosys.h my_alarm.h queues.h \ my_tree.h hash.h thr_alarm.h thr_lock.h \ - getopt.h my_getopt.h t_ctype.h violite.h md5.h \ - my_handler.h mysql_version.h.in + t_ctype.h violite.h md5.h mysql_version.h.in \ + my_handler.h # mysql_version.h are generated SUPERCLEANFILES = mysql_version.h my_config.h diff --git a/include/my_alloc.h b/include/my_alloc.h new file mode 100644 index 00000000000..0857c8886c5 --- /dev/null +++ b/include/my_alloc.h @@ -0,0 +1,39 @@ +/* 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 */ + +/* + Data structures for mysys/my_alloc.c (root memory allocator) +*/ + +#ifndef ST_USED_MEM_DEFINED +#define ST_USED_MEM_DEFINED +typedef struct st_used_mem { /* struct for once_alloc (block) */ + struct st_used_mem *next; /* Next block in use */ + unsigned int left; /* memory left in block */ + unsigned int size; /* size of block */ +} USED_MEM; +typedef struct st_mem_root { + USED_MEM *free; /* blocks with free memory in it */ + USED_MEM *used; /* blocks almost without free memory */ + USED_MEM *pre_alloc; /* preallocated block */ + /* if block have less memory it will be put in 'used' list*/ + unsigned int min_malloc; + unsigned int block_size; /* initial block size */ + unsigned int block_num; /* allocated blocks counter */ + + void (*error_handler)(void); +} MEM_ROOT; +#endif diff --git a/include/my_getopt.h b/include/my_getopt.h index b3b3ee2f785..3b50fbe2ded 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -16,7 +16,8 @@ C_MODE_START -enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_LONG, GET_LL, GET_STR }; +enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG, + GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC }; enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; struct my_option @@ -38,6 +39,7 @@ struct my_option }; extern char *disabled_my_option; +extern my_bool my_getopt_print_errors; extern int handle_options (int *argc, char ***argv, const struct my_option *longopts, diff --git a/include/my_global.h b/include/my_global.h index 2b5c6915ad9..01910eb1342 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1023,12 +1023,4 @@ typedef union { #define C_MODE_END #endif -/* - Now if query is taken off then tests with query cache fails - SANJA TODO: remove this when problem with mysql-test will be solved -*/ -#if defined(MYSQL_SERVER) && !defined(HAVE_QUERY_CACHE) -#define HAVE_QUERY_CACHE -#endif - #endif /* _global_h */ diff --git a/include/my_net.h b/include/my_net.h index c2ebe80a343..2f5743923cf 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -67,5 +67,47 @@ C_MODE_START void my_inet_ntoa(struct in_addr in, char *buf); +/* + Handling of gethostbyname_r() +*/ + +#if !defined(HPUX) +struct hostent; +#endif /* HPUX */ +#if !defined(HAVE_GETHOSTBYNAME_R) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +void my_gethostbyname_r_free(); +#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +#define my_gethostbyname_r_free() +#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX) +#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) +#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */ + +#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT) +#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +#define my_gethostbyname_r_free() +#else +#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E)) +#define my_gethostbyname_r_free() +#endif /* !defined(HAVE_GETHOSTBYNAME_R) */ + +#ifndef GETHOSTBYNAME_BUFF_SIZE +#define GETHOSTBYNAME_BUFF_SIZE 2048 +#endif + +/* On SCO you get a link error when refering to h_errno */ +#ifdef SCO +#undef h_errno +#define h_errno errno +#endif + C_MODE_END #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index cfc1ea326f4..fda31b9d4f2 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -349,6 +349,13 @@ extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority); #undef HAVE_GETHOSTBYADDR_R /* No definition */ #endif +#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX) +extern int my_pthread_cond_timedwait(pthread_cond_t *cond, + pthread_mutex_t *mutex, + struct timespec *abstime); +#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) +#endif + #if defined(OS2) #define my_pthread_getspecific(T,A) ((T) &(A)) #define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) @@ -419,31 +426,6 @@ struct tm *localtime_r(const time_t *clock, struct tm *res); #define HAVE_PTHREAD_KILL #endif -#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) -#if !defined(HPUX) -struct hostent; -#endif /* HPUX */ -struct hostent *my_gethostbyname_r(const char *name, - struct hostent *result, char *buffer, - int buflen, int *h_errnop); -#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) -#define GETHOSTBYNAME_BUFF_SIZE 2048 -#else -#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) -#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */ - -#else -#ifdef HAVE_GETHOSTBYNAME_R_RETURN_INT -#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) -struct hostent *my_gethostbyname_r(const char *name, - struct hostent *result, char *buffer, - int buflen, int *h_errnop); -#else -#define GETHOSTBYNAME_BUFF_SIZE 2048 -#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E)) -#endif /* HAVE_GETHOSTBYNAME_R_RETURN_INT */ -#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */ - #endif /* defined(__WIN__) */ #if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) diff --git a/include/my_sys.h b/include/my_sys.h index 3b69092d5ae..54ed9110e95 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -464,26 +464,7 @@ typedef struct st_changeable_var { } CHANGEABLE_VAR; -/* structs for alloc_root */ - -#ifndef ST_USED_MEM_DEFINED -#define ST_USED_MEM_DEFINED -typedef struct st_used_mem { /* struct for once_alloc */ - struct st_used_mem *next; /* Next block in use */ - unsigned int left; /* memory left in block */ - unsigned int size; /* Size of block */ -} USED_MEM; - -typedef struct st_mem_root { - USED_MEM *free; - USED_MEM *used; - USED_MEM *pre_alloc; - unsigned int min_malloc; - unsigned int block_size; - - void (*error_handler)(void); -} MEM_ROOT; -#endif +#include <my_alloc.h> /* Prototypes for mysys and my_func functions */ @@ -602,7 +583,7 @@ extern int my_sortncmp(CHARSET_INFO *cs, const char *s,uint s_len, const char *t extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); -extern size_s stripp_sp(my_string str); +extern size_s strip_sp(my_string str); extern void get_date(my_string to,int timeflag,time_t use_time); extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,pbool remove_garbage); extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, @@ -662,9 +643,9 @@ extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); -#define init_dynamic_array(A,B,C,D) _init_dynamic_array(A,B,C,D CALLER_INFO) -#define init_dynamic_array_ci(A,B,C,D) _init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) -extern my_bool _init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, +#define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO) +#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) +extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, uint init_alloc,uint alloc_increment CALLER_INFO_PROTO); extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element); extern byte *alloc_dynamic(DYNAMIC_ARRAY *array); diff --git a/include/mysql.h b/include/mysql.h index 7a16cbbe1d2..5bcdca636c0 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -100,23 +100,7 @@ typedef struct st_mysql_rows { typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ -#ifndef ST_USED_MEM_DEFINED -#define ST_USED_MEM_DEFINED -typedef struct st_used_mem { /* struct for once_alloc */ - struct st_used_mem *next; /* Next block in use */ - unsigned int left; /* memory left in block */ - unsigned int size; /* size of block */ -} USED_MEM; -typedef struct st_mem_root { - USED_MEM *free; - USED_MEM *used; - USED_MEM *pre_alloc; - unsigned int min_malloc; - unsigned int block_size; - - void (*error_handler)(void); -} MEM_ROOT; -#endif +#include <my_alloc.h> typedef struct st_mysql_data { my_ulonglong rows; diff --git a/include/mysql_com.h b/include/mysql_com.h index 0e54c0e992b..c30eb30f779 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -81,6 +81,7 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, #define REFRESH_QUERY_CACHE 65536 #define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ #define REFRESH_DES_KEY_FILE 0x40000L +#define REFRESH_USER_RESOURCES 0x80000L #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 61442247ea8..170a07422c3 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Definefile for errormessagenumbers */ +/* Definefile for error messagenumbers */ #define ER_HASHCHK 1000 #define ER_NISAMCHK 1001 diff --git a/include/mysys_err.h b/include/mysys_err.h index b3d058aff3e..a86765c74fd 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -54,7 +54,23 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ #define EE_CANT_SYMLINK 25 #define EE_REALPATH 26 + /* exit codes for all MySQL programs */ + +#define EXIT_UNSPECIFIED_ERROR 1 +#define EXIT_UNKNOWN_OPTION 2 +#define EXIT_AMBIGUOUS_OPTION 3 +#define EXIT_NO_ARGUMENT_ALLOWED 4 +#define EXIT_ARGUMENT_REQUIRED 5 +#define EXIT_VAR_PREFIX_NOT_UNIQUE 6 +#define EXIT_UNKNOWN_VARIABLE 7 +#define EXIT_OUT_OF_MEMORY 8 +#define EXIT_UNKNOWN_SUFFIX 9 +#define EXIT_NO_PTR_TO_VARIABLE 10 +#define EXIT_CANNOT_CONNECT_TO_SERVICE 11 + + #ifdef __cplusplus } #endif #endif + diff --git a/include/violite.h b/include/violite.h index 0f36e493b57..40da31ee1b6 100644 --- a/include/violite.h +++ b/include/violite.h @@ -153,27 +153,27 @@ my_bool vio_ssl_peer_addr(Vio* vio, char *buf); void vio_ssl_in_addr(Vio *vio, struct in_addr *in); /* Single copy for server */ +enum vio_ssl_acceptorfd_state +{ + state_connect = 1, + state_accept = 2 +}; + struct st_VioSSLAcceptorFd { SSL_CTX* ssl_context_; SSL_METHOD* ssl_method_; struct st_VioSSLAcceptorFd* session_id_context_; - enum { - state_connect = 1, - state_accept = 2 - }; - - /* function pointers which are only once for SSL server - Vio*(*sslaccept)(struct st_VioSSLAcceptorFd*,Vio*); */ }; /* One copy for client */ struct st_VioSSLConnectorFd { SSL_CTX* ssl_context_; - SSL_METHOD* ssl_method_; /* function pointers which are only once for SSL client */ + SSL_METHOD* ssl_method_; }; + void sslaccept(struct st_VioSSLAcceptorFd*, Vio*, long timeout); void sslconnect(struct st_VioSSLConnectorFd*, Vio*, long timeout); |