1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Merge mysql.com:/home/my/mysql-5.0

into  mysql.com:/home/my/mysql-5.1
Merge of 'remove compiler warnings when using -Wshadow'
This commit is contained in:
monty@narttu.mysql.fi
2007-01-27 03:46:45 +02:00
215 changed files with 3302 additions and 3092 deletions

View File

@@ -470,7 +470,7 @@ ulong slave_net_timeout, slave_trans_retries;
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
ulong query_cache_size=0;
ulong refresh_version, flush_version; /* Increments on each reload */
query_id_t query_id;
query_id_t global_query_id;
ulong aborted_threads, aborted_connects;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
@@ -502,7 +502,7 @@ ulong rpl_recovery_rank=0;
const char *log_output_str= "TABLE";
double log_10[32]; /* 10 potences */
time_t start_time;
time_t server_start_time;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
char *default_tz_name;
@@ -518,7 +518,6 @@ key_map key_map_full(0); // Will be initialized later
const char *opt_date_time_formats[3];
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
struct passwd *user_info;
char server_version[SERVER_VERSION_LENGTH];
char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /* Error messages */
@@ -537,7 +536,6 @@ Lt_creator lt_creator;
Ge_creator ge_creator;
Le_creator le_creator;
FILE *bootstrap_file;
int bootstrap_error;
FILE *stderror_file=0;
@@ -620,9 +618,13 @@ static char **defaults_argv;
static char *opt_bin_logname;
static my_socket unix_sock,ip_sock;
static pthread_t select_thread;
struct rand_struct sql_rand; // used by sql_class.cc:THD::THD()
#ifndef EMBEDDED_LIBRARY
struct passwd *user_info;
static pthread_t select_thread;
#endif
/* OS specific variables */
#ifdef __WIN__
@@ -699,7 +701,6 @@ struct st_VioSSLFd *ssl_acceptor_fd;
/* Function declarations */
static void start_signal_handler(void);
pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void);
static void get_options(int argc,char **argv);
@@ -710,7 +711,6 @@ static void fix_paths(void);
pthread_handler_t handle_connections_sockets(void *arg);
pthread_handler_t kill_server_thread(void *arg);
static void bootstrap(FILE *file);
static void close_server_sock();
static bool read_init_file(char *file_name);
#ifdef __NT__
pthread_handler_t handle_connections_namedpipes(void *arg);
@@ -721,11 +721,17 @@ pthread_handler_t handle_connections_shared_memory(void *arg);
pthread_handler_t handle_slave(void *arg);
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
static void clean_up(bool print_message);
static int test_if_case_insensitive(const char *dir_name);
static void end_ssl();
#ifndef EMBEDDED_LIBRARY
static void start_signal_handler(void);
static void close_server_sock();
static void clean_up_mutexes(void);
static void wait_for_signal_thread_to_end(void);
static int test_if_case_insensitive(const char *dir_name);
static void create_pid_file();
static void end_ssl();
#endif
#ifndef EMBEDDED_LIBRARY
/****************************************************************************
@@ -915,7 +921,6 @@ static void close_connections(void)
DBUG_PRINT("quit",("close_connections thread"));
DBUG_VOID_RETURN;
}
#endif /*EMBEDDED_LIBRARY*/
static void close_server_sock()
@@ -958,12 +963,14 @@ static void close_server_sock()
#endif
}
#endif /*EMBEDDED_LIBRARY*/
void kill_mysql(void)
{
DBUG_ENTER("kill_mysql");
#ifdef SIGNALS_DONT_BREAK_READ
#if defined(SIGNALS_DONT_BREAK_READ) && !defined(EMBEDDED_LIBRARY)
abort_loop=1; // Break connection loops
close_server_sock(); // Force accept to wake up
#endif
@@ -1041,7 +1048,7 @@ static void __cdecl kill_server(int sig_ptr)
kill_in_progress=TRUE;
abort_loop=1; // This should be set
if (sig != 0) // 0 is not a valid signal number
my_sigset(sig,SIG_IGN);
my_sigset(sig, SIG_IGN); /* purify inspected */
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname);
else
@@ -1262,6 +1269,8 @@ void clean_up(bool print_message)
} /* clean_up */
#ifndef EMBEDDED_LIBRARY
/*
This is mainly needed when running with purify, but it's still nice to
know that all child threads have died when mysqld exits
@@ -1332,6 +1341,9 @@ static void clean_up_mutexes()
(void) pthread_cond_destroy(&COND_manager);
}
#endif /*EMBEDDED_LIBRARY*/
/****************************************************************************
** Init IP and UNIX socket
****************************************************************************/
@@ -1366,7 +1378,7 @@ static void set_ports()
static struct passwd *check_user(const char *user)
{
#if !defined(__WIN__) && !defined(__NETWARE__)
struct passwd *user_info;
struct passwd *tmp_user_info;
uid_t user_id= geteuid();
// Don't bother if we aren't superuser
@@ -1374,12 +1386,14 @@ static struct passwd *check_user(const char *user)
{
if (user)
{
// Don't give a warning, if real user is same as given with --user
user_info= getpwnam(user);
if ((!user_info || user_id != user_info->pw_uid) &&
/* Don't give a warning, if real user is same as given with --user */
/* purecov: begin tested */
tmp_user_info= getpwnam(user);
if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
global_system_variables.log_warnings)
sql_print_warning(
"One can only use the --user switch if running as root\n");
/* purecov: end */
}
return NULL;
}
@@ -1392,23 +1406,22 @@ static struct passwd *check_user(const char *user)
}
return NULL;
}
/* purecov: begin tested */
if (!strcmp(user,"root"))
return NULL; // Avoid problem with dynamic libraries
if (!(user_info= getpwnam(user)))
if (!(tmp_user_info= getpwnam(user)))
{
// Allow a numeric uid to be used
const char *pos;
for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ;
if (*pos) // Not numeric id
goto err;
if (!(user_info= getpwuid(atoi(user))))
if (!(tmp_user_info= getpwuid(atoi(user))))
goto err;
else
return user_info;
}
else
return user_info;
return tmp_user_info;
/* purecov: end */
err:
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
@@ -1417,10 +1430,11 @@ err:
return NULL;
}
static void set_user(const char *user, struct passwd *user_info)
static void set_user(const char *user, struct passwd *user_info_arg)
{
/* purecov: begin tested */
#if !defined(__WIN__) && !defined(__NETWARE__)
DBUG_ASSERT(user_info != 0);
DBUG_ASSERT(user_info_arg != 0);
#ifdef HAVE_INITGROUPS
/*
We can get a SIGSEGV when calling initgroups() on some systems when NSS
@@ -1429,33 +1443,34 @@ static void set_user(const char *user, struct passwd *user_info)
output a specific message to help the user resolve this problem.
*/
calling_initgroups= TRUE;
initgroups((char*) user, user_info->pw_gid);
initgroups((char*) user, user_info_arg->pw_gid);
calling_initgroups= FALSE;
#endif
if (setgid(user_info->pw_gid) == -1)
if (setgid(user_info_arg->pw_gid) == -1)
{
sql_perror("setgid");
unireg_abort(1);
}
if (setuid(user_info->pw_uid) == -1)
if (setuid(user_info_arg->pw_uid) == -1)
{
sql_perror("setuid");
unireg_abort(1);
}
#endif
/* purecov: end */
}
static void set_effective_user(struct passwd *user_info)
static void set_effective_user(struct passwd *user_info_arg)
{
#if !defined(__WIN__) && !defined(__NETWARE__)
DBUG_ASSERT(user_info != 0);
if (setregid((gid_t)-1, user_info->pw_gid) == -1)
DBUG_ASSERT(user_info_arg != 0);
if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1)
{
sql_perror("setregid");
unireg_abort(1);
}
if (setreuid((uid_t)-1, user_info->pw_uid) == -1)
if (setreuid((uid_t)-1, user_info_arg->pw_uid) == -1)
{
sql_perror("setreuid");
unireg_abort(1);
@@ -1796,6 +1811,7 @@ extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
}
#endif
/******************************************************************************
Setup a signal thread with handles all signals.
Because Linux doesn't support schemas use a mutex to check that
@@ -1815,6 +1831,7 @@ static void init_signals(void)
#endif
}
static void start_signal_handler(void)
{
// Save vm id of this process
@@ -1822,6 +1839,7 @@ static void start_signal_handler(void)
create_pid_file();
}
static void check_data_home(const char *path)
{}
@@ -2042,6 +2060,7 @@ static void init_signals(void)
}
static void start_signal_handler(void)
{
// Save vm id of this process
@@ -2178,6 +2197,8 @@ bugs.\n");
#define SA_NODEFER 0
#endif
#ifndef EMBEDDED_LIBRARY
static void init_signals(void)
{
sigset_t set;
@@ -2250,7 +2271,6 @@ static void init_signals(void)
}
#ifndef EMBEDDED_LIBRARY
static void start_signal_handler(void)
{
int error;
@@ -2424,11 +2444,11 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
}
return(0); /* purecov: deadcode */
}
#endif /*!EMBEDDED_LIBRARY*/
static void check_data_home(const char *path)
{}
#endif /*!EMBEDDED_LIBRARY*/
#endif /* __WIN__*/
@@ -2493,6 +2513,7 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
}
#ifndef EMBEDDED_LIBRARY
static void *my_str_malloc_mysqld(size_t size)
{
return my_malloc(size, MYF(MY_FAE));
@@ -2503,6 +2524,7 @@ static void my_str_free_mysqld(void *ptr)
{
my_free((gptr)ptr, MYF(MY_FAE));
}
#endif /* EMBEDDED_LIBRARY */
#ifdef __WIN__
@@ -2609,7 +2631,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
tzset(); // Set tzname
max_system_variables.pseudo_thread_id= (ulong)~0;
start_time=time((time_t*) 0);
server_start_time= time((time_t*) 0);
if (init_thread_environment())
return 1;
mysql_init_variables();
@@ -2617,7 +2639,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
#ifdef HAVE_TZNAME
{
struct tm tm_tmp;
localtime_r(&start_time,&tm_tmp);
localtime_r(&server_start_time,&tm_tmp);
strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
sizeof(system_time_zone)-1);
@@ -3007,6 +3029,8 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file,
#endif /* HAVE_OPENSSL */
#ifndef EMBEDDED_LIBRARY
static void init_ssl()
{
#ifdef HAVE_OPENSSL
@@ -3044,6 +3068,8 @@ static void end_ssl()
#endif /* HAVE_OPENSSL */
}
#endif /* EMBEDDED_LIBRARY */
static int init_server_components()
{
@@ -3059,7 +3085,7 @@ static int init_server_components()
query_cache_set_min_res_unit(query_cache_min_res_unit);
query_cache_init();
query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
reset_floating_point_exceptions();
init_thr_lock();
#ifdef HAVE_REPLICATION
@@ -3362,6 +3388,8 @@ server.");
}
#ifndef EMBEDDED_LIBRARY
static void create_maintenance_thread()
{
if (flush_time && flush_time != ~(ulong) 0L)
@@ -3375,7 +3403,6 @@ static void create_maintenance_thread()
static void create_shutdown_thread()
{
#if !defined(EMBEDDED_LIBRARY)
#ifdef __WIN__
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread;
@@ -3384,10 +3411,11 @@ static void create_shutdown_thread()
// On "Stop Service" we have to do regular shutdown
Service.SetShutdownEvent(hEventShutdown);
#endif
#endif // EMBEDDED_LIBRARY
#endif /* __WIN__ */
}
#endif /* EMBEDDED_LIBRARY */
#if (defined(__NT__) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
static void handle_connections_methods()
@@ -6304,7 +6332,7 @@ static int show_starttime(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONG;
var->value= buff;
*((long *)buff)= (long) (thd->query_start() - start_time);
*((long *)buff)= (long) (thd->query_start() - server_start_time);
return 0;
}
@@ -6988,7 +7016,7 @@ static void mysql_init_variables(void)
protocol_version= PROTOCOL_VERSION;
what_to_log= ~ (1L << (uint) COM_TIME);
refresh_version= flush_version= 1L; /* Increments on each reload */
query_id= thread_id= 1L;
global_query_id= thread_id= 1L;
strmov(server_version, MYSQL_SERVER_VERSION);
myisam_recover_options_str= sql_mode_str= "OFF";
myisam_stats_method_str= "nulls_unequal";
@@ -8062,6 +8090,8 @@ static int test_if_case_insensitive(const char *dir_name)
/* Create file to store pid number */
#ifndef EMBEDDED_LIBRARY
static void create_pid_file()
{
File file;
@@ -8081,7 +8111,7 @@ static void create_pid_file()
sql_perror("Can't start server: can't create PID file");
exit(1);
}
#endif /* EMBEDDED_LIBRARY */
/* Clear most status variables */
void refresh_status(THD *thd)