~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

mergeĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
347
347
time_t server_start_time;
348
348
time_t flush_status_time;
349
349
 
 
350
/* FRM Junk */
 
351
const char *reg_ext= ".frm";
 
352
uint32_t reg_ext_length= 4;
 
353
 
350
354
char drizzle_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
351
355
char *default_tz_name;
352
356
char glob_hostname[FN_REFLEN];
355
359
     *opt_init_file, 
356
360
     *opt_tc_log_file;
357
361
char drizzle_unpacked_real_data_home[FN_REFLEN];
358
 
 
359
362
const key_map key_map_empty(0);
360
363
key_map key_map_full(0);                        // Will be initialized later
361
364
 
465
468
 
466
469
static void usage(void);
467
470
static void clean_up_mutexes(void);
468
 
static void drizzled_exit(int exit_code) __attribute__((noreturn));
469
471
extern "C" bool safe_read_error_impl(NET *net);
470
472
 
471
473
/****************************************************************************
586
588
    alarm(2);                                   /* reschedule alarm */
587
589
}
588
590
 
589
 
 
590
 
void unireg_init()
591
 
{
592
 
  abort_loop=0;
593
 
 
594
 
  my_disable_async_io=1;                /* aioread is only in shared library */
595
 
  wild_many='%'; wild_one='_'; wild_prefix='\\'; /* Change to sql syntax */
596
 
 
597
 
  current_pid=(ulong) getpid();         /* Save for later ref */
598
 
  init_time();                          /* Init time-functions (read zone) */
599
 
  my_abort_hook=unireg_abort;           /* Abort with close of databases */
600
 
 
601
 
  return;
602
 
}
603
 
 
604
 
 
605
591
/**
606
592
  cleanup all memory and end program nicely.
607
593
 
632
618
  else if (opt_help)
633
619
    usage();
634
620
  clean_up(!opt_help && (exit_code)); /* purecov: inspected */
635
 
  drizzled_exit(exit_code);
636
 
}
637
 
 
638
 
 
639
 
static void drizzled_exit(int exit_code)
640
 
{
641
621
  clean_up_mutexes();
642
622
  my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
643
623
  exit(exit_code); /* purecov: inspected */
644
624
}
645
625
 
646
626
 
647
 
void clean_up(bool print_message)
 
627
static void clean_up(bool print_message)
648
628
{
649
629
  if (cleanup_done++)
650
630
    return; /* purecov: inspected */
771
751
      errmsg_printf(ERRMSG_LVL_ERROR, _("Fatal error: Please read \"Security\" section of "
772
752
                      "the manual to find out how to run drizzled as root!\n"));
773
753
    unireg_abort(1);
774
 
 
775
 
    return NULL;
776
754
  }
777
755
  /* purecov: begin tested */
778
756
  if (!strcmp(user,"root"))
804
782
  }
805
783
#endif
806
784
 
 
785
/* Sun Studio 5.10 doesn't like this line.  5.9 requires it */
 
786
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x590)
807
787
  return NULL;
 
788
#endif
 
789
 
808
790
}
809
791
 
810
792
static void set_user(const char *user, struct passwd *user_info_arg)
1475
1457
  /* connections and databases needs lots of files */
1476
1458
  (void) my_set_max_open_files(0xFFFFFFFF);
1477
1459
 
1478
 
  unireg_init(); /* Set up extern variabels */
 
1460
  current_pid=(ulong) getpid();         /* Save for later ref */
 
1461
  init_time();                          /* Init time-functions (read zone) */
 
1462
 
1479
1463
  if (init_errmessage())        /* Read error messages from file */
1480
1464
    return 1;
1481
1465
  if (item_create_init())
1706
1690
    }
1707
1691
    if (!ha_storage_engine_is_enabled(hton))
1708
1692
    {
1709
 
          errmsg_printf(ERRMSG_LVL_ERROR, _("Default storage engine (%s) is not available"),
1710
 
                      default_storage_engine_str);
 
1693
      errmsg_printf(ERRMSG_LVL_ERROR, _("Default storage engine (%s) is not available"),
 
1694
                    default_storage_engine_str);
1711
1695
      unireg_abort(1);
1712
 
      assert(global_system_variables.table_plugin);
 
1696
      //assert(global_system_variables.table_plugin);
1713
1697
    }
1714
1698
    else
1715
1699
    {
1853
1837
 
1854
1838
  if (drizzle_rm_tmp_tables() || my_tz_init((Session *)0, default_tz_name))
1855
1839
  {
1856
 
    abort_loop=1;
 
1840
    abort_loop= true;
1857
1841
    select_thread_in_use=0;
1858
1842
    (void) pthread_kill(signal_thread, SIGTERM);
1859
1843
 
1890
1874
  (void) pthread_mutex_unlock(&LOCK_thread_count);
1891
1875
 
1892
1876
  clean_up(1);
1893
 
  drizzled_exit(0);
 
1877
  clean_up_mutexes();
 
1878
  my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
 
1879
  return 0;
1894
1880
}
1895
1881
 
1896
1882
 
2861
2847
  slave_open_temp_tables= 0;
2862
2848
  opt_endinfo= using_udf_functions= 0;
2863
2849
  opt_using_transactions= false;
2864
 
  abort_loop= select_thread_in_use= 0;
 
2850
  abort_loop= select_thread_in_use= false;
2865
2851
  ready_to_exit= shutdown_in_progress= 0;
2866
2852
  aborted_threads= aborted_connects= 0;
2867
2853
  max_used_connections= 0;
3323
3309
 
3324
3310
 
3325
3311
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
3326
 
                                   const char *option)
 
3312
                                      const char *option)
3327
3313
{
3328
3314
  uint32_t res;
3329
3315