~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/signal_handler/signal_handler.cc

  • Committer: Lee Bieber
  • Date: 2011-01-12 02:31:03 UTC
  • mfrom: (2068.7.5 session-fix)
  • mto: This revision was merged to the branch mainline in revision 2076.
  • Revision ID: kalebral@gmail.com-20110112023103-nmz26cv1j32jc6n3
Merge Brian - fix bug 527084 - DROP TABLE: getTableDefiniton returns EEXIST but doDropTable returns ENOENT leads to SIGSEGV

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
2
 
   Copyright (C) 2011 Brian Aker
3
 
   Copyright (C) 2006 MySQL AB
 
1
/* Copyright (C) 2006 MySQL AB
4
2
 
5
3
   This program is free software; you can redistribute it and/or modify
6
4
   it under the terms of the GNU General Public License as published by
16
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
17
15
 
18
16
#include "config.h"
19
 
 
20
17
#include <drizzled/gettext.h>
21
18
#include <drizzled/error.h>
22
19
#include <drizzled/unireg.h>
23
20
#include <drizzled/plugin/storage_engine.h>
 
21
#include <drizzled/cursor.h> /* for refresh_version */
24
22
#include "drizzled/pthread_globals.h"
25
23
#include "drizzled/internal/my_pthread.h"
26
24
#include "drizzled/internal/my_sys.h"
27
25
#include "drizzled/plugin/daemon.h"
28
26
#include "drizzled/signal_handler.h"
29
27
 
30
 
#include <drizzled/session.h>
31
 
#include <drizzled/session/cache.h>
32
 
 
33
 
#include "drizzled/debug.h"
 
28
#include "drizzled/session/cache.h"
34
29
 
35
30
#include "drizzled/drizzled.h"
36
31
 
37
 
#include <drizzled/refresh_version.h>
38
 
 
39
32
#include <boost/thread/thread.hpp>
40
33
#include <boost/filesystem.hpp>
41
34
 
54
47
extern boost::filesystem::path pid_file;
55
48
/* Prototypes -> all of these should be factored out into a propper shutdown */
56
49
extern void close_connections(void);
 
50
extern std::bitset<12> test_flags;
57
51
}
58
52
 
59
53
using namespace drizzled;
82
76
  if (sig != 0) // 0 is not a valid signal number
83
77
    ignore_signal(sig);                    /* purify inspected */
84
78
  if (sig == SIGTERM || sig == 0)
85
 
    errmsg_printf(error::INFO, _(ER(ER_NORMAL_SHUTDOWN)),internal::my_progname);
 
79
    errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_NORMAL_SHUTDOWN)),internal::my_progname);
86
80
  else
87
 
    errmsg_printf(error::ERROR, _(ER(ER_GOT_SIGNAL)),internal::my_progname,sig);
88
 
 
 
81
    errmsg_printf(ERRMSG_LVL_ERROR, _(ER(ER_GOT_SIGNAL)),internal::my_progname,sig);
89
82
  close_connections();
90
83
  clean_up(1);
91
84
}
127
120
  boost::this_thread::at_thread_exit(&internal::my_thread_end);
128
121
  signal_thread_in_use= true;
129
122
 
130
 
  if ((drizzled::getDebug().test(drizzled::debug::ALLOW_SIGINT)))
 
123
  if ((test_flags.test(TEST_SIGINT)))
131
124
  {
132
125
    (void) sigemptyset(&set);                   // Setup up SIGINT for debug
133
126
    (void) sigaddset(&set,SIGINT);              // For debugging
134
 
    (void) pthread_sigmask(SIG_UNBLOCK, &set, NULL);
 
127
    (void) pthread_sigmask(SIG_UNBLOCK,&set,NULL);
135
128
  }
136
129
  (void) sigemptyset(&set);                     // Setup up SIGINT for debug
137
130
#ifndef IGNORE_SIGHUP_SIGQUIT
286
279
}
287
280
 
288
281
 
 
282
static drizzle_sys_var* system_variables[]= {
 
283
  NULL
 
284
};
 
285
 
289
286
DRIZZLE_DECLARE_PLUGIN
290
287
{
291
288
  DRIZZLE_VERSION_ID,
295
292
  "Default Signal Handler",
296
293
  PLUGIN_LICENSE_GPL,
297
294
  init, /* Plugin Init */
298
 
  NULL,   /* depends */
 
295
  system_variables,   /* system variables */
299
296
  NULL    /* config options */
300
297
}
301
298
DRIZZLE_DECLARE_PLUGIN_END;