diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/my_context.h | 232 | ||||
-rw-r--r-- | include/my_pthread.h | 1 | ||||
-rw-r--r-- | include/my_sys.h | 4 | ||||
-rw-r--r-- | include/mysql.h.pp | 2 | ||||
-rw-r--r-- | include/mysql_async.h | 38 | ||||
-rw-r--r-- | include/mysql_com.h | 9 | ||||
-rw-r--r-- | include/sql_common.h | 7 | ||||
-rw-r--r-- | include/violite.h | 2 |
8 files changed, 11 insertions, 284 deletions
diff --git a/include/my_context.h b/include/my_context.h deleted file mode 100644 index ea0e3496887..00000000000 --- a/include/my_context.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright 2011 Kristian Nielsen and Monty Program Ab - - This file is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this. If not, see <http://www.gnu.org/licenses/>. -*/ - -/* - Simple API for spawning a co-routine, to be used for async libmysqlclient. - - Idea is that by implementing this interface using whatever facilities are - available for given platform, we can use the same code for the generic - libmysqlclient-async code. - - (This particular implementation uses Posix ucontext swapcontext().) -*/ - -#ifdef __WIN__ -#define MY_CONTEXT_USE_WIN32_FIBERS 1 -#elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__x86_64__) && !defined(__ILP32__) -#define MY_CONTEXT_USE_X86_64_GCC_ASM -#elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__i386__) -#define MY_CONTEXT_USE_I386_GCC_ASM -#elif defined(HAVE_UCONTEXT_H) -#define MY_CONTEXT_USE_UCONTEXT -#else -#define MY_CONTEXT_DISABLE -#endif - -#ifdef MY_CONTEXT_USE_WIN32_FIBERS -struct my_context { - void (*user_func)(void *); - void *user_arg; - void *app_fiber; - void *lib_fiber; - int return_value; -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_USE_UCONTEXT -#include <ucontext.h> - -struct my_context { - void (*user_func)(void *); - void *user_data; - void *stack; - size_t stack_size; - ucontext_t base_context; - ucontext_t spawned_context; - int active; -#ifdef HAVE_VALGRIND_MEMCHECK_H - unsigned int valgrind_stack_id; -#endif -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_USE_X86_64_GCC_ASM -#include <stdint.h> - -struct my_context { - uint64_t save[9]; - void *stack_top; - void *stack_bot; -#ifdef HAVE_VALGRIND_MEMCHECK_H - unsigned int valgrind_stack_id; -#endif -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_USE_I386_GCC_ASM -#include <stdint.h> - -struct my_context { - uint64_t save[7]; - void *stack_top; - void *stack_bot; -#ifdef HAVE_VALGRIND_MEMCHECK_H - unsigned int valgrind_stack_id; -#endif -#ifndef DBUG_OFF - void *dbug_state; -#endif -}; -#endif - - -#ifdef MY_CONTEXT_DISABLE -struct my_context { - int dummy; -}; -#endif - - -/* - Initialize an asynchroneous context object. - Returns 0 on success, non-zero on failure. -*/ -extern int my_context_init(struct my_context *c, size_t stack_size); - -/* Free an asynchroneous context object, deallocating any resources used. */ -extern void my_context_destroy(struct my_context *c); - -/* - Spawn an asynchroneous context. The context will run the supplied user - function, passing the supplied user data pointer. - - The context must have been initialised with my_context_init() prior to - this call. - - The user function may call my_context_yield(), which will cause this - function to return 1. Then later my_context_continue() may be called, which - will resume the asynchroneous context by returning from the previous - my_context_yield() call. - - When the user function returns, this function returns 0. - - In case of error, -1 is returned. -*/ -extern int my_context_spawn(struct my_context *c, void (*f)(void *), void *d); - -/* - Suspend an asynchroneous context started with my_context_spawn. - - When my_context_yield() is called, execution immediately returns from the - last my_context_spawn() or my_context_continue() call. Then when later - my_context_continue() is called, execution resumes by returning from this - my_context_yield() call. - - Returns 0 if ok, -1 in case of error. -*/ -extern int my_context_yield(struct my_context *c); - -/* - Resume an asynchroneous context. The context was spawned by - my_context_spawn(), and later suspended inside my_context_yield(). - - The asynchroneous context may be repeatedly suspended with - my_context_yield() and resumed with my_context_continue(). - - Each time it is suspended, this function returns 1. When the originally - spawned user function returns, this function returns 0. - - In case of error, -1 is returned. -*/ -extern int my_context_continue(struct my_context *c); - - -struct mysql_async_context { - /* - This is set to the value that should be returned from foo_start() or - foo_cont() when a call is suspended. - */ - unsigned int events_to_wait_for; - /* - It is also set to the event(s) that triggered when a suspended call is - resumed, eg. whether we woke up due to connection completed or timeout - in mysql_real_connect_cont(). - */ - unsigned int events_occurred; - /* - This is set to the result of the whole asynchronous operation when it - completes. It uses a union, as different calls have different return - types. - */ - union { - void *r_ptr; - const void *r_const_ptr; - int r_int; - my_bool r_my_bool; - } ret_result; - /* - The timeout value (in millisecods), for suspended calls that need to wake - up on a timeout (eg. mysql_real_connect_start(). - */ - unsigned int timeout_value; - /* - This flag is set when we are executing inside some asynchronous call - foo_start() or foo_cont(). It is used to decide whether to use the - synchronous or asynchronous version of calls that may block such as - recv(). - - Note that this flag is not set when a call is suspended, eg. after - returning from foo_start() and before re-entering foo_cont(). - */ - my_bool active; - /* - This flag is set when an asynchronous operation is in progress, but - suspended. Ie. it is set when foo_start() or foo_cont() returns because - the operation needs to block, suspending the operation. - - It is used to give an error (rather than crash) if the application - attempts to call some foo_cont() method when no suspended operation foo is - in progress. - */ - my_bool suspended; - /* - If non-NULL, this is a pointer to a callback hook that will be invoked with - the user data argument just before the context is suspended, and just after - it is resumed. - */ - void (*suspend_resume_hook)(my_bool suspend, void *user_data); - void *suspend_resume_hook_user_data; - /* - This is used to save the execution contexts so that we can suspend an - operation and switch back to the application context, to resume the - suspended context later when the application re-invokes us with - foo_cont(). - */ - struct my_context async_context; -}; diff --git a/include/my_pthread.h b/include/my_pthread.h index 66876032178..68d4fb0f0c8 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -104,7 +104,6 @@ int pthread_cancel(pthread_t thread); #define ETIMEDOUT 145 /* Win32 doesn't have this */ #endif -#define getpid() GetCurrentThreadId() #define HAVE_LOCALTIME_R 1 #define _REENTRANT 1 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 diff --git a/include/my_sys.h b/include/my_sys.h index a66bfd8217c..2ad4e131b3f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -263,6 +263,10 @@ extern int my_umask_dir, my_recived_signals, /* Signals we have got */ my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ my_dont_interrupt; /* call remember_intr when set */ +#ifdef _WIN32 +extern SECURITY_ATTRIBUTES my_dir_security_attributes; +LPSECURITY_ATTRIBUTES my_win_file_secattr(); +#endif extern my_bool my_use_symdir; extern ulong my_default_record_cache_size; diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 4e6240a19ac..e906e4e1a86 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -18,7 +18,7 @@ enum enum_server_command COM_SLAVE_WORKER=251, COM_SLAVE_IO=252, COM_SLAVE_SQL=253, - COM_MULTI=254, + COM_RESERVED_1=254, COM_END=255 }; enum enum_indicator_type diff --git a/include/mysql_async.h b/include/mysql_async.h deleted file mode 100644 index 3e4cb351bb5..00000000000 --- a/include/mysql_async.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2012 MariaDB Services and Kristian Nielsen - - 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; version 2 of the License. - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -/* Common definitions for MariaDB non-blocking client library. */ - -#ifndef MYSQL_ASYNC_H -#define MYSQL_ASYNC_H - -extern int my_connect_async(struct mysql_async_context *b, my_socket fd, - const struct sockaddr *name, uint namelen, - int vio_timeout); -extern ssize_t my_recv_async(struct mysql_async_context *b, my_socket fd, - unsigned char *buf, size_t size, int timeout); -extern ssize_t my_send_async(struct mysql_async_context *b, my_socket fd, - const unsigned char *buf, size_t size, - int timeout); -extern my_bool my_io_wait_async(struct mysql_async_context *b, - enum enum_vio_io_event event, int timeout); -#ifdef HAVE_OPENSSL -extern int my_ssl_read_async(struct mysql_async_context *b, SSL *ssl, - void *buf, int size); -extern int my_ssl_write_async(struct mysql_async_context *b, SSL *ssl, - const void *buf, int size); -#endif - -#endif /* MYSQL_ASYNC_H */ diff --git a/include/mysql_com.h b/include/mysql_com.h index fa5960a377b..b4f1a3c8f94 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -123,7 +123,7 @@ enum enum_server_command COM_SLAVE_WORKER=251, COM_SLAVE_IO=252, COM_SLAVE_SQL=253, - COM_MULTI=254, + COM_RESERVED_1=254, /* Old COM_MULTI, now removed */ /* Must be last */ COM_END=255 }; @@ -296,8 +296,10 @@ enum enum_indicator_type #define MARIADB_CLIENT_FLAGS_MASK 0xffffffff00000000ULL /* Client support progress indicator */ #define MARIADB_CLIENT_PROGRESS (1ULL << 32) -/* support COM_MULTI */ -#define MARIADB_CLIENT_COM_MULTI (1ULL << 33) + +/* Old COM_MULTI experiment (functionality removed).*/ +#define MARIADB_CLIENT_RESERVED_1 (1ULL << 33) + /* support of array binding */ #define MARIADB_CLIENT_STMT_BULK_OPERATIONS (1ULL << 34) /* support of extended metadata (e.g. type/format information) */ @@ -341,7 +343,6 @@ enum enum_indicator_type CLIENT_SESSION_TRACK |\ CLIENT_DEPRECATE_EOF |\ CLIENT_CONNECT_ATTRS |\ - MARIADB_CLIENT_COM_MULTI |\ MARIADB_CLIENT_STMT_BULK_OPERATIONS |\ MARIADB_CLIENT_EXTENDED_METADATA|\ CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS) diff --git a/include/sql_common.h b/include/sql_common.h index 9836d0c1cdc..9fc983616a0 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -28,8 +28,6 @@ extern const char *cant_connect_sqlstate; extern const char *not_error_sqlstate; -struct mysql_async_context; - struct st_mysql_options_extention { char *plugin_dir; char *default_auth; @@ -41,7 +39,6 @@ struct st_mysql_options_extention { double progress, const char *proc_info, uint proc_info_length); - struct mysql_async_context *async_context; HASH connection_attributes; size_t connection_attributes_length; }; @@ -125,10 +122,6 @@ struct st_mysql_client_plugin; extern struct st_mysql_client_plugin *mysql_client_builtins[]; uchar * send_client_connect_attrs(MYSQL *mysql, uchar *buf); -/* Non-blocking client API. */ -void my_context_install_suspend_resume_hook(struct mysql_async_context *b, - void (*)(my_bool, void *), void *); - #ifdef __cplusplus } #endif diff --git a/include/violite.h b/include/violite.h index 28e3ca08b0a..2333d0018b5 100644 --- a/include/violite.h +++ b/include/violite.h @@ -249,7 +249,6 @@ struct st_vio char *read_pos; /* start of unfetched data in the read buffer */ char *read_end; /* end of unfetched data */ - struct mysql_async_context *async_context; /* For non-blocking API */ int read_timeout; /* Timeout value (ms) for read ops. */ int write_timeout; /* Timeout value (ms) for write ops. */ /* function pointers. They are similar for socket/SSL/whatever */ @@ -279,6 +278,7 @@ struct st_vio HANDLE hPipe; OVERLAPPED overlapped; int shutdown_flag; + void *tp_ctx; /* threadpool context */ #endif }; #endif /* vio_violite_h_ */ |