diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/my_global.h | 6 | ||||
-rw-r--r-- | include/mysql/psi/mysql_socket.h | 24 | ||||
-rw-r--r-- | include/mysqld_default_groups.h | 3 | ||||
-rw-r--r-- | include/thr_lock.h | 13 |
4 files changed, 45 insertions, 1 deletions
diff --git a/include/my_global.h b/include/my_global.h index 816c9dd87c6..5ea761d587e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -598,6 +598,12 @@ typedef SOCKET_SIZE_TYPE size_socket; #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0 +#endif /* additional file share flags for win32 */ #ifdef __WIN__ diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h index 1573fe77a9a..bd05ef9b8a9 100644 --- a/include/mysql/psi/mysql_socket.h +++ b/include/mysql/psi/mysql_socket.h @@ -553,7 +553,7 @@ inline_mysql_socket_socket int domain, int type, int protocol) { MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET; - mysql_socket.fd= socket(domain, type, protocol); + mysql_socket.fd= socket(domain, type | SOCK_CLOEXEC, protocol); #ifdef HAVE_PSI_SOCKET_INTERFACE if (likely(mysql_socket.fd != INVALID_SOCKET)) @@ -1013,6 +1013,8 @@ inline_mysql_socket_accept #endif MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len) { + int flags; + MYSQL_SOCKET socket_accept= MYSQL_INVALID_SOCKET; socklen_t addr_length= (addr_len != NULL) ? *addr_len : 0; @@ -1026,7 +1028,17 @@ inline_mysql_socket_accept (&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); /* Instrumented code */ +#ifdef HAVE_ACCEPT4 + socket_accept.fd= accept4(socket_listen.fd, addr, &addr_length, + SOCK_CLOEXEC); +#else socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); + flags= fcntl(socket_accept.fd, F_GETFD); + if (flags != -1) { + flags |= FD_CLOEXEC; + fcntl(socket_accept.fd, F_SETFD, flags); + } +#endif /* Instrumentation end */ if (locker != NULL) @@ -1036,7 +1048,17 @@ inline_mysql_socket_accept #endif { /* Non instrumented code */ +#ifdef HAVE_ACCEPT4 + socket_accept.fd= accept4(socket_listen.fd, addr, &addr_length, + SOCK_CLOEXEC); +#else socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); + flags= fcntl(socket_accept.fd, F_GETFD); + if (flags != -1) { + flags |= FD_CLOEXEC; + fcntl(socket_accept.fd, F_SETFD, flags); + } +#endif } #ifdef HAVE_PSI_SOCKET_INTERFACE diff --git a/include/mysqld_default_groups.h b/include/mysqld_default_groups.h index a2e94ddd854..30dfdae1338 100644 --- a/include/mysqld_default_groups.h +++ b/include/mysqld_default_groups.h @@ -5,4 +5,7 @@ const char *load_default_groups[]= { "mysqld", "server", MYSQL_BASE_VERSION, "mariadb", MARIADB_BASE_VERSION, "client-server", +#ifdef WITH_WSREP +"galera", +#endif 0, 0}; diff --git a/include/thr_lock.h b/include/thr_lock.h index 3f7a5ca988f..f05db666da9 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -20,6 +20,15 @@ #ifdef __cplusplus extern "C" { #endif +#ifdef WITH_WSREP +#include <my_sys.h> + typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool); + typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool); + typedef int (* wsrep_on_fun)(void *); + void wsrep_thr_lock_init( + wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, + my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun); +#endif #include <my_pthread.h> #include <my_list.h> @@ -95,6 +104,10 @@ typedef struct st_thr_lock_info { pthread_t thread; my_thread_id thread_id; +#ifdef WITH_WSREP + void *mysql_thd; // THD pointer + my_bool in_lock_tables; // true, if inside locking session +#endif } THR_LOCK_INFO; |