summaryrefslogtreecommitdiff
path: root/ndb/include
diff options
context:
space:
mode:
authortomas@poseidon.ndb.mysql.com <>2005-01-28 00:42:41 +0100
committertomas@poseidon.ndb.mysql.com <>2005-01-28 00:42:41 +0100
commit732d1a5e81037407067c345f5f6f33ee95210e6e (patch)
treeb49b8c43f32032d4eac08d9789796e546970efec /ndb/include
parent42531336f0b3e79c9b58c41cf46831f30977e359 (diff)
downloadmariadb-git-732d1a5e81037407067c345f5f6f33ee95210e6e.tar.gz
Bug#8167 signal usage clash between mysql server and ndb shared memory
added shared memory config parameter, signum for use in signalling added global variable for holdign signum to be used for shared memory connection only fiddle with signals if it is set simplified common ndb client option handling
Diffstat (limited to 'ndb/include')
-rw-r--r--ndb/include/Makefile.am1
-rw-r--r--ndb/include/mgmapi/mgmapi_config_parameters.h1
-rw-r--r--ndb/include/ndbapi/ndb_opt_defaults.h27
-rw-r--r--ndb/include/transporter/TransporterDefinitions.hpp1
-rw-r--r--ndb/include/util/ndb_opts.h59
5 files changed, 79 insertions, 10 deletions
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am
index 38b9d870fbc..ef4e9552566 100644
--- a/ndb/include/Makefile.am
+++ b/ndb/include/Makefile.am
@@ -8,6 +8,7 @@ ndb_version.h
ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
+ndbapi/ndb_opt_defaults.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbConnection.hpp \
diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h
index 406bdb1a110..8a04ee2fe37 100644
--- a/ndb/include/mgmapi/mgmapi_config_parameters.h
+++ b/ndb/include/mgmapi/mgmapi_config_parameters.h
@@ -121,6 +121,7 @@
#define CFG_SHM_CHECKSUM 501
#define CFG_SHM_KEY 502
#define CFG_SHM_BUFFER_MEM 503
+#define CFG_SHM_SIGNUM 504
#define CFG_SCI_HOST1_ID_0 550
#define CFG_SCI_HOST1_ID_1 551
diff --git a/ndb/include/ndbapi/ndb_opt_defaults.h b/ndb/include/ndbapi/ndb_opt_defaults.h
new file mode 100644
index 00000000000..63b673ed60d
--- /dev/null
+++ b/ndb/include/ndbapi/ndb_opt_defaults.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2003 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 */
+
+#ifndef NDB_OPT_DEFAULTS_H
+#define NDB_OPT_DEFAULTS_H
+
+#ifdef SIGRTMIN
+#define OPT_NDB_SHM_SIGNUM_DEFAULT SIGRTMIN+2
+#else
+#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
+#endif
+#define OPT_NDB_SHM_DEFAULT 0
+
+#endif
diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp
index 4ff6b2073eb..d4763ba4c37 100644
--- a/ndb/include/transporter/TransporterDefinitions.hpp
+++ b/ndb/include/transporter/TransporterDefinitions.hpp
@@ -77,6 +77,7 @@ struct SHM_TransporterConfiguration {
Uint32 shmKey;
Uint32 shmSize;
+ int signum;
};
/**
diff --git a/ndb/include/util/ndb_opts.h b/ndb/include/util/ndb_opts.h
index dc95149f706..aa7a02f58ae 100644
--- a/ndb/include/util/ndb_opts.h
+++ b/ndb/include/util/ndb_opts.h
@@ -22,24 +22,16 @@
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
+#include <ndb_opt_defaults.h>
#define NDB_STD_OPTS_VARS \
const char *opt_connect_str= 0;\
-my_bool opt_ndb_shm;\
my_bool opt_ndb_optimized_node_selection
-#define NDB_STD_OPTS_OPTIONS \
-OPT_NDB_SHM= 256,\
-OPT_NDB_OPTIMIZED_NODE_SELECTION
+my_bool opt_ndb_shm;
#define OPT_NDB_CONNECTSTRING 'c'
-#if defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
-#define OPT_NDB_SHM_DEFAULT 1
-#else
-#define OPT_NDB_SHM_DEFAULT 0
-#endif
-
#define NDB_STD_OPTS_COMMON \
{ "usage", '?', "Display this help and exit.", \
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
@@ -75,4 +67,51 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
#endif
+static void ndb_std_print_version()
+{
+ printf("MySQL distrib %s, for %s (%s)\n",
+ MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
+}
+
+static void usage();
+
+enum ndb_std_options {
+ OPT_NDB_SHM= 256,
+ OPT_NDB_SHM_SIGNUM,
+ OPT_NDB_OPTIMIZED_NODE_SELECTION,
+ NDB_STD_OPTIONS_LAST /* should always be last in this enum */
+};
+
+static my_bool
+ndb_std_get_one_option(int optid,
+ const struct my_option *opt __attribute__((unused)),
+ const char *argument)
+{
+ switch (optid) {
+ case '#':
+ if (argument)
+ {
+ DBUG_PUSH(argument);
+ }
+ break;
+ case 'V':
+ ndb_std_print_version();
+ exit(0);
+ case '?':
+ usage();
+ exit(0);
+ case OPT_NDB_SHM:
+ if (opt_ndb_shm)
+ {
+#ifndef NDB_SHM_TRANSPORTER
+ printf("Warning: binary not compiled with shared memory support,\n"
+ "Tcp connections will now be used instead\n");
+ opt_ndb_shm= 0;
+#endif
+ }
+ break;
+ }
+ return 0;
+}
+
#endif /*_NDB_OPTS_H */