~drizzle-developers/pkg-drizzle/trunk

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Hudson
  • Date: 2010-09-10 22:49:08 UTC
  • mfrom: (1273.485.36 staging)
  • Revision ID: hudson@orisndriz03-20100910224908-cb0fq7vjdg87sag5
* Non-maintainer upload.
* Merged from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
*/
199
199
bool opt_help= false;
200
200
bool opt_help_extended= false;
 
201
bool opt_print_defaults= false;
201
202
 
202
203
arg_cmp_func Arg_comparator::comparator_matrix[5][2] =
203
204
{{&Arg_comparator::compare_string,     &Arg_comparator::compare_e_string},
478
479
 
479
480
  if (exit_code)
480
481
    errmsg_printf(ERRMSG_LVL_ERROR, _("Aborting\n"));
481
 
  else if (opt_help || opt_help_extended)
 
482
  else if (opt_help || opt_help_extended || opt_print_defaults)
482
483
    usage();
483
484
  clean_up(!opt_help && (exit_code));
484
485
  internal::my_end();
593
594
  initgroups((char*) user, user_info_arg->pw_gid);
594
595
  if (setgid(user_info_arg->pw_gid) == -1)
595
596
  {
596
 
    sql_perror("setgid");
 
597
    sql_perror(N_("Set process group ID failed"));
597
598
    unireg_abort(1);
598
599
  }
599
600
  if (setuid(user_info_arg->pw_uid) == -1)
600
601
  {
601
 
    sql_perror("setuid");
 
602
    sql_perror(N_("Set process user ID failed"));
602
603
    unireg_abort(1);
603
604
  }
604
605
}
610
611
{
611
612
  if ((chroot(path) == -1) || !chdir("/"))
612
613
  {
613
 
    sql_perror("chroot");
 
614
    sql_perror(N_("Process chroot failed"));
614
615
    unireg_abort(1);
615
616
  }
616
617
}
734
735
  if (!(default_charset_info=
735
736
        get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
736
737
  {
 
738
    errmsg_printf(ERRMSG_LVL_ERROR, _("Error getting default charset"));
737
739
    return 1;                           // Eof of the list
738
740
  }
739
741
 
759
761
 
760
762
  if (not (character_set_filesystem=
761
763
           get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY)))
 
764
  {
 
765
    errmsg_printf(ERRMSG_LVL_ERROR, _("Error setting collation"));
762
766
    return 1;
 
767
  }
763
768
  global_system_variables.character_set_filesystem= character_set_filesystem;
764
769
 
765
770
  if (!(my_default_lc_time_names=
851
856
    all things are initialized so that unireg_abort() doesn't fail
852
857
  */
853
858
  if (table_cache_init())
 
859
  {
 
860
    errmsg_printf(ERRMSG_LVL_ERROR, _("Could not initialize table cache\n"));
854
861
    unireg_abort(1);
 
862
  }
855
863
  TableShare::cacheStart();
856
864
 
857
865
  setup_fpu();
860
868
 
861
869
  if (xid_cache_init())
862
870
  {
863
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory"));
 
871
    errmsg_printf(ERRMSG_LVL_ERROR, _("XA cache initialization failed: Out of memory\n"));
864
872
    unireg_abort(1);
865
873
  }
866
874
 
869
877
 
870
878
  if (plugin_init(plugins, &defaults_argc, defaults_argv, long_options))
871
879
  {
872
 
    errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins."));
 
880
    errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins\n"));
873
881
    unireg_abort(1);
874
882
  }
875
883
 
876
884
 
877
 
  if (opt_help || opt_help_extended)
 
885
  if (opt_help || opt_help_extended || opt_print_defaults)
878
886
    unireg_abort(0);
879
887
 
880
888
  po::parsed_options parsed= po::command_line_parser(defaults_argc,
890
898
    exception here */
891
899
  if (unknown_options.size() > 0)
892
900
  {
893
 
     fprintf(stderr,
894
 
            _("%s: Too many arguments (first extra is '%s').\n"
 
901
     errmsg_printf(ERRMSG_LVL_ERROR,
 
902
            _("%s: Unknown options give (first unknown is '%s').\n"
895
903
              "Use --verbose --help to get a list of available options\n"),
896
904
            internal::my_progname, unknown_options[0].c_str());
897
905
      unireg_abort(1);
940
948
    engine= plugin::StorageEngine::findByName(name);
941
949
    if (engine == NULL)
942
950
    {
943
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported storage engine: %s"),
 
951
      errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown/unsupported storage engine: %s\n"),
944
952
                    default_storage_engine_str);
945
953
      unireg_abort(1);
946
954
    }
949
957
 
950
958
  if (plugin::XaResourceManager::recoverAllXids())
951
959
  {
 
960
    /* This function alredy generates error messages */
952
961
    unireg_abort(1);
953
962
  }
954
963
 
1023
1032
  OPT_PLUGIN_DIR,
1024
1033
  OPT_PORT_OPEN_TIMEOUT,
1025
1034
  OPT_SECURE_FILE_PRIV,
1026
 
  OPT_MIN_EXAMINED_ROW_LIMIT
 
1035
  OPT_MIN_EXAMINED_ROW_LIMIT,
 
1036
  OPT_PRINT_DEFAULTS
1027
1037
};
1028
1038
 
1029
1039
 
1030
1040
struct option my_long_options[] =
1031
1041
{
 
1042
 
1032
1043
  {"help", '?', N_("Display this help and exit."),
1033
1044
   (char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
1034
1045
   0, 0},
1036
1047
   N_("Display this help and exit after initializing plugins."),
1037
1048
   (char**) &opt_help_extended, (char**) &opt_help_extended,
1038
1049
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
1050
  {"print-defaults", OPT_PRINT_DEFAULTS,
 
1051
   N_("Print the default settings and exit"),
 
1052
   (char**) &opt_print_defaults, (char**) &opt_print_defaults, 0, GET_BOOL,
 
1053
   NO_ARG, 0, 0, 0, 0, 0, 0},
1039
1054
  {"auto-increment-increment", OPT_AUTO_INCREMENT,
1040
1055
   N_("Auto-increment columns are incremented by this"),
1041
1056
   (char**) &global_system_variables.auto_increment_increment,
1382
1397
         "This software comes with ABSOLUTELY NO WARRANTY. "
1383
1398
         "This is free software,\n"
1384
1399
         "and you are welcome to modify and redistribute it under the GPL "
1385
 
         "license\n\n"
1386
 
         "Starts the Drizzle database server\n"));
 
1400
         "license\n\n"));
1387
1401
 
1388
 
  printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
 
1402
  if (!opt_print_defaults)
1389
1403
  {
1390
 
     internal::print_defaults(DRIZZLE_CONFIG_NAME,load_default_groups);
1391
 
     puts("");
 
1404
    printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
 
1405
 
 
1406
    internal::print_defaults(DRIZZLE_CONFIG_NAME,load_default_groups);
 
1407
    puts("");
 
1408
  }
1392
1409
 
1393
 
     /* Print out all the options including plugin supplied options */
1394
 
     my_print_help_inc_plugins(my_long_options, long_options);
1395
 
  }
 
1410
  /* Print out all the options including plugin supplied options */
 
1411
  my_print_help_inc_plugins(my_long_options, long_options);
 
1412
 
1396
1413
}
1397
1414
 
1398
 
 
1399
1415
/**
1400
1416
  Initialize all Drizzle global variables to default values.
1401
1417
 
1758
1774
  internal::convert_dirname(buff,buff,NULL);
1759
1775
  (void) internal::my_load_path(language,language,buff);
1760
1776
 
1761
 
  if (not opt_help and not opt_help_extended)
 
1777
  if (not opt_help and not opt_help_extended and not opt_print_defaults)
1762
1778
  {
1763
1779
    char *tmp_string;
1764
1780
    struct stat buf;